Use filter_packages to unbunden metalava

This change fixes a problem that entire framework source files are given
to metalava even when many of the source files are not for public. Using
the new property filter_packages, only source files that belongs to the
public packages are given to metalava.

This CL also changes the name of the filegroup 'framework-srcs' to
'framework-non-updatable-sources' to better describe its contents. In
addition, a build-time only library 'framework-all' is introduced. This
library produces a header jar for all framework sources for both
non-updatable and updatable parts. It is put to the classpath when
invoking metalava to give information on the hidden classes that were
filtered-out.

Bug: 140764681
Test: m
Change-Id: I6e16679109ac07820e35037754d4327442c014f2
This commit is contained in:
Jiyong Park 2019-09-15 20:19:02 +09:00
parent 763cb4638a
commit ae9972bda4
4 changed files with 38 additions and 12 deletions

View File

@ -163,7 +163,7 @@ filegroup {
}
filegroup {
name: "framework-srcs",
name: "framework-non-updatable-sources",
srcs: [
// Java/AIDL sources under frameworks/base
":framework-core-sources",
@ -211,6 +211,14 @@ filegroup {
],
}
filegroup {
name: "framework-all-sources",
srcs: [
":framework-non-updatable-sources",
":updatable-media-srcs",
],
}
java_defaults {
name: "framework-aidl-export-defaults",
aidl: {
@ -283,15 +291,12 @@ java_defaults {
defaults: ["framework-aidl-export-defaults"],
installable: true,
srcs: [
":framework-srcs",
"core/java/**/*.logtags",
],
aidl: {
generate_get_transaction_name: true,
},
srcs: ["core/java/**/*.logtags"],
exclude_srcs: [
// See comment on framework-atb-backward-compatibility module below
"core/java/android/content/pm/AndroidTestBaseUpdater.java",
@ -356,6 +361,7 @@ filegroup {
java_library {
name: "framework",
defaults: ["framework-defaults"],
srcs: [":framework-non-updatable-sources"],
javac_shard_size: 150,
required: [
"framework-platform-compat-config",
@ -364,9 +370,17 @@ java_library {
],
}
java_library {
name: "framework-all",
defaults: ["framework-defaults"],
srcs: [":framework-all-sources"],
installable: false,
}
java_library {
name: "framework-annotation-proc",
defaults: ["framework-defaults"],
srcs: [":framework-all-sources"],
installable: false,
plugins: [
"unsupportedappusage-annotation-processor",
@ -878,10 +892,21 @@ metalava_framework_docs_args += " --replace-documentation " +
// replacement (with $1, $2 backreferences to the regex groups)
"'$$1https://docs.oracle.com/javase/8/docs/$$2\">' "
packages_to_document = [
"android",
"java",
"javax",
"org.apache.http",
"org.json",
"org.w3c.dom",
"org.xml.sax",
"org.xmlpull",
]
stubs_defaults {
name: "framework-doc-stubs-default",
srcs: [
":framework-srcs",
":framework-non-updatable-sources",
"core/java/**/*.logtags",
"test-base/src/**/*.java",
":opt-telephony-srcs",
@ -945,7 +970,7 @@ doc_defaults {
stubs_defaults {
name: "metalava-api-stubs-default",
srcs: [
":framework-srcs",
":framework-non-updatable-sources",
"core/java/**/*.logtags",
":opt-telephony-srcs",
":opt-net-voip-srcs",
@ -967,6 +992,7 @@ stubs_defaults {
"api-versions-jars-dir",
],
sdk_version: "core_platform",
filter_packages: packages_to_document,
}
droidstubs {
@ -1465,7 +1491,7 @@ filegroup {
// annotations to private apis
aidl_mapping {
name: "framework-aidl-mappings",
srcs: [":framework-srcs"],
srcs: [":framework-all-sources"],
output: "framework-aidl-mappings.txt",
}

View File

@ -18,7 +18,7 @@ java_sdk_library {
name: "com.android.location.provider",
srcs: [
"java/**/*.java",
":framework-srcs",
":framework-all-sources",
],
api_packages: ["com.android.location.provider"],
}

View File

@ -18,7 +18,7 @@ java_sdk_library {
name: "com.android.mediadrm.signer",
srcs: [
"java/**/*.java",
":framework-srcs",
":framework-all-sources",
],
api_packages: ["com.android.mediadrm.signer"],
}

View File

@ -21,7 +21,7 @@ java_sdk_library {
srcs: [
"src/**/*.java",
":framework-srcs",
":framework-all-sources",
],
api_packages: [