summaryrefslogtreecommitdiffstats
path: root/src/build.h
Commit message (Collapse)AuthorAgeFilesLines
* build.cc: constify BuildStatusKonstantin Kharlamov2019-11-201-2/+2
| | | | Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
* build.cc: constify a map in BuildStatusKonstantin Kharlamov2019-11-201-1/+1
| | | | | | Modifying a key in C++ associative containers is UB. Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
* build.cc: constify a few Plan functionsKonstantin Kharlamov2019-11-201-6/+6
| | | | Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
* Small constifications (#1647)Konstantin Kharlamov2019-09-191-2/+2
| | | | | | | * build: constify EdgeWanted() * build: constify a bit of CommandRunner * graph: constify functions of struct Edge Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
* Teach builder to load dyndep files when they are readyBrad King2019-04-181-3/+18
| | | | | | | | 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-1/+4
| | | | | | | 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-0/+1
| | | | | 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-0/+2
| | | | | 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-2/+6
| | | | | | | 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.
* Restore depfile toleration of multiple output paths on distinct linesBrad King2018-11-191-0/+2
| | | | | | | | | | | | | | | | 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.
* Revert "Fix confusing smart console output from concurrent builds"Jan Niklas Hasse2018-11-051-1/+0
| | | | | | This reverts commit 52c1d0c8f8545231581c4d51cb0a85f50564c415. Fixes #1418.
* Fix confusing smart console output from concurrent buildsNico Weber2018-04-051-0/+1
| | | | | | | | | | | 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-5/+17
|\ | | | | Track in Plan whether wanted edges have been scheduled
| * Track in Plan whether wanted edges have been scheduledBrad King2017-09-141-5/+17
| | | | | | | | | | | | | | | | 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-0/+4
|/ | | | | | 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-3/+1
| | | | | We now detect and reject cycles in DependencyScan::RecomputeDirty before Plan::AddTarget is called so we can assume DAG input to the Plan.
* Add a test that fails if a rule updates it output file but failsColin Cross2017-05-221-0/+3
| | | | | | | | 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.
* Tidy up rate snprintf'ing helperScott Graham2016-10-071-5/+7
|
* Fixed not initialized elapsed time.gkistanova2016-07-141-0/+1
|
* Fix NINJA_STATUS %r on dumb terminalsColin Cross2016-04-291-2/+9
| | | | | | | | | | | | 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.
* Improve Plan::EdgeFinished signatureBrad King2016-04-191-1/+6
| | | | | | | Use an enumeration instead of a boolean to clarify the purpose of arguments at call sites. Suggested-by: Nico Weber <nicolasweber@gmx.de>
* Release the pool slot held by an edge whether it succeeds or failsFredrik Medley2016-04-061-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* simplify & inlineScott Graham2015-04-271-6/+1
|
* avoid calling ResumeDelayedJobs insteadScott Graham2015-04-241-1/+1
|
* Cleanup: Make stack a const ref now that it's no longer modified.Nico Weber2015-04-011-1/+2
|
* Make failing stat() calls abort the build.Nico Weber2015-03-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Minor style fixes. No functionality change.Nico Weber2013-10-191-2/+3
|
* add deps_prefix for localized /showIncludes' output parsingPeter Kümmel2013-10-181-1/+1
|
* Minor style fixes, no behavior change.Nico Weber2013-08-231-1/+1
|
* Fix for incorrect number of total edges in the status messageRichard Geary2013-08-221-1/+1
|
* Fix for missing "no work to do." message if all build edges are phony rules.Richard Geary2013-08-111-1/+1
| | | | Added NestedPhonyPrintsDone unit test
* Adding error checking on fwrite/fflush in deps_logMaxim Kalaev2013-07-011-1/+4
|
* drop std:: qualifiers on more stl datatypesEvan Martin2013-04-181-2/+1
| | | | We "using namespace std" anywhere we need a std::string or a std::vector.
* always use output timestamp for depsEvan Martin2013-04-101-2/+1
| | | | | | | | Using the timestamp of the .d file was wrong. It can be written at a different time than the output, and it is immediately deleted after parsing; only the output remains for subsequent timestamp comparison purposes, so always use the output's timestamp. (This is how the code worked on Windows already.)
* fix testScott Graham2013-04-091-4/+0
|
* Merge branch 'dep-pipeless'Evan Martin2013-04-091-4/+19
|\ | | | | | | | | This merges a new mechanism for tracking "depfile" dependencies that is faster on all platforms but dramatically so on Windows.
| * add a straightforward deps log test, fix the other oneEvan Martin2013-04-091-1/+2
| | | | | | | | | | | | The first test I wrote was wrong; write a simpler test that exercises the "no failures" code paths, then fix the second test and the bugs it exposed.
| * hook up depslog writing into build processEvan Martin2013-04-081-3/+4
| |
| * refactor build-time deps-extractionEvan Martin2013-04-081-0/+3
| |
| * plumb DepsLog load through BuilderEvan Martin2013-04-081-1/+2
| |
| * pass command results via a structEvan Martin2013-04-081-2/+11
| | | | | | | | | | WaitForCommand now passes all command output via a struct. This will allow adding more output in a future change.
* | move single-line printing to new classNico Weber2013-04-091-4/+3
|/
* NINJA_STATUS now takes %e for elapsed time.Avinash Baliga2013-03-041-0/+1
|
* Merge pull request #461 from riannucci/global_sectionEvan Martin2012-12-131-3/+13
|\ | | | | Resource pools for ninja
| * Doc improvementsRobert Iannucci2012-11-301-0/+8
| |
| * stub out an api and de-constify PoolRobert Iannucci2012-11-091-3/+5
| |
* | Fix a doxygen bug found by clang's -Wdocumentation.Nico Weber2012-11-081-1/+1
|/ | | | | (That found one more issue, but I think that might be a bug in -Wdocumentation, http://llvm.org/PR14295.)
* Fix subtile buffer size errorPeter Kümmel2012-09-181-4/+4
| | | | | The deduced type was char* with size 4 and not char[32] with size 32. This removes strange output characters on Windows.
* remove some code duplicationPeter Kümmel2012-09-181-16/+12
|
* Change rate measurement code.Nico Weber2012-09-141-18/+40
| | | | | | | | | | | For %o, remove a superfluous + 0.5: snprintf("%f") rounds already. Remove some unnecessary code. For %c, fix a TODO to add a sliding window and update after every completed edge. Else, with -j50 and several files that take 3s to compile each, this number would only update every 150s. Also give the number one decimal place so that this can measure steps slower than 1s.