Commit graph

31 commits

Author SHA1 Message Date
Colin Cross
8f9f01bbc3 Revert "Have all targets in build.ninja"
--gen_all_targets seems to be dropping some intermediate targets,
causing problems when kati is passed a goal and then ninja is run with
checkbuild as a goal, for example with:
m -j PRODUCT-aosp_flounder-userdebug checkbuild

This reverts commit 92bbf5667d.

Change-Id: If34a790028f8da98fcc713e3f7000d06c63dcf80
2015-09-29 14:21:24 -07:00
Colin Cross
52b697a488 Revert "Pass all goals to kati when "dist" is in goals"
This isn't actually necessary, dist doesn't use MAKEDISTGOALS other than
to check if it contains any other real targets.  The real issue is
caused by --gen_all_targets, and is broader than just "dist".

This reverts commit d3701e9e96.

Change-Id: Iaea1f158dbd1d4b9035954efef40b33485e6c6b3
2015-09-29 14:20:28 -07:00
Colin Cross
02d04b4ddc Merge "Pass all goals to kati when "dist" is in goals" 2015-09-29 17:09:03 +00:00
Shinichiro Hamaji
d3701e9e96 Pass all goals to kati when "dist" is in goals
Bug: 24339367
Change-Id: Iee80d65fe169ec005900a96446aa7a432fc68872
2015-09-29 15:52:58 +09:00
Shinichiro Hamaji
92bbf5667d Have all targets in build.ninja
We should pass --gen_all_targets instead of --gen_all_phony_targets
to have targets which are not declared as .PHONY.

Bug: 24384320
Change-Id: I616d8c74e6efd9d69b1a935cfc5116b716f100ff
2015-09-29 14:18:59 +09:00
Shinichiro Hamaji
8b08f3a864 Reland: Only put PARSE_TIME_MAKE_GOALS into KATI_TARGETS
Only goals that modify the parsing need to be passed to kati, filter out
everything else and only pass it to ninja.

Also, always specify --gen_all_phony_targets. With this flag, kati emits
all phony targets in the ninja file so a ninja file generated only with
PARSE_TIME_MAKE_GOALS can handle targets which don't change the parsing.

This is a reland attempt of
https://android-review.googlesource.com/#/c/172800/

The two issues should have been fixed by Ying in internal trees.

Bug: 24339367
Change-Id: I8ba2254f9bff271da2a7aa7684fd3d987e07c9d3
2015-09-28 16:03:21 -07:00
Colin Cross
fe5e6894d2 Set BUILDING_WITH_NINJA flag when parsing makefiles for ninja build
Distinguish between parsing makefiles in make for a pre-ninja build,
parsing makefiles in kati for a ninja build, and parsing makefiles in
make for a non-ninja build by leaving USE_NINJA=true enabled for the
kati pass but also setting BUILDING_WITH_NINJA.

Change-Id: I63f1ce1efe08cd86fdf41f8051901f720b38cfaf
2015-09-28 15:36:05 -07:00
Colin Cross
c53d6b90b3 Remove checkbuild and test from parse time goals
The tests goal is not a parse time goal.

The checkbuild goal is only a parse time goal so that it doesn't result
in a circular dependency between droid and checkbuild when
ANDROID_BUILD_EVERYTHING_BY_DEFAULT is set.  Get rid of the circular
dependency by making droid depend on droid_targets, and droid_targets
depend on the targets that are normally built for droid.  checkbuild can
then always depend on droid_targets, and droid can condtionally depend
on checkbuild without introducing a circular dependency.

Bug: 24413153
Change-Id: I231d80e05ffe321384a5efbcdf5578f86ad84da0
2015-09-25 16:43:36 -07:00
Shinichiro Hamaji
5ff665d407 Revert "Only put PARSE_TIME_MAKE_GOALS into KATI_TARGETS"
This reverts commit cb31f040e3.

This could be the cause of an internal build breakage.

Change-Id: Ic5d2a2ce1f2d214a8201db5c570682d8336763b9
2015-09-25 14:21:37 +09:00
Shinichiro Hamaji
cb31f040e3 Only put PARSE_TIME_MAKE_GOALS into KATI_TARGETS
Only goals that modify the parsing need to be passed to kati, filter out
everything else and only pass it to ninja.

Also, always specify --gen_all_phony_targets. With this flag, kati emits
all phony targets in the ninja file so a ninja file generated only with
PARSE_TIME_MAKE_GOALS can handle targets which don't change the parsing.

