1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-12 13:36:02 +01:00

Remove default constructor from OutputsSpec

This forces us to be explicit.

It also requires to rework how `from_json` works. A `JSON_IMPL` is added
to assist with this.
This commit is contained in:
John Ericson 2023-01-11 16:32:30 -05:00
parent 114a6e2b09
commit 5ba6e5d0d9
12 changed files with 103 additions and 49 deletions

View file

@ -478,9 +478,14 @@ static void printMissing(EvalState & state, DrvInfos & elems)
std::vector<DerivedPath> targets;
for (auto & i : elems)
if (auto drvPath = i.queryDrvPath())
targets.push_back(DerivedPath::Built{*drvPath});
targets.push_back(DerivedPath::Built{
.drvPath = *drvPath,
.outputs = OutputsSpec::All { },
});
else
targets.push_back(DerivedPath::Opaque{i.queryOutPath()});
targets.push_back(DerivedPath::Opaque{
.path = i.queryOutPath(),
});
printMissing(state.store, targets);
}
@ -751,8 +756,13 @@ static void opSet(Globals & globals, Strings opFlags, Strings opArgs)
auto drvPath = drv.queryDrvPath();
std::vector<DerivedPath> paths {
drvPath
? (DerivedPath) (DerivedPath::Built { *drvPath })
: (DerivedPath) (DerivedPath::Opaque { drv.queryOutPath() }),
? (DerivedPath) (DerivedPath::Built {
.drvPath = *drvPath,
.outputs = OutputsSpec::All { },
})
: (DerivedPath) (DerivedPath::Opaque {
.path = drv.queryOutPath(),
}),
};
printMissing(globals.state->store, paths);
if (globals.dryRun) return;