Commit graph

604 commits

Author SHA1 Message Date
Colin Cross
24575c46e3 Put javac, d8 and r8 rules into RBE ninja pool
javac, d8 and r8 rules for module defined in Android.mk files are
running remotely with RBE but are running in the local ninja pool,
restricting them to only running as many jobs in parallel as there
are local CPUs.  Set the ninja pool to let them run 500 jobs in
parallel.

Bug: 228603472
Test: m checkbuild
Change-Id: I60f7859f3657fc1eff0daf0e0a1b0f9fe63551b6
2022-04-08 10:56:57 -07: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
Ulya Trafimovich
2bf587713b Consolidate manifest_check for different module types.
Move manifest_check (a.k.a. verify_uses_libraries check) from makefiles
for specific module types to common makefile dex_preopt_odex_install.mk,
which is included by all Java modules that may require dexpreopt. If a
modules locally disables dexpreopt, it still goes through manifest_check
(unless dexpreopt is globally disabled or the module has no Java code).

This CL allows to have manifest_check and dexpreopt in the same makefile
(which is needed for a follow-up CL that will reuse dexpreopt variables
for manifest_check).

Bug: 132357300
Test: lunch cf_x86_64_phone-userdebug && m
Change-Id: Ia217cfc247ae43d8fc716bfc1fe9dcce1d00aa7f
2021-03-19 11:00:51 +00:00
Colin Cross
a1271eb343 Turn missing jarjar output files into errors
Jarjar doesn't exit with a nonzero return code when there is a syntax
error in a rules file and doesn't write the output file.  Without a
nonzero return code ninja prints a warning but continues, which leads
to stale results on incremental builds where the output file already
exists, or delayed errors on clean builds whre the output file didn't
exist.

Delete the output file before running jarjar, and then check if it
exists after running jarjar.

Fixes: 119516143
Test: m out/target/common/obj/JAVA_LIBRARIES/noto-emoji-compat-java_intermediates/classes-jarjar.jar
Change-Id: Ib99167403948ee11f039dd4d2d7e63052bb92136
2021-02-08 10:55:05 -08:00
Dan Willemsen
a3f6632de9 Remove obsolete PDK build functionality
This hasn't worked for a couple years, and continues to bitrot. Just
remove it.

Test: treehugger
Change-Id: Iea6caf3c08252a560155e095135c5ddaad712991
Merged-In: Iea6caf3c08252a560155e095135c5ddaad712991
2020-08-11 01:12:01 +00:00
Jeongik Cha
d05b57a362 Introduce TARGET_BUILD_UNBUNDLED_IMAGE
- TARGET_BUILD_UNBUNDLED_IMAGE is similar to TARGET_BUILD_APPS, but
its targets are the unbundled partitions instead of apps.
- Rename TARGET_BUILD_APPS_USE_PREBUILT_SDK to TARGET_BUILD_USE_PREBUILT_SDKS
because it is used even without TARGET_BUILD_APPS.
-Instead of TARGET_BUILD_APPS, use TARGET_BUILD_USE_PREBUILT_SDKS
to build java modules with prebuilt sdks, and propagate to Soong.

Bug: 160390776
Test: TARGET_BUILD_UNBUNDLED_IMAGE=true m vendorimage
Change-Id: Ie096212ccbcca0018baae55e106af693b002c9e5
2020-08-03 15:47:09 +09:00
Pete Gillin
3829475b74 Rename the Default* constants in java/config.
These values are used in two out of the many possible sdk_version
configurations, and therefore weren't really defaults in any
meaningful sense. Giving them more descriptive names makes the code
easier to follow.

Bug: 157640067
Test: m java
Change-Id: I67767b2be72ed3d8cc879280036850096eb65415
2020-07-01 12:47:02 +01: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
Kousik Kumar
7d61116cc1 Use soong_zip instead of jar to generate .jar files in javac actions
This is to make the jar-output deterministic so that we can get
cache-hits for r8/d8 actions from RBE.

Change-Id: I911ee702fa5dabfe7122e82b21f78c811a0c960d
Test: m droid checkbuild
2020-04-16 18:23:32 -07:00
Colin Cross
28ff3e3f94 Disable goma for javac actions in Make
goma can't handle the --system argument that Android must pass to
javac.

