Commit graph

459 commits

Author SHA1 Message Date
Yo Chiang
15fbad3dfa Merge "Don't call $(my_path_comp) if $(dir $(LOCAL_PATH)) is TOP" 2020-08-12 03:55:57 +00:00
Yo Chiang
b5bbe4bca0 Merge "Revert "Error if $(LOCAL_PATH) is empty"" 2020-08-11 10:21:24 +00:00
Yo Chiang
e01766433a Revert "Error if $(LOCAL_PATH) is empty"
This reverts commit 60052f3a9f.

Reason for revert: Breaks build_test

Bug: 163473133
Change-Id: Ib5a8030f7b49b131f912e2df8026d3e2107c87a4
2020-08-11 10:19:32 +00:00
Yo Chiang
cbdfc3a5ed Merge "Error if $(LOCAL_PATH) is empty" 2020-08-11 07:58:57 +00:00
Yo Chiang
60052f3a9f Error if $(LOCAL_PATH) is empty
Bug: 162918277
Test: m com.android.art
Test: m MODULES-IN-art
Change-Id: I7c35dba22385e89313ea7210e9b1db15c7f6af86
2020-08-11 11:23:08 +08:00
Yo Chiang
150a1ca0c2 Don't call $(my_path_comp) if $(dir $(LOCAL_PATH)) is TOP
So we don't accidentally create phony rules like
`MODULES-IN-: MODULES-IN-` and `MODULES-IN-.: MODULES-IN-*`

Bug: 162918277
Test: m com.android.art
Test: ninja -t browse
Change-Id: Id0656d1b08bc933df57914df162853934352593b
2020-08-11 11:22:36 +08:00
Inseob Kim
ce83956fa9 Fix broken my_image_variant
It should happen after adjusting vendor and product variables.

Bug: 162476652
Test: see image variant with LOCAL_PROPRIETARY_MODULE := true
Change-Id: I071434916c9ad18572c559a26e3ef6abb8c47303
2020-08-10 13:04:23 +09:00
Inseob Kim
8b0ccdafbb Separate lists of soong sanitize modules
Dependencies of makefile modules are being redirected according to
SOONG_CFI_STATIC_LIBRARIES and SOONG_HWASAN_STATIC_LIBRARIES. But the
variables are shared among all variants (e.g. core, vendor, product,
arch), which can cause build error.

This splits the Makefile variables into several lists, one list per each
arch and each image variant, to correctly make the redirection.

Bug: 162476652
Test: build and inspect ninja
Change-Id: I8a46804d4b7c1c485e59e10710cc514a89333fa4
2020-08-04 17:18:01 +09:00
Chris Parsons
1abe7ef455 Add optional relative path to LOCAL_TEST_DATA processing
Test: Verified in conjunction with changes to soong (aosp/1359742)
Test: Treehugger to verify backwards compatibility
Change-Id: I39d2669ff74b4387606b6416e8afefc1f6507348
2020-07-17 17:09:21 -04:00
Dan Willemsen
343caec30c Refactor how MODULES-IN-* is defined
Unlike the previous performance patches, this does change the ninja
file, shrinking build-aosp_crosshatch.ninja on aosp-master from 393MB to
387MB, while reducing kati runtime from 28.6s to 27.7s.

