Commit graph

84 commits

Author SHA1 Message Date
Colin Cross
ac7febc9c7 Revert "Revert "Produce mappings of hashes to elf symbols and r8 dictionaries""
This reverts commit 59ecb9e016.

Reason for revert: symbols_map is fixed to ignore non-elf files

Bug: 218888599
Change-Id: I88654b2dba3dfb9ab2809b0555544277279f345d
2022-04-06 01:11:20 +00:00
Colin Cross
59ecb9e016 Revert "Produce mappings of hashes to elf symbols and r8 dictionaries"
This reverts commit 3570b3ed86.

Reason for revert: b/228195288

Bug: 218888599
Change-Id: I17b38ca1b6f8940d682f2782515bfd5f8db1ce58
2022-04-05 17:47:27 +00:00
Colin Cross
3570b3ed86 Produce mappings of hashes to elf symbols and r8 dictionaries
Run the symbols_map tool on each unstripped binary and proguard
dictionary while copying it to produce a textproto that maps the
hash to the symbol/dictionary file location.  Combine the textprotos
into a mapping file when producing the zipped build artifacts.

Bug: 218888599
Test: m dist
Change-Id: I78997e2f3b631ed74213903cc8e72415b2d7eee0
2022-04-04 16:04:52 -07:00
Colin Cross
143af9284f Remove duplicate includes of BUILD_NOTICE_FILE
Some module types include BUILD_NOTICE_FILE a second time after
the include from base_rules.mk.  This won't work after a future
change, and doesn't seem to be necessary as none of the files
leave any modified LOCAL* variables in place for notice_files.mk
to read.

Bug: 207445310
Test: m checkbuild
Change-Id: I8c68888d6bf26926f5c2216abe147ccf28ddc2b8
2021-11-30 13:20:01 -08:00
Colin Cross
47cfffea79 Move java install rules into Soong
Remove the copy rules for LOCAL_SOONG_BUILT_INSTALLED, they will already
be created by Soong.

Also clean the soong host tools directory to remove any old copies of
java binaries.

Bug: 204136549
Test: m checkbuild
Change-Id: Ib6b5362ad59aa48770e48541430d6857846926c2
2021-11-08 15:23:32 -08:00
Colin Cross
fd54f03d1b Use the Soong output as the checkbuild target
Save disk space when building checkbuild by avoiding copying the Soong
output file into the Make intermediates directory.

All the same files in out/soong that were created by m checkbuild before
this patch are still created after this patch.  In the internal branch
the total size of the out directory after m checkbuild is reduced from
1320 GB to 965 GB.

Bug: 201816050
Test: m checkbuild
Change-Id: I6370df44f9baab00fcfe30c072600fe58109954d
2021-10-09 13:33:40 -07:00
Bob Badour
58c4535b7e Re-call BUILD_NOTICE_FILE for modules that add deps
The normal pattern is:

1. Set a bunch of variables like LOCAL_MODULE
2. Include a makefile specific to the module type
3. The included file in turn includes base_rules.mk
4. At the end of base_rules.mk, it include notice_files.mk
5. The included file declares a build rule and finishes.

The below files included for some module types add additional
dependencies after returning from base_rules.mk, which are not
reflected in the notice files.

Including notice_files.mk a 2nd time adds these dependencies.

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Test: m systemlicense

Change-Id: I030399ffb13a2cfb58cf583ae5a2e418f5dbc534
2021-09-09 20:09:13 +00:00
Treehugger Robot
6edaa353b1 Merge "Store dexpreopt.config files to dexpreopt_config.zip" 2021-04-23 06:47:57 +00:00
Jeongik Cha
a8056d6cb9 Store dexpreopt.config files to dexpreopt_config.zip
To dexpreopt in post processing, store config files for dexpreopt

Bug: 158843648
Test: m dist and check dexpreopt_config.zip
Change-Id: I5c63a5ffc10023994b14e3a63f50defb9194739f
2021-04-23 01:01:31 +00:00
Treehugger Robot
b2fccdd318 Merge "Fix build break for Android.bp dex_import" 2021-04-09 06:00:27 +00:00
Colin Cross
330b1fef31 Package jacoco and proguard files out of a PACKAGING directory
Package jacoco-report-classes.jar, proguard_usage.zip and
proguard_dictionary out of directories in $OUT/obj/PACKAGING
so that they get cleared by m installclean.  This will make
incremental builds that package these files accurate as long
as installclean was run, which is much faster than a full clean
build.

