| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
header files
|
|\
| |
| | |
manifest_parser: remove multi-output depslog restriction
|
| | |
|
|/
|
|
| |
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
|
| |
|
|
|
|
|
| |
Accessing inputs_[0] when it's empty results in an assert when running
in debug. Avoid it by using data() if available.
|
|
|
|
|
|
|
| |
* build: constify EdgeWanted()
* build: constify a bit of CommandRunner
* graph: constify functions of struct Edge
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The full readiness of a node that has a dyndep binding cannot be known
until after the dyndep file is loaded. If a dyndep file is ready while
constructing the build plan it can be loaded immediately so full
information can be used to decide whether anything needs to be built.
If a dyndep file is not ready while constructing the build plan then the
edges naming it cannot be ready either because the dyndep file is one of
their inputs. In this case we defer loading the dyndep file until the
build plan is being executed.
|
|
|
|
|
| |
Add a LoadDyndeps method to load a dyndep file and update
the edges that name it in their dyndep binding.
|
|
|
|
|
|
| |
Allow rules or build statements to specify one of the build statement
inputs in a "dyndep" binding. This will later be used to load
dependency information from the specified file.
|
|
|
|
|
|
| |
Track for each Edge whether depfile information has been loaded using an
explicit flag. This will allow RecomputeDirty to be repeated for an
edge without loading deps again.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
This prepares it for higher-resolution timestamps.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since commit v1.8.0^2~3^2~1 (Teach RecomputeDirty to detect cycles in
the build graph, 2015-11-13) we correctly reject self-referencing phony
build statements like
build a: phony a
as cycles. Unfortunately this breaks support for CMake 2.8.12.x and
3.0.x because those versions incorrectly produce edges of this form
(that we used to tolerate). In order to preserve compatibility with
those CMake versions we need to restore tolerance of these edges.
Add a special case to the manifest parser to filter out self-referencing
inputs of phony edges of the form produced by those CMake versions.
Warn by default, but add a `-w phonycycle={err,warn}` option to make it
an error.
Fixes: #1322
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RecomputeDirty is the earliest traversal of the build graph complete
with depfile-loaded dependencies. Teach it to detect cycles and fail
immediately. This avoids the need to tolerate cycles in RecomputeDirty
only to diagnose them later. It also enables future simplification of
Plan and Builder logic because they will be able to assume DAG input.
When RecomputeDirty detects a cycle, reject it with an error message
like that previously produced by Plan::CheckDependencyCycle.
Previously we used the stat state of each node to determine whether
we reached it earlier in the walk. Retain this approach for leaf
nodes, but add an explicit walk state mark for each Edge so that
we can have a temporary mark to aid cycle detection.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
PR #1281 added a deference of most_recent_input without checking
for NULL, which can occur if a build rule has no inputs.
Check it for null before dereferencing, and add a test.
Fixes #1290.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
Stat is not always used through Node::Stat, it is often used directly
through DiskInterface. THe next patches will cause it to be called
even more often through DiskInterface, so move the metrics to
DiskInterface.
|
|\
| |
| | |
Allow more path components
|
| |
| |
| |
| | |
The VS compiler complained about possible loss of data (and it was right!)
|
| |
| |
| |
| |
| |
| |
| | |
- 60 instead of 30 path components
- 64 instead of 32 backslashes in a path (windows only)
Issue: 1161
|
|/
|
|
|
| |
Debugging "ninja: error: empty path" is not fun, so make the error
message mention the depfile name.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The call to StatIfNecessary in DependencyScan::RecomputeOutputsDirty was
added by commit v1.4.0^2~7^2~1 (Share more code between CleanNode() and
RecomputeDirty(), 2013-09-02) while consolidating code paths. However,
it was needed only when called from RecomputeDirty because prior to
refactoring the CleanNode code path did not call it.
Later commit v1.6.0^2~46^2 (Let DependencyScan::RecomputeDirty() work
correclty with cyclic graphs, 2014-12-07) added back to RecomputeDirty a
loop over outputs that calls StatIfNecessary. Therefore
RecomputeOutputsDirty no longer needs to call StatIfNecessary for either
of its own callers.
|
|\
| |
| | |
Add support for build statement implicit outputs
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Some build rules produce outputs that are not mentioned on the command
line but that should be part of the build graph. Such outputs should
not be named in the `$out` variable. Extend the build statement syntax
to support specification of implicit outputs using the syntax
`| out1 out2` after the explicit outputs and before the `:`.
For example, compilation of a Fortran source file `foo.f90` that defines
`MODULE FOO` may now be specified as:
rule fc
command = f95 -c $in -o $out
build foo.o | foo.mod: fc foo.f90
The `foo.mod` file is an implicit output generated by the compiler based
on the content of the source file and not mentioned on the command line.
|
|/
|
|
|
|
| |
Return a status so callers can distinguish a missing file from an empty
file. This allows our VirtualFileSystem test infrastructure to report
as missing any file for which it has no entry.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
Also check for Stat() failure in a few more places.
This way, ninja doesn't print two "ninja: error: " lines if stat() fails
during a build. It also makes it easier to keep the stat tests quiet.
Every caller of Stat() needs to explicitly log the error string if
that's desired.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #902.
This dynamically detects cycles. I like this approach less than
detecting them statically when parsing rules [1], but it has the
advantage that it doesn't break existing ninja manifest files.
It has the disadvantage that it slows down manifest_parser_perftest by
3.9%.
1: https://github.com/martine/ninja/commit/cc6f54d6d436047
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #830, fixes #904.
In practice, this either happens with 64-bit inodes and a 32-bit
userspace when building without -D_FILE_OFFSET_BITS=64 in CFLAGS, or
when a filename is longer than the system file length limit.
Since DiskInterface::Stat() returns -1 on error, and Node used -1 on
"stat state unknown", not aborting the build lead to ninja stat()ing the
same file over and over again, until it finally ran out of stack. That's
now fixed.
* Change RecomputeOutputsDirty() to return success instead of dirty
state (like RecomputeDirty()) and return the dirty state in a bool
outparam
* Node::Stat()s old return value wasn't used anywhere, change the
function to return success instead and add an |err| outparam
* Node::StatIfNecessary()'s old return value was used only in one place.
Change that place to explicitly check status_known() and make
StatIfNecessary() return success and add an |err| outparam
* Plan::CleanNode() can now fail, make it return bool and add an |err|
outparam
|
| |
|
|
|
|
| |
Fixes #417.
|
|
|
|
|
|
|
|
| |
Ninja didn't support scoping rules through subninja and assumed
a unique rule name in the whole namespace. With this change, this
behavior is changed to allow scoping rules. Two rules can have the
same name if they belong to two different scopes. However, two
rules can NOT have the same name in the same scope.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RecomputDirty(edge) currently works roughly like this:
RecomputeDirty(edge):
LoadDeps(edge)
for in in edge.inputs:
if in.StatIfNecessary():
RecomputeDirty(in.in_edge) # recurse into inputs
for out in edge.outputs:
out.StatIfNecessary() # mark outputs as visited
It uses the stat state of each node to mark nodes as visited and doesn't
traverse across nodes that have been visited already. For cyclic graphs
with an edge with multiple outputs on the cycle, nothing prevents an
edge to be visited more than once if the cycle is entered through an
output that isn't on the cycle. In other words, RecomputeDirty() for
the same edge can be on the call stack more than once. This is bad for
at least two reasons:
1. Deps are added multiple times, making the graph confusing to reason
about.
2. LoadDeps() will insert into the inputs_ of an edge that's iterated
over in a callframe higher up. This can invalidate the iterator,
which causes a crash when the callframe with the loop over the
now-invalidated iterator resumes.
To fix this, let RecomputeDirty() mark all outputs of an edge as visited
as the first thing it does. This way, even if the edge is on a cycle
with several outputs, each output is already marked and no edge will
have its deps loaded more than once.
Fixes the crashes in #875. (In practice, it turns the crashes into
"stuck [this is a bug]" messages for now, due to the example without
duplicate rules in #867)
|
|
|
|
|
|
|
|
|
| |
It confused me that the iterator iterating over `outputs_` was called
`i` -- this always made me think of "input", not "iterator".
Call iterators over edge outputs "o", iterators over edge inputs "i",
iterators over node input edges "oe", and general iterators over edges
"e".
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #730. This has always been broken, but due to #690 more paths are now
escaped (e.g. paths containing + characters, like file.c++). Also see
discussion in #689.
The approach is to give EdgeEnv an enum deciding on whether or not to escape
file names, and provide functions that evaluate depfile and rspfile with that
set that to kNoEscape. (depfile=$out.d doesn't make sense on edges with
multiple outputs.)
This should be relatively safe, as $in and $out can't be used on edges, only
on rules (#687).
|
|
|
|
|
|
|
| |
This is a pre-defined pool with a depth of 1. It has the special property
that any task in the pool has direct access to the console. This can be
useful for interactive tasks or long-running tasks which produce status
updates on the console (such as test suites).
|