diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-04-25 14:01:34 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-04-25 15:44:45 +0200 |
commit | 830380a20f15c6c6d2f91213279c98de9f7cb399 (patch) | |
tree | 2b9757b8958ee342d1a6a455cb7c5d1fc46eae33 /src/buildtool/main/main.cpp | |
parent | cafea2acc444692e7fe99292a73a7fbc0f1ec348 (diff) | |
download | justbuild-830380a20f15c6c6d2f91213279c98de9f7cb399.tar.gz |
result description: always show full information
So far, `just describe` reported only the list of keys for runfiles
and artifacts while reporting full information for the provided
data, including the artifacts contained therein. Change this to
always reporting the full information, as for runfiles and artifacts
the detailed information is valuable as well.
Diffstat (limited to 'src/buildtool/main/main.cpp')
-rw-r--r-- | src/buildtool/main/main.cpp | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index 7cb26e45..7c0d69c0 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -690,24 +690,12 @@ struct AnalysisResult { } [[nodiscard]] auto ResultToJson(TargetResult const& result) -> nlohmann::json { - std::vector<std::string> artifacts{}; - std::vector<std::string> runfiles{}; - artifacts.reserve(result.artifact_stage->Map().size()); - runfiles.reserve(result.runfiles->Map().size()); - auto get_key = [](std::pair<std::string, ExpressionPtr> const& entry) { - return entry.first; - }; - std::transform(result.artifact_stage->Map().begin(), - result.artifact_stage->Map().end(), - std::back_inserter(artifacts), - get_key); - std::transform(result.runfiles->Map().begin(), - result.runfiles->Map().end(), - std::back_inserter(runfiles), - get_key); return nlohmann::ordered_json{ - {"artifacts", artifacts}, - {"runfiles", runfiles}, + {"artifacts", + result.artifact_stage->ToJson( + Expression::JsonMode::SerializeAllButNodes)}, + {"runfiles", + result.runfiles->ToJson(Expression::JsonMode::SerializeAllButNodes)}, {"provides", result.provides->ToJson(Expression::JsonMode::SerializeAllButNodes)}}; } @@ -914,10 +902,15 @@ void DumpNodes(std::string const& file_path, AnalysisResult const& result) { [[nodiscard]] auto DiagnoseResults(AnalysisResult const& result, Target::ResultTargetMap const& result_map, DiagnosticArguments const& clargs) { - Logger::Log(LogLevel::Info, - "Result of target {}: {}", - result.id.ToString(), - ResultToJson(result.target->Result()).dump(2)); + Logger::Log( + LogLevel::Info, + "Result of target {}: {}", + result.id.ToString(), + IndentOnlyUntilDepth( + ResultToJson(result.target->Result()), + 2, + 2, + std::unordered_map<std::string, std::size_t>{{"/provides", 3}})); if (clargs.dump_actions) { DumpActions(*clargs.dump_actions, result); } |