Bug: 184583915
Test: m TARGET_BUILD_APPS=DeskClock EMMA_INSTRUMENT=true dist
Change-Id: I60c6a0fec1fbce26eab8d5adab25a2231b48e251
2021-04-07 18:52:02 -07:00
Po Hu
db9f6e13c8 Fix build break for Android.bp dex_import
Error message is:
'out/target/common/obj/JAVA_LIBRARIES/x_intermediates/classes.jar',
needed by 'out/target/common/obj/JAVA_LIBRARIES/x_intermediates/jav
alib.jar', missing and no known rule to make it;

Soong Android.mk generated does not define LOCAL_SOONG_CLASSES_JAR
or LOCAL_SOONG_HEADER_JAR. So don't add them to javalib.jar's
dependencies.

Bug: 144664536
Change-Id: I6b530d40c859c6484425b8ec37c0fa7112a21346
2021-03-18 08:49:02 +08:00
Ulya Trafimovich
558cb6c5ac Merge <uses-library> dependency configs into dexpreopt.config files.
Since Make does not visit modules in topological order of their
<uses-library> dependencies, information from dependencies to the
dexpreopted module has to be passed via dexpreopt.config files. A build
rule for a dexpreopt.config file depends on dexpreopt.config files for
<uses-library> dependencies, and dex_preopt_config_merger.py script
extracts the necessary information from dependency configs and patches
the module's config.

Bug: 132357300
Test: lunch aosp_cf_x86_phone-userdebug && m
Change-Id: Id0b71170a4d2ab1d33059de0e9ad9d7e61f2345e
2021-01-28 14:59:14 +00:00
Colin Cross
a9b9e6e5ff Merged and dist lists of unused methods from R8
Merge all the proguard_usage.zip files produced by the R8 rules and
dist the result.

Bug: 151857441
Test: m TARGET_BUILD_APPS=DocumentsUI dist
Change-Id: I7e6d73241478016093a203dc7bd86407ab86a4ac
2020-08-17 19:31:22 +00:00
Yo Chiang
3ca4980d36 Auto-generate dexpreopt boot image module
Add prebuilt modules that installs bootjar dexpreopt files generated by
soong, for example `dexpreopt_bootjar.boot_arm64` installs .art / .oat /
.vdex, etc for the framework boot image ("boot") for primary arch
("arm64").

Bug: 159196136
Test: TH built artifacts noop
Test: Check device boot images are installed
Test: ./prebuilts/build-tools/linux-x86/bin/ninja -f out/combined-aosp_arm64.ninja -t browse
Test: Check that generated dependency graph is sane
Test: Check that bootjar dexpreopt bits are listed in `m dump-files`
Change-Id: Ia30b37be9be972c5e28b5840923801ea7237a237
2020-07-14 15:49:08 +08:00
Dan Willemsen
fd1e67b8ce More performance improvements
Instead of using `x := $(x) foo`, make sure `x` is initialized first,
then use `x += foo`.

For a aosp-master/aosp_crosshatch-userdebug build, this takes the build
from 49s to 33s (no significant difference in peak memory)

Bug: 158488548
Test: build-aosp_crosshatch.ninja is the same before/after
Change-Id: I41fb7611030dd3ba824f896a9c9eadbdd218f464
2020-06-08 19:10:23 -07:00
Yo Chiang
5814247ed2 Access ALL_MODULES subvars with my_register_name
ALL_MODULES and subvars are registered with my_register_name.
Replace references of ALL_MODULES.$(LOCAL_MODULE).* with
ALL_MODULES.$(my_register_name).*.

