Commit graph

5759 commits

Author SHA1 Message Date
Paul Duffin
77590a8263 Allow framework-media to build the framework-media.impl
The framework-media java_sdk_library is currently api_only for legacy
reasons. This change allows it to also build the framework-media.impl
library by making the following changes:
* Adds impl_only_static_libs to allow the implementation to statically
  include other libraries, something no other java_sdk_library has
  needed to do.
* Passes the apex_availability property through to the impl library so
  it can be statically included in the updatable-media which is what is
  included in the apex, again for legacy reasons.

Bug: 190807367
Bug: 229932396
Test: m com.android.media media-module-sdk
      # Compare before and after this change (and corresponding change
      # to updatable-media/framework-media.
Change-Id: I9e1837edcca6f5fa84fc611274cf8fbba8a896b8
2022-04-28 14:30:14 +00:00
Ulya Trofimovich
a465e28bcb Merge "Remove obsolete dexpreopt config option UseArtImage." 2022-04-28 09:44:21 +00:00
Cole Faust
8b7f627f30 Fix erroneous "Field requires API level 33 (current min is 32)" warnings
Bug: 215567981
Bug: 204776549
Test: m out/soong/.intermediates/frameworks/base/framework-minus-apex/android_common/lint/lint-report.xml, then check that that file doesn't have any of these warnings
Change-Id: I39aa2228474630c93250bf5833ac6bd9bbadcc7f
2022-04-27 12:20:08 -07:00
Muhammad Haseeb Ahmad
4e70b7586a Merge "Add jni support to java_fuzz_host" 2022-04-27 16:14:29 +00:00
Treehugger Robot
b3f437ae7b Merge "Deduplicate classLoaderContexts field between two structs." 2022-04-27 14:53:14 +00:00
Ulya Trafimovich
442ec7fc07 Remove obsolete dexpreopt config option UseArtImage.
Bug: 170935728
Test: lunch aosp_cf_x86_64_phone-userdebug && m && lunch_cvd
Change-Id: Id83b9085794fd2ec338077ca909f84e04ccad041
2022-04-27 13:36:47 +01:00
Ulya Trafimovich
12164ded20 Deduplicate classLoaderContexts field between two structs.
This field is provided by the `dexpreopter` struct, which is a part of
`java.Module` and also had an identially named field. This created
confusion when the latter field was not properly copied into the former,
which resulted in not propagating class loader context, e.g. for static
library "androidx.preference_preference". This didn't cause class loader
context mismatch errors at boot previously, because the library didn't
have any uses-library dependencies before a recent prebuilt update.

Bug: 214255490
Test: lunch aosp_cf_x86_64_phone-userdebug && m && launch_cvd \
    && adb wait-for-device && adb root \
    && adb logcat | grep -E 'ClassLoaderContext [a-z ]+ mismatch'
    # empty output, no errors at boot
Change-Id: Ib818c5d2934d28817bb7a04b6114ae8b82a5c04d
2022-04-27 11:59:34 +01:00
Treehugger Robot
7cb3f50fda Merge changes I8ef31373,Ic408857d
* changes:
  Disable newapi check in defaults
  Enforce newapi check only if min_sdk_version < compile_sdk_version
2022-04-27 00:55:56 +00:00
Muhammad Haseeb Ahmad
7e74405b2d Add jni support to java_fuzz_host
Bug: 219782880
Test: m example_java_fuzzer_with_native_lib, go test -run TestJavaFuzz
Change-Id: I1d05fb449e5378a27a0096869d9c12ca0a1245c6
2022-04-26 18:49:02 +00:00
Spandan Das
397e910835 Disable newapi check in defaults
- Making newapi disabled by default will ensure that this lint check
  does not run on the platform. This prevents noisy lint warnings like b/228956345#1
- This lint check will continue to be enforced on the transitive deps of
  apexes, since lint.strict_updatability_linting will be true for those
  Soong modules

Test: TH
Test: m
out/soong/.intermediates/frameworks/base/services/core/services.core.unboosted/android_common/lint/lint-report.xml
// file no longer contains "Call requires API level ..." warning
Bug: 228956345

Change-Id: I8ef3137394011fb679a1129f80f6351fb05a4eff
2022-04-25 18:17:11 +00:00
Spandan Das
ba7e532a11 Enforce newapi check only if min_sdk_version < compile_sdk_version
- NewApi check should be enforced only if min_sdk_version is less than
  the compile_sdk_version (the opposite direction should be a different
  build-time error)
