Optimize findleaves regen check

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.
4 files changed
tree: e745c148c010fee46253f57056ceefb7820751d4
  1. cmd/
  2. make-c/
  3. testcase/
  4. .gitignore
  5. .travis.yml
  6. affinity.cc
  7. affinity.h
  8. Android.bp
  9. ast.go
  10. AUTHORS
  11. bootstrap.go
  12. buf.go
  13. buf_test.go
  14. command.cc
  15. command.h
  16. CONTRIBUTING.md
  17. CONTRIBUTORS
  18. dep.cc
  19. dep.go
  20. dep.h
  21. depgraph.go
  22. doc.go
  23. eval.cc
  24. eval.go
  25. eval.h
  26. evalcmd.go
  27. exec.cc
  28. exec.go
  29. exec.h
  30. expr.cc
  31. expr.go
  32. expr.h
  33. expr_test.go
  34. file.cc
  35. file.h
  36. file_cache.cc
  37. file_cache.h
  38. fileutil.cc
  39. fileutil.go
  40. fileutil.h
  41. fileutil_bench.cc
  42. find.cc
  43. find.h
  44. find_test.cc
  45. flags.cc
  46. flags.go
  47. flags.h
  48. func.cc
  49. func.go
  50. func.h
  51. func_test.go
  52. INTERNALS.md
  53. io.cc
  54. io.h
  55. LICENSE
  56. loc.h
  57. log.cc
  58. log.go
  59. log.h
  60. m2n
  61. main.cc
  62. make-c.sh
  63. Makefile
  64. Makefile.ckati
  65. Makefile.kati
  66. ninja.cc
  67. ninja.go
  68. ninja.h
  69. ninja_test.cc
  70. ninja_test.go
  71. pack.sh
  72. parser.cc
  73. parser.go
  74. parser.h
  75. pathutil.go
  76. pathutil_test.go
  77. query.go
  78. README.md
  79. regen.cc
  80. regen.h
  81. regen_dump.cc
  82. rule.cc
  83. rule.h
  84. rule_parser.go
  85. rule_parser_test.go
  86. runtest.rb
  87. serialize.go
  88. shellutil.go
  89. shellutil_test.go
  90. stats.cc
  91. stats.go
  92. stats.h
  93. stmt.cc
  94. stmt.h
  95. string_piece.cc
  96. string_piece.h
  97. string_piece_test.cc
  98. stringprintf.cc
  99. stringprintf.h
  100. strutil.cc
  101. strutil.go
  102. strutil.h
  103. strutil_bench.cc
  104. strutil_test.cc
  105. strutil_test.go
  106. symtab.cc
  107. symtab.go
  108. symtab.h
  109. testutil.h
  110. thread_local.h
  111. thread_pool.cc
  112. thread_pool.h
  113. timeutil.cc
  114. timeutil.h
  115. var.cc
  116. var.go
  117. var.h
  118. version.go
  119. version.h
  120. version_unknown.cc
  121. worker.go
README.md

kati

Build Status

kati is an experimental GNU make clone. The main goal of this tool is to speed-up incremental build of Android.

Currently, kati does not offer a faster build by itself. It instead converts your Makefile to a ninja file.

How to use for Android

Now AOSP has kati and ninja, so all you have to do is

% export USE_NINJA=true

All Android's build commands (m, mmm, mmma, etc.) should just work.

How to use for Android (deprecated way)

Set up kati:

% cd ~/src
% git clone https://github.com/google/kati
% cd kati
% make

Build Android:

% cd <android-directory>
% source build/envsetup.sh
% lunch <your-choice>
% ~/src/kati/m2n --kati_stats  # Use --goma if you are a Googler.
% ./ninja.sh

You need ninja in your $PATH.

More usage examples (deprecated way)

"make clean"

% ./ninja.sh -t clean

Note ./ninja.sh passes all parameters to ninja.

Build a specific target

For example, the following is equivalent to "make cts":

% ./ninja.sh cts

Or, if you know the path you want, you can do:

% ./ninja.sh out/host/linux-x86/bin/adb