Bug: 155869107
Test: TH presubmit build pass
Test: TH presubmit build noop
Change-Id: I1481c341a285dc04de86619abec3194bb92c9739
2020-05-14 04:08:42 +00:00
Ulya Trafimovich
4c69c2ff72 Use two-column format for PRODUCT_BOOT_JARS components.
The first component is the apex name, or a special name "platform"
if the boot jar is a platform jar rather than a part of some apex.
This is a prerequisite change for moving core-icu4j to a separate
com.android.i18n apex.

Old one-column format is still supported, but all unqualified
components of PRODUCT_BOOT_JARS get "platform:" prepended to them
after reading the product makefiles.

Test: aosp_walleye-userdebug boots
Bug: 138994281
Change-Id: I0f79c7d10477880ca65354251a5d1ca0b7ce79ab
2020-04-30 17:16:29 +01:00
patricktu
379f7f0ef6 AIDEGen: Collect the classes.jar of the prebuilt modules into module-info.json
Current information is not enough if the prebuilt modules are depend on
AAR libs Therefore, AIDEGen has to collect the classes.jar of the
prebuilt modules from build system.

Build module-info.json without this change:
Build time: 1m55.001s
File size: 14,918,354 Bytes

Build module-info.json with this change:
Build time: 1m56.292s
File size: 15,577,031 Bytes

Bug: 132768299
Test: 1. Checkout the internal master branch
      2. Patch this CL
      3. m -j out/target/product/generic_x86_64/module-info.json
      4. Open the module-info.json
      5. For verifying soong_java_prebuilt.mk, check the classes.jar of
         module prebuilt-google-play-* exists.
         e.g.
         "prebuilt-google-play-...": {
              ...
              "classes_jar": [
	      	"out/target/common/obj/JAVA_LIBRARIES/
		 prebuilt-google-..._intermediates/classes.jar"
	      ]
         }
      5. For verifying java_prebuilt_internal.mk, check the classes.jar
         of module ink exists.
         e.g.
	 "ink": {
	     ...
	     "classes_jar": [
	     	"out/target/common/obj/JAVA_LIBRARIES/ink_intermediates/
		 classes.jar"
	     ]
	 }

Change-Id: I09518c92260db47d2686493fa13951f316159d13
2019-06-14 10:47:18 +08:00
Colin Cross
691335af21 Support LOCAL_SOONG_PROGUARD_DICT in soong_java_prebuilt.mk
Test: m checkbuild
Change-Id: I60a14be7d8bc4992b0519397b0e1933819f6e773
2019-04-23 20:05:35 +00:00
Colin Cross
3ecb9c4fdd Add a dependency on boot jars $(LOCAL_BUILT_MODULE)
After I25163e91886cea6941afa25cdb529ed053278dcb there is no longer
a dependency on $(LOCAL_BUILT_MODULE) for boot jars, as boot.art
is installed instead.  Add a dependency from boot.art to
$(LOCAL_BUILT_MODULE) so that $(LOCAL_BUILT_MODULE) and its
dependencies (which may include jacoco-report-classes.jar) is
copied for every build.

Fixes: 127702563
Test: forrest
Change-Id: I4db2d1f5fe2e1141fe93317cd7a2a58a33f8fbff
2019-03-18 13:17:22 -07:00
Colin Cross
485c9cd400 Move hiddenapi singleton rules to Soong
Hiddenapi rules are now in build/soong/java/hiddenapi_singleton.go.
This effectively requires any module in PRODUCT_BOOT_JARS to be
defined in Soong.

Bug: 123645297
Test: m checkbuild
Change-Id: If72bd1c20b2014d0a3d400624d37fdb0a3052245
2019-02-05 21:38:55 -08:00
Colin Cross
bd2287b846 Build aar files for m <module name>
Test: m SystemUI-core
Change-Id: I0bee792d1af80abb3e74c278db488bd668bd1fb4
2019-01-29 15:12:17 -08:00
Colin Cross
b405fe3765 Don't depend on classes-header.jar when turbine is disabled
TARGET_BUILD_APPS sets TURBINE_ENABLED := false, which triggers
an issue where a dependency is added on classes-header.jar but
there is no rule to create it.  Skip creating the dependency
when TURBINE_ENABLED is false for now.

