| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If we've found all possible files in a leaf directory, we don't need to
re-run findleaves every time the leaf directory's timestamp changes, we
just need to make sure the file(s) that we found still exist. This
saves a few seconds every time an atomic write is done in a source
directory next to an Android.mk file. (Atomic writes use renames, so
they always change the directory's timestamp)
With the last commit that finds out/Android.mk and out/CleanSpec.mk, it
turns out that the output directory's timestamp was changing every
build, causing the global Android.mk & CleanSpec.mk findleaves.py
command to be executed every regen check.
TEST_FIND_EMULATOR still passes after this change.
|
|\
| |
| | |
Implement the `file` function to read and write files
|
| |
| |
| |
| |
| |
| |
| | |
This allows us to do file reading and writing without $(shell). Besides
being simpler, this also allows faster regen times, since we can just
stat the files to be read, or directly write to the files that need to
be written.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For every $(shell echo "test: $PATH") command, when SHELL is /bin/bash,
we essentially run: (each arg wrapped in [])
[/bin/sh] [-c] [/bin/bash -c "echo \"test: \$PATH\""]
This is redundant, since we can just use SHELL, and then we don't need
to do an extra level of shell escaping either. This change makes us run
this instead:
[/bin/bash] [-c] [echo "test: $PATH"]
If SHELL is more complicated than an absolute path to a binary, then
we'll fall back to /bin/sh.
Using the benchmark introduced in the last change, this reduces a
minimal RunCommand execution with a simple SHELL from 3.7ms to 1.3ms.
For a more complex benchmark (though less normalized), for an AOSP
Android build, this change shrinks the average time spent in $(shell)
functions from 4.5ms to 3ms.
Change-Id: I622116e33565e58bb123ee9e9bdd302616a6609c
|
|
|
|
|
| |
These aren't meant to be called directly, so there's no point putting
them in the ninja file.
|
| |
|
| |
|
|
|
|
|
| |
.POSIX pseudo target should change the behavior of $(shell).
This also implements .POSIX for ckati's non-ninja mode.
|
|
|
|
|
|
|
|
|
|
|
| |
$(shell ...) command lines are executed using $(SHELL). We need to use
the same shell during regeneration check instead of hard-coding /bin/sh
or otherwise the results might be different when $(SHELL) is redefined
in the makefile.
Fixes https://github.com/google/kati/issues/53
Change-Id: I1f9809106f29f7e806324a82e2323a2f8df64b63
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
| |
instead of after an open paren.
|
| |
|
| |
|
| |
|
|
|
|
| |
This makes generation time ~5% faster.
|
|
|
|
|
| |
It seems we can use it even for -static build with
-Wl,--whole-archive -lpthread -Wl,--no-whole-archive -ldl
|
|
|
|
| |
No one uses this.
|
| |
|
| |
|
|
|
|
|
| |
libc++'s sstream indirectly includes mutex, which conflicts
with ours.
|
|
|
|
|
| |
Sticking to a single processor improves the performance while
we are running only a single thread.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Ninja automatically creates the necessary output directories.
This also fixes the logic to remove the empty '(true) &&' that was added
for echo -> description detection.
|
| |
|
|
|
|
|
| |
Unlike other target specific variables, this variable must
not be propagated to other targets.
|
|
|
|
| |
This reverts commit bee26c1a805c45cdbf2372e17a09766ecd02579f.
|
|
|
|
|
| |
If this variable is specified for a target, the target in
output ninja file will have depfile attribute.
|
|
|
|
| |
For issue #39.
|
| |
|
|
|
|
| |
This is a temporary workaround. See TODO for detail.
|
| |
|
|
|
|
|
|
|
|
| |
Android needs to ignore dirty files under out/ when deciding to rebuild,
except for the soong-generated out/Android.mk. Add a --no_ignore_dirty
flag to override the pattern provided in --ignore_dirty.
Change-Id: I8810963f4dff07b51187868c7afedb10c6a4cb2e
|
|
|
|
|
|
|
|
| |
Separate the environment variables out of the ninja shell script so that
the caller can source the environment script and then manually call
ninja.
Change-Id: If977a8316dceae955d71c32d528232d8b3f3aeef
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
We have the first target as default only when --gen_all_targets
or --gen_all_phony_targets.
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Otherwise, build.ninja generated with --gen_all_(phony_|)targets
runs unnecessary build targets if no target is specified.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is possible to get a mismatch between the .kati_stamp file and the
build.ninja file by exiting due to error or interrupt after the ninja
file is written but before the stamp file is written. If the change
that caused the previous stamp file verification to fail are then
reverted, for example an environment variable set back to what it was in
the stamp file, the next run of kati could see the old stamp file and
not rewrite the non-matching ninja file.
To avoid stamp and ninja file mismatches, delete the old stamp file just
before starting to write any new files. To avoid a partially written
stamp file write the stamp file to .kati_stamp.tmp, and then atomically
rename it to .kati_stamp.
Change-Id: Id5c7d7ab2b7f051a430ebbf919b8535b219ca290
|