Bug: b/143658984
Test: treehugger
Change-Id: I7091a14f940ae696930c9d4a7869ae3a81a33fbe
2020-03-05 20:46:47 +00:00
Colin Cross
2a40672597 Initialize common_proguard_flags for each module
Id938aa35e87c9c69769a3184dfea06fd02299688 removed the initial
assignment to common_proguard_flags, which both makes it grow as
each module is parsed and also turns it into a lazily evaluated
variable.  That causes the flags passed to R8 to be the flags
computed for the current module multiplied by the number of previously
parsed modules.

Fixes: 146150575
Test: m checkbuild
Change-Id: I87c9625496f482896be6867124f2f12ff662cd57
2019-12-13 16:23:11 -08:00
Søren Gjesse
f38d3ccf47 Remove passing -forceprocessing flag to R8
R8 ignores the flag

Test: m -j
Change-Id: Id938aa35e87c9c69769a3184dfea06fd02299688
2019-11-27 12:41:45 +01:00
Colin Cross
23dcf76a36 Set pools manually for rules that can run in RBE or goma
Use .KATI_NINJA_POOL := none to mark rules that can run in RBE or
goma when they are enabled, which along with passing
--default_pool=local_pool will allow moving remoteable jobs into
the remote pool without relying on hacks in kati.

Fixes: 143938974
Test: inspect pools in build-${TARGET-PRODUCT}.ninja for m USE_RBE=true
Test: inspect pools in build-${TARGET-PRODUCT}.ninja for m USE_GOMA=true
Change-Id: I08615ae1f2eaef9ff0ba253b8aa3d83ab57ebb27
2019-11-12 13:59:49 -08:00
Pete Gillin
6a88bd49bc Remove support for EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9.
Prior to this change, setting that to "false" turned the default Java
language level back to 8. This change removes that option.

Also remove the unused make variable USE_OPENJDK9.

Bug: 115604102
Test: m java droid docs tests cts
Change-Id: I040cf83a2457227ffbcd1c62649e33b98c0c66f7
2019-10-25 16:55:54 +01:00
Dan Willemsen
829abaefee Add dependencies for files in LOCAL_PROGUARD_FLAGS
Do this by introducing a new LOCAL_PROGUARD_FLAGS_DEPS variable that we
can modify anytime we add a file reference to LOCAL_PROGUARD_FLAGS.

An alternative would have been to switch to LOCAL_PROGUARD_FLAG_FILES,
but that would have been much harder to ensure the same command line
ordering.

Bug: 130111713
Test: treehugger
Change-Id: If367197b30d563e0796f0cafa00be1f275f2c406
2019-08-09 09:19:52 -07:00
Dan Willemsen
f14179b3ff Fix some java library dependencies
Bug: 130111713
Test: treehugger
Test: build system image w/RBE
Change-Id: I2c76701c1ad396c1b13f873297785c736fba544d
2019-06-12 21:36:29 +00:00
Treehugger Robot
56bfae6402 Merge "Add missing dependencies to python scripts" 2019-06-11 03:15:54 +00:00
Dan Willemsen
c84e4cb917 Add missing dependencies to python scripts
These were found when trying to run remotely on RBE with only the
sources depended upon available for each rule.

Bug: 130111713
Test: treehugger
Change-Id: Id763f8fc7dfbe60445f98604db3422147165f537
2019-06-10 23:58:49 +00:00
Dan Willemsen
84c6c1cfe4 Convert java proto generation to use srcjars
So that we actually represent all files in the build graph.

Test: treehugger
Change-Id: I48e32437fcfd8c0de8cbc87d07934393db557aa4
2019-06-10 16:31:07 -07:00
patricktu
ab435e39a5 AIDEGen: Collect the srcjar path of modules into module-info.json
By design doc: go/aidegen-doc-generate-R
In order to generate R.java of app modules, AIDEGen needs to build
the module. It might cause system.img oversized so we turn to build
the target srcjar file if it exists in module-info.json.

Build module-info.json without this change:
Build time: 1m47.227s
File size: 14,186,429 Bytes

