From 6a51ecf902e0b79b6dc8fc50318c3f6e0ad1b02e Mon Sep 17 00:00:00 2001 From: Hampus Adolfsson Date: Fri, 22 Dec 2023 10:33:53 +0100 Subject: [PATCH] Update documentation for dynouts --- doc/manual.asciidoc | 14 +++++++++----- src/graph.h | 10 ++++++++-- src/ninja.cc | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/doc/manual.asciidoc b/doc/manual.asciidoc index aefbab997b..697539aec9 100644 --- a/doc/manual.asciidoc +++ b/doc/manual.asciidoc @@ -306,6 +306,9 @@ each of them with a missing include error or equivalent pointing to the generated file. _Available since Ninja 1.11._ +`outputs`:: list all outputs of the build graph. This includes any dynamic +outputs stored in the deps log. + `recompact`:: recompact the `.ninja_deps` file. _Available since Ninja 1.4._ `restat`:: updates all recorded file modification timestamps in the `.ninja_log` @@ -899,11 +902,12 @@ keys. stored as `.ninja_deps` in the `builddir`, see <>. -`dynout`:: path to an optional _dynout file_ that contains the list - of outputs generated by the rule. The dynout file syntax except one - path per line. This is to make Ninja aware of dynamic outputs, so - the command is re-run if the some dynamic outputs are missing, and - dynamic outputs are clean when using `-t clean` tool. +`dynout`:: path to an optional _dynout file_ that contains extra _implicit + outputs_ generated by the rule. This allows ninja to dynamically discover + output files whose presence is decided during the build, so that for + subsequent builds the edge is re-run if some dynamic output is missing, and + dynamic outputs are cleaned when using the `-t clean` tool. The dynout file + syntax expects one path per line. `msvc_deps_prefix`:: _(Available since Ninja 1.5.)_ defines the string which should be stripped from msvc's /showIncludes output. Only diff --git a/src/graph.h b/src/graph.h index 799e2af2c1..ed70b3f494 100644 --- a/src/graph.h +++ b/src/graph.h @@ -277,8 +277,8 @@ struct EdgeCmp { typedef std::set EdgeSet; -/// ImplicitDepLoader loads implicit dependencies, as referenced via the -/// "depfile" attribute in build files. +/// ImplicitDepLoader loads implicit dependencies and outputs, as referenced via +/// the "depfile" and "dynout" attributes in build files. struct ImplicitDepLoader { ImplicitDepLoader(State* state, DepsLog* deps_log, DiskInterface* disk_interface, @@ -290,6 +290,10 @@ struct ImplicitDepLoader { /// @return false on error (without filling \a err if info is just missing // or out of date). bool LoadDeps(Edge* edge, std::string* err); + + /// Load implicit outputs for \a edge. + /// @return false on error (without filling \a err if info is just missing + // or out of date). bool LoadImplicitOutputs(Edge* edge, std::string* err); DepsLog* deps_log() const { @@ -311,6 +315,8 @@ struct ImplicitDepLoader { /// @return false on error (without filling \a err if info is just missing). bool LoadDepsFromLog(Edge* edge, std::string* err); + /// Load implicit outputs for \a edge from the DepsLog. + /// @return false on error (without filling \a err if info is just missing). bool LoadOutputsFromLog(Edge* edge, std::string* err); /// Preallocate \a count spaces in the input array on \a edge, returning diff --git a/src/ninja.cc b/src/ninja.cc index 5eb5de630b..4b843a9bd8 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -1192,7 +1192,7 @@ const Tool* ChooseTool(const string& tool_name) { Tool::RUN_AFTER_LOGS, &NinjaMain::ToolQuery }, { "targets", "list targets by their rule or depth in the DAG", Tool::RUN_AFTER_LOAD, &NinjaMain::ToolTargets }, - { "outputs", "list all outputs of the build graph, include dynamic outputs if there are any and they have been built.", + { "outputs", "list all outputs of the build graph, including dynamic outputs stored in the deps log", Tool::RUN_AFTER_LOGS, &NinjaMain::ToolOutputs }, { "compdb", "dump JSON compilation database to stdout", Tool::RUN_AFTER_LOAD, &NinjaMain::ToolCompilationDatabase },