aboutsummaryrefslogtreecommitdiffstats
path: root/dep.cc
Commit message (Collapse)AuthorAgeFilesLines
* Include implicit outputs in the DepNode graphDan Willemsen2017-08-151-3/+69
| | | | | | | | | | | The last patch was good enough for simple use cases, but if a dependency was added to the implicit output, Kati would create a phony rule in addition to the implicit output. This patch will cause the rules to be combined into a single DepNode, combining any variables and dependencies. Change-Id: I92c9e5b6fdb8bfe49d0cef0a5fa22def4acd6d99
* Support Ninja implicit outputsDan Willemsen2017-08-091-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add .KATI_IMPLICIT_OUTPUTS target-specific variable to add extra implicit outputs to the build line in the ninja file. This doesn't actually affect the node graph within Kati, but combined with --gen_all_targets should be usable. This allows us to properly define the build graph in ninja when one rule creates multiple files. There are a number of ways that people attempt to do this in make, all of which have problems: a b: touch a b Define multiple outputs with the same rule. This looks correct to most people, but actually runs the rule multiple times -- once for every output file. Most of the time this works, but runs into very strange concurrency issues when the two rules happen to run at the same time. a: touch a b Only define one of the files in the graph. Then users need to depend on a file that they don't use, and the unlisted file won't be noticed if it's updated separately (or even removed). b: a a: touch a b Define dependencies between the multiple files. This doesn't actually know how to update `b` if `b` is older than `a`, or doesn't exist. b: a touch b a: touch a b A variant of the previous approach, which can "fix" the timestamp if the original rule happened to create `b` before `a`. This can be even more dangerous, since it may create / update `b` improperly. But since ninja supports a graph where there can be multiple outputs from a single edge, with this patch we can write: a: .KATI_IMPLICIT_OUTPUTS := b a: touch a b which translates to: rule rule1 command = touch a b build a | b: rule1 This ninja will allow users to depend on either `a` or `b`, and the rule will be run (once) as appropriate. Change-Id: Ieb9ced7eb4d212b0aa4de5ceb1deb9ba48ada132
* Add --werror_find_emulator, --werror_overriding_commandsDan Willemsen2017-05-221-6/+12
| | | | | | | | | | | | | | | | | | | For Android builds, we'd like to start removing some of the default warnings and turn them into errors so that they can't come back. For find emulator, we could attempt to check for errors, or silence every find command in the tree, but that doesn't particularly scale, especially when new code gets added with warnings. We've gone through and fixed many of these, but they keep coming back, so add --werror_find_emulator so that when we fix them all we can prevent them from coming back. Overriding commands is similar -- we really don't want multiple rules defining a single output file. In ninja we've turned on -w dupbuild=err, but if the paths happen to be identical the makefile overriding logic kicks in first and presents a warning instead of an error. So add --werror_overriding_commands in order to turn the make warning into an error.
* Add --color_warnings to make warnings/errors like clangDan Willemsen2017-02-221-9/+10
| | | | | | | | | | This adds new (WARN|KATI_WARN|ERROR)_LOC log macro variants that take a location as the first argument, and will prefix that location information to the warning/error lines. When --color_warnings is enabled, it reformats them to have a standard warning:/error: infix, and adds colors in order to match the warnings/errors produced by clang.
* Allow rules to specify custom ninja poolsDan Willemsen2016-11-051-1/+6
| | | | | | | | Setting .KATI_NINJA_POOL as a rule variable will set the corresponding pool variable in the ninja file. There's no way to define custom pools in Kati, Android is planning on scaling the pool depth in a parent ninja file without re-running Kati.
* Fix some possible performance issues found by clang-tidyDan Willemsen2016-11-011-1/+1
| | | | | No obvious time differences when building AOSP, but these all seem like reasonable changes.
* [C++] Add -d flag to make debugging slightly easierShinichiro Hamaji2016-05-121-0/+2
|
* [C++] Handle .POSIX at eval timeShinichiro Hamaji2016-04-271-4/+0
| | | | | .POSIX pseudo target should change the behavior of $(shell). This also implements .POSIX for ckati's non-ninja mode.
* [C++] Add support for .POSIX:Stefan Becker2016-04-121-1/+5
| | | | | | | | | | Add a global flag that is set to "true" when .POSIX: is encountered. The flag will switch the bash flags from "-c" to "-ec", i.e. enable correct error handling of shell command lines. Fixes https://github.com/google/kati/issues/48 Change-Id: Ieea386742b05b52d209b74e640e14212f0e2da88
* [C++] Associate global variables with Symbols directlyShinichiro Hamaji2016-02-221-1/+2
|
* [C++] Refactor DepBuilderShinichiro Hamaji2016-02-191-166/+168
| | | | | | After this patch, multiple Rule objects won't be merged to a single rule. Instead, DepBuilder holds the list of Rules and directly write merged results to DepNode.
* [C++] Remove Rule::is_default_targetShinichiro Hamaji2016-02-191-5/+1
|
* [C++] Refactor handling of special targetsShinichiro Hamaji2016-02-191-17/+31
|
* [C++] Change the type of DepBuilder::first_rule_Shinichiro Hamaji2016-02-191-7/+6
|
* [C++] Use emplace instead of insert+make_pairShinichiro Hamaji2016-02-171-1/+1
|
* [C++] Fix last_resort.mkShinichiro Hamaji2016-02-161-2/+2
|
* [C++] Ignore suppression rules for RCS/SCCS related rulesShinichiro Hamaji2016-02-161-1/+16
| | | | Kati doesn't have default rules for them.
* dep statsShinichiro Hamaji2016-02-161-0/+7
|
* [C++] Stop using shared_ptr in evalShinichiro Hamaji2016-02-081-8/+8
|
* [C++] Handle multiple implicit patterns properlyShinichiro Hamaji2016-02-021-27/+49
| | | | | When there are multiple implicit patterns in a rule, recipe should be used only once.
* [C++] Fix a minor typoShinichiro Hamaji2016-02-011-2/+2
|
* [C++] Fix target specific variables in implicit rulesShinichiro Hamaji2016-01-261-5/+3
|
* [C++] Introduce .KATI_DEPFILE againShinichiro Hamaji2016-01-201-2/+10
| | | | | Unlike other target specific variables, this variable must not be propagated to other targets.
* [C++] Warn about unsupported builtin targetsShinichiro Hamaji2015-11-301-0/+23
|
* [C++] Add a minimal support for .SUFFIXESShinichiro Hamaji2015-11-301-0/+9
| | | | Only disabling all suffix rules is supported.
* [C++] Remove gen_all_phony_targets flagShinichiro Hamaji2015-11-091-4/+0
|
* [C++] Fix target specific variables with --gen_all_targetsShinichiro Hamaji2015-10-031-3/+15
| | | | | | | --gen_all_targets started traversing the dependency graph from random node. This may prevent target specific variables in parents from being applied. With this patch, we always traverse the graph from nodes without parents.
* [C++] Always set is_default_targetShinichiro Hamaji2015-10-031-2/+4
|
* Merge branch 'ordering' of git://github.com/danw/kati into danw-orderingShinichiro Hamaji2015-10-031-1/+2
|\ | | | | | | | | Conflicts: dep.cc
| * Use ordered containers to prevent changes to ninja filesDan Willemsen2015-10-011-2/+4
| | | | | | | | | | | | | | | | When using --gen_all_targets / --gen_all_phony_targets, we're changing the selected targets using unordered containers. This causes trivial changes to the makefiles to trigger large changes to the generated ninja files. Switch to using ordered containers so that the order is the same every time.
* | [C++] Add .KATI_RESTAT builtin targetShinichiro Hamaji2015-10-021-3/+13
|/ | | | | | | | | | | | | | This is an experimental kati-specific expansion for GNU make. Targets specified by this will have "restat = 1" in generated ninja files. Even with this change, kati should be still compatible with GNU make. GNU make will ignore this but this only means GNU make will do some extra unnecessary builds. This different should not change the final output as long as .KATI_RESTAT is used appropriately. TODO: Implement the same feature in exec.cc and add a test.
* [C++] Do not have multiple default statements in a ninja fileShinichiro Hamaji2015-10-011-2/+1
| | | | | We have the first target as default only when --gen_all_targets or --gen_all_phony_targets.
* Add support for default targets in ninja outputColin Cross2015-09-291-5/+9
| | | | | | | | | make treats the first target it sees as the default target if no goals are passed on the commmand line. When generating a ninja file, mark this target with "default" to make it build if no goals are passed to ninja. Change-Id: I11befa4f88b8ca8734fdc7dd470c2a0a3722410d
* [C++] Add --gen_all_targets flagShinichiro Hamaji2015-09-281-0/+4
|
* [C++] Fix merge of rules with output patternsShinichiro Hamaji2015-09-271-31/+51
|
* [C++] Unconditonally checks --generate_all_phony_targetsShinichiro Hamaji2015-09-241-5/+4
| | | | | This flag should work even with targets specified in a command line.
* [C++] Correct the implementation of $*Shinichiro Hamaji2015-09-111-1/+7
|
* [C++] A global refactoring for command line flagsShinichiro Hamaji2015-09-091-1/+1
| | | | So we will be able to use the command line parser for sub-makes.
* Add --gen_all_phony_targets flagShinichiro Hamaji2015-09-021-0/+5
| | | | | Let me keep this flag for a while, as there would be some people who are still using m2n+ninja.sh workflow.
* [C++] Fix ckati with no arguments building all phony targetsDan Willemsen2015-08-311-2/+0
| | | | | | | | Only the first rule should be built if no targets are in the arguments. This wasn't a problem for ninja, since the target was again passed to ninja. Change-Id: Ia5381b89411fcc9b164c83de5faee46029897423
* [C++] Fix warnings for clangShinichiro Hamaji2015-08-171-2/+1
|
* [C++] Stop using shared_ptr<string> in SimpleVarShinichiro Hamaji2015-08-141-1/+1
|
* [C++] Have all phony targets in build.ninjaShinichiro Hamaji2015-07-161-0/+3
| | | | | Also specify the default target not to build all phony targets by default.
* [C++] Order only should not be an attribute of nodeShinichiro Hamaji2015-07-061-3/+1
| | | | Also add order_only2.mk
* [C++] Suppress warningsShinichiro Hamaji2015-07-031-1/+1
|
* [C++] Introduce SymbolShinichiro Hamaji2015-06-291-51/+53
|
* [C++] Implement .PHONYShinichiro Hamaji2015-06-291-0/+7
|
* [C++] Fix implicit_pattern_rule_prefix.mkShinichiro Hamaji2015-06-291-1/+7
|
* [C++] Use trie to pickfind implicit rulesShinichiro Hamaji2015-06-291-7/+62
| | | | 28.0 secs => 1.8 secs
* [C++] Show numbers in DepBuilderShinichiro Hamaji2015-06-291-0/+4
|