- Change the datatype of *sdkVersion to android.ApiLevel (from string)
  to support version comparisons

Test: go build ./java
Test: no changes in ninja file
Bug: 228956345

Change-Id: Ic408857db7760d912ef4694d2ed72c0b7106eb04
2022-04-25 18:12:50 +00:00
Treehugger Robot
224879e794 Merge "Fix error message formatting" 2022-04-23 12:24:08 +00:00
Pedro Loureiro
ea2f5eff5e Fix error message formatting
Test: m nothing

Fixes: 230086179
Change-Id: Ieb6a7de9dcf0c12184c868b5af9af52c7b4bfa5e
2022-04-22 13:53:16 +00:00
Jared Duke
0cf7c9686d Limit JIT tier for D8
Standalone D8 invocations tend to be shorter-lived than R8 invocations
that involve deeper layers of bytecode optimization. Introduce a
separate set of JVM flags to pass to D8 invocations which limit the
runtime JIT tiering, reducing overall compile times and significantly
reducing total CPU consumption for D8 build workloads.

Representative incremental build times with this change:
 * real 6m1.388s
 * user 63m32.412s
and without:
 * real 6m30.624s
 * user 79m12.626s

Bug: 205303544
Test: time m
Change-Id: Ic568a4316325c6a4e0da41ffebbb07f0c5f7e8e3
2022-04-21 18:24:52 +00:00
Vinh Tran
ef4a5a3028 Merge "Update doc for Platform_apis field in DeviceProperties" 2022-04-19 00:14:16 +00:00
Vinh Tran
d91939ee84 Update doc for Platform_apis field in DeviceProperties
The doc for Platform_apis is outdated. The property is used by not only android_app, but also android_test and android_test_helper_app

https://cs.android.com/android/platform/superproject/+/master:build/soong/java/app.go;l=382;bpv=1

Next steps:
1. Clean up existing misuse of Platform_apis and Sdk_version in android_test and android_test_helper_app.

2. Add validation check to ensure proper use of Platform_apis and Sdk_version moving forward android_test and android_test_helper_app.
Currently, android_app already has validation in place. https://cs.android.com/android/platform/superproject/+/master:build/soong/java/app.go;l=275;bpv=1;bpt=1
WIP: https://android-review.googlesource.com/c/platform/build/soong/+/2065270

Test: N/A
Change-Id: I934860cdc8b23268d70e205089118c6451d4cf8a
2022-04-18 19:51:34 +00:00
Yike Zhang
29f5068a1c Merge "Export Java library dependency information" 2022-04-18 04:58:47 +00:00
Yike
f628202aab Export Java library dependency information
Write `static_libs` and `libs` of Java library and Android app modules to module_bp_java_deps.json. This enables downstream tools to correctly set up the runtime environment. Note that while static libraries don't need to be on the Java classpath these modules could have non-static library dependencies that do need to be present.

Test: m out/soong/module_bp_java_deps.json
Bug: 227538646
Change-Id: I7c4aecb2fb03c890f0d2aaae80e619f6176809ef
2022-04-18 10:23:28 +08:00
Vinh Tran
62a2fd93de Merge "Update doc for DeviceProperties's Sdk_version field" 2022-04-14 23:42:51 +00:00
Vinh Tran
a9c8f7db27 Update doc for DeviceProperties's Sdk_version field
Test: N/A
Change-Id: I7848ce27a5dcecaf24b0129908f6673dd1fdb63f
2022-04-14 21:02:16 +00:00
Vinh Tran
08e0f96841 Merge "Document AARImportProperties fields" 2022-04-14 20:25:11 +00:00
Vinh Tran
4ae8d4ac46 Fix documentation for android_app_import
Test: N/A
Fix: 226586426
Change-Id: I588a249a85d152f37f5d1bd7157cfab120185648
2022-04-13 21:40:23 +00:00
Vinh Tran
ce0781f8f5 Document AARImportProperties fields
Test: no testing necessary

Change-Id: Idff223f5c9a0b89cd5e0e2c8782c700d8fe9e9b3
2022-04-13 02:12:37 +00:00
Paul Duffin
bd88c882f6 Remove implementation details from stub flags in sdk snapshot
Previously, the build applied the same filtering to remove
implementation details from the sdk snapshot's stub-flags.csv file as
it did for its all-flags.csv, i.e. removing the signatures that only
had a "blocked" flag. Unfortunately, that had no effect on the stub
flags as the implementation signatures had no flags, not a single
blocked flag. That meant that the sdk snapshot's
filtered-stub-flags.csv file contained a lot of implementation details.