Bug: 123183568
Test: m TARGET_PRODUCT=mainline_modules_arm UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true TARGET_BUILD_APPS=com.android.media
Change-Id: I8ec3e244b8f9618c58f4ac57329a5a07f01dc797
2019-01-21 10:59:42 -08:00
Colin Cross
49adea3bd8 Move hiddenapi to Soong
Perform hiddenapi CSV generation and dex encoding for Soong modules
in Soong.  This fixes an issue where dexpreopting was happening on
a different jar than was being installed.

Bug: 122856783
Test: m checkbuild
Change-Id: I24a235c63ff62fed7e1af9f2fd17e55b0c1598a5
2019-01-17 10:23:10 -08:00
Colin Cross
83b7bdf765 Simplify soong_java_prebuilt.mk and soong_app_prebuilt.mk
Simplify importing Soong modules into Make by always copying
LOCAL_PREBUILT_MODULE_FILE to LOCAL_BUILT_MODULE, which lets
Soong pick the final output file instead of trying to figure
out which of the various intermediate files should be the
output file.

Also fixes an issue where hostdex modules could attempt to
copy to both $(common_javalib.jar) and $(LOCAL_BUILT_MODULE),
which are the same file for host java modules.

Test: set compile_dex:true on core.platform.api.stubs. no warnings
      of target overriding
Test: m checkbuild

Change-Id: I2e089012436fe8649db82a673d446d1c5a73a731
2019-01-17 10:23:06 -08:00
Nicolas Geoffray
6ce12f56de dex_preopt: differentiate between updatable boot jars and non-updatable boot jars.
bug: 119868597
Test: m
Change-Id: I2f12ed6f37b629effc30e7b0c3310dc32e5ff4c8
2019-01-17 14:35:41 +00:00
Colin Cross
5d196364e1 Revert "Simplify soong_java_prebuilt.mk and soong_app_prebuilt.mk"
This reverts commit a76cc6d732.

Reason for revert: broke emma turbine build

Change-Id: Ie894565501d0de44f96dc736408a8c4e2ba2ed90
2019-01-16 01:38:41 +00:00
Colin Cross
a76cc6d732 Simplify soong_java_prebuilt.mk and soong_app_prebuilt.mk
Simplify importing Soong modules into Make by always copying
LOCAL_PREBUILT_MODULE_FILE to LOCAL_BUILT_MODULE, which lets
Soong pick the final output file instead of trying to figure
out which of the various intermediate files should be the
output file.

Also fixes an issue where hostdex modules could attempt to
copy to both $(common_javalib.jar) and $(LOCAL_BUILT_MODULE),
which are the same file for host java modules.

Test: set compile_dex:true on core.platform.api.stubs. no warnings
      of target overriding
Test: m checkbuild

Change-Id: Id84d499a0869961be5a906d8472b75b9c843b4b4
2019-01-15 10:16:55 -08:00
Colin Cross
1a2e9dc10c Error if a Soong module attempts to install a classes jar
Only dex jars should be installed, make it an error to not provide
a dex jar for an device installable java module.

Bug: 122831369
Test: m checkbuild
Change-Id: I99c5738e6053fbaa3dd22406f50b7a002555702c
2019-01-14 12:50:08 -08:00
Treehugger Robot
81e29e0969 Merge "Add missing dependency on common javalib.jar" 2018-12-18 21:17:07 +00:00
Colin Cross
54a71e229b Add missing dependency on common javalib.jar
Building $OUT/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar
is no longer updating the common intermediates:
out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/classes.jar
after I25163e91886cea6941afa25cdb529ed053278dcb.  Add the missing
dependency on common javalib.jar, which already depends on common
classes.jar.

Bug: 119412419
Bug: 121194944
Test: rm out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/classes.jar &&
      m core-tests &&
      ls out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/classes.jar

Change-Id: Id463d159e46c82656c364fdb2dbe53f33ee1a103
2018-12-18 11:06:25 -08:00
Colin Cross
19fbc1b9e9 Don't install boot.art when WITH_DEXPREOPT is false
Don't create the install rules for boot.art when WITH_DEXPREOPT
is not set to true, which will ensure there is no dependency on
boot.art in a normal build, which matches the behavior before
I25163e91886cea6941afa25cdb529ed053278dcb.