Previously, MODULES-IN-art would depend on every target defined under
art/***. After this change, it only depends on the modules names that
were directly defined under it, and depends on the MODULES-IN-art-*
for its subfolders.

Bug: 158488548
Test: mmma system/core/adb
Test: mmma system/core
Change-Id: Idfe80f707738faae4777e0d6dc9fd08014775696
2020-06-16 15:35:37 -07:00
Dan Willemsen
8447b8116a base_rules.mk optimizations
A few more misc improvements that I found while analyzing the
performance of base_rules.mk.

This brings an aosp-master/aosp_crosshatch-userdebug kati run from 33.3s
to 28.6s

Bug: 158488548
Test: build-aosp_crosshatch.ninja is the same before/after
Change-Id: If99c31cc7b5d7133d70eb644c6095f19060b71e5
2020-06-09 09:59:24 -07:00
Dan Willemsen
c5ec8e95bc Rewrite test data logic to make it faster
It turns out we have a few tests with thousands of test data files,
which this logic does not handle very well. Just switching from `x :=
$(x) ...` to `x += ...` accomplishes the majority of these gains, but I
rewrote the logic to be less function-call+eval based to hopefully make
it easier to understand.

For an aosp-master/aosp_coral-eng build, this brings the time spent in
this logic from 7.6s to 0.3s (total kati runtime of 54s to 46s). Kati's
peak memory use (maxrss) also shrunk from 6.1GB to 3.8GB.

Bug: 158488548
Test: build-aosp_coral.ninja is the same before/after
Change-Id: Ia2ec8b29b5c1dd12fa7ea10b4f80fe802c692725
2020-06-08 11:42:51 -07:00
Sasha Smundak
f15ff83b07 Editorial: fix indentation
Test: treehugger
Change-Id: Ie461f7244c52c0ea5f463409290901c16e424636
2020-05-06 13:46:30 -07:00
Treehugger Robot
dcdd0db41a Merge "Reland "mark platform un-availability""" 2020-05-06 12:28:02 +00:00
Jiyong Park
403c255b6f Reland "mark platform un-availability""
This reverts commit 6e1fa4452b.

Reason for revert: relanding a reverted changed

Bug: 153073816
Change-Id: I3735866776cf6eb0320c9fb8c6be8ac0c48baa1c
Test: m
2020-05-04 11:12:00 +00:00
Jiyong Park
af4c62f78a Merge "Revert "mark platform un-availability"" 2020-05-04 10:58:24 +00:00
Jiyong Park
6e1fa4452b Revert "mark platform un-availability"
This reverts commit f9e67a8980.

Reason for revert: broke some targets

Exempt-From-Owner-Approval: reverting

Change-Id: I10af29b0fcf564dba0c3dbc1951b660b24fc58bb
2020-05-04 10:57:26 +00:00
Jiyong Park
8023018b0c Merge "mark platform un-availability" 2020-05-04 10:10:24 +00:00
Bill Peckham
a2c63454a6 Allow recording ALL_DEPS by setting RECORD_ALL_DEPS
This change enables recording ALL_DEPS information
without having to specify the deps-license goal, which
can be useful to populate the dependencies field of
module-info.json for various types of post-processing.

Usage: `RECORD_ALL_DEPS=true make droid` (preferred), or
`make RECORD_ALL_DEPS=true droid`.

Test: make, inspect module-info.json
Test: RECORD_ALL_DEPS=true make, inspect module-info.json
Bug: 151755703
Change-Id: Ib81a8dfb0ecbe0b63be320a9d33e558b419cb4b2
2020-04-27 18:28:10 +00:00
Jiyong Park
f9e67a8980 mark platform un-availability
A module is marked unavailable for platform when 1) it does not have
"//apex_available:platform" in its apex_available property, or 2)
it depends on another module that is unavailable for platform.

In that case, LOCAL_NOT_AVAILABLE_FOR_PLATFORM is set to true for the
module in the Make world. Later, that flag is used to ensure that there
is no module with the flag is installed to the device.

The reason why this isn't entirely done in Soong is because Soong
doesn't know if a module will be installed to the device or not. To
explain this, let's have an example.

cc_test { name: "mytest", static_libs: ["libfoo"]}
cc_library_static { name: "libfoo", static_libs: ["libbar"]}
cc_library { name: "libbar", apex_available: ["com.android.xxx"]}

Here, libbar is not available for platform, but is used by libfoo which
is available for platform (apex_available defaults to
"//apex_available:platform"). libfoo is again depended on by mytest
which again is available for platform. The use of libbar should be
allowed in the context of test; we don't want to make libbar available
to platform just for the dependency from test because it will allow
non-test uses of the library as well.

Soong by itself can't tell whether libfoo and libbar are used only in the
context of a test. There could be another module depending them, e.g.,

cc_library_shared { name: "mylib", static_libs: ["libfoo"] }

can exist and it might be installed to the device, in which case
we really should trigger an error.

Since Make has the knowledge of what's installed and what's not,
the check should be done there.

Bug: 153073816
Test: m

Change-Id: I14ddf0e5700d0a7bf60e4e41536efbd26ab5ed3d
2020-04-27 08:46:41 +09:00
Dan Willemsen
58634e1482 Remove AUX support
This was deprecated in R, which has now branched, and there aren't any
users on master.

Test: build-aosp_crosshatch.ninja is the same (except for the removal of the empty auxiliary target)
Test: treehugger
Change-Id: I306156ab7f91cd4a2258554b4215766c99cd12d1
2020-04-18 21:00:18 -07:00
Colin Cross
fca369e4e3 Don't install test suite files from uninstallable modules
Don't copy tests or test data to the test suite directories if the
module is marked LOCAL_UNINSTALLABLE_MODULE := true.

Fixes: 153758132
Test: m checkbuild
Change-Id: Ibdf18807a2ffe9bb352d74880a802ad55b57f154
2020-04-13 12:21:44 -07:00
Bill Peckham
19c3feb2d3 Build merged apexkeys.txt/apkcerts.txt by partition.
Propagate partition tag data to apexkeys.txt and
apkcerts.txt so that merge_target_files.py can build
merged versions of these files by filtering the
framework files for framework partitions and filtering
the vendor files for vendor partitions.

Bug: 138942268
Change-Id: Ic3226728e97dae84d38ec230ccc86d1b124bea94
2020-03-30 22:33:27 +00:00
Jaewoong Jung
b5aa16d44f Fix test suite data files issue.
The current test suite rule implementation has a bug where test data
files are excluded from the final suite zip files when a suite doesn't
have a designated testcases output directory, which is represented by
COMPATIBILITY_TESTCASES_OUT_$(suite_name).

Specifically, the rule that collects test data files for each suite
filters out suite output paths that conflict with module output paths,
which happens when a suite doesn't have its own testcases output
directory. It seems to have been done this way just to avoid make rule
conflict errors, but it ended up causing missing test data files.

This change fixes it by adding an indexing purpose only test suit file
variable.

Fixes: 140761783
Test: m general-tests
Test: Compared before vs after, no meaningful differences.
Test: Changed bc-tests to a device test and built general-tests.
Test: Before - data files missing, after - data files present
Change-Id: I2008992f4144c6ee115f4b4e4ac9caa4312bbe34
2020-03-19 06:47:35 -07:00
Justin Yun
2bfe0a1a25 Restore "Linktype check for native:product"
Similar to native:vendor, native:product can use VNDK libs but not
vndk_private.
It is activated when PRODUCT_PRODUCT_VNDK_VERSION is set.

This restores the reverted commit
4e7e76fe5a (aosp/1197274).
The problem of the original CL was assuming no modules have both
LOCAL_PRODUCT_MODULE and LOCAL_USE_VNDK in the old implementations.
But many vendor modules in the targets without setting
PRODUCT_PRODUCT_VNDK_VERSION in old branches had both flags that
caused link failures.
To make it no-op without PRODUCT_PRODUCT_VNDK_VERSION, I defined
LOCAL_USE_VNDK_PRODUCT that is set to true if
PRODUCT_PRODUCT_VNDK_VERSION is defined and LOCAL_PRODUCT_MODULE is
true.

Bug: 146620523
Test: build with PRODUCT_PRODUCT_VNDK_VERSION := current
Change-Id: I344c7dc1c47f08706c101e486ff07c3f10aff8ac
2020-01-22 00:16:25 +00:00
Justin Yun
dd5401713c Revert "Linktype check for native:product"
This reverts commit 4e7e76fe5a.

Reason for revert: build breaks (bid: 6147225) and postsubmit test fails.
There are some modules that have both "product_specific: true" and "vendor_available: true", which tags the module as "native:product" unintentionally.
We need to clean up these cases first and revisit this CL.

Bug: 146620523
Bug: 147987741
Change-Id: Ib07543235d72a135b6b732aaa909c147d2df832b
2020-01-20 07:39:41 +00:00
Justin Yun
4e7e76fe5a Linktype check for native:product
Similar to native:vendor, native:product can use VNDK libs but not
vndk_private.
It is activated when PRODUCT_PRODUCT_VNDK_VERSION is set.

Bug: 146620523
Test: build with PRODUCT_PRODUCT_VNDK_VERSION := current
Change-Id: Icfd94dfc30e77581991799d9e2f408f57da22cea
2020-01-19 23:46:47 +00:00
Jaewoong Jung
7c7dfcdf54 Enable overrides for ETC modules
Bug: 143975137
Test: TreeHugger
Change-Id: I8290d06726d8aabe265022cd84ec2ea97eff7acf
2019-11-06 14:08:59 -08:00
Treehugger Robot
30e613a48d Merge "Add backend for LOCAL_FUZZ_DATA for cc_fuzz corpus/dict." 2019-09-19 13:51:17 +00:00
Mitch Phillips
fd6d9022fe Add backend for LOCAL_FUZZ_DATA for cc_fuzz corpus/dict.
Adds the backend makefile parser for the LOCAL_FUZZ_DATA vars generated
by the cc_fuzz target.

Bug: 141026328
Test: m example_fuzzer, fuzz target should have adjacent corpus/dict
files.

Change-Id: Ide2c34318f11be132992650ce5cc1fd27895915c
2019-09-18 18:58:28 -07:00
Treehugger Robot
bd496d27ad Merge "Remove TARGET_TRANSLATE_2ND_ARCH" 2019-09-18 20:47:43 +00:00
Colin Cross
02b50d12be Remove TARGET_TRANSLATE_2ND_ARCH
TARGET_TRANSLATE_2ND_ARCH is never set to true any more,
TARGET_NATIVE_BRIDGE_ARCH := arm is always used instead.

Bug: 141242600
Test: m checkbuild
Change-Id: Id3e0614a1d8a088d37929655b74fecd812606db2
2019-09-18 16:23:04 +00:00
Jaewoong Jung
9f2e68009d Merge "Revert "Build: Fix test data no present in test suite zip files."" 2019-09-17 14:00:45 +00:00
Jaewoong Jung
5ea6971a1d Revert "Build: Fix test data no present in test suite zip files."
This reverts commit 068d101077.

Reason for revert: Caused a regression

Test: Added data to a sh_test and compared before vs after
Fixes: 140761783
Change-Id: Ied6427cb2dc3093fb88632eb8f337c2b76e86b95
2019-09-13 19:06:30 +00:00
Ivan Lozano
e9cb5fa350 Merge "Make support for rust modules from Soong." 2019-08-28 22:04:56 +00:00
Ivan Lozano
d62e7123d8 Make support for rust modules from Soong.
Support for rust modules built in Soong.

Bug: 136189233
Test: Test module builds.
Test: crosvm builds.
Change-Id: Idf2e4a4f760cbcee1d35fe6567ef8e12d4855094
2019-08-27 11:23:35 -07:00
Dan Willemsen
46a88893b1 More base_rules.mk optimizations
This saves another 5-15% of makefile eval time (depending on
target/branch).

I'm not sure if deps-license is still used at all, but we'll only save
the information for it if it's actually going to run now.

Since the default module tag is "optional", we really don't need to save
a list of most modules in another variable. I don't see anything that
really needs to see the list of optional modules.

Test: treehugger
Change-Id: Iaf54e9932fbe8e61f10bd0c9336fc4fdefea27ab
2019-08-27 00:49:31 -07:00
Dan Willemsen
2abf159f9b Improve performance (don't filter ALL_MODULES)
It turns out that this single line was responsible for 28-44% of the
time we spent parsing makefiles. So instead of filtering across
$(ALL_MODULES), check to see if a variable that we always would set is
set.

Test: treehugger
Test: check kati-build eval time before/after
Change-Id: I946c2efd060181a4ae9edd3409c53d9b49a58285
2019-08-26 23:25:17 -07:00
Bill Peckham
6733381fce Avoid adding VINTF manifest fragment more than once.
In the case of building a multilib library that defines LOCAL_VINTF_FRAGMENTS,
the previous code would create duplicate rules for the fragment. This change
uses the my_vintf_new_installed variable (which may be empty) to avoid the
duplication.

Bug: 139268165
Test: Verify that build warnings are gone, yet VINTF fragment still installed.
Change-Id: I579ec650019a29a6a105118ad5e5ae9376e8d9bc
2019-08-13 16:05:34 -07:00
Justin Yun
6151e3f1ea Rename product_services to system_ext
Bug: 134359158
Test: build and check if system_ext.img is created
Change-Id: I67f2e95dd29eac6a28e07e24ea973d3a134c3bfc
2019-07-09 08:57:19 +00:00
nelsonli
068d101077 Build: Fix test data no present in test suite zip files.
my_installed_test_data (LOCAL_TEST_DATA) no present in test
 suite zip files for device tests

Bug: 135957483
Test: 1. Remove the patch aosp/1008195
      2. m general-tests
      3. unzip general-tests.zip
      4. data files should exist in target/testcases/toybox-tests

Change-Id: I3f0a4d87e284c809625843d55dc5d35ef77e79bb
2019-07-05 23:52:45 +08:00
Dan Willemsen
bbe4e11a76 Call clean-path in more places
When an Android.mk specifies a local path that is outside the current
directory, it uses '..', since we prepend $(LOCAL_PATH)/ to the given
path.

This path ('a/b/../c') gets inserted into command lines and
dependencies. For dependencies, when it gets to Ninja, Ninja calls
CanonicalizePath and removes those references ('a/c'), but the command
line is preserved.

So we've got a command line that references 'a/b', but no dependency on
it. Usually that's not a big problem, but it's an issue if we're trying
to only expose dependencies to the rule, like with RBE only sending the
dependencies to the remote workers. So use our 'clean-path' macro to
collapse the '..' references in Kati so that they don't show up in the
command line either.

Test: treehugger
Test: build a system image with RBE
Change-Id: I0706faa2ac15e9c12c720f43c7bb8171c5efd97c
2019-06-12 21:35:33 +00:00
Martin Stjernholm
43ee355406 Fix typo causing ALL_DEPS.$(module).ALL_DEPS to be incomplete.
Test: m droid, look at some ALL_DEPS values using $(info).
Change-Id: Ifc182a0545715343a677cb880e21062ce37f5e62
2019-06-05 21:49:34 +01:00
Dan Willemsen
e048f7eff3 Remove BUILD_BROKEN_ENG_DEBUG_TAGS
All users have been removed.

Test: treehugger
Change-Id: I2cfe720bef88cc5485e90746d85a7e0a5d068ef7
Merged-In: I2cfe720bef88cc5485e90746d85a7e0a5d068ef7
2019-05-25 22:47:35 +00:00
Dan Willemsen
8e96a794ac Split ALL_MODULES.*.REQUIRED and friends between target/host
So that we actually respect different LOCAL_REQUIRED_MODULES for the
host and device versions instead of unioning them. That got particularly
problematic when LOCAL_SHARED_LIBRARIES is implicitly added to
LOCAL_REQUIRED_MODULES. We also used to walk through device-only modules
when filling out the list of required modules, which triggered even more
extra installations.

This also changes the requirements for PRODUCT_HOST_PACKAGES so that it
no longer accepts target-only phony modules (since we can now
differentiate them). They were all removed in previous patches.

Test: treehugger; diff resulting builds
Test: diff list of product_target_FILES and product_host_FILES
Change-Id: I2ed8950320d31f5693323ad8cef6ec5b6780b7d4
2019-04-10 13:22:23 -07:00
joker.yang
a75c9a5079 Statements in build system such as ifeq (true,$(LOCAL_VENDOR_MODULE)) has a poor compatibility
We have developed a vendor module and set LOCAL_VENDOR_MODULE := true<space> (Added a space character at the end)
The android build system then can't installed it in the right partition until we removed the extra space character.

bug: 129725067

Change-Id: I081ffe7f39a9c850007ba304c815436500be694c
2019-04-03 01:31:43 +00:00
Sasha Smundak
da25b691d3 Eliminate ENABLE_DEFAULT_TEST_LOCATION as it is always true
Bug: 117224272
Test: treehugger
Change-Id: Idd47ead31fcd89dbf728f140dc3353e5013ba352
2019-03-25 13:26:03 -07:00
Vic Yang
1b83413b5a Add module-target-built-files function
This is similar to module-built-files, except that it only returns
files built for the target, not the host.

Bug: 119423884
Test: Build with the no-vendor-variant VNDK change that uses this
      function.

Change-Id: I2a3d99003b05999eae01c0b90bb62b5263d65592
2019-03-20 10:22:21 -07:00
nelsonli
fe04351f6f Build: Ensuring test runtime dependencies are installed.
After migrating the primary install location of test modules into a
    generic testcase folder. All test modules will install to
    out/target/product/<product>/testcase/<module_name>/ if they don't
    specify their LOCAL_MODULE_PATH.
    But the dependent test module should also be copied to testcase
    folder even its LOCAL_MODULE_PATH be set.

BUG: 128815093
Test: 1. vi cts/tests/signature/api-check/Android.mk
        add LOCAL_MODULE_PATH for cts-hiddenapi_flags-csv
      2. m CtsHiddenApiBlacklistDebugClassTestCases
         Then, hiddenapi_flags.csv should also be copied to testcase
	 folder.

Change-Id: Iff872447348e74b2728e0913d04e46ccbaa4e972
2019-03-19 08:12:20 +00:00
Nelson Li
1f8357fe7d Revert "Revert "Build System: Solve dependency problem for test""
This reverts commit 6fe7f194b9.

Reason for revert: Fixed all build break.

Change-Id: I0a4842df1225399752515a4cd7a7c14173a5bf7b
2019-03-14 01:05:36 +00:00