From 830380a20f15c6c6d2f91213279c98de9f7cb399 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Mon, 25 Apr 2022 14:01:34 +0200 Subject: 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. --- src/buildtool/main/main.cpp | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'src') 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 artifacts{}; - std::vector runfiles{}; - artifacts.reserve(result.artifact_stage->Map().size()); - runfiles.reserve(result.runfiles->Map().size()); - auto get_key = [](std::pair 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{{"/provides", 3}})); if (clargs.dump_actions) { DumpActions(*clargs.dump_actions, result); } -- cgit v1.2.3