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
diff --git a/Android.bp b/Android.bp
index 8520d40..7241417 100644
--- a/Android.bp
+++ b/Android.bp
@@ -163,7 +163,7 @@
}
filegroup {
- name: "framework-srcs",
+ name: "framework-non-updatable-sources",
srcs: [
// Java/AIDL sources under frameworks/base
":framework-core-sources",
@@ -211,6 +211,14 @@
],
}
+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 @@
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 @@
java_library {
name: "framework",
defaults: ["framework-defaults"],
+ srcs: [":framework-non-updatable-sources"],
javac_shard_size: 150,
required: [
"framework-platform-compat-config",
@@ -365,8 +371,16 @@
}
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 @@
// 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 @@
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 @@
"api-versions-jars-dir",
],
sdk_version: "core_platform",
+ filter_packages: packages_to_document,
}
droidstubs {
@@ -1465,7 +1491,7 @@
// annotations to private apis
aidl_mapping {
name: "framework-aidl-mappings",
- srcs: [":framework-srcs"],
+ srcs: [":framework-all-sources"],
output: "framework-aidl-mappings.txt",
}