Merge "Cleanup in StubLibraries.bp"

This commit is contained in:
Anton Hansson
2020-11-18 14:15:30 +00:00
committed by Gerrit Code Review

View File

@@ -16,12 +16,12 @@
// //
// raw source files --(metalava)--> stub source files --(javac)--> stub jar files // raw source files --(metalava)--> stub source files --(javac)--> stub jar files
// //
// The metalava conversion is done by droidstub modules *-api-stubs-docs. // - The metalava conversion is done by droidstub modules
// The javac compilation is done by java_library modules android_*_stubs_current. // - The javac compilation is done by java_library modules
//
// The metalava conversion is also responsible for creating API signature files // 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 comparing them against the checked in API signature, and also checking compatibility
// and also against the latest frozen API signature in prebuilts/sdk/*/*/api/android.txt // with the latest frozen API signature.
// files.
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// Common metalava configs // Common metalava configs
@@ -41,7 +41,7 @@ packages_to_document = [
] ]
stubs_defaults { stubs_defaults {
name: "metalava-base-api-stubs-default", name: "metalava-non-updatable-api-stubs-default",
srcs: [ srcs: [
":framework-non-updatable-sources", ":framework-non-updatable-sources",
"core/java/**/*.logtags", "core/java/**/*.logtags",
@@ -51,9 +51,14 @@ stubs_defaults {
":android_icu4j_public_api_files", ":android_icu4j_public_api_files",
"**/package.html", "**/package.html",
], ],
sdk_version: "core_platform",
arg_files: ["core/res/AndroidManifest.xml"],
// TODO(b/147699819): remove below aidl includes. // TODO(b/147699819): remove below aidl includes.
aidl: { aidl: {
local_include_dirs: ["telephony/java"], local_include_dirs: [
"apex/media/aidl/stable",
"telephony/java",
],
}, },
// These are libs from framework-internal-utils that are required (i.e. being referenced) // 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. // from framework-non-updatable-sources. Add more here when there's a need.
@@ -72,6 +77,12 @@ stubs_defaults {
"android.hardware.usb.gadget-V1.0-java", "android.hardware.usb.gadget-V1.0-java",
"android.hardware.vibrator-V1.3-java", "android.hardware.vibrator-V1.3-java",
"framework-protos", "framework-protos",
// 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 high_mem: true, // Lots of sources => high memory use, see b/170701554
installable: false, installable: false,
@@ -84,31 +95,6 @@ stubs_defaults {
filter_packages: packages_to_document, 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"],
},
}
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// These modules provide source files for the stub libraries // These modules provide source files for the stub libraries
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
@@ -116,7 +102,6 @@ stubs_defaults {
droidstubs { droidstubs {
name: "api-stubs-docs-non-updatable", name: "api-stubs-docs-non-updatable",
defaults: ["metalava-non-updatable-api-stubs-default"], defaults: ["metalava-non-updatable-api-stubs-default"],
arg_files: ["core/res/AndroidManifest.xml"],
args: metalava_framework_docs_args, args: metalava_framework_docs_args,
check_api: { check_api: {
current: { current: {
@@ -135,23 +120,26 @@ droidstubs {
}, },
} }
priv_apps = " " + priv_apps =
"--show-annotation android.annotation.SystemApi\\(" +
"client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
"\\) "
module_libs = " " +
" --show-annotation android.annotation.SystemApi\\(" + " --show-annotation android.annotation.SystemApi\\(" +
"client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" + "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
"\\)" + "\\)"
priv_apps_in_stubs =
" --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" + " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
"client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" + "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
"\\) " "\\)"
test = " --show-annotation android.annotation.TestApi"
module_libs =
" --show-annotation android.annotation.SystemApi\\(" +
"client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
"\\)"
droidstubs { droidstubs {
name: "system-api-stubs-docs-non-updatable", name: "system-api-stubs-docs-non-updatable",
defaults: ["metalava-non-updatable-api-stubs-default"], defaults: ["metalava-non-updatable-api-stubs-default"],
arg_files: ["core/res/AndroidManifest.xml"],
args: metalava_framework_docs_args + priv_apps, args: metalava_framework_docs_args + priv_apps,
check_api: { check_api: {
current: { current: {
@@ -174,14 +162,7 @@ droidstubs {
droidstubs { droidstubs {
name: "test-api-stubs-docs-non-updatable", name: "test-api-stubs-docs-non-updatable",
defaults: ["metalava-non-updatable-api-stubs-default"], defaults: ["metalava-non-updatable-api-stubs-default"],
arg_files: [ args: metalava_framework_docs_args + test + priv_apps_in_stubs,
"core/res/AndroidManifest.xml",
],
args: metalava_framework_docs_args
+ " --show-annotation android.annotation.TestApi"
+ " --show-for-stub-purposes-annotation android.annotation.SystemApi\\("
+ "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS"
+ "\\)",
check_api: { check_api: {
current: { current: {
api_file: "core/api/test-current.txt", api_file: "core/api/test-current.txt",
@@ -199,16 +180,10 @@ droidstubs {
}, },
} }
/////////////////////////////////////////////////////////////////////
// Following droidstub module for extra APIs for modules,
// namely @SystemApi(client=MODULE_LIBRARIES) APIs.
/////////////////////////////////////////////////////////////////////
droidstubs { droidstubs {
name: "module-lib-api-stubs-docs-non-updatable", name: "module-lib-api-stubs-docs-non-updatable",
defaults: ["metalava-non-updatable-api-stubs-default"], defaults: ["metalava-non-updatable-api-stubs-default"],
arg_files: ["core/res/AndroidManifest.xml"], args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
args: metalava_framework_docs_args + priv_apps + module_libs,
check_api: { check_api: {
current: { current: {
api_file: "core/api/module-lib-current.txt", api_file: "core/api/module-lib-current.txt",
@@ -227,7 +202,7 @@ droidstubs {
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// android_*_stubs_current modules are the stubs libraries compiled // android_*_stubs_current modules are the stubs libraries compiled
// from *-api-stubs-docs // from stub sources
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
java_defaults { java_defaults {