diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/profile/profile.cpp | 24 | ||||
-rw-r--r-- | src/buildtool/profile/profile.hpp | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/buildtool/profile/profile.cpp b/src/buildtool/profile/profile.cpp index 66ea50d6..6d1cc34d 100644 --- a/src/buildtool/profile/profile.cpp +++ b/src/buildtool/profile/profile.cpp @@ -34,6 +34,12 @@ void Profile::Write(int exit_code) { entry["duration"] = v.duration; } entry["artifacts"] = v.artifacts; + if (v.out) { + entry["stdout"] = *v.out; + } + if (v.err) { + entry["stderr"] = *v.err; + } actions[k] = entry; } profile_["actions"] = actions; @@ -57,16 +63,34 @@ void Profile::NoteActionCompleted(std::string const& id, IExecutionResponse::Ptr const& response) { std::unique_lock lock{mutex_}; auto artifacts = response->Artifacts(); + std::optional<std::string> out = std::nullopt; + std::optional<std::string> err = std::nullopt; + if (response->HasStdOut()) { + auto action_out = response->StdOutDigest(); + if (action_out) { + out = action_out->hash(); + } + } + if (response->HasStdErr()) { + auto action_err = response->StdErrDigest(); + if (action_err) { + err = action_err->hash(); + } + } if (not artifacts) { actions_[id] = ActionData{ .cached = response->IsCached(), .duration = response->ExecutionDuration(), + .out = out, + .err = err, .artifacts = std::unordered_map<std::string, std::string>()}; } else { actions_[id] = ActionData{ .cached = response->IsCached(), .duration = response->ExecutionDuration(), + .out = out, + .err = err, .artifacts = std::unordered_map<std::string, std::string>( (*artifacts)->size())}; for (auto const& [k, v] : **artifacts) { diff --git a/src/buildtool/profile/profile.hpp b/src/buildtool/profile/profile.hpp index 7e03b0ae..71511245 100644 --- a/src/buildtool/profile/profile.hpp +++ b/src/buildtool/profile/profile.hpp @@ -42,6 +42,8 @@ class Profile { struct ActionData { bool cached; double duration; + std::optional<std::string> out; + std::optional<std::string> err; std::unordered_map<std::string, std::string> artifacts; }; |