This change removes signatures from stub-flags.csv that have no flags
which removes all implementation details from the sdk snapshot.

Bug: 194063708
Test: atest --host verify_overlaps_test
      m out/soong/hiddenapi/hiddenapi-flags.csv
      m art-module-sdk
      # Check contents of its filtered-stub-flags.csv file
Change-Id: I30edc77348fad118ea732e787ae8e206c8841f84
2022-04-12 17:44:15 +01:00
Colin Cross
412436f7fe Don't panic if no certificates found
Getting the first certificate will panic if there are no certificates,
which can happen when AllowMissingDependencies is set and the
certificate property is a module reference to a missing module.
Only get the first certificate if the list is not nil.

Bug: 228379411
Test: TestAppMissingCertificateAllowMissingDependencies
Change-Id: I046d75dbbd4f21f4a2b6851f558e430e9879fcff
2022-04-11 11:50:34 -07:00
Colin Cross
abc0dab477 Move proguard test files to java package
The proguard test files are duplicated in apex and sysprop and will
be needed by app tests, move them to the java package.

Test: run all soong tests
Change-Id: Ie13817dcda8d98801d16a97ffceef1100c7d5380
2022-04-11 11:44:32 -07:00
Treehugger Robot
b6e1614272 Merge "convert logtags in java srcs" 2022-04-08 22:37:22 +00:00
Treehugger Robot
a2a7b57924 Merge changes from topic "export-vars"
* changes:
  export Java variables to Bazel
  refactor Bazel variable export
2022-04-08 17:31:23 +00:00
Sam Delmerico
24da73c032 convert logtags in java srcs
Some java_* modules contain .logtag files in their srcs, but we should
separate these out into their own targets.

Test: enabled QuickSearchBox and build
Change-Id: I595722ca59686d450ff522987a15ce283d3607e0
2022-04-08 14:43:18 +00:00
Sam Delmerico
932c01cf9e export Java variables to Bazel
Test: build/bazel/bp2build.sh
Change-Id: Ia06f9265c9f96e6add6edbd0cee925fe37b430d3
2022-04-08 14:15:43 +00:00
Paul Duffin
0c12b78ae8 Use named options for verify_overlaps
Previously, verify_overlaps used positional arguments, the first was
the monolithi flags and the rest were the module flag pairs (filtered
flags file and signature patterns file). This change makes them use
named options to make the purpose of the arguments clearer on the
command line.

Bug: 194063708
Test: atest --host verify_overlaps_test
      m out/soong/hiddenapi/hiddenapi-flags.csv
Change-Id: Ife0af0016eb0f91416e8330d5d98cb53c97d68a4
2022-04-08 10:56:21 +01:00
Isaac Chiou
c7bb9d47d6 Merge "Revert "Use kapt stubs for kotlin header jar for javac"" 2022-04-06 08:25:29 +00:00
Isaac Chiou
a23d994022 Revert "Use kapt stubs for kotlin header jar for javac"
This reverts commit c6ef485370.

Reason for revert: Multiple systemui presubmits are broken due to this change

Bug: 228262695
Change-Id: I1efed519c49d8d0583815c7bf2b3801bf0ba12fa
2022-04-06 07:04:09 +00:00
Wei Li
c055d88c16 Merge "Export provenance metadata for prebuilt APKs and APEXes." 2022-04-06 04:03:41 +00:00
Colin Cross
40f8c75752 Merge "Use kapt stubs for kotlin header jar for javac" 2022-04-05 23:59:34 +00:00
Colin Cross
bbf5f8c158 Merge "Enable turbine for api generating annotation processors when using kotlin" 2022-04-05 23:48:12 +00:00
Colin Cross
93d65fb60d Merge "Enable kotlin's jvm-abi-gen plugin to generate header jars" 2022-04-05 23:32:54 +00:00
Wei Li
340ee8e699 Export provenance metadata for prebuilt APKs and APEXes.
Bug: 217434690
Test: atest --host gen_provenance_metadata_test
Test: m provenance_metadata