Bug: 24339367
Change-Id: I63237160c3c86817b53635665d56906790ec4e6a
2015-09-25 13:49:46 +09:00
Shinichiro Hamaji
3c524993c7 Merge "Make it possible to change the number of remote jobs" 2015-09-25 04:34:37 +00:00
Ying Wang
ce2843f455 The pattern %tests is too broad.
We had fixed the filtering of %tests in art/Android.mk.
Actually the %tests leads to false build<suffix>.ninja when you run:
$ mmma cts/tests/tests/nativeopengl/libnativeopengltests
because the new mmma calls make with goals like
MODULES-IN/cts/tests/tests/nativeopengl/libnativeopengltests .

Bug: 24309760
Change-Id: I35af2e8d046ae40f3b90ec0a92473fcab8ff5db5
2015-09-24 11:34:46 -07:00
Shinichiro Hamaji
c1cba69970 Make it possible to change the number of remote jobs
User can overwrite NINJA_REMOTE_NUM_JOBS for this purpose. The
number is passed to ninja instead of to kati so no we don't
need to regenerate a ninja file when a user changes this value.

Change-Id: I2ccfaaae4492d84a8b8045dff612cb5f6ebe2c79
2015-09-24 16:22:44 +09:00
Dan Willemsen
3ad3549519 Don't add CFLAGS to CPPFLAGS
Except for kati, we never use COMMON_GLOBAL_CPPFLAGS without also using
COMMON_GLOBAL_CFLAGS, which leads to duplicate command line entries.

Change-Id: I25d625924e9d157175a9e88bc3f15b7214cfb4ed
2015-09-23 16:23:02 -07:00
Colin Cross
87e0e8a764 Merge "Revert "Only put PARSE_TIME_MAKE_GOALS into KATI_TARGETS"" 2015-09-23 21:53:08 +00:00
Colin Cross
84a8ca3173 Revert "Only put PARSE_TIME_MAKE_GOALS into KATI_TARGETS"
If there are any goals on the command line, kati hides targets that are
not dependencies of those goals.  Revert this until kati is modified to
include all targets.

This reverts commit b71d24931c.

Bug: 24339367
Change-Id: I7c3a950aef8efc9a0eb72bd29ee07710d2faca99
2015-09-23 21:49:27 +00:00
Colin Cross
f8579330a5 Merge "Only put PARSE_TIME_MAKE_GOALS into KATI_TARGETS" 2015-09-23 20:54:16 +00:00
Ying Wang
127da9e4aa Use md5sum as the build.ninja filename suffix if the suffix gets too long.
Use md5sum as the build.ninja filename suffix if the suffix is longer
than 64 characters. Also store the original suffix in a corresponding
.suf file for human lookup.
This fixes the "File name too long" error when kati tries to write to
build.ninja with the long original suffix.

Bug: 24302576
Change-Id: Ie04b0c14e1a9d593aa5c2a6b357b19a9e8a7158e
2015-09-22 16:16:12 -07:00
Colin Cross
b71d24931c Only put PARSE_TIME_MAKE_GOALS into KATI_TARGETS
Only goals that modify the parsing need to be passed to kati, filter out
everything else and only pass it to ninja.

Change-Id: I28788a3409d601fe838749bcf15394bc8f3d775b
2015-09-22 14:24:00 -07:00
Colin Cross
af6c071a5f Pass --ninja to makeparallel for ninja
When parallelism is being handled by ninja, pass --ninja to makeparallel
to have it translate -j with no number to default ninja parallelism, and
-k to -k0.

Bug: 24199503
Change-Id: Ic1be7572f93b33e4a71ed23e9e73dea1d4255703
2015-09-18 15:02:40 -07:00
Dan Willemsen
b384eb84c3 Merge "kati: Handle MAKECMDGOALS modifications" 2015-09-15 00:28:42 +00:00
Dan Willemsen
cb1bd116ed kati: Handle MAKECMDGOALS modifications
For some special targets (PRODUCT-%), the MAKECMDGOALS variable is
modified. Before this change, using one would result in a "no rule to
make target" error, since the new target was not stubbed out.

Change-Id: I879642a48b84a66789d4bdb7db1b6fd1130819b7
2015-09-14 16:30:51 -07:00
Colin Cross
f7ca64faa0 Use makeparallel to propagate -j flag to ninja or kati
When USE_NINJA=true is set, use makeparallel to claim all jobs from make and
pass them to ninja with -j.  If USE_GOMA is set, pass the -j flag to
kati instead so the parallelism can be set in the local_pool instead.

