summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Merge pull request #143 from cipriancraciun/patches/python2"Evan Martin2011-11-252-2/+2
| | | | | | | This reverts commit 38ab41f45ff818b437942b753328a0168914fc86, reversing changes made to 819d6347b424f583d651b86dd1280605ddb23b88. Platforms that don't have /usr/bin/python pointing to python2 are broken.
* Renamed `python` to `python2`.Ciprian Dorin, Craciun2011-11-221-1/+1
|
* Fixed Python 2 scripts prologue (i.e. `#!/usr/bin/env python2`).Ciprian Dorin, Craciun2011-11-221-1/+1
|
* Fix compilation warning in Ninja's test suite.Nicolas Despres2011-11-213-5/+5
|
* Remove warning triggered by -Wextra on MinGW.Nicolas Despres2011-11-195-2/+11
|
* Add -Wextra warning flag.Nicolas Despres2011-11-195-6/+6
| | | | | | | Fix triggered warnings: - unused parameter - type qualifiers ignored on function return type - missing initializer for member
* Fix compilation warning with getopt() on MinGW.Nicolas Despres2011-11-191-1/+1
|
* Fix compilation warning with getopt_long() on MinGW.Nicolas Despres2011-11-191-2/+2
|
* Use more portable way to get the current process ID.Nicolas Despres2011-11-191-2/+1
| | | | | | | GetProcessId() is available only since Windows XP. Since MinGW define WINVER to 0x0400 which is Windows 2000 I think, we have a compilation error. Using GetCurrentProcessId() instead of GetProcessId(GetCurrentProcess()) fix this issue.
* Add spelling suggestions for four cases:Nico Weber2011-11-1610-8/+87
| | | | | | | | | | | 1. For targets, when invoking ninja to build a target. 2. For targets, when doing a "query" command. 3. For command names. 4. For the subcommands of the "targets" command. Also change CmdTargets() to call LookupNode() instead of GetNode() -- since the result was checked for NULL, that's probably what was intended here originally.
* Add a EditDistance() function based on the one in ↵Nico Weber2011-11-134-1/+143
| | | | llvm/lib/Support/StringRef.cpp.
* Merge pull request #127 from tiresdonexits/masterEvan Martin2011-11-061-1/+1
|\ | | | | Minor code change to address a warning in g++ 4.6.
| * Added a cast to NULL to remove a warning issues by g++ 4.6.Jonathan Sternberg2011-11-051-1/+1
| |
* | Add a "commands" toolPeter Collingbourne2011-11-041-6/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This tool performs a post-order traversal of the build graph, starting from a list of targets specified on the command line, and for each build statement encountered, prints the evaluated command line. Use cases include: - Generating input for a tool which needs to know the full command line for every command invoked during a build. Many static analysis and indexing tools require this information. - Generating a build script which does not depend on Ninja. For example, such a script could be used by Ninja to bootstrap itself.
* | Merge pull request #125 from pcc/outputs-readyEvan Martin2011-11-0212-134/+437
|\ \ | | | | | | CMake requirements: Make-style order-only dependencies, restat rules
| * | Implement restat rulesPeter Collingbourne2011-10-249-22/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A restat rule is a rule which is capable of pruning the build tree depending on the timestamps of its outputs before and after a build. After a restat rule is rebuilt, Ninja will re-stat each output file to obtain its current timestamp. If the timestamp is unchanged from when Ninja initially stat'ed the file before starting the build, Ninja will mark that output file as clean, and recursively for each reverse dependency of the output file, recompute its dirty status. Ninja then stores the most recent timestamp of any input file in the build log entry associated with the output file. This timestamp will be treated by future invocations of Ninja as the output file's modification time instead of the output file's actual modification time for the purpose of deciding whether it is dirty (but not whether its reverse dependencies are dirty).
| * | Create log entries in BuildLog::RecordCommand without requiring a log filePeter Collingbourne2011-10-241-4/+2
| | | | | | | | | | | | | | | This permits us to write tests that write and later read from the build log without needing a temporary log file.
| * | Implement Make-style order-only dependenciesPeter Collingbourne2011-10-242-16/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the implementation of order-only dependencies differed between Make and Ninja in two important ways: 1) If the order-only dependency existed but was out of date, it would never be rebuilt, whereas Make would always rebuild out of date order-only dependencies. 2) If the order-only dependency did not exist, it would cause its reverse dependencies to always build, whereas Make would only rebuild a file if a non-order-only dependency was out of date. A key distinction between Ninja and Make as seen through the above two points was that in Ninja, order-only dependencies cared about whether the target as a file exists (so perhaps a better name for the old semantics would have been "missing-only dependencies"). These differences made it impossible to introduce an order-only dependency on an always out-of-date (i.e. missing) target without also causing the depender and its reverse dependencies to rebuild unnecessarily on every build. Build systems which must perform some action (such as logging the build start time, or printing a message) at the start of every build typically implement this by adding to every target an order-only dependency which performs this action, which would have forced an entire rebuild on every invocation of Ninja under the old semantics. This commit causes Ninja to conform to the Make-style behaviour.
| * | Split Node::dirty_ into two flags: Node::dirty_ and Edge::outputs_ready_Peter Collingbourne2011-10-188-106/+160
| |/ | | | | | | | | dirty_ is intended to remain static during the build (unless a restat occurs), while outputs_ready_ reflects the dynamic state of the build.
* | don't leak fds into subprocessesEvan Martin2011-10-311-0/+1
| | | | | | | | Patch from Antoine Labour <piman@chromium.org>, (hacky) test by me.
* | move SetCloseOnExec to utilEvan Martin2011-10-313-17/+21
|/
* Make the command line interface for the clean tool consistentPeter Collingbourne2011-10-151-22/+15
| | | | | | Since we have started using command line flags for the clean tool, it is inconsistent to keep the "target" and "rule" prefixes. Replace them with a "-r" flag with the same semantics as "rule".
* Implement generator rulesPeter Collingbourne2011-10-157-7/+61
| | | | | | | | | | | | | Introduce a rule attribute "generator" which, if present, specifies that this rule is used to re-invoke the generator program. Files built using generator rules are treated specially in two ways: firstly, they will not be rebuilt if the command line changes; and secondly, they are not cleaned by default. A command line flag "-g" is introduced for the clean tool, which causes it to remove generator files. Fixes issue #102.
* pass extra flags into the toolEvan Martin2011-10-141-2/+5
|
* Elide output in the middle when exceeding terminal width.Nicolas Despres2011-10-121-3/+4
| | | | | | | | | | When building projects with long file paths, the rule name may disappear since the output is elided on the left side. So you no longer know whether you are compiling or linking. I think the user is interested in both the rule name and the file name. Eliding the output in the middle solves this problem.
* make CanonicalizePath report an error on empty pathEvan Martin2011-10-067-19/+57
| | | | Fixes part of issue 121, but the fix exposed a further issue.
* add syntax to build output from a given fileEvan Martin2011-09-221-0/+23
| | | | e.g. "ninja src/graph.cc^" builds the object file generated from that input
* command line supports multiple targetsEvan Martin2011-09-221-2/+2
|
* make options constEvan Martin2011-09-221-6/+6
|
* stylistic cleanupsEvan Martin2011-09-221-19/+20
|
* note that target is optional in command-line helpEvan Martin2011-09-221-1/+3
|
* Merge pull request #106 from pcc/depfile-vectorEvan Martin2011-09-141-4/+7
|\ | | | | Allocate space in the inputs vector for the depfile implicit deps
| * Allocate space in the inputs vector for the depfile implicit depsPeter Collingbourne2011-09-141-4/+7
| | | | | | | | This speeds up a no-op LLVM/Clang build by about 20ms.
* | Consider missing phony targets with no dependencies out of datePeter Collingbourne2011-09-142-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 639c8f0 ("don't mark phony edges dirty if none of their inputs are dirty") modified the behaviour of the "phony" built-in rule. Previously, when the output file was missing, it was marked as dirty. After 639c8f0, it was always marked as clean unless one of the dependencies was dirty. The depfile mechanism uses the old behaviour of "phony" to rebuild an object file if any of the headers were missing. Restore the old "phony" behaviour only for the case where the build statement has no dependencies. This is slightly inconsistent, but I can't really see any other use case for an alias of nothing. Also, document this behaviour.
* | Modify the build tests to use the virtual file systemPeter Collingbourne2011-09-143-7/+21
|/
* generalize the pattern of hash_map<const char*, ...>, use in BuildLogEvan Martin2011-09-125-32/+42
| | | | | | Refactor the code in StatCache for use in BuildLog. Now both use hash tables where the keys are const char*. Removes another 30ms from Chrome no-op builds.
* use StringPiece for makefile depsEvan Martin2011-09-125-12/+77
| | | | | | | | | | | | Because of this, MakefileParser now returns pointers into the source makefile string rather than allocating new strings. Despite needing to take the result and stuff it into a new string anyway to canonicalize it, this takes another 50ms or so off the null Chrome build, likely due to the vector used in MakefileParser changing to a type that doesn't use any allocations. (I also experimented with making the vector reserve an initial size but didn't see any performance impact.)
* Split ninja_test.cc into state_test.cc and disk_interface_test.ccThiago Farina2011-09-113-141/+140
| | | | Signed-off-by: Thiago Farina <tfarina@chromium.org>
* Merge pull request #103 from tfarina/structEvan Martin2011-09-111-1/+1
|\ | | | | This is C++, there is no need to write 'struct' before the type when decl
| * This is C++, there is no need to write 'struct' before the type when ↵Thiago Farina2011-09-101-1/+1
| | | | | | | | | | | | declaring a variable. Signed-off-by: Thiago Farina <tfarina@chromium.org>
* | change main hash to char*; use pointers into filesEvan Martin2011-09-102-3/+26
| | | | | | | | | | This has a small (20ms) effect on Chrome, but it will also be used more as I remove more strings.
* | optimize IsIdentCharEvan Martin2011-09-091-5/+25
| | | | | | | | Rather than nested tests, use a table. Shaves 200ms off Chrome null startup.
* | fix "ignored return value of write" harderEvan Martin2011-09-091-2/+4
| |
* | verify -k param is numericEvan Martin2011-09-092-4/+10
| | | | | | | | Fixes issue #85.
* | minor cleanupsEvan Martin2011-09-091-2/+4
| |
* | don't mark phony edges dirty if none of their inputs are dirtyEvan Martin2011-09-092-8/+23
|/ | | | | | | Because the output file is always missing, we'd consider a phony edge dirty even when there wasn't any work to do. Most importantly, that would mean we wouldn't print "nothing to do" in the common case of everything being up to date when building an alias.
* Merge pull request #101 from tfarina/build-config-referenceEvan Martin2011-09-092-5/+5
|\ | | | | Make Cleaner::config_ a reference-to-const instead of copying the value.
| * Make Cleaner::config_ a reference-to-const instead of copying the value.Thiago Farina2011-09-092-5/+5
| | | | | | | | Signed-off-by: Thiago Farina <tfarina@chromium.org>
* | Merge pull request #95 from qhuo/depfile-for-command-with-multiple-outputsEvan Martin2011-09-093-22/+11
|\ \ | |/ |/| Add depfile support to build command with multiple outputs (Fixes: #61)
| * Move a passing test from Errors to MultipleOutputsQingning Huo2011-09-061-10/+11
| |