This should fix the Mac build, which never sets WITH_DEXPREOPT
and does not support running dex2oat.

Bug: 119412419
Bug: 121130576
Bug: 121183382
Test: lunch aosp_sailfish-eng && m WITH_DEXPREOPT=false
      files does not depend on out/target/product/sailfish/dex_bootjars/system/framework/arm/boot.art
Change-Id: I39e96b1f35f6808d3007cf1785ec3db89e0decb6
2018-12-18 15:36:36 +00:00
Colin Cross
6db5b0ea9a Move dexpreopting to Soong
Move the dexpreopting logic into Soong.  Make modules will be
dexpreopted by executing the Soong logic in the standalone
dexpreopt_gen binary, which will generate scripts that will
perform dexpreopting for each module.  Export global configuration
as JSON to $OUT/dexpreopt.config, which will be used by
dexpreopt_gen and Soong, and per-module JSON configuration that
will be used by dexpreopt_gen.

This relands I59b20c931ee3e5a8d35eb30da4148691c5095502,
I39d580999947ee54cfefe875b57a028be5333bd7,
Ie7daa94e107d53eff075ca58dbe721bd9d7fc8c2 and
Ica006a007d112c232311435aaac0c0e476232b67, with a minor
update to match the changes made to dexpreopt_gen arguments
and a fix to correctly keep dexpreopt disabled on mac builds.

Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
      only expected changes to dexpreopt outputs on system_other
      (.vdex files for privileged Soong modules no longer incorrectly
      contain .dex contents).
Change-Id: I25163e91886cea6941afa25cdb529ed053278dcb
2018-12-17 13:46:17 -08:00
Colin Cross
b8901d7fb8 Revert "Move dexpreopting to Soong"
This reverts commit e736c58043.

Test: none
Bug: 119412419
2018-12-14 11:49:55 -08:00
Colin Cross
e736c58043 Move dexpreopting to Soong
Move the dexpreopting logic into Soong.  Make modules will be
dexpreopted by executing the Soong logic in the standalone
dexpreopt_gen binary, which will generate scripts that will
perform dexpreopting for each module.  Export global configuration
as JSON to $OUT/dexpreopt.config, which will be used by
dexpreopt_gen and Soong, and per-module JSON configuration that
will be used by dexpreopt_gen.

Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
      only expected changes to dexpreopt outputs on system_other
      (.vdex files for privileged Soong modules no longer incorrectly
      contain .dex contents).
Change-Id: I59b20c931ee3e5a8d35eb30da4148691c5095502
2018-12-12 17:21:22 -08:00
David Brazdil
59b6fd541d Replace hidden API lists with a single CSV
Combine existing hiddenapi-* txt files into a single CSV containing
a list of all class members and their corresponding flags.

Test: m, phone boots
Change-Id: I67f1b5f331b262e9b681d9a3c78c9e4cbb5ea082
2018-11-29 15:48:56 +00:00
Paul Duffin
50537afe99 Merge "Allow UnsupportedAppUsage annotations to be in separate target" 2018-11-01 10:22:53 +00:00
Paul Duffin
79d8bf25ea Allow UnsupportedAppUsage annotations to be in separate target
Previously, all the UnsupportedAppUsage annotations were assumed to be
in the same target as was used at runtime. e.g. frameworks,
core-libart, etc. This change allows separate targets to be specified
in the EXTRA_HIDDENAPI_JARS. It is needed to avoid maintaining local
patches for those annotations in the libcore/ojluni/src/main/java code
which comes from upstream OpenJDK.

This was tested by making and then manually checking that the generated
out/target/common/obj/PACKAGING/hiddenapi-light-greylist.txt was the
same (after sorting) before and after this change.

Test: see above
Bug: 117818301
Change-Id: Icfadbe52601371f6a4cabef106750b16f6c6d4c8
2018-10-31 10:33:38 +00:00
Colin Cross
74e4cf10bf Store AAR path from Soong for dist
Store the path to the AAR file from Soong so that it will be picked
up by dist if requested in TARGET_BUILD_APPS.