Change-Id: I6e4f957c65683b74533ecb6d33e25de858922823
2015-09-14 14:41:00 -07:00
Shinichiro Hamaji
d762bcae25 Use the same build.ninja for normal make targets
$(PARSE_TIME_MAKE_GOALS) is a list of known goals which affect
parsing of make (e.g., there is $(filter XXX,$(MAKECMDGOALS))).
If the make targets contain one of them, we keep using a
different build.ninja for each combination of make targets.
Otherwise, we use the same build.ninja which has all phony
targets.

Also load vendor/google/build/ninja_config.mk so it can add
Google-specific goals to $(PARSE_TIME_MAKE_GOALS).

Bug: 23685536
Change-Id: I3da5c76fa7644a05a55c374a754212f4fb794818
2015-09-09 15:48:10 +09:00
Shinichiro Hamaji
909e7f40ae Use $(BUILD_MODULES_IN_PATHS) as a part of ninja suffix
So that switching between two different mmma targets won't
need regenerating ninja files.

Change-Id: Ifddd75ec49abd3ab2a54c6afbb902b0b32359db8
2015-09-05 09:00:19 +09:00
Shinichiro Hamaji
bfd01872cb Set --ninja_suffix based on make/mm/mmm targets
This fixes two issues:

- Switching make target didn't work well when the latter
  make target is not a subset of the first make target.
- Switching between m and mm/mmm forced build.ninja to be
  regenerated.

Bug: 23685536

Change-Id: I3c3550d6cca3007d166a13367d6bc22cc3feede2
2015-09-02 07:37:39 +09:00
Shinichiro Hamaji
ee482fd521 Use goma when USE_GOMA=true is set
With USE_GOMA, the path to gomacc in $GOMA_DIR or $HOME/goma
will be appended to CC_WRAPPER and CXX_WRAPPER.

Note this works only with USE_NINJA. Unlike ninja, GNU make
cannot change the parallelism depending on targets. Specifying
-j500 to GNU make would mean you may run 500 local jobs in
parallel, but with -j32 goma will just slow down the build.

Change-Id: I0f571454fd2a5b525ee29b445f7ab8715927ca00
2015-08-20 14:33:44 +09:00
Shinichiro Hamaji
5b6b6bb974 Add two flags for the latest ckati
* --regen

Re-generate build.ninja only when necessary. If either

1. .mk file is updated,
2. environment variable is updated,
3. $(wildcard) result is changed, or
4. $(shell) result is changed,

ckati will regenerate ninja file. This check takes only ~1
second, so incremental build will become much faster even
without "fastincremental" target.

* --ignore_dirty=out/%:

Some .mk files in out/ (e.g.,
out/target/product/generic/previous_build_config.mk)
are updated while ckati is running. With this flag, ckati
does not regenerate build.ninja when they look modified.
This should be OK for ninja based build, as ninja handles
command line changes nicely.

Change-Id: I7a2fca0e327d999599d6b16f06358e8a5e657565
2015-08-17 20:20:20 +09:00
Ying Wang
0a0e6eae3f Build static ckati on Linux.
Bug: 22798670
Change-Id: I3aaf127627c1c478ab3af2549e49506d4d1f19df
2015-08-04 12:23:27 -07:00
Ying Wang
bb1da5e614 Use unmodified MAKECMDGOALS in ninja.mk.
The build system removes targets like "PRODUCT-full-eng" from
MAKECMDGOALS in build/core/product_config.mk.
Without this change, such target isn't passed to kati.

Change-Id: I0b3949ed1f5557445d7f5d5bd59b7875c0b2ea7f
2015-07-29 12:21:54 -07:00
Colin Cross
3b324cb32e Build with kati+ninja when USE_NINJA=true
If USE_NINJA=true, use kati to translate makefiles into ninja files,
and then execute them with ninja.

Builds kati from source using simplified versions of the rules
in binary.mk and definitions.mk.

Adds two new goals when USE_NINJA=true: generateonly will regenerate
build.ninja but not rebuild (useful for comparing build.ninja output
between runs), and fastincremental will skip regenerating build.ninja
and go directly to running ninja, providing ~5 second incremental
builds.

Change-Id: Ib85399e730f1fbb1be7371fafeee7d1c31080771
2015-07-23 17:29:01 -07:00