Build module-info.json with this change:
Build time: 1m46.796s
File size: 14,614,470 Bytes

Bug: 132407603
Test: 1. m out/target/product/generic_x86_64/module-info.json
      2. by grep "target/common/obj/APPS/Settings_intermediates/aapt2.srcjar"
         in module-info.json.

Change-Id: I09c812aede0324bc38acbead0a863a85ae15b33e
2019-05-17 01:46:56 +00:00
Colin Cross
91f53fddc7 Remove reverse-list from java static libraries.
Make was reversing the list of static library dependencies when passing
it to merge_zips.  This was originally done to match the behavior of
unzipping each static library in order into the same directory,
overwriting duplicates each time.  This order is counter-intuitive,
and Soong does it the sensible way (first one takes priority, the same
as the compile classpath).  Fix Make to match Soong.

Bug: 131603999
Test: m checkbuild
Test: compare target_files.zip
Change-Id: Idad125068ed2f750dc2dd95ab82bacb6e074489d
2019-04-29 10:31:02 -07:00
Treehugger Robot
ff14c47182 Merge "Clean up LOCAL_DONT_DELETE_JAR_META_INF" 2019-04-24 15:08:28 +00:00
Colin Cross
aebe1e9fe9 Clean up LOCAL_DONT_DELETE_JAR_META_INF
Allow setting it for host modules, it is necessary for
RoboLectric.

Remove some unused PRIVATE_DONT_DELETE_JAR_META_INF variables.

Remove unzip-jar-files, it is obsolete since merge_zips was
introduced.

Test: m checkbuild
Change-Id: I3f2fc466321904eace31525cbac99ad524f39188
2019-04-23 13:05:11 -07:00
Colin Cross
ab2b34b8fd Merge "Use framework.aidl built by Soong" 2019-04-21 17:20:17 +00:00
Colin Cross
50bf3127d9 Use framework.aidl built by Soong
Bug: 130798034
Test: m checkbuild
Change-Id: I24621b41860ce1fd1c3ba067430c8d62b49d03cb
2019-04-18 12:06:27 -07:00
Colin Cross
e6210f6eb2 Remove AAPT1 support
AAPT2 is used everywhere now, remove support for AAPT1.  Also
removes dpi_specific_apk.mk, it was never updated to use AAPT2
and has been generating bad APKs (resource ID mismatch between
the dex files and the resources) since AAPT2 was made the default
in May 2018 (I9b67fd2a9b3234798b2aac879b5242c2097b3863).

Bug: 80450981
Test: m checkbuild
Change-Id: I2ff768897360ff866dbae5562455bab22be270f7
Merged-In: I2ff768897360ff866dbae5562455bab22be270f7
2019-04-17 16:50:30 -07:00
Jiyong Park
eadd1bdb8e Don't feed framework.jar to proguard for vendor apks
We used to add framework.jar to proguard via -systemjars option even
for the apks building againsd SDK. This was because the app might have
references to hidden APIs via static libraries, etc.

However, for vendor apks, the use of hidden API is strictly prohibited.
So it is fine to not include framework.jar. Furthermore, including
framework.jar even causes problems in some cases; if a java library
(e.g., android.hidl.base-V1.0-java) is statically linked to both the app
and the framework.jar, -systemjars frameworks.jar forcibly removes
classes in the library from the app to have references to the non-public
classes in framework.jar. This could fail some compliance tests.

Fixing the problem by not raising SDK for apks located in vendor or odm
partitions.

Bug: 128574081
Test: m
Change-Id: If2b658fead5b4bb4d8c023a37eb57a37ad9b741d
2019-04-03 22:35:34 +09:00
Colin Cross
a27f42aa5d Consolidate sdk version handling
Share the logic that converts LOCAL_SDK_VERSION, LOCAL_MIN_SDK_VERSION
and the global config values into minSdkVersion, targetSdkVersion,
and compileSdkVersion.

Test: m checkbuild
Change-Id: Id038673662b23cffc9e57978ac55a3f35ef8237a
2019-02-07 08:55:48 -08:00
Treehugger Robot
6d1ae7a015 Merge "Move hiddenapi singleton rules to Soong" 2019-02-07 07:27:33 +00: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
Steven Moreland
e0c38893ff Remove '-b' from AIDL.
An empty file will be emitted for parcel declarations. Now sources may
include parcel definitions.

