summaryrefslogtreecommitdiffstats
path: root/src/build.cc
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tidy] check empty instead of size (#1784)Rosen Penev2020-06-041-1/+1
| | | | | Found with readability-container-size-empty Signed-off-by: Rosen Penev <rosenp@gmail.com>
* Merge pull request #1534 from mathstuf/remove-depslog-restrictionJan Niklas Hasse2020-01-041-8/+10
|\ | | | | manifest_parser: remove multi-output depslog restriction
| * depfile_parser: remove restriction on multiple outputsBen Boeckel2019-11-201-1/+1
| |
| * build: add to deps log for each edge outputBen Boeckel2019-11-201-7/+9
| |
* | build.cc: constify BuildStatusKonstantin Kharlamov2019-11-201-2/+2
| | | | | | | | Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
* | build.cc: constify a few Plan functionsKonstantin Kharlamov2019-11-201-7/+7
| | | | | | | | Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
* | build.cc: constify a map key in RealCommandRunnerKonstantin Kharlamov2019-11-201-3/+3
|/ | | | | | Modifying a key in C++ associative containers is UB. Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
* Small constifications (#1647)Konstantin Kharlamov2019-09-191-5/+5
| | | | | | | * build: constify EdgeWanted() * build: constify a bit of CommandRunner * graph: constify functions of struct Edge Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
* Merge pull request #1508 from mqudsi/colored_failJan Niklas Hasse2019-08-021-1/+5
|\ | | | | Emit "FAILED: " in red if terminal supports ANSI color output
| * Add braces to clarify conditional scopeMahmoud Al-Qudsi2019-02-041-2/+3
| |
| * Emit "FAILED: " in red if terminal supports ANSI color outputMahmoud Al-Qudsi2018-12-051-1/+4
| |
* | Teach builder to load dyndep files when they are readyBrad King2019-04-181-4/+173
| | | | | | | | | | | | | | | | 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.
* | Make a Builder optionally available to PlanBrad King2019-04-181-2/+7
| | | | | | | | | | | | | | 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.
* | Factor out output edge ready check from Plan::NodeFinishedBrad King2019-04-181-9/+16
| | | | | | | | | | Move the logic to a new Plan::EdgeMaybeReady method so it can be re-used elsewhere.
* | Factor out edge marking logic from Plan::AddSubTargetBrad King2019-04-181-3/+7
| | | | | | | | | | Move the logic to mark edges as wanted over to a Plan::EdgeWanted method so it can be re-used elsewhere later.
* | Allow EdgeFinished and NodeFinished to fail with errorsBrad King2019-04-181-9/+17
| | | | | | | | | | | | | | 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.
* | Assert precondition in BuildStatus::BuildEdgeStartedBrad King2019-04-181-0/+1
|/ | | | | This method should be called only with edges that have not already been started.
* Restore depfile toleration of multiple output paths on distinct linesBrad King2018-11-191-2/+3
| | | | | | | | | | | | | | | | 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.
* Allow disabling of escape code stripping, fix #1475Jan Niklas Hasse2018-11-131-1/+0
| | | | | 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.
* Revert "Fix confusing smart console output from concurrent builds"Jan Niklas Hasse2018-11-051-13/+0
| | | | | | This reverts commit 52c1d0c8f8545231581c4d51cb0a85f50564c415. Fixes #1418.
* Do not always strip colored output in verbose mode, fix #1214Jan Niklas Hasse2018-11-051-1/+1
|
* Fix confusing smart console output from concurrent buildsNico Weber2018-04-051-0/+13
| | | | | | | | | | | 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.
* Merge pull request #1294 from bradking/plan-track-schedulingNico Weber2018-04-051-21/+23
|\ | | | | Track in Plan whether wanted edges have been scheduled
| * Track in Plan whether wanted edges have been scheduledBrad King2017-09-141-21/+23
| | | | | | | | | | | | | | | | 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`.
* | make ninja build with -std=c++17Nico Weber2018-04-051-1/+6
|/ | | | | | 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.
* Drop unnecessary cycle detection in Plan::AddTargetBrad King2017-06-191-44/+5
| | | | | We now detect and reject cycles in DependencyScan::RecomputeDirty before Plan::AddTarget is called so we can assume DAG input to the Plan.
* Refactor RecomputeDirty to take a node instead of an edgeBrad King2017-06-191-2/+3
| | | | | | 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.
* Merge pull request #1156 from cdbennett/windows-binary-mode-outputNico Weber2017-06-141-0/+15
|\ | | | | Write subprocess output to stdout in binary mode
| * Write subprocess output to stdout in binary modeColin D Bennett2016-05-121-0/+15
| | | | | | | | | | | | | | | | 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.
* | Always rebuild on errorsColin Cross2017-05-221-5/+11
| | | | | | | | | | | | | | | | | | | | 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.
* | Add a test that fails if a rule updates it output file but failsColin Cross2017-05-221-0/+7
| | | | | | | | | | | | | | | | 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. Add a test for this case, which currently fails.
* | Merge pull request #1181 from DanielWeber/issue-1161Nico Weber2017-01-241-1/+1
|\ \ | | | | | | Allow more path components
| * | Allow more path componentsDaniel Weber2016-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | | - 60 instead of 30 path components - 64 instead of 32 backslashes in a path (windows only) Issue: 1161
* | | Tidy up rate snprintf'ing helperScott Graham2016-10-071-2/+2
|/ /
* | Fixed not initialized elapsed time.gkistanova2016-07-141-5/+8
|/
* Fix NINJA_STATUS %r on dumb terminalsColin Cross2016-04-291-7/+12
| | | | | | | | | | | | PR #999 made dumb terminals only output when edges finish. PrintStatus is called after finished_edges_ is incremented, which means the calculation for running edges will always return 1 less than the real number of running processes. This happens on smart terminals too, but ninja will immediately print the status for the next edge with starting_edges_ incremented, so the incorrect value is never visible. Pass a boolean specifying whether the status is being printed on an edge finishing, and if so count the edge that just finished as being running.
* Fix NINJA_STATUS %e on dumb terminalsColin Cross2016-04-281-4/+6
| | | | | | | | | | | | | PR #999 made dumb terminals only output when edges finish. BuildStatus::overall_rate_ stopwatch is only initialized to the current time when PrintStatus is called with finished_edges_ == 0, but on a dumb terminal it will be called for the first time when finished_edge_ = 1, which results in very long elapsed times: NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es ] " [0 processes, 2/2 @ 0.0/s : 1461869902.367s ] Reset the stopwatches in BuildEdgeFinished before finshed_edges_ is incremented instead.
* Update %p to use finished edges after #1143.Nico Weber2016-04-281-1/+1
|
* Change default NINJA_STATUS to [%f/%t]Colin Cross2016-04-281-1/+1
| | | | | | | | | | | | | | | | | | PR #999 changed the status line to be printed when edges finish on dumb teerminals, but the default status message includes the number of started edges, resulting in sequential status lines with identical edge counts. Change the default status to show the number of finished edges, which will keep the count incrementing on every line. This will slightly change the output on smart terminals. Previously a build that was just starting would show a count equal to the number of concurrent jobs, and a build waiting for the final jobs to finish would show a count equal to the total number of edges. Now a starting build will show 0, and build waiting for the final jobs will show a count less than the total number of edges by the number of remaining jobs. Fixes: #1142
* Improve Plan::EdgeFinished signatureBrad King2016-04-191-6/+6
| | | | | | | Use an enumeration instead of a boolean to clarify the purpose of arguments at call sites. Suggested-by: Nico Weber <nicolasweber@gmx.de>
* Merge pull request #1126 from bradking/pool-release-on-failNico Weber2016-04-191-9/+16
|\ | | | | Release the pool slot held by an edge whether it succeeds or fails
| * Release the pool slot held by an edge whether it succeeds or failsFredrik Medley2016-04-061-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an edge finishes building, it should be release from its pool. Make sure that this also is the case when an edge fails to build. The bug can be shown with a pool has size N, then `ninja -k N+1` will still stop after N failing commands for that pool, even if there are many more jobs to be done for that pool: pool mypool depth = 1 rule bad_rule command = false pool = mypool build a : bad_rule build b : bad_rule Current behaviour: $ ninja -k 0 [1/2] false FAILED: false ninja: build stopped: cannot make progress due to previous errors. Expected behaviour: $ ninja -k 0 [1/2] false FAILED: false [2/2] false FAILED: false ninja: build stopped: cannot make progress due to previous errors. Signed-off-by: Fredrik Medley <fredrik.medley@gmail.com>
* | Merge pull request #1059 from bradking/avoid-double-scheduling-edgeNico Weber2016-04-191-7/+10
|\ \ | |/ |/| Avoid double-scheduling build edges in another case
| * Avoid double-scheduling build edges in another caseBrad King2016-02-031-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The change in commit v1.2.0~3^2~3^2~3 (Fix duplicate edge Pool crash in the minimally invasive way, 2013-03-18) avoids double-scheduling in a case involving duplicate out edges. However, double-scheduling may also occur on a consistent graph when an edge and one of its dependencies share an order-only input: $ cat build.ninja ... build c: touch build b: touch || c build a: touch | b || c $ ninja a $ rm a c $ ninja a In this case 'c' will build first. When NodeFinished('c') loops over the out edges it will find AllInputsReady is true for 'b' and call EdgeFinished('b') since it is not wanted (up to date). This will call NodeFinished('b') which will loop over its out edges, find AllInputsReady is true for 'a', and call ScheduleEdge('a'). When we eventually return to the loop in NodeFinished('c') it will move on to its second output and find that AllInputsReady is true for 'a' and call ScheduleEdge('a') again. Teach ScheduleEdge to tolerate duplicate calls for an edge that has already been scheduled. Avoid calling EdgeScheduled more than once for the same edge.
* | Make deps=msvc experimentally available on non-Windows.Nico Weber2016-04-061-3/+1
|/ | | | | | | | | This makes it possible to run most of the clparser tests on non-Windows, and is potentially useful for cross-compiling on non-Windows hosts. Also, the manual didn't document this as Windows-only previously. If you use this on non-Windows, please let me know, else I might undo this change again in the future.
* Merge pull request #1033 from colincross/failedNico Weber2016-02-031-2/+9
|\ | | | | Print output file on failure
| * Print output file on failureColin Cross2015-10-051-2/+9
| | | | | | | | | | | | | | | | | | | | | | Modify the FAILED: output to provide the output files that failed to build, followed by the failed command on the next line. This makes the failure much easier to read, as you can immediately see much shorter name of the file that failed instead of trying to parse a very long command line. It also makes manually re-running the failed command much easier because you can copy the whole line without ending up with the FAILED: prefix.
* | Expose more details in FileReader::ReadFile signatureBrad King2016-02-031-2/+10
| | | | | | | | | | | | 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.
* | Add -d keepdepfile to preserve depfilesShinichiro Hamaji2016-01-281-3/+5
| | | | | | | | | | This is useful when you are developing a tool which generates GCC-style depfiles.
* | Merge pull request #999 from colincross/dumbstatusNico Weber2015-11-121-2/+3
|\ \ | | | | | | Print status when edge finishes on dumb terminals