Test: m checkbuild
Change-Id: Ifeaf2b5ca3f405fbe79a966ceee9989a38d77f6e
2018-10-30 15:48:33 -07:00
Colin Cross
fc782ad949 Reduce the propagation of LOCAL_DEX_PREOPT := nostripping
nostripping causes confusing double negatives, allow nostripping
in LOCAL_DEX_PREOPT and DEFAULT_DEX_PREOPT, but convert to
LOCAL_STRIP_DEX outside of dex_preopt_odex_install.mk.

Test: m checkbuild
Change-Id: I996e9258ce20c394900d9fe937d638bc2ab8589d
2018-10-23 22:33:07 -07:00
Mathew Inwood
8c96298a92 Write greylist annotation metadata to a csv file.
Also add support for merging these into a single file elsewhere in the
build.

Test: m, inspect generated greylist.csv
Bug: 117314178
Change-Id: If28110fc1ed090222e55c274e8363110753d10f1
2018-10-16 12:06:02 +01:00
Mathew Inwood
edb1c84f03 Support for adding dark greylist members from annotations.
Currently, we support maxTargetSdk values of 26 & 28, corresponding to
the P blacklist (existing dark grey list) and upcoming Q blacklist.

For now, just put the two into the same list, as the runtime support to
distinguish between the two does not exist yet.

Bug: 114361293
Test: m
Change-Id: I2f8d206e8dd22afc6c0e98fb5e53b1d78a534125
2018-09-07 16:52:16 +01:00
David Brazdil
b67402ecce Support hidden API whitelist generated by class2greylist
Libcore has support for annotating a virtual method which is known
to change its return type in a future release. This annotation is
recognized by the dexer and a future-proof bridge method is created.
This patch integrates changes in class2greylist to support this
annotation into the build system and generation of hidden API lists.

Calling class2greylist on each boot classpath module now produces two
text files instead of one: signatures for greylisting and now also
whitelisting. They are passed on to the hidden API list generating rules
in frameworks/base.

Bug: 112186571
Test: m appcompat, diff public-list.txt whitelist.txt
Change-Id: I9861203e6e07a17d50850892ec13880971457d11
2018-08-23 10:38:03 +01:00
Colin Cross
7a504334cd Fix java soong_to_convert data
soong_to_convert looks for modules with no unconverted deps, but
the list of converted modules was not being updated for java and
app prebuilts.  That meant soong_to_convert only reported modules
with no deps at all.

Test: examine soong_to_convert.txt
Change-Id: I136e6fa74153a80df5ecd767642bb2feb2ddb9dc
2018-08-16 22:55:43 -07:00
Colin Cross
521b22cf66 Add soong_droiddoc_prebuilt.mk
Soong droiddoc modules were using soong_java_prebuilt.mk, but they
don't need any of the java logic from it, and it includes
base_rules.mk which was not included by droiddoc.mk.  Add
soong_droiddoc_prebuilt.mk that just installs the droiddoc
outputs without including base_rules.mk.

Fixes building docs modules in mm, mma, and m checkbuild.

Bug: 112388925
Test: m docs
Change-Id: I4f7262e2c3b1afbee44c1cc306330885b687a074
2018-08-09 11:24:11 -07:00
Mathew Inwood
48a7929962 Merge "Build rules to derive greylists from annotations." 2018-07-26 07:37:29 +00:00
Nan Zhang
28af1e7484 Merge "Copy annotations.zip to out/target/common/obj/PACKAGING/" 2018-07-24 22:44:12 +00:00
Mathew Inwood
04c58dea0b Build rules to derive greylists from annotations.
Uses the new class2greylist tool to extract API descriptors from .class
files.

Also add these generated greylist.txt files as dependencies of
INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST so they can be merged later in
the build.

Bug: 110868826
Test: m
Change-Id: I406587732b537f9b56768ad9909039dfab34c334
2018-07-24 15:48:42 +01:00
Dan Willemsen
7a1da0e43e Mark more targets as PHONY
So that we can start restricting non-phony targets to $OUT_DIR and
$DIST_DIR.

Test: add --writable=out/, see fewer warnings
Change-Id: I411fe4af732b1bce35d4a4c1e2a47b5f8a15e6b8
2018-07-24 01:21:12 -07:00