| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A common problem in the Android build is inserting rules that perform
some sort of error checking that doesn't produce any artifacts needed
by the build, for example static analysis tools. There are a few
patterns currently used, both of which have downsides.
The first is to have a rule that depends on all of the static analysis
results. This ensures they run, but requires running static analysis
over everything, and not just the active parts of the build graph.
The second is to insert the static analysis rule into the build graph
between the artifact producing rule and anything that depends on it,
often copying the artifact as the output of the static analysis rule.
This increases the critical path of the build, often reducing
parallelism. In the case of copying the artifact, it also wastes
disk space.
This patch adds "validation nodes" to edges in Ninja. A build
statement can specify validation nodes using "|@" in the edge
inputs. The validation nodes are not used as an input to the edge
(the edge can run before the validation node is ready), but are
added to the initial nodes of the build graph whenever the edge
is part of the build graph. The edge that outputs the validation
node can depend on the output of the edge that is being validated
if desired.
Test: ninja_test
Change-Id: Ife27086c50c1b257a26509373199664680b2b247
|
|
|
|
|
|
|
|
| |
Refactor Builder::AddTarget to remove an early return in a non-error
case. The next CL will add code that needs to be executed even if the
node is clean.
Change-Id: I953dc54b60b635dd75d75f8f3931970faefc5ecf
|
|
|
|
|
|
|
|
|
| |
Since commit 86f606fe (Remove path component limit from input of
CanonicalizePath in windows, 2017-08-30, v1.8.0^2~2^2), the only failure
case in the `CanonicalizePath` implementation is the "empty path" error.
All call sites have been updated to ensure `CanonicalizePath` is never
called with an empty path. Remove error handling from the signature to
simplify call sites.
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 67fbbeeec91ec171da7d4e297b8f9b319f3424c8.
There were a few missing test cases exposed by CMake's test suite that
need slight adjustments. Better to revert the original attempt, add the
test cases, and then re-land the change with the fixes.
Fixes #1932
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If an edge's output files' mtimes are compared to the most recent
input's mtime, edges might be calculated as clean even if they are
actually dirty. While an edge's command is running its rule to produce
its outputs and an input to the edge is updated before the outputs are
written to disk, then subsequent runs will think that the outputs are
newer than the inputs, even though the inputs have actually been updated
and may be different than what were used to produce those outputs.
Ninja will now restat all inputs just prior to running an edge's command
and remember the most recent input mtime. When the command completes,
it will stat any discovered dependencies from dep files (if necessary),
recalculate the most recent input mtime, and log it to the build log
file. On subsequent runs, ninja will use this value to compare to the
edge's most recent input's mtime to determine whether the outputs are
dirty.
This extends the methodology used by restat rules to work in all cases.
Restat rules are still unique in that they will clean the edge's output
nodes recursively if the edge's command did not change the output, but
in all cases, the mtime recorded in the log file is now the most recent
input mtime. See the new tests for more clarification.
|
|
|
|
|
|
| |
Send all output after manifest parsing is finished to the Status
interface, so that when status frontends are added they can handle
build messages.
|
|
|
|
|
|
| |
Make BuildStatus an abstract interface, and move the current
implementation to StatusPrinter, to make way for a serialized
Status output.
|
|
|
|
|
|
|
| |
Store the number of running edges instead of trying to compute it
from the started and finshed edge counts, which may be different
for starting and ending status messages. Allows removing the status
parameter to PrintStatus and the EdgeStatus enum.
|
|
|
|
|
|
|
|
| |
The times that end up in the build log currently originate in the
status printer, and are propagated back out to the Builder. Move
the edge times into the Builder instead, and move the overall start
time into NinjaMain so it doesn't get reset during manifest
rebuilds.
|
|\
| |
| | |
Add unique IDs to edges
|
| |
| |
| |
| |
| |
| |
| |
| | |
Edges are nominally ordered by order in the build manifest, but in
fact are ordered by memory address. In most cases the memory address
will be monontonically increasing. Since serialized build output will
need unique IDs, add a monotonically increasing ID to edges, and use
that for sorting instead of memory address.
|
| |
| |
| |
| |
| |
| | |
Found with readability-inconsistent-declaration-parameter-name
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
|\ \
| |/
|/| |
Close BuildLog while running generators, fix #1724
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
While #1780 delayed opening .ninja_log until the first write, this
this didn't fully fix the issue on Windows: There might be build
statements which run before the generator resulting in an actual write
to .ninja_log.
To fix this once and for all the BuildLog now gets closed before running
the generator. BuildLog::log_file_path_ won't be cleared so that it can
be opened again after the generator finished.
|
| |
| |
| |
| | |
header files
|
|\ \
| | |
| | | |
[clang-tidy] fix small false positive
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
else if has to be on the same line it seems.
Found with readability-misleading-indentation
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
|\ \ \
| |_|/
|/| | |
[clang-tidy] remove redundant member init
|
| |/
| |
| |
| |
| |
| | |
Found with readability-redundant-member-init
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
|/ |
|
|
|
|
|
| |
Found with readability-container-size-empty
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
|\
| |
| | |
manifest_parser: remove multi-output depslog restriction
|
| | |
|
| | |
|
| |
| |
| |
| | |
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
|
| |
| |
| |
| | |
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
|
|/
|
|
|
|
| |
Modifying a key in C++ associative containers is UB.
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
|
|
|
|
|
|
|
| |
* build: constify EdgeWanted()
* build: constify a bit of CommandRunner
* graph: constify functions of struct Edge
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
|
|\
| |
| | |
Emit "FAILED: " in red if terminal supports ANSI color output
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
After finishing an edge that produces a dyndep file, load the file and
update the build graph structure. Recompute the dirty state of all its
dependents and of newly reachable portions of the graph. Add edges to
the build plan that are discovered to be wanted. Finally, schedule
edges that are wanted and now ready to build.
|
| |
| |
| |
| |
| |
| |
| | |
In order to later support dynamic updates to the build plan while
building, the Plan will need access to its Builder. Since this access
will be needed only for specific features we can avoid updating all Plan
constructions in the test suite by making this access optional.
|
| |
| |
| |
| |
| | |
Move the logic to a new Plan::EdgeMaybeReady method so it can be re-used
elsewhere.
|
| |
| |
| |
| |
| | |
Move the logic to mark edges as wanted over to a Plan::EdgeWanted method
so it can be re-used elsewhere later.
|
| |
| |
| |
| |
| |
| |
| | |
Add an 'err' string argument and return a boolean for success. Update
call sites to pass an 'err' string argument and check the return value.
This will be useful later for adding logic to these methods that may
fail.
|
|/
|
|
|
| |
This method should be called only with edges that have not
already been started.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Prior to introduction of depfile parser handling of multiple rules,
ninja silently accepted a depfile of the form:
out: in1 in2 in3
other: otherIn1 otherIn2 otherIn3
and incorrectly treated `other` and `otherIn*` as additional inputs to
`out`. Now we prefer to reject this just as we already do for a depfile
specifying multiple outputs on one line. However, this can break
existing cases where such a depfile was silently tolerated.
Add a `-w depfilemulti={err,warn}` option to control this behavior,
and make it just a warning by default.
|
|
|
|
|
| |
Don't strip colors when CLICOLOR_FORCE is set to a non-zero value. This
environment variable is also used by CMake's Make back-end.
|
|
|
|
|
|
| |
This reverts commit 52c1d0c8f8545231581c4d51cb0a85f50564c415.
Fixes #1418.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Developers tend to blame the last printed line when a build takes too
long. Unfortunately, when building concurrently, the last printed line
may have actually finished a long time ago. Under the current system,
ninja does not update the status line to reflect what jobs are still
running. This change makes ninja always print the oldest still running job
instead. In other words, the likely build bottlenecks.
Patch from David Zarzycki, originally uploaded at #1320.
|
|\
| |
| | |
Track in Plan whether wanted edges have been scheduled
|
| |
| |
| |
| |
| |
| |
| |
| | |
Refactor the `want_` map to track for wanted edges whether they have
been scheduled or not. This gives `ScheduleWork` a direct place to keep
this information, making the logic more robust and easier to follow. It
also future-proofs `ScheduleWork` to avoid repeat scheduling if it is
called after an edge has been removed from `ready_` by `FindWork`.
|
|/
|
|
|
|
| |
Ninja is supposed to be able to build as C++98 so it can run on old
systems, but it should also be possible to optionally build it with
newer dialects.
|
|
|
|
|
| |
We now detect and reject cycles in DependencyScan::RecomputeDirty before
Plan::AddTarget is called so we can assume DAG input to the Plan.
|
|
|
|
|
|
| |
All call sites have a node on which they call `in_edge()` to call
RecomputeDirty. Simplify call sites by taking the node directly and
calling `in_edge()` internally.
|
|\
| |
| | |
Write subprocess output to stdout in binary mode
|
| |
| |
| |
| |
| |
| |
| |
| | |
Set stdout to binary mode while writing subprocess output, so that the
CR in a CR LF sequence is not replaced with CR LF itself, which would
result in CR CR LF.
Based on patch posted by nico in issue #773 comment.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
https://groups.google.com/forum/#!msg/ninja-build/YQuGNrECI-4/ti-lAs9SPv8J
discusses a case where an rule updates its output file and then
fails. The next run of ninja considers the ouptut file clean
and doesn't rebuild it. Always stat output files after they are
built, and write the mtime into .ninja_log. Consider output files
dirty if the recorded mtime is older than the most recent input
file.
|