summaryrefslogtreecommitdiff
path: root/StubLibraries.bp
diff options
context:
space:
mode:
Diffstat (limited to 'StubLibraries.bp')
-rw-r--r--StubLibraries.bp465
1 files changed, 215 insertions, 250 deletions
diff --git a/StubLibraries.bp b/StubLibraries.bp
index 3eb482dc5dc5..64ee09cf5e05 100644
--- a/StubLibraries.bp
+++ b/StubLibraries.bp
@@ -16,12 +16,12 @@
//
// raw source files --(metalava)--> stub source files --(javac)--> stub jar files
//
-// The metalava conversion is done by droidstub modules *-api-stubs-docs.
-// The javac compilation is done by java_library modules android_*_stubs_current.
+// - The metalava conversion is done by droidstub modules
+// - The javac compilation is done by java_library modules
+//
// The metalava conversion is also responsible for creating API signature files
-// and comparing them against the last API signature in api/*-current.txt files
-// and also against the latest frozen API signature in prebuilts/sdk/*/*/api/android.txt
-// files.
+// and comparing them against the checked in API signature, and also checking compatibility
+// with the latest frozen API signature.
/////////////////////////////////////////////////////////////////////
// Common metalava configs
@@ -41,20 +41,52 @@ packages_to_document = [
]
stubs_defaults {
- name: "metalava-base-api-stubs-default",
+ name: "metalava-non-updatable-api-stubs-default",
srcs: [
":framework-non-updatable-sources",
"core/java/**/*.logtags",
":opt-telephony-srcs",
":opt-net-voip-srcs",
- ":art-module-public-api-stubs-source",
- ":android_icu4j_public_api_files",
+ "**/package.html",
],
+ sdk_version: "none",
+ system_modules: "none",
+ java_version: "1.8",
+ arg_files: ["core/res/AndroidManifest.xml"],
// TODO(b/147699819): remove below aidl includes.
aidl: {
- local_include_dirs: ["telephony/java"],
+ local_include_dirs: [
+ "apex/media/aidl/stable",
+ "telephony/java",
+ ],
},
- libs: ["framework-internal-utils"],
+ // These are libs from framework-internal-utils that are required (i.e. being referenced)
+ // from framework-non-updatable-sources. Add more here when there's a need.
+ // DO NOT add the entire framework-internal-utils. It might cause unnecessary circular
+ // dependencies gets bigger.
+ libs: [
+ "android.hardware.cas-V1.2-java",
+ "android.hardware.health-V1.0-java-constants",
+ "android.hardware.radio-V1.5-java",
+ "android.hardware.radio-V1.6-java",
+ "android.hardware.thermal-V1.0-java-constants",
+ "android.hardware.thermal-V2.0-java",
+ "android.hardware.tv.input-V1.0-java-constants",
+ "android.hardware.tv.tuner-V1.0-java-constants",
+ "android.hardware.usb-V1.0-java-constants",
+ "android.hardware.usb-V1.1-java-constants",
+ "android.hardware.usb.gadget-V1.0-java",
+ "android.hardware.vibrator-V1.3-java",
+ "framework-protos",
+ "stable.core.platform.api.stubs",
+ // There are a few classes from modules used as type arguments that
+ // need to be resolved by metalava. For now, we can use a previously
+ // finalized stub library to resolve them. If a new class gets added,
+ // this may be need to be revisited to use a manually maintained stub
+ // library with empty classes in order to resolve those references.
+ "sdk_system_30_android",
+ ],
+ high_mem: true, // Lots of sources => high memory use, see b/170701554
installable: false,
annotations_enabled: true,
previous_api: ":android.api.public.latest",
@@ -65,247 +97,185 @@ stubs_defaults {
filter_packages: packages_to_document,
}
-stubs_defaults {
- name: "metalava-full-api-stubs-default",
- defaults: ["metalava-base-api-stubs-default"],
- srcs: [
- ":conscrypt.module.public.api{.public.stubs.source}",
- ":framework-updatable-sources",
- ],
- sdk_version: "core_platform",
-}
-
-stubs_defaults {
- name: "metalava-non-updatable-api-stubs-default",
- defaults: ["metalava-base-api-stubs-default"],
- sdk_version: "core_platform",
- // There are a few classes from modules used as type arguments that
- // need to be resolved by metalava. For now, we can use a previously
- // finalized stub library to resolve them. If a new class gets added,
- // this may be need to be revisited to use a manually maintained stub
- // library with empty classes in order to resolve those references.
- libs: ["sdk_system_30_android"],
- aidl: {
- local_include_dirs: ["apex/media/aidl/stable"],
- },
-}
-
/////////////////////////////////////////////////////////////////////
-// *-api-stubs-docs modules providing source files for the stub libraries
+// These modules provide source files for the stub libraries
/////////////////////////////////////////////////////////////////////
-// api-stubs-docs, system-api-stubs-docs, and test-api-stubs-docs have APIs
-// from the non-updatable part of the platform as well as from the updatable
-// modules
droidstubs {
- name: "api-stubs-docs",
- defaults: ["metalava-full-api-stubs-default"],
- removed_dex_api_filename: "removed-dex.txt",
- arg_files: [
- "core/res/AndroidManifest.xml",
- ],
+ name: "api-stubs-docs-non-updatable",
+ defaults: ["metalava-non-updatable-api-stubs-default"],
args: metalava_framework_docs_args,
check_api: {
current: {
- api_file: "api/current.txt",
- removed_api_file: "api/removed.txt",
+ api_file: "core/api/current.txt",
+ removed_api_file: "core/api/removed.txt",
},
last_released: {
- api_file: ":android.api.public.latest",
- removed_api_file: ":removed.api.public.latest",
+ api_file: ":android-non-updatable.api.public.latest",
+ removed_api_file: ":android-non-updatable-removed.api.public.latest",
baseline_file: ":public-api-incompatibilities-with-last-released",
},
api_lint: {
enabled: true,
- new_since: ":android.api.public.latest",
- baseline_file: "api/lint-baseline.txt",
+ new_since: ":android-non-updatable.api.public.latest",
},
},
- dist: {
- targets: ["sdk", "win_sdk"],
- dir: "apistubs/android/public/api",
- dest: "android.txt",
- },
- jdiff_enabled: true,
-}
-
-droidstubs {
- name: "api-stubs-docs-non-updatable",
- defaults: ["metalava-non-updatable-api-stubs-default"],
- arg_files: ["core/res/AndroidManifest.xml"],
- args: metalava_framework_docs_args,
- check_api: {
- current: {
- api_file: "non-updatable-api/current.txt",
- removed_api_file: "non-updatable-api/removed.txt",
+ dists: [
+ {
+ targets: ["sdk", "win_sdk"],
+ dir: "apistubs/android/public/api",
+ dest: "android-non-updatable.txt",
+ tag: ".api.txt",
},
- api_lint: {
- enabled: true,
- new_since: ":android-non-updatable.api.public.latest",
+ {
+ targets: ["sdk", "win_sdk"],
+ dir: "apistubs/android/public/api",
+ dest: "android-non-updatable-removed.txt",
+ tag: ".removed-api.txt",
},
- },
+ ],
}
-priv_apps = " " +
- "--show-annotation android.annotation.SystemApi\\(" +
+priv_apps =
+ " --show-annotation android.annotation.SystemApi\\(" +
+ "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
+ "\\)"
+
+priv_apps_in_stubs =
+ " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
"client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
- "\\) "
+ "\\)"
-module_libs = " " +
+test = " --show-annotation android.annotation.TestApi"
+
+module_libs =
" --show-annotation android.annotation.SystemApi\\(" +
"client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
- "\\) "
+ "\\)"
droidstubs {
- name: "system-api-stubs-docs",
- defaults: ["metalava-full-api-stubs-default"],
- removed_dex_api_filename: "system-removed-dex.txt",
- arg_files: [
- "core/res/AndroidManifest.xml",
- ],
+ name: "system-api-stubs-docs-non-updatable",
+ defaults: ["metalava-non-updatable-api-stubs-default"],
args: metalava_framework_docs_args + priv_apps,
check_api: {
current: {
- api_file: "api/system-current.txt",
- removed_api_file: "api/system-removed.txt",
+ api_file: "core/api/system-current.txt",
+ removed_api_file: "core/api/system-removed.txt",
},
last_released: {
- api_file: ":android.api.system.latest",
- removed_api_file: ":removed.api.system.latest",
+ api_file: ":android-non-updatable.api.system.latest",
+ removed_api_file: ":android-non-updatable-removed.api.system.latest",
baseline_file: ":system-api-incompatibilities-with-last-released"
},
api_lint: {
enabled: true,
- new_since: ":android.api.system.latest",
- baseline_file: "api/system-lint-baseline.txt",
+ new_since: ":android-non-updatable.api.system.latest",
+ baseline_file: "core/api/system-lint-baseline.txt",
},
},
- dist: {
- targets: ["sdk", "win_sdk"],
- dir: "apistubs/android/system/api",
- dest: "android.txt",
- },
- jdiff_enabled: true,
-}
-
-droidstubs {
- name: "system-api-stubs-docs-non-updatable",
- defaults: ["metalava-non-updatable-api-stubs-default"],
- arg_files: ["core/res/AndroidManifest.xml"],
- args: metalava_framework_docs_args + priv_apps,
- check_api: {
- current: {
- api_file: "non-updatable-api/system-current.txt",
- removed_api_file: "non-updatable-api/system-removed.txt",
+ dists: [
+ {
+ targets: ["sdk", "win_sdk"],
+ dir: "apistubs/android/system/api",
+ dest: "android-non-updatable.txt",
+ tag: ".api.txt",
},
- api_lint: {
- enabled: true,
- new_since: ":android-non-updatable.api.system.latest",
- baseline_file: "non-updatable-api/system-lint-baseline.txt",
+ {
+ targets: ["sdk", "win_sdk"],
+ dir: "apistubs/android/system/api",
+ dest: "android-non-updatable-removed.txt",
+ tag: ".removed-api.txt",
},
- },
+ ],
}
droidstubs {
- name: "test-api-stubs-docs",
- defaults: ["metalava-full-api-stubs-default"],
- arg_files: [
- "core/res/AndroidManifest.xml",
- ],
- args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
+ name: "test-api-stubs-docs-non-updatable",
+ defaults: ["metalava-non-updatable-api-stubs-default"],
+ args: metalava_framework_docs_args + test + priv_apps_in_stubs,
check_api: {
current: {
- api_file: "api/test-current.txt",
- removed_api_file: "api/test-removed.txt",
+ api_file: "core/api/test-current.txt",
+ removed_api_file: "core/api/test-removed.txt",
},
api_lint: {
enabled: true,
- baseline_file: "api/test-lint-baseline.txt",
+ baseline_file: "core/api/test-lint-baseline.txt",
},
},
- dist: {
- targets: ["sdk", "win_sdk"],
- dir: "apistubs/android/test/api",
- dest: "android.txt",
- },
-}
-
-/////////////////////////////////////////////////////////////////////
-// Following droidstubs modules are for extra APIs for modules.
-// The framework currently have two more API surfaces for modules:
-// @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES)
-/////////////////////////////////////////////////////////////////////
-
-// TODO(b/146727827) remove the *-api module when we can teach metalava
-// about the relationship among the API surfaces. Currently, these modules are only to generate
-// the API signature files and ensure that the APIs evolve in a backwards compatible manner.
-// They however are NOT used for building the API stub.
-
-droidstubs {
- name: "module-lib-api",
- defaults: ["metalava-full-api-stubs-default"],
- arg_files: ["core/res/AndroidManifest.xml"],
- args: metalava_framework_docs_args + module_libs,
- check_api: {
- current: {
- api_file: "api/module-lib-current.txt",
- removed_api_file: "api/module-lib-removed.txt",
+ dists: [
+ {
+ targets: ["sdk", "win_sdk"],
+ dir: "apistubs/android/test/api",
+ dest: "android.txt",
+ tag: ".api.txt",
},
- last_released: {
- api_file: ":android.api.module-lib.latest",
- removed_api_file: ":removed.api.module-lib.latest",
- baseline_file: ":module-lib-api-incompatibilities-with-last-released"
+ {
+ targets: ["sdk", "win_sdk"],
+ dir: "apistubs/android/test/api",
+ dest: "removed.txt",
+ tag: ".removed-api.txt",
},
- api_lint: {
- enabled: true,
- new_since: ":android.api.module-lib.latest",
- baseline_file: "api/module-lib-lint-baseline.txt",
+ {
+ targets: ["sdk", "win_sdk"],
+ dir: "apistubs/android/test/api",
+ dest: "android-non-updatable.txt",
+ tag: ".api.txt",
},
- },
- dist: {
- targets: ["sdk", "win_sdk"],
- dir: "apistubs/android/module-lib/api",
- dest: "android.txt",
- },
+ {
+ targets: ["sdk", "win_sdk"],
+ dir: "apistubs/android/test/api",
+ dest: "android-non-updatable-removed.txt",
+ tag: ".removed-api.txt",
+ },
+ ],
}
droidstubs {
name: "module-lib-api-stubs-docs-non-updatable",
defaults: ["metalava-non-updatable-api-stubs-default"],
- arg_files: ["core/res/AndroidManifest.xml"],
- args: metalava_framework_docs_args + module_libs,
+ args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
check_api: {
current: {
- api_file: "non-updatable-api/module-lib-current.txt",
- removed_api_file: "non-updatable-api/module-lib-removed.txt",
+ api_file: "core/api/module-lib-current.txt",
+ removed_api_file: "core/api/module-lib-removed.txt",
+ },
+ last_released: {
+ api_file: ":android-non-updatable.api.module-lib.latest",
+ removed_api_file: ":android-non-updatable-removed.api.module-lib.latest",
},
api_lint: {
enabled: true,
new_since: ":android-non-updatable.api.module-lib.latest",
},
},
-}
-
-// The following droidstub module generates source files for the API stub library for
-// modules. Note that it not only includes its own APIs but also other APIs that have
-// narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES').
-
-droidstubs {
- name: "module-lib-api-stubs-docs",
- defaults: ["metalava-non-updatable-api-stubs-default"],
- arg_files: ["core/res/AndroidManifest.xml"],
- args: metalava_framework_docs_args + priv_apps + module_libs,
+ dists: [
+ {
+ targets: ["sdk", "win_sdk"],
+ dir: "apistubs/android/module-lib/api",
+ dest: "android-non-updatable.txt",
+ tag: ".api.txt",
+ },
+ {
+ targets: ["sdk", "win_sdk"],
+ dir: "apistubs/android/module-lib/api",
+ dest: "android-non-updatable-removed.txt",
+ tag: ".removed-api.txt",
+ },
+ ],
}
/////////////////////////////////////////////////////////////////////
// android_*_stubs_current modules are the stubs libraries compiled
-// from *-api-stubs-docs
+// from stub sources
/////////////////////////////////////////////////////////////////////
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
],
errorprone: {
@@ -313,24 +283,26 @@ java_defaults {
"-XepDisableAllChecks",
],
},
- java_resources: [":notices-for-framework-stubs"],
sdk_version: "none",
system_modules: "none",
java_version: "1.8",
compile_dex: true,
}
-java_library_static {
- name: "android_monolith_stubs_current",
- srcs: [ ":api-stubs-docs" ],
- static_libs: [ "private-stub-annotations-jar" ],
- defaults: ["android_defaults_stubs_current"],
+java_defaults {
+ name: "android_stubs_dists_default",
+ dist: {
+ targets: ["sdk", "win_sdk"],
+ tag: ".jar",
+ dest: "android.jar",
+ },
}
java_library_static {
- name: "android_merged_stubs_current",
+ name: "android_stubs_current",
srcs: [ ":api-stubs-docs-non-updatable" ],
static_libs: [
+ "art.module.public.api.stubs",
"conscrypt.module.public.api.stubs",
"framework-media.stubs",
"framework-mediaprovider.stubs",
@@ -339,28 +311,17 @@ java_library_static {
"framework-statsd.stubs",
"framework-tethering.stubs",
"framework-wifi.stubs",
+ "i18n.module.public.api.stubs",
"private-stub-annotations-jar",
],
defaults: ["android_defaults_stubs_current"],
}
java_library_static {
- name: "android_stubs_current",
- static_libs: ["android_merged_stubs_current"],
- defaults: ["android_defaults_stubs_current"],
-}
-
-java_library_static {
- name: "android_system_monolith_stubs_current",
- srcs: [ ":system-api-stubs-docs" ],
- static_libs: [ "private-stub-annotations-jar" ],
- defaults: ["android_defaults_stubs_current"],
-}
-
-java_library_static {
- name: "android_system_merged_stubs_current",
+ name: "android_system_stubs_current",
srcs: [ ":system-api-stubs-docs-non-updatable" ],
static_libs: [
+ "art.module.public.api.stubs",
"conscrypt.module.public.api.stubs",
"framework-media.stubs.system",
"framework-mediaprovider.stubs.system",
@@ -369,43 +330,73 @@ java_library_static {
"framework-statsd.stubs.system",
"framework-tethering.stubs.system",
"framework-wifi.stubs.system",
+ "i18n.module.public.api.stubs",
"private-stub-annotations-jar",
],
- defaults: ["android_defaults_stubs_current"],
-}
-
-java_library_static {
- name: "android_system_stubs_current",
- static_libs: ["android_system_merged_stubs_current"],
- defaults: ["android_defaults_stubs_current"],
+ defaults: [
+ "android_defaults_stubs_current",
+ "android_stubs_dists_default",
+ ],
+ dist: {
+ dir: "apistubs/android/system",
+ },
+ dists: [
+ {
+ // Legacy dist path
+ targets: ["sdk", "win_sdk"],
+ tag: ".jar",
+ dest: "android_system.jar",
+ },
+ ],
}
java_library_static {
name: "android_test_stubs_current",
- srcs: [ ":test-api-stubs-docs" ],
- static_libs: [ "private-stub-annotations-jar" ],
- defaults: ["android_defaults_stubs_current"],
+ srcs: [ ":test-api-stubs-docs-non-updatable" ],
+ static_libs: [
+ // Modules do not have test APIs, but we want to include their SystemApis, like we include
+ // the SystemApi of framework-non-updatable-sources.
+ "art.module.public.api.stubs",
+ "conscrypt.module.public.api.stubs",
+ "framework-media.stubs.system",
+ "framework-mediaprovider.stubs.system",
+ "framework-permission.stubs.system",
+ "framework-sdkextensions.stubs.system",
+ "framework-statsd.stubs.system",
+ "framework-tethering.stubs.system",
+ "framework-wifi.stubs.system",
+ "i18n.module.public.api.stubs",
+ "private-stub-annotations-jar",
+ ],
+ defaults: [
+ "android_defaults_stubs_current",
+ "android_stubs_dists_default",
+ ],
+ dist: {
+ dir: "apistubs/android/test",
+ },
+ dists: [
+ {
+ // Legacy dist path
+ targets: ["sdk", "win_sdk"],
+ tag: ".jar",
+ dest: "android_test.jar",
+ },
+ ],
}
java_library_static {
name: "android_module_lib_stubs_current",
- srcs: [ ":module-lib-api-stubs-docs" ],
- defaults: ["android_defaults_stubs_current"],
- libs: ["sdk_system_29_android"],
-}
-
-java_library_static {
- name: "android_non_updatable_stubs_current",
- srcs: [":api-stubs-docs-non-updatable"],
- defaults: ["android_defaults_stubs_current"],
- libs: ["sdk_system_29_android"],
-}
-
-java_library_static {
- name: "android_system_non_updatable_stubs_current",
- srcs: [":system-api-stubs-docs-non-updatable"],
- defaults: ["android_defaults_stubs_current"],
+ srcs: [ ":module-lib-api-stubs-docs-non-updatable" ],
+ defaults: [
+ "android_defaults_stubs_current",
+ "android_stubs_dists_default",
+ ],
libs: ["sdk_system_29_android"],
+ static_libs: ["art.module.public.api.stubs"],
+ dist: {
+ dir: "apistubs/android/module-lib",
+ },
}
/////////////////////////////////////////////////////////////////////
@@ -450,29 +441,3 @@ java_library_static {
":hwbinder-stubs-docs",
],
}
-
-/////////////////////////////////////////////////////////////////////
-// api/*-current.txt files for use by modules in other directories
-// like the CTS test
-/////////////////////////////////////////////////////////////////////
-
-filegroup {
- name: "frameworks-base-api-current.txt",
- srcs: [
- "api/current.txt",
- ],
-}
-
-filegroup {
- name: "frameworks-base-api-system-current.txt",
- srcs: [
- "api/system-current.txt",
- ],
-}
-
-filegroup {
- name: "frameworks-base-api-system-removed.txt",
- srcs: [
- "api/system-removed.txt",
- ],
-}