summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md4
-rw-r--r--share/man/just.1.org5
-rw-r--r--src/buildtool/common/cli.hpp5
-rw-r--r--src/buildtool/main/main.cpp13
4 files changed, 24 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 65467f67..c7636b44 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ A feature release on top of `1.0.0`, backwards compatible.
- `just-mr` is now available as C++ binary and supports fetching in parallel
+### Other changes
+
+- `just analyse` now supports a new option `--dump-export-targets`
+
## Release `1.0.0` (2022-12-12)
Initial stable release.
diff --git a/share/man/just.1.org b/share/man/just.1.org
index 3c4cabe8..6ca71764 100644
--- a/share/man/just.1.org
+++ b/share/man/just.1.org
@@ -476,6 +476,11 @@ well-defined graph file. See *just-graph-file(5)* for more details.
}
#+END_SRC
+ *--dump-export-targets* PATH\\
+ Dump all transitive targets to file for the given target that are
+ export targets. ~-~ is treated as stdout. The output format is
+ the same as for *--dump-targets*.
+
*--dump-targets-graph* PATH\\
Dump the graph of configured targets to a file (even if it
is called ~-~). In this graph, only non-source targets are
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp
index 6592a02f..4650f749 100644
--- a/src/buildtool/common/cli.hpp
+++ b/src/buildtool/common/cli.hpp
@@ -77,6 +77,7 @@ struct DiagnosticArguments {
std::optional<std::string> dump_trees{std::nullopt};
std::optional<std::string> dump_vars{std::nullopt};
std::optional<std::string> dump_targets{std::nullopt};
+ std::optional<std::string> dump_export_targets{std::nullopt};
std::optional<std::string> dump_targets_graph{std::nullopt};
std::optional<std::string> dump_anonymous{std::nullopt};
std::optional<std::string> dump_nodes{std::nullopt};
@@ -283,6 +284,10 @@ static inline auto SetupDiagnosticArguments(
clargs->dump_targets,
"Dump targets to file (use - for stdout).")
->type_name("PATH");
+ app->add_option("--dump-export-targets",
+ clargs->dump_export_targets,
+ "Dump \"export\" targets to file (use - for stdout).")
+ ->type_name("PATH");
app->add_option("--dump-targets-graph",
clargs->dump_targets_graph,
"Dump the graph of the configured targets to file.")
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index fbbef488..0c9f047a 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -787,7 +787,8 @@ void DumpTrees(std::string const& file_path, AnalysisResult const& result) {
}
void DumpTargets(std::string const& file_path,
- std::vector<Target::ConfiguredTarget> const& target_ids) {
+ std::vector<Target::ConfiguredTarget> const& target_ids,
+ std::string const& target_qualifier = "") {
auto repo_map = nlohmann::json::object();
auto conf_list =
[&repo_map](Base::EntityName const& ref) -> nlohmann::json& {
@@ -813,12 +814,14 @@ void DumpTargets(std::string const& file_path,
});
auto const dump_string = IndentListsOnlyUntilDepth(repo_map, 2);
if (file_path == "-") {
- Logger::Log(LogLevel::Info, "List of analysed targets:");
+ Logger::Log(
+ LogLevel::Info, "List of analysed {}targets:", target_qualifier);
std::cout << dump_string << std::endl;
}
else {
Logger::Log(LogLevel::Info,
- "Dumping list of analysed targets to file '{}'.",
+ "Dumping list of analysed {}targets to file '{}'.",
+ target_qualifier,
file_path);
std::ofstream os(file_path);
os << dump_string << std::endl;
@@ -941,6 +944,10 @@ void DumpNodes(std::string const& file_path, AnalysisResult const& result) {
if (clargs.dump_targets) {
DumpTargets(*clargs.dump_targets, result_map.ConfiguredTargets());
}
+ if (clargs.dump_export_targets) {
+ DumpTargets(
+ *clargs.dump_export_targets, result_map.ExportTargets(), "export ");
+ }
if (clargs.dump_targets_graph) {
auto graph = result_map.ConfiguredTargetsGraph().dump(2);
Logger::Log(LogLevel::Info,