summaryrefslogtreecommitdiffstats
path: root/src/graph.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #1181 from DanielWeber/issue-1161Nico Weber2017-01-241-4/+4
|\ | | | | Allow more path components
| * Use uint64_t for slash_bits consistentlyDaniel Weber2016-09-011-2/+2
| | | | | | | | The VS compiler complained about possible loss of data (and it was right!)
| * Allow more path componentsDaniel Weber2016-08-221-2/+2
| | | | | | | | | | | | | | - 60 instead of 30 path components - 64 instead of 32 backslashes in a path (windows only) Issue: 1161
* | Improve error message when a depfile contains a bad pathTomasz Śniatowski2016-10-121-1/+3
|/ | | | | Debugging "ninja: error: empty path" is not fun, so make the error message mention the depfile name.
* Remove StatIfNecessary call that is never necessaryBrad King2016-02-251-2/+1
| | | | | | | | | | | | | | 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.
* Merge pull request #989 from bradking/implicit-outputsNico Weber2016-02-031-1/+2
|\ | | | | Add support for build statement implicit outputs
| * Add support for build statement implicit outputsBrad King2016-02-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Expose more details in FileReader::ReadFile signatureBrad King2016-02-031-2/+9
|/ | | | | | 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.
* win: print right slashes in 'unknown target' messageNico Weber2015-07-101-3/+4
|
* Add a missing EXPLAIN() call.Nico Weber2015-05-151-1/+7
|
* Let Stat() have an err outparam instead of writing to stderr.Nico Weber2015-03-311-7/+1
| | | | | | | | | 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.
* Recover slowdown for cyclic rule bindings fix.Nico Weber2015-03-211-9/+17
|
* Don't crash on cyclic references between rule bindings.Nico Weber2015-03-211-0/+12
| | | | | | | | | | | | | 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
* Make failing stat() calls abort the build.Nico Weber2015-03-191-10/+22
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Env should only be about variables. No behavior change.Nico Weber2015-03-181-5/+0
|
* On unexpected output in a .d file, rebuild instead erroring.Nico Weber2015-03-121-3/+4
| | | | Fixes #417.
* Allow scoping rules through subninjaMohamed Bamakhrama2015-03-011-24/+5
| | | | | | | | 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.
* Typo fix in graph.cctzik2015-02-061-1/+1
|
* Let DependencyScan::RecomputeDirty() work correclty with cyclic graphs.Nico Weber2014-12-081-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Rename a few iterators. No behavior change.Nico Weber2014-12-071-9/+9
| | | | | | | | | 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".
* remove two unneeded `explicit`sNico Weber2014-12-071-1/+1
|
* whitespace/comment/wrap fixes, no intended functionality changeScott Graham2014-11-121-1/+1
|
* no need to Decanonicalize on non-WindowsScott Graham2014-11-111-0/+2
|
* make all GetNode explicit, add DepsLog canonicalize testScott Graham2014-11-101-1/+1
|
* fix order of args to CanonicalizePathScott Graham2014-11-091-3/+3
|
* remove CanonicalizePath overloads, test for toplevel behaviourScott Graham2014-11-091-2/+9
|
* path decanonicalization when building commandScott Graham2014-11-081-1/+13
|
* Make "depfile=$out.d" work if $out contains escaped characters, rspfile too.Nico Weber2014-05-211-6/+25
| | | | | | | | | | | | | | 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).
* Introduce the "console" poolPeter Collingbourne2014-02-031-0/+4
| | | | | | | 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).
* More robust escaping of $in, $out pathsNicholas Hutchinson2014-01-061-9/+6
| | | | | | In summary: don’t escape if the path doesn’t contain problematic characters, otherwise: - Shell: enclose string in single quotes, escape embedded single quotes with the magic quote-backslash-quote sequence - Win32: Escape double quotes by doubling the number of consecutive backslashes that precede them (if any) and adding one more. Finally, double the number of trailing backslashes, and enclose the whole thing in double quotes.
* add -d keeprsp to preserve @rsp files on success on windowsScott Graham2013-09-101-1/+1
|
* Simplify.Nico Weber2013-09-021-18/+7
|
* Delete a line I failed to delete in d7a46654a7be1.Nico Weber2013-09-021-1/+0
|
* Fix restat rebuild if deps are missing.Maxim Kalaev2013-09-021-1/+2
| | | | | | | | | | | | Fixes issue #603. Apparently, the problem was caused by my fix r "consider target dirty if depfile is missing" (bcc8ad1), which was not working correctly with restat rules cleaning nodes. Switching to deps only triggered an easily observable issue. Fix by setting a flag in edges with invalid deps, and not cleaning edges with that flag set.
* Share more code between CleanNode() and RecomputeDirty().Maxim Kalaev2013-09-021-12/+14
| | | | | | | | | Move a common loop into the new function RecomputeOutputsDirty(). Simplifies things a bit, and makes it harder for the restat path to have different behavior from the regular path. No dramatic behavior change (the restat path now also calls RestatIfNecessary()).
* Check depslog timestamp in LoadDepsFromLog(), not in RecomputeOutputDirty().Maxim Kalaev2013-09-021-19/+17
| | | | | | | | | | | | RecomputeOutputDirty() is called from two places: 1. RecomputeDirty(), which calls LoadDeps(). 2. CleanNode(), which always passes 0 for the deps mtime. So this is no behavior change in either case. deps_mtime was nonzero only in deps mode, and it got passed all over the place. This makes things simpler.
* Add test that proves `node->AddOutEdge(edge);` in `LoadDepFile()` is needed.Nico Weber2013-06-041-3/+4
| | | | No functionality change. Related to issue #590.
* Fix restat builds with edges generating headers depended on through deps filesNico Weber2013-06-031-0/+1
| | | | | | | | | | | | | in deps mode. `ImplicitDepLoader::LoadDepFile()` already adds a depfile edge from every file mentioned in a depfile to the depfile's output. `ImplicitDepLoader::LoadDepsFromLog()` didn't do this yet, so add it. Else, if a restat rule clears a generated .h file, this wouldn't propagate to cc files depending on that .h file through a depfile. Fixues issue #590.
* include mtimes in deplog explainEvan Martin2013-04-101-1/+2
|
* add a test for the "deps out of date" caseEvan Martin2013-04-091-1/+1
| | | | It touched the various remaining XXXes in the code, hooray.
* use logged deps mtime in dirty calculationEvan Martin2013-04-081-5/+15
| | | | | | | | The idea here is that it's possible for a build to complete (writing its output) but then for Ninja to get interrupted before writing out the updated dependency information. In that case the mtime stored in the deps log (if any) will match the previous output, and we'll know we need to rebuild the output just to get the deps updated.
* rename "special" to "deps"Evan Martin2013-04-081-4/+4
|
* use special=anything to trigger loading from depslogEvan Martin2013-04-081-1/+1
|
* add "special=gcc" attribute, use to load depslogEvan Martin2013-04-081-10/+34
|
* use DepsLog in loading dependenciesEvan Martin2013-04-081-56/+79
| | | | WIP
* factor out implicit dep loadingEvan Martin2013-04-081-2/+3
|
* refactor some of the output mtime-handling codeEvan Martin2013-04-051-12/+13
| | | | Reduces duplicated explain output.
* more verbose error (including path) when depfile fails to loadScott Graham2013-01-241-1/+3
|
* rearrange handling of builtin bindings to make rules simplerEvan Martin2012-12-291-36/+45
| | | | | Now, a 'build' block can override any special binding like 'command' or 'description' if it needs to.
* wrap some overlong linesEvan Martin2012-12-291-3/+4
|