android_test defaults to using R8, but with shrinking, optimization and
obfuscation disabled, eliminating most of the benefits of R8. Instead,
use D8 by default, improving build performance and avoiding any other
issues that may arise in test-specific code related to whole-program R8
execution. An initial audit shows that android_test targets that *do*
enable shrinking or optimization also explicitly opt in to R8.
A follow-up CL will do the same for android_test_helper_app, but that
requires some additional auditing of downstream targets.
Bug: 192032291
Test: m + presubmit
Change-Id: I5b14a0986dde210f241a77c3a93daacf9e53d667
This reverts commit 0b1c70efbc.
The reverted commit was based on the idea that uses-libraries that are
explicitly specified in build files should not be implicitly added to
the manifest, as that would mean that anything added to the build files
will flow to the manifest.
Although this logic is correct, it prevents propagation of
uses-libraries from dependencies, which is wrong: if a library has an
explicit uses-library property in Android.bp, this property is expected
to be propagated to the library's dependencies. Failing to do so would
mean that every user of that library has to add uses-library property to
their build files, which doesn't scale (see b/214255490 for example).
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: I6f420e76a89aa2f37be99f877711736640f2c361
(cherry picked from commit 3953153c9e)
Previously, the .impl library of java_sdk_library modules would end up
with the jacocoagent statically included. That is because their
Instrument flag was set to true when created by their parent. As that
was before the deps were added that meant that they ended up with a
static dependency on jacoagent (at least when UnbundledBuild() was
true).
That was not previously a problem because the .impl files were only
used at build time. However, a recent change to make updatable-media
statically include framework-media.impl (which statically included the
jacocoagent classes) broke the coverage build because the jacocoagent
classes are not in the permitted packages for the updatable-media.
When instrumenting the bootclasspath the jacocoagent library is added
to the art-bootclasspath-fragment.
The jacocoagent should only be statically included in apps, or test
apps. This change adds an extra flag to specify whether the module type
supports statically including the jacocoagent. This is set to true by
apps and test apps but not when the java_sdk_library creates the .impl
java_library preventing it from statically including jacocoagent.
Bug: 230967146
Bug: 229932396
Test: COVERAGE_MODULES=media \
PRODUCT=mainline_modules_x86 \
TARGET_BUILD_APPS=com.google.android.media \
vendor/google/build/build_unbundled_coverage_mainline_module.sh
# Fails without this change, passes with it.
Merged-In: Ic95cf11a05f59b67e623474ed3dd9be6b4442c42
Change-Id: Ic95cf11a05f59b67e623474ed3dd9be6b4442c42
The kapt rule uses kotlincFlags but was not using kotlincDeps,
causing the rule to get the -Xplugin argument on the compose
compiler plugin jar, but not have a dependency on it.
Bug: 231222079
Test: TestKotlinCompose
Change-Id: I4c2cf30fb7d8cad4eededa29f67f4ffd459caa41
This CL also converts `external/rappor` (which already set `java_version` to `1.7`) to be bazelable to testify the changes.
Results from `b build //external/rappor && cat bazel-bin/external/rappor/librappor.jar-0.params`: https://paste.googleplex.com/5518725462622208.
Test: go test ./bp2build/...
Bug: 227618664
Change-Id: I8d370d4639f70fba51e6de6ceb7bcb5ace9ccd91
The Q and R runtimes can handle Q/R flags but not S flags. So, this
change verifies that any library that can run on Q/R
(min_sdk_version <= R) by adding --max-hiddenapi-level=max-target-r
to the "hiddenapi encode" command. That will cause a failure if any
S+ flags are found in the flags to encode.
Bug: 172453495
Test: m droid && launch_cvd
Cherry pick changes in https://r.android.com/q/topic:max-target-s
Add @UnsupportedAppUsage maxTargetSdk=S in classes in framework-permission (for r/q)
and framework-permission-s (nominally for S+). I had to incresed the min_sdk_version
in the latter to 31 (S) as it was still set at 30 (R).
Change-Id: Ie0f68482603adc7b4e3d7a5c81bf203d81a84a9e
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
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
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
- 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
- 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
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
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
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
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
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
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
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
This reverts commit c6ef485370.
Reason for revert: Multiple systemui presubmits are broken due to this change
Bug: 228262695
Change-Id: I1efed519c49d8d0583815c7bf2b3801bf0ba12fa