Bug: 70046217
Test: manual
Change-Id: Ib4bfaf52101956a543738d50ea699f9232f5bb91
2019-02-06 04:58:06 +00:00
Colin Cross
8e0ff1c370 Add a flag to allow unbundled builds to build SDKs from source
Mainline modules are tightly coupled to the platform, and should
build against the current SDK from source and not prebuilts. Add
a flag UNBUNDLED_BUILD_SDKS_FROM_SOURCE to specify that a
TARGET_BUILD_APPS build should build the current SDK instead of
using the prebuilts.

Bug: 121194841
Bug: 121231426
Test: no change to out/build-aosp_sailfish.ninja
Test: forrest unbundled build
Test: forrest master apps build
Test: forrest mainline modules build
Change-Id: I9ebc08745409a817d831817cb282aba1de6d81bb
2018-12-18 22:43:16 -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
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
patricktu
b23d8e6502 aidegen: Collect all java sources from makefile system.
Bug: 117129969
Test: make -j64 out/target/product/generic_x86_64/module-info.json
Change-Id: I4bc6cab8e56a1ed6485ad2f5f22fe9b8149b25d0
2018-10-05 14:55:36 +08:00
Colin Cross
ec17af3364 Pass classpath to d8
d8 requires the full classpath if --min-api requires default method
or try-with-resources desugaring.  Always pass the full classpath,
since it will already have been built to generate the input jar.

Bug: 116243313
Test: m checkbuild
Change-Id: I363b4d3145e23d4eed77455c1897430206f3ac22
2018-09-21 12:36:53 -07: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
7c76579e7a Merge "Support hidden API whitelist generated by class2greylist" 2018-08-27 21:41:04 +00:00
Søren Gjesse
b22934382f Ensure that the R8 minification map (ProGuard dictionary) file exists
R8 no longer outputs an empty map file when minification
(obfuscation) is turned off.

Test: m -j PRODUCT-aosp_x86-eng
Change-Id: I3bd3f2900225dca05a972f46a3b882041e17ba49
2018-08-27 11:19:35 +02: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
3ebfe7309f Remove proguard support
R8 is always used now.

Bug: 111885749
Test: m checkbuild
Change-Id: I9ae586c6360f2e3050422090b4e08f27ae167758
2018-08-07 11:22:17 -07:00
Colin Cross
1ef3c64906 Merge changes from topic "manifest_fixer_targetSdkVersion"
am: 7b21221d2a

Change-Id: I23336d8a71e2b42877606989d330aa68efb57d5e
2018-07-26 15:10:59 -07:00
Colin Cross
7b21221d2a Merge changes from topic "manifest_fixer_targetSdkVersion"
* changes:
  Pass --library to manifest_fixer.py for android libraries
  Fix dependencies for obfuscated instrumentation tests
  Move manifest fixing to a separate rule
2018-07-26 22:02:36 +00:00
Mathew Inwood
50f59655ba Merge "Build rules to derive greylists from annotations."
am: 48a7929962

Change-Id: I029776a9e31923b87e125ab0054b398d9c935bce
2018-07-26 01:37:29 -07:00
Mathew Inwood
48a7929962 Merge "Build rules to derive greylists from annotations." 2018-07-26 07:37:29 +00:00
Colin Cross
fcb441b2b7 Fix dependencies for obfuscated instrumentation tests
This path is never used, otherwise the dependency on
proguard.classes.jar would have triggered the checkbuild
dangling rules errors.  Remove the dependency on the
proguarded classes, which don't exist any more, and depend
on the proguard_options and proguard_dictionary files
instead.

Test: none
Change-Id: Ia3ebc3bc71f0d6fdfa4a7a6850e2f7021adfdd1a
2018-07-25 14:30:10 -07:00
Dan Willemsen
76f0441dc0 Merge "Mark more targets as PHONY"
am: 6708f9507b

Change-Id: I4a23ba6f0043cef1406e40752d40b1228d0c8774
2018-07-24 15:37:00 -07: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