summaryrefslogtreecommitdiffstats
path: root/src/manifest_parser.cc
Commit message (Collapse)AuthorAgeFilesLines
* depfile_parser: remove restriction on multiple outputsBen Boeckel2019-11-201-8/+0
|
* Fix minor typo of return valuexianglin10062019-11-151-2/+2
| | | Return value of ManifestParser::ParseEdge shoule be boolean
* Add a "dyndep" reserved binding to the manifest formatBrad King2019-04-181-0/+17
| | | | | | 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.
* Factor out a base class of ManifestParserBrad King2019-04-181-35/+1
| | | | | | Create a Parser base class that holds parser functionality not specific to the build manifest file format. This will allow it to be re-used for other parsers later.
* Restore tolerance of self-referencing phony build statementsBrad King2017-09-081-0/+19
| | | | | | | | | | | | | | | | | | | | 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
* Factor ManifestParser options into a structureBrad King2017-09-071-4/+4
| | | | | | This will allow more options to be added without updating everywhere that constructs a ManifestParser. Also extend the AssertParse function to take the options so tests can control them.
* Allow more path componentsDaniel Weber2016-08-221-3/+3
| | | | | | | - 60 instead of 30 path components - 64 instead of 32 backslashes in a path (windows only) Issue: 1161
* Parser accepts no explicit outputs.Nicolas Despres2016-05-251-5/+5
| | | | | | | | | | There is a class of commands that take an output directory where they create their output files. Among them are cp(1), tar(1) to name a few. These commands have one or more implicit outputs but no explicit output. With this patch, Ninja's parser accepts build edge with an empty list of explicit outputs.
* Fix crash with duplicate implicit outputs.Nico Weber2016-04-271-7/+11
| | | | | | | | Sadly, duplicate outputs aren't an error by default in Ninja (see also a new edge has no effect. Remember to decrement the "number of implicit outputs" counter for the new edge when this happens. Fixes #1136.
* Merge pull request #989 from bradking/implicit-outputsNico Weber2016-02-031-0/+15
|\ | | | | Add support for build statement implicit outputs
| * Add support for build statement implicit outputsBrad King2016-02-031-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Replace ManifestParser::FileReader with general FileReaderBrad King2016-02-031-1/+2
|/ | | | | | Avoid having two separate filesystem interfaces. Simplify test infrastructure by avoiding custom `ManifestParser::FileReader` implementations.
* dupe_edge_should_err from bool to enumScott Graham2016-01-271-4/+4
|
* Make dupbuild=err work in subninjaScott Graham2016-01-271-1/+1
|
* Add an opt-in flag to make duplicate edges an error (`-w dupbuild=err`).Nico Weber2015-03-241-4/+10
| | | | | This is step 1 on #931. Duplicated edges will become an error by default in the future.
* Make tests quiet again.Nico Weber2015-03-241-5/+7
|
* Move warning emission on dupe edges from State to ManifestParser.Nico Weber2015-03-241-1/+6
| | | | | | | | This will make it easier to optionally make this an error (because ManifestParser has a way of printing errors), and it'll also make it easier to make the tests quiet again. No behavior change.
* Preallocate edge node vectors. ~1% faster.Nico Weber2015-03-211-0/+2
|
* Another crash fix for duplicate edges. Fixes #939.Nico Weber2015-03-191-12/+12
| | | | | | | | | | | Patch #933 fixed a crash with duplicate edges by not adding edges to the graph if all the edge's outputs are already built by other edges. However, it added the edge to the out_edges of the edge's input nodes before deleting it, letting inputs refer to dead edges. To fix, move the check for deleting an edge above the code that adds inputs. Expand VerifyGraph() to check that nodes don't refer to edges that aren't present in the state.
* Build self-consistent graphs for dupe edges with multiple outputs.Nico Weber2015-03-151-0/+8
| | | | | | | | | | | | | | | | | | | | | | Fixes #867, both the crashes and "[stuck]" issues. The problem was that a duplicate edge would modify the in_edge of the outputs of the new build rule, but the edge corresponding to the old build rule would still think that the in_edge points to itself. `old_edge->outputs_[0]->in_edge()` would not return `old_edge`, which confused the scan logic. As fix, let `State::AddOut()` reject changing in_edge if it's already set. This changes behavior in a minor way: Previously, if there were multiple edges for a single output, the last edge would be kept. Now, the first edge is kept. This only had mostly-well-defined semantics if all duplicate edges are the same (which is the only case I've seen in practice), and for that case the behavior doesn't change. For testing, add a VerifyGraph() function and call that every time any test graph is parsed. That's a bit more code than just copying the test cases from the bug into build_test.cc, but it also yields better test coverage overall.
* Allow scoping rules through subninjaMohamed Bamakhrama2015-03-011-3/+3
| | | | | | | | 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.
* Cleanup: Fix 'hasIdent' variable name/style.Thiago Farina2015-01-101-4/+4
| | | | | | | Seems more correct to name it has_indent_token and to use the unix_hacker style. Signed-off-by: Thiago Farina <tfarina@chromium.org>
* fix order of args to CanonicalizePathScott Graham2014-11-091-3/+3
|
* remove CanonicalizePath overloads, test for toplevel behaviourScott Graham2014-11-091-1/+2
|
* wip on adding tests at higher level, some not rightScott Graham2014-11-081-4/+6
|
* Provide an error message on malformed lets. Fixes #807.Nico Weber2014-09-041-1/+1
|
* wip for console pool on windowsNico Weber2014-05-131-4/+0
|
* Merge pull request #714 from pcc/console-poolNico Weber2014-04-171-0/+4
|\ | | | | Introduce the "console" pool
| * 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).
* | Allocate per-edge BindingEnvs lazily.Nico Weber2014-02-111-4/+5
|/ | | | | | | In chrome, only 2000 of 22000 build edges have bindings. A BindingEnv is 64 bytes, so allocating these only when needed saves a bit over 1 MB of memory. Since env chains are shorter for lookups, builds also become a tiny bit faster.
* Fix diagnostic formatting regression caused by adaa91a33eb2cf23b88.Nico Weber2013-07-191-3/+5
| | | | | | | | | | | | | Ninja regressed to include a location for every file on the include stack for nested diagnostics, i.e. it would print: input:1: include.ninja:1: expected path Fix this so that it prints only the current file location, like it used to: include.ninja:1: expected path Also add a test for this.
* Add back contents.resize(), but with a comment and just 1 instead of 10.Nico Weber2013-07-181-0/+8
|
* Let the ".ninja parse" metric include the time to read the toplevel ninja file.Nico Weber2013-07-111-1/+1
| | | | | | Loads of included ninja files were covered by the ".ninja parse" in Parse() further up the stack from the toplevel file, but the load of the toplevel file wasn't counted. Fix that.
* Reuse ManifestParser::Load() in ManifestParser::ParseFileInclude().Nico Weber2013-07-111-9/+3
| | | | | | | | | | | | | | | | ParseFileInclude() was doing the work that Load() was doing. Instead, just make it call Load(). Also, remove a FIXME about using ReadPath() in ParseFileInclude() -- it's already being used. (The FIXME was added in the same commit that added the call to ReadPath() -- 8a0c96075786c19 -- it probably should've been deleted before that commit.) Also, remove a `contents.resize(contents.size() + 10);`. It's not clear what it's for, but if it was important then ManifestParser::ParseFileInclude() would have needed that call too, and it didn't have it. No intended behavior change.
* Improve error message for duplicate rules and unknown pools.Nico Weber2013-07-021-5/+3
| | | | | Also add more tests for invalid manifests. According to gcov, these invalid inputs weren't tested before.
* Add stdlib.h include for atol().Nico Weber2013-06-221-0/+1
| | | | | This attempts to fix issue #600. `man atol` claims that atol() is in stdlib.h, which wasn't included yet.
* Remove a few unused includes.Nico Weber2013-05-121-3/+1
|
* make it an error for now to have multiple outputs with depslogEvan Martin2013-04-081-0/+8
|
* add syntax for checking versionsEvan Martin2013-02-161-3/+9
|
* rearrange handling of builtin bindings to make rules simplerEvan Martin2012-12-291-51/+25
| | | | | Now, a 'build' block can override any special binding like 'command' or 'description' if it needs to.
* wrap some overlong linesEvan Martin2012-12-291-2/+4
|
* begin rationalizing platform for both parsersRobert Iannucci2012-11-101-7/+5
|
* block parse method doneRobert Iannucci2012-11-101-2/+66
|
* all building and tests passingRobert Iannucci2012-11-091-1/+1
|
* stub out an api and de-constify PoolRobert Iannucci2012-11-091-1/+1
|
* reject tabs (and CRs) in input files more aggressivelyEvan Martin2012-08-021-2/+3
|
* Rename parsers.* to manifest_parser.*Thiago Farina2012-07-091-0/+327
So it matches with the class name in there. Signed-off-by: Thiago Farina <tfarina@chromium.org>