Change-Id: I91c184b6e6fe5ccfc3fc65b55b09e7a3da9502a0
2022-04-05 16:16:16 -07:00
Colin Cross
209844ce1c Merge "Enable restat for sbox rules" 2022-04-05 22:49:10 +00:00
Treehugger Robot
ef03b3d8ba Merge "support errorprone javacflags" 2022-04-05 17:46:08 +00:00
Anton Hansson
71cf2a3cc6 Merge "Remove apex framework jars from hard-coded list" 2022-04-05 11:46:04 +00:00
Anton Hansson
51bbac2137 Remove apex framework jars from hard-coded list
All apex jars get auto-instrumented since
I2b1c0736202de26c5ea88c0ab14574bd7207a5fb

Test: $ EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true m nothing && \
      $ grep LOCAL_MODULE.*framework-sdkextensions.com.android.sdkext$ \
            out/soong/Android-aosp_coral.mk  -A9 -B2 | grep JACO
Change-Id: I1de5ba6673bef93b16c302412f920d93129d4420
2022-04-05 09:00:57 +00:00
Treehugger Robot
5f58c378b6 Merge "Keep dependency files out of the apk file." 2022-04-05 05:53:22 +00:00
Bob Badour
2c8888edef Keep dependency files out of the apk file.
Bug: 227682036

Test: TARGET_BUILD_VARIANT=userdebug UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true vendor/google/build/mainline_modules_bundles.sh -j97

Change-Id: I1a9775af7c652191bb1ce3b97c1cb9365b469c19
2022-04-04 19:21:18 -07:00
Colin Cross
c6ef485370 Use kapt stubs for kotlin header jar for javac
When compling kotlin code with annotation processors we are generating
java stubs for the kotlin sources using kapt, and parsing them in
turbine when running the annotation processors.  Passing --output
to turbine will also compile the stubs into a header jar that can
be used as a dependency to javac, allowing the javac and kotlinc
rules to run in parallel.  The turbine-apt header jar can't be used
as the header jar for downstream modules as it doesn't contain the
kotlin metadata needed by kotlinc rules, so the kotlinc gen-jvm-abi
plugin output is still used for the module's final header jar.

Test: TestKapt
Bug: 222095735
Change-Id: I82d0900f3dc30f3e3ebd7cab0693dfe741d9b955
2022-04-04 16:42:46 -07:00
Colin Cross
b5db401599 Enable turbine for api generating annotation processors when using kotlin
Normally turbine is disabled when an api generating annotation processor
is in use because the annotation processors are run in javac, so any
generated api would not be present in the turbine header jar.  When
compiling with kotlin and annotation processors, the annotation processors
(including any that generate api) are run in an extra turbine invocation
to generate sources to make the results visible to kotlinc, and so can
also be compiled by the normal turbine invocation.  Force turbine enabled
when kotlin sources are present.

Test: m SystemUI
Bug: 222095735
Change-Id: I5fcfe67e46cb4a4e90388f088327488959b6571f
2022-04-04 16:42:46 -07:00
Colin Cross
220a9a1245 Enable kotlin's jvm-abi-gen plugin to generate header jars
Kotlin's jvm-abi-gen plugin can generate header jars similar to the
turbine output for java sources, which can be used to avoid recompiling
downstream modules when the ABI hasn't changed.  Unlike turbine, the
plugin runs as part of the main kotlinc invocation, so it doesn't allow
the downstream modules to start compiling any sooner.

A future possible optimization is to use turbine to compile the kapt
stubs, at least for the  kotlin+annotation processor modules that already
generate them, which would allow compiling downstream modules before
invoking kotlinc or javac, as well as invoking kotlinc and javac in
parallel with each other.

Bug: 222095735
Test: TestKotlin
Test: m SystemUI
Change-Id: Ib1bb2ecea47c851a108a26f9ed4f827f289d1321
2022-04-04 16:42:46 -07:00
Colin Cross
e52c2ac7fb Enable restat for sbox rules
Add support to sbox for only writing output files if they are changed
to support enabling restat.  Move the clearing of the output directory
into sbox, and when write if changed is enabled delete obsolete output
files without deleting output files that will be replaced.

Enable restat for local metalava rules.  Restat for metalava rules
run remotely is still blocked on b/183630617.

Bug: 222095735
Test: TestRuleBuilder_Build
Test: m SystemUI
Change-Id: If8fc47e711f4a6f43947ab69f17cccc8ba6ae61a
2022-04-04 16:42:46 -07:00
Treehugger Robot
7a45d37e62 Merge "convert java_import jars with arch variants" 2022-04-04 16:06:55 +00:00
Bob Badour
3aae38d451 Merge "Revert "Revert "Build notice files from license metadata.""" 2022-04-02 00:43:34 +00:00