diff options
-rw-r--r-- | share/man/just-profile.5.md | 3 | ||||
-rw-r--r-- | src/buildtool/profile/profile.cpp | 8 | ||||
-rw-r--r-- | src/buildtool/profile/profile.hpp | 3 |
3 files changed, 14 insertions, 0 deletions
diff --git a/share/man/just-profile.5.md b/share/man/just-profile.5.md index a7da6d25..991472cb 100644 --- a/share/man/just-profile.5.md +++ b/share/man/just-profile.5.md @@ -47,6 +47,9 @@ The profile file contains the following information. - For the key *`"exit code"`* the exit code of the **`just`**(1) process. +- For the key *`"analysis errors"`*, if present, a list of error messages + describing each an error that occurred during analysis. + - For the key *`"actions"`* an object. For each action that was looked at in the build phase there is an entry, with the key being the action identifier; the identifier is the same as in the **`just-graph-file`**(5) diff --git a/src/buildtool/profile/profile.cpp b/src/buildtool/profile/profile.cpp index 6e7e8d47..f37629f1 100644 --- a/src/buildtool/profile/profile.cpp +++ b/src/buildtool/profile/profile.cpp @@ -47,6 +47,9 @@ void Profile::Write(int exit_code) { } profile_["exit code"] = exit_code; + if (not analysis_errors_.empty()) { + profile_["analysis errors"] = analysis_errors_; + } std::ofstream os(*output_file_); os << profile_.dump(2) << std::endl; @@ -148,3 +151,8 @@ void Profile::NoteActionCompleted(std::string const& id, } } } + +void Profile::NoteAnalysisError(std::string const& error_message) { + std::unique_lock lock{mutex_}; + analysis_errors_.emplace_back(error_message); +} diff --git a/src/buildtool/profile/profile.hpp b/src/buildtool/profile/profile.hpp index 9067a309..d172ae85 100644 --- a/src/buildtool/profile/profile.hpp +++ b/src/buildtool/profile/profile.hpp @@ -21,6 +21,7 @@ #include <string> #include <unordered_map> #include <utility> +#include <vector> #include "nlohmann/json.hpp" #include "src/buildtool/execution_api/common/execution_response.hpp" @@ -40,6 +41,7 @@ class Profile { void NoteActionCompleted(std::string const& id, IExecutionResponse::Ptr const& response, std::string const& cwd); + void NoteAnalysisError(std::string const& error_message); private: struct ActionData { @@ -54,6 +56,7 @@ class Profile { std::optional<std::string> output_file_; nlohmann::json profile_; std::unordered_map<std::string, ActionData> actions_; + std::vector<std::string> analysis_errors_; std::mutex mutex_; void SetCLI(CommandLineArguments const& cli); |