mirror of
https://github.com/NixOS/nix
synced 2025-07-07 01:51:47 +02:00
Don't use DerivedPath::toJSON()
It doesn't work on unrealized paths.
This commit is contained in:
parent
762114b7c4
commit
fd0d824fa5
4 changed files with 22 additions and 12 deletions
|
@ -23,11 +23,20 @@ void to_json(nlohmann::json & json, const BuildResult & buildResult)
|
||||||
json["stopTime"] = buildResult.stopTime;
|
json["stopTime"] = buildResult.stopTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json KeyedBuildResult::toJSON(Store & store) const
|
void to_json(nlohmann::json & json, const KeyedBuildResult & buildResult)
|
||||||
{
|
{
|
||||||
auto json = nlohmann::json((const BuildResult &) *this);
|
to_json(json, (const BuildResult &) buildResult);
|
||||||
json["path"] = path.toJSON(store);
|
auto path = nlohmann::json::object();
|
||||||
return json;
|
std::visit(
|
||||||
|
overloaded{
|
||||||
|
[&](const DerivedPathOpaque & opaque) { path["opaque"] = opaque.path.to_string(); },
|
||||||
|
[&](const DerivedPathBuilt & drv) {
|
||||||
|
path["drvPath"] = drv.drvPath->getBaseStorePath().to_string();
|
||||||
|
path["outputs"] = drv.outputs.to_string();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
buildResult.path.raw());
|
||||||
|
json["path"] = std::move(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,10 +134,9 @@ struct KeyedBuildResult : BuildResult
|
||||||
KeyedBuildResult(BuildResult res, DerivedPath path)
|
KeyedBuildResult(BuildResult res, DerivedPath path)
|
||||||
: BuildResult(std::move(res)), path(std::move(path))
|
: BuildResult(std::move(res)), path(std::move(path))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
nlohmann::json toJSON(Store & store) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void to_json(nlohmann::json & json, const BuildResult & buildResult);
|
void to_json(nlohmann::json & json, const BuildResult & buildResult);
|
||||||
|
void to_json(nlohmann::json & json, const KeyedBuildResult & buildResult);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1566,9 +1566,10 @@ Goal::Done DerivationGoal::done(
|
||||||
logger->result(
|
logger->result(
|
||||||
act ? act->id : getCurActivity(),
|
act ? act->id : getCurActivity(),
|
||||||
resBuildResult,
|
resBuildResult,
|
||||||
KeyedBuildResult(
|
nlohmann::json(
|
||||||
buildResult,
|
KeyedBuildResult(
|
||||||
DerivedPath::Built{.drvPath = makeConstantStorePathRef(drvPath), .outputs = wantedOutputs}).toJSON(worker.store));
|
buildResult,
|
||||||
|
DerivedPath::Built{.drvPath = makeConstantStorePathRef(drvPath), .outputs = wantedOutputs})));
|
||||||
|
|
||||||
return amDone(buildResult.success() ? ecSuccess : ecFailed, std::move(ex));
|
return amDone(buildResult.success() ? ecSuccess : ecFailed, std::move(ex));
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,10 @@ Goal::Done PathSubstitutionGoal::done(
|
||||||
logger->result(
|
logger->result(
|
||||||
getCurActivity(),
|
getCurActivity(),
|
||||||
resBuildResult,
|
resBuildResult,
|
||||||
KeyedBuildResult(
|
nlohmann::json(
|
||||||
buildResult,
|
KeyedBuildResult(
|
||||||
DerivedPath::Opaque{storePath}).toJSON(worker.store));
|
buildResult,
|
||||||
|
DerivedPath::Opaque{storePath})));
|
||||||
|
|
||||||
return amDone(result);
|
return amDone(result);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue