Compile android-non-updatable separately

The java stubs for android-non-updatable were previously only compiled
into the "main android stubs" target. This change refactors the build so
that we compile android-non-updatable stubs as a separate jar file. That
jar is then statically included into the main android stubs, making it
effectively a noop for the existing stub.

This has the benefit of making it possible to finalize the
android-non-updatable when the rest of the SDK artifacts are frozen,
so that we can later re-create android.jar with a mix of different
android-non-updatable and module stubs.

Bug: 184839599
Test: `m sdk dist` && diff -r out/apistubs{before,after}
Change-Id: I624e2e7ab5723eb5e27cf26dbe247aac2a799b72
This commit is contained in:
Anton Hansson
2021-04-09 10:16:19 +01:00
parent 6603593474
commit a4748cd10d

View File

@@ -299,13 +299,9 @@ modules_system_stubs = [
]
java_defaults {
name: "android_defaults_stubs_current",
libs: [ "stub-annotations" ],
static_libs: [
// License notices from art module
"art-notices-for-framework-stubs-jar",
"framework-res-package-jar", // Export package of framework-res
],
name: "android-non-updatable_defaults_stubs_current",
libs: ["stub-annotations"],
static_libs: ["framework-res-package-jar"], // Export package of framework-res
errorprone: {
javacflags: [
"-XepDisableAllChecks",
@@ -317,6 +313,47 @@ java_defaults {
compile_dex: true,
}
java_library_static {
name: "android-non-updatable.stubs",
defaults: ["android-non-updatable_defaults_stubs_current"],
srcs: [":api-stubs-docs-non-updatable"],
libs: modules_public_stubs,
}
java_library_static {
name: "android-non-updatable.stubs.system",
defaults: ["android-non-updatable_defaults_stubs_current"],
srcs: [ ":system-api-stubs-docs-non-updatable" ],
libs: modules_system_stubs,
}
java_library_static {
name: "android-non-updatable.stubs.module_lib",
defaults: ["android-non-updatable_defaults_stubs_current"],
srcs: [":module-lib-api-stubs-docs-non-updatable"],
libs: [
"sdk_system_current_android",
// NOTE: The below can be removed once the prebuilt stub contains IKE.
"sdk_system_current_android.net.ipsec.ike",
],
}
java_library_static {
name: "android-non-updatable.stubs.test",
defaults: ["android-non-updatable_defaults_stubs_current"],
srcs: [":test-api-stubs-docs-non-updatable"],
libs: modules_system_stubs,
}
java_defaults {
name: "android_defaults_stubs_current",
static_libs: ["art-notices-for-framework-stubs-jar"], // License notices from art module
sdk_version: "none",
system_modules: "none",
java_version: "1.8",
compile_dex: true,
}
java_defaults {
name: "android_stubs_dists_default",
dist: {
@@ -328,8 +365,8 @@ java_defaults {
java_library_static {
name: "android_stubs_current",
srcs: [ ":api-stubs-docs-non-updatable" ],
static_libs: modules_public_stubs + [
"android-non-updatable.stubs",
"private-stub-annotations-jar",
],
defaults: ["android_defaults_stubs_current"],
@@ -337,8 +374,8 @@ java_library_static {
java_library_static {
name: "android_system_stubs_current",
srcs: [ ":system-api-stubs-docs-non-updatable" ],
static_libs: modules_system_stubs + [
"android-non-updatable.stubs.system",
"private-stub-annotations-jar",
],
defaults: [
@@ -360,10 +397,10 @@ java_library_static {
java_library_static {
name: "android_test_stubs_current",
srcs: [ ":test-api-stubs-docs-non-updatable" ],
// Modules do not have test APIs, but we want to include their SystemApis, like we include
// the SystemApi of framework-non-updatable-sources.
static_libs: modules_system_stubs + [
"android-non-updatable.stubs.test",
"private-stub-annotations-jar",
],
defaults: [
@@ -385,17 +422,14 @@ java_library_static {
java_library_static {
name: "android_module_lib_stubs_current",
srcs: [ ":module-lib-api-stubs-docs-non-updatable" ],
defaults: [
"android_defaults_stubs_current",
"android_stubs_dists_default",
],
libs: [
"sdk_system_current_android",
// NOTE: The below can be removed once the prebuilt stub contains IKE.
"sdk_system_current_android.net.ipsec.ike",
static_libs: [
"android-non-updatable.stubs.module_lib",
"art.module.public.api.stubs",
],
static_libs: ["art.module.public.api.stubs"],
dist: {
dir: "apistubs/android/module-lib",
},