Merge changes Ib1a1d1bb,If0362c6d,I6018791a,Id81c93ea,I7704a884, ...
* changes: Create a filegroup for public stub sources Minor refactorings in api.go Convert merged module lib stub to api.go Some minor tweaks for api.go Temporarily add support for conditional modules Construct sdk-annotations.zip programmatically Replace manual genrule modules with combined_apis
This commit is contained in:
21
Android.bp
21
Android.bp
@@ -140,27 +140,6 @@ filegroup {
|
||||
],
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "framework-updatable-stubs-module_libs_api",
|
||||
static_libs: [
|
||||
"android.net.ipsec.ike.stubs.module_lib",
|
||||
"framework-appsearch.stubs.module_lib",
|
||||
"framework-connectivity.stubs.module_lib",
|
||||
"framework-graphics.stubs.module_lib",
|
||||
"framework-media.stubs.module_lib",
|
||||
"framework-mediaprovider.stubs.module_lib",
|
||||
"framework-permission.stubs.module_lib",
|
||||
"framework-permission-s.stubs.module_lib",
|
||||
"framework-scheduling.stubs.module_lib",
|
||||
"framework-sdkextensions.stubs.module_lib",
|
||||
"framework-statsd.stubs.module_lib",
|
||||
"framework-tethering.stubs.module_lib",
|
||||
"framework-wifi.stubs.module_lib",
|
||||
],
|
||||
sdk_version: "module_current",
|
||||
visibility: ["//visibility:private"],
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "framework-all",
|
||||
installable: false,
|
||||
|
||||
61
ApiDocs.bp
61
ApiDocs.bp
@@ -74,11 +74,6 @@ stubs_defaults {
|
||||
srcs: [
|
||||
":android-non-updatable-stub-sources",
|
||||
|
||||
// Module sources
|
||||
":art.module.public.api{.public.stubs.source}",
|
||||
":conscrypt.module.public.api{.public.stubs.source}",
|
||||
":i18n.module.public.api{.public.stubs.source}",
|
||||
|
||||
// No longer part of the stubs, but are included in the docs.
|
||||
":android-test-base-sources",
|
||||
":android-test-mock-sources",
|
||||
@@ -116,6 +111,10 @@ stubs_defaults {
|
||||
name: "framework-doc-stubs-sources-default",
|
||||
defaults: ["framework-doc-stubs-default"],
|
||||
srcs: [
|
||||
":art.module.public.api{.public.stubs.source}",
|
||||
":conscrypt.module.public.api{.public.stubs.source}",
|
||||
":i18n.module.public.api{.public.stubs.source}",
|
||||
|
||||
":framework-appsearch-sources",
|
||||
":framework-connectivity-sources",
|
||||
":framework-graphics-srcs",
|
||||
@@ -156,22 +155,8 @@ droidstubs {
|
||||
droidstubs {
|
||||
name: "framework-doc-stubs",
|
||||
defaults: ["framework-doc-stubs-default"],
|
||||
srcs: [":all-modules-public-stubs-source"],
|
||||
args: metalava_framework_docs_args,
|
||||
srcs: [
|
||||
":android.net.ipsec.ike{.public.stubs.source}",
|
||||
":framework-appsearch{.public.stubs.source}",
|
||||
":framework-connectivity{.public.stubs.source}",
|
||||
":framework-graphics{.public.stubs.source}",
|
||||
":framework-media{.public.stubs.source}",
|
||||
":framework-mediaprovider{.public.stubs.source}",
|
||||
":framework-permission{.public.stubs.source}",
|
||||
":framework-permission-s{.public.stubs.source}",
|
||||
":framework-scheduling{.public.stubs.source}",
|
||||
":framework-sdkextensions{.public.stubs.source}",
|
||||
":framework-statsd{.public.stubs.source}",
|
||||
":framework-tethering{.public.stubs.source}",
|
||||
":framework-wifi{.public.stubs.source}",
|
||||
],
|
||||
aidl: {
|
||||
local_include_dirs: [
|
||||
"apex/media/aidl/stable",
|
||||
@@ -182,42 +167,6 @@ droidstubs {
|
||||
},
|
||||
}
|
||||
|
||||
// This produces the same annotations.zip as framework-doc-stubs, but by using
|
||||
// outputs from individual modules instead of all the source code.
|
||||
genrule {
|
||||
name: "sdk-annotations.zip",
|
||||
srcs: [
|
||||
":android-non-updatable-doc-stubs{.annotations.zip}",
|
||||
|
||||
// Conscrypt and i18n currently do not enable annotations
|
||||
// ":conscrypt.module.public.api{.public.annotations.zip}",
|
||||
// ":i18n.module.public.api{.public.annotations.zip}",
|
||||
|
||||
// Modules that enable annotations below
|
||||
":android.net.ipsec.ike{.public.annotations.zip}",
|
||||
":art.module.public.api{.public.annotations.zip}",
|
||||
":framework-appsearch{.public.annotations.zip}",
|
||||
":framework-connectivity{.public.annotations.zip}",
|
||||
":framework-graphics{.public.annotations.zip}",
|
||||
":framework-media{.public.annotations.zip}",
|
||||
":framework-mediaprovider{.public.annotations.zip}",
|
||||
":framework-permission{.public.annotations.zip}",
|
||||
":framework-permission-s{.public.annotations.zip}",
|
||||
":framework-scheduling{.public.annotations.zip}",
|
||||
":framework-sdkextensions{.public.annotations.zip}",
|
||||
":framework-statsd{.public.annotations.zip}",
|
||||
":framework-tethering{.public.annotations.zip}",
|
||||
":framework-wifi{.public.annotations.zip}",
|
||||
],
|
||||
out: ["annotations.zip"],
|
||||
tools: [
|
||||
"merge_annotation_zips",
|
||||
"soong_zip",
|
||||
],
|
||||
cmd: "$(location merge_annotation_zips) $(genDir)/out $(in) && " +
|
||||
"$(location soong_zip) -o $(out) -C $(genDir)/out -D $(genDir)/out",
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// API docs are created from the generated stub source files
|
||||
// using droiddoc
|
||||
|
||||
352
api/Android.bp
352
api/Android.bp
@@ -32,6 +32,7 @@ bootstrap_go_package {
|
||||
"soong",
|
||||
"soong-android",
|
||||
"soong-genrule",
|
||||
"soong-java",
|
||||
],
|
||||
srcs: ["api.go"],
|
||||
pluginFor: ["soong_build"],
|
||||
@@ -102,43 +103,30 @@ genrule {
|
||||
visibility: ["//visibility:public"],
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "frameworks-base-api-current.txt",
|
||||
srcs: [
|
||||
":android.net.ipsec.ike{.public.api.txt}",
|
||||
":art.module.public.api{.public.api.txt}",
|
||||
":conscrypt.module.public.api{.public.api.txt}",
|
||||
":framework-appsearch{.public.api.txt}",
|
||||
":framework-connectivity{.public.api.txt}",
|
||||
":framework-graphics{.public.api.txt}",
|
||||
":framework-media{.public.api.txt}",
|
||||
":framework-mediaprovider{.public.api.txt}",
|
||||
":framework-permission{.public.api.txt}",
|
||||
":framework-permission-s{.public.api.txt}",
|
||||
":framework-scheduling{.public.api.txt}",
|
||||
":framework-sdkextensions{.public.api.txt}",
|
||||
":framework-statsd{.public.api.txt}",
|
||||
":framework-tethering{.public.api.txt}",
|
||||
":framework-wifi{.public.api.txt}",
|
||||
":i18n.module.public.api{.public.api.txt}",
|
||||
":non-updatable-current.txt",
|
||||
combined_apis {
|
||||
name: "frameworks-base-api",
|
||||
bootclasspath: [
|
||||
"android.net.ipsec.ike",
|
||||
"art.module.public.api",
|
||||
"conscrypt.module.public.api",
|
||||
"framework-appsearch",
|
||||
"framework-connectivity",
|
||||
"framework-graphics",
|
||||
"framework-media",
|
||||
"framework-mediaprovider",
|
||||
"framework-permission",
|
||||
"framework-permission-s",
|
||||
"framework-scheduling",
|
||||
"framework-sdkextensions",
|
||||
"framework-statsd",
|
||||
"framework-tethering",
|
||||
"framework-wifi",
|
||||
"i18n.module.public.api",
|
||||
],
|
||||
out: ["current.txt"],
|
||||
tools: ["metalava"],
|
||||
cmd: metalava_cmd + "$(in) --api $(out)",
|
||||
dists: [
|
||||
{
|
||||
targets: ["droidcore"],
|
||||
dir: "api",
|
||||
dest: "current.txt",
|
||||
},
|
||||
{
|
||||
targets: ["sdk"],
|
||||
dir: "apistubs/android/public/api",
|
||||
dest: "android.txt",
|
||||
},
|
||||
system_server_classpath: [
|
||||
"service-media-s",
|
||||
"service-permission",
|
||||
],
|
||||
visibility: ["//visibility:public"],
|
||||
}
|
||||
|
||||
genrule {
|
||||
@@ -157,108 +145,6 @@ genrule {
|
||||
"$(location :frameworks-base-api-current.txt)",
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "frameworks-base-api-current.srcjar",
|
||||
srcs: [
|
||||
":android.net.ipsec.ike{.public.stubs.source}",
|
||||
":api-stubs-docs-non-updatable",
|
||||
":art.module.public.api{.public.stubs.source}",
|
||||
":conscrypt.module.public.api{.public.stubs.source}",
|
||||
":framework-appsearch{.public.stubs.source}",
|
||||
":framework-connectivity{.public.stubs.source}",
|
||||
":framework-graphics{.public.stubs.source}",
|
||||
":framework-media{.public.stubs.source}",
|
||||
":framework-mediaprovider{.public.stubs.source}",
|
||||
":framework-permission{.public.stubs.source}",
|
||||
":framework-permission-s{.public.stubs.source}",
|
||||
":framework-scheduling{.public.stubs.source}",
|
||||
":framework-sdkextensions{.public.stubs.source}",
|
||||
":framework-statsd{.public.stubs.source}",
|
||||
":framework-tethering{.public.stubs.source}",
|
||||
":framework-wifi{.public.stubs.source}",
|
||||
":i18n.module.public.api{.public.stubs.source}",
|
||||
],
|
||||
out: ["current.srcjar"],
|
||||
tools: ["merge_zips"],
|
||||
cmd: "$(location merge_zips) $(out) $(in)",
|
||||
visibility: ["//visibility:private"], // Used by make module in //development, mind.
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "frameworks-base-api-removed.txt",
|
||||
srcs: [
|
||||
":android.net.ipsec.ike{.public.removed-api.txt}",
|
||||
":art.module.public.api{.public.removed-api.txt}",
|
||||
":conscrypt.module.public.api{.public.removed-api.txt}",
|
||||
":framework-appsearch{.public.removed-api.txt}",
|
||||
":framework-connectivity{.public.removed-api.txt}",
|
||||
":framework-graphics{.public.removed-api.txt}",
|
||||
":framework-media{.public.removed-api.txt}",
|
||||
":framework-mediaprovider{.public.removed-api.txt}",
|
||||
":framework-permission{.public.removed-api.txt}",
|
||||
":framework-permission-s{.public.removed-api.txt}",
|
||||
":framework-scheduling{.public.removed-api.txt}",
|
||||
":framework-sdkextensions{.public.removed-api.txt}",
|
||||
":framework-statsd{.public.removed-api.txt}",
|
||||
":framework-tethering{.public.removed-api.txt}",
|
||||
":framework-wifi{.public.removed-api.txt}",
|
||||
":i18n.module.public.api{.public.removed-api.txt}",
|
||||
":non-updatable-removed.txt",
|
||||
],
|
||||
out: ["removed.txt"],
|
||||
tools: ["metalava"],
|
||||
cmd: metalava_cmd + "$(in) --api $(out)",
|
||||
dists: [
|
||||
{
|
||||
targets: ["droidcore"],
|
||||
dir: "api",
|
||||
dest: "removed.txt",
|
||||
},
|
||||
{
|
||||
targets: ["sdk"],
|
||||
dir: "apistubs/android/public/api",
|
||||
dest: "removed.txt",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "frameworks-base-api-system-current.txt",
|
||||
srcs: [
|
||||
":art.module.public.api{.system.api.txt}",
|
||||
":android.net.ipsec.ike{.system.api.txt}",
|
||||
":framework-appsearch{.system.api.txt}",
|
||||
":framework-connectivity{.system.api.txt}",
|
||||
":framework-graphics{.system.api.txt}",
|
||||
":framework-media{.system.api.txt}",
|
||||
":framework-mediaprovider{.system.api.txt}",
|
||||
":framework-permission{.system.api.txt}",
|
||||
":framework-permission-s{.system.api.txt}",
|
||||
":framework-scheduling{.system.api.txt}",
|
||||
":framework-sdkextensions{.system.api.txt}",
|
||||
":framework-statsd{.system.api.txt}",
|
||||
":framework-tethering{.system.api.txt}",
|
||||
":framework-wifi{.system.api.txt}",
|
||||
":non-updatable-system-current.txt",
|
||||
],
|
||||
out: ["system-current.txt"],
|
||||
tools: ["metalava"],
|
||||
cmd: metalava_cmd + "$(in) --api $(out)",
|
||||
dists: [
|
||||
{
|
||||
targets: ["droidcore"],
|
||||
dir: "api",
|
||||
dest: "system-current.txt",
|
||||
},
|
||||
{
|
||||
targets: ["sdk"],
|
||||
dir: "apistubs/android/system/api",
|
||||
dest: "android.txt",
|
||||
},
|
||||
],
|
||||
visibility: ["//visibility:public"],
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "frameworks-base-api-system-current-compat",
|
||||
srcs: [
|
||||
@@ -277,79 +163,6 @@ genrule {
|
||||
"$(location :frameworks-base-api-system-current.txt)",
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "frameworks-base-api-system-removed.txt",
|
||||
srcs: [
|
||||
":art.module.public.api{.system.removed-api.txt}",
|
||||
":android.net.ipsec.ike{.system.removed-api.txt}",
|
||||
":framework-appsearch{.system.removed-api.txt}",
|
||||
":framework-connectivity{.system.removed-api.txt}",
|
||||
":framework-graphics{.system.removed-api.txt}",
|
||||
":framework-media{.system.removed-api.txt}",
|
||||
":framework-mediaprovider{.system.removed-api.txt}",
|
||||
":framework-permission{.system.removed-api.txt}",
|
||||
":framework-permission-s{.system.removed-api.txt}",
|
||||
":framework-scheduling{.system.removed-api.txt}",
|
||||
":framework-sdkextensions{.system.removed-api.txt}",
|
||||
":framework-statsd{.system.removed-api.txt}",
|
||||
":framework-tethering{.system.removed-api.txt}",
|
||||
":framework-wifi{.system.removed-api.txt}",
|
||||
":non-updatable-system-removed.txt",
|
||||
],
|
||||
out: ["system-removed.txt"],
|
||||
tools: ["metalava"],
|
||||
cmd: metalava_cmd + "$(in) --api $(out)",
|
||||
dists: [
|
||||
{
|
||||
targets: ["droidcore"],
|
||||
dir: "api",
|
||||
dest: "system-removed.txt",
|
||||
},
|
||||
{
|
||||
targets: ["sdk"],
|
||||
dir: "apistubs/android/system/api",
|
||||
dest: "removed.txt",
|
||||
},
|
||||
],
|
||||
visibility: ["//visibility:public"],
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "frameworks-base-api-module-lib-current.txt",
|
||||
srcs: [
|
||||
":art.module.public.api{.module-lib.api.txt}",
|
||||
":android.net.ipsec.ike{.module-lib.api.txt}",
|
||||
":framework-appsearch{.module-lib.api.txt}",
|
||||
":framework-connectivity{.module-lib.api.txt}",
|
||||
":framework-graphics{.module-lib.api.txt}",
|
||||
":framework-media{.module-lib.api.txt}",
|
||||
":framework-mediaprovider{.module-lib.api.txt}",
|
||||
":framework-permission{.module-lib.api.txt}",
|
||||
":framework-permission-s{.module-lib.api.txt}",
|
||||
":framework-scheduling{.module-lib.api.txt}",
|
||||
":framework-sdkextensions{.module-lib.api.txt}",
|
||||
":framework-statsd{.module-lib.api.txt}",
|
||||
":framework-tethering{.module-lib.api.txt}",
|
||||
":framework-wifi{.module-lib.api.txt}",
|
||||
":non-updatable-module-lib-current.txt",
|
||||
],
|
||||
out: ["module-lib-current.txt"],
|
||||
tools: ["metalava"],
|
||||
cmd: metalava_cmd + "$(in) --api $(out)",
|
||||
dists: [
|
||||
{
|
||||
targets: ["droidcore"],
|
||||
dir: "api",
|
||||
dest: "module-lib-current.txt",
|
||||
},
|
||||
{
|
||||
targets: ["sdk"],
|
||||
dir: "apistubs/android/module-lib/api",
|
||||
dest: "android.txt",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "frameworks-base-api-module-lib-current-compat",
|
||||
srcs: [
|
||||
@@ -371,42 +184,6 @@ genrule {
|
||||
"$(location :frameworks-base-api-module-lib-current.txt)",
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "frameworks-base-api-module-lib-removed.txt",
|
||||
srcs: [
|
||||
":art.module.public.api{.module-lib.removed-api.txt}",
|
||||
":android.net.ipsec.ike{.module-lib.removed-api.txt}",
|
||||
":framework-appsearch{.module-lib.removed-api.txt}",
|
||||
":framework-connectivity{.module-lib.removed-api.txt}",
|
||||
":framework-graphics{.module-lib.removed-api.txt}",
|
||||
":framework-media{.module-lib.removed-api.txt}",
|
||||
":framework-mediaprovider{.module-lib.removed-api.txt}",
|
||||
":framework-permission{.module-lib.removed-api.txt}",
|
||||
":framework-permission-s{.module-lib.removed-api.txt}",
|
||||
":framework-scheduling{.module-lib.removed-api.txt}",
|
||||
":framework-sdkextensions{.module-lib.removed-api.txt}",
|
||||
":framework-statsd{.module-lib.removed-api.txt}",
|
||||
":framework-tethering{.module-lib.removed-api.txt}",
|
||||
":framework-wifi{.module-lib.removed-api.txt}",
|
||||
":non-updatable-module-lib-removed.txt",
|
||||
],
|
||||
out: ["module-lib-removed.txt"],
|
||||
tools: ["metalava"],
|
||||
cmd: metalava_cmd + "$(in) --api $(out)",
|
||||
dists: [
|
||||
{
|
||||
targets: ["droidcore"],
|
||||
dir: "api",
|
||||
dest: "module-lib-removed.txt",
|
||||
},
|
||||
{
|
||||
targets: ["sdk"],
|
||||
dir: "apistubs/android/module-lib/api",
|
||||
dest: "removed.txt",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "combined-removed-dex",
|
||||
visibility: [
|
||||
@@ -423,86 +200,3 @@ genrule {
|
||||
out: ["combined-removed-dex.txt"],
|
||||
cmd: "$(location gen_combined_removed_dex.sh) $(location metalava) $(genDir) $(in) > $(out)",
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "frameworks-base-api-system-server-current.txt",
|
||||
srcs: [
|
||||
":service-media-s{.system-server.api.txt}",
|
||||
":service-permission{.system-server.api.txt}",
|
||||
":non-updatable-system-server-current.txt",
|
||||
],
|
||||
out: ["system-server-current.txt"],
|
||||
tools: ["metalava"],
|
||||
cmd: metalava_cmd + "$(in) --api $(out)",
|
||||
dists: [
|
||||
{
|
||||
targets: ["droidcore"],
|
||||
dir: "api",
|
||||
dest: "system-server-current.txt",
|
||||
},
|
||||
{
|
||||
targets: ["sdk"],
|
||||
dir: "apistubs/android/system-server/api",
|
||||
dest: "android.txt",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "frameworks-base-api-system-server-removed.txt",
|
||||
srcs: [
|
||||
":service-media-s{.system-server.removed-api.txt}",
|
||||
":service-permission{.system-server.removed-api.txt}",
|
||||
":non-updatable-system-server-removed.txt",
|
||||
],
|
||||
out: ["system-server-removed.txt"],
|
||||
tools: ["metalava"],
|
||||
cmd: metalava_cmd + "$(in) --api $(out)",
|
||||
dists: [
|
||||
{
|
||||
targets: ["droidcore"],
|
||||
dir: "api",
|
||||
dest: "system-server-removed.txt",
|
||||
},
|
||||
{
|
||||
targets: ["sdk"],
|
||||
dir: "apistubs/android/system-server/api",
|
||||
dest: "removed.txt",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
// This rule will filter classes present in the jar files of mainline modules
|
||||
// from the lint database in api-versions.xml.
|
||||
// This is done to reduce the number of false positive NewApi findings in
|
||||
// java libraries that compile against the module SDK
|
||||
genrule {
|
||||
name: "api-versions-xml-public-filtered",
|
||||
srcs: [
|
||||
// Note: order matters: first parameter is the full api-versions.xml
|
||||
// after that the stubs files in any order
|
||||
// stubs files are all modules that export API surfaces EXCEPT ART
|
||||
":framework-doc-stubs{.api_versions.xml}",
|
||||
":android.net.ipsec.ike.stubs{.jar}",
|
||||
":conscrypt.module.public.api.stubs{.jar}",
|
||||
":framework-appsearch.stubs{.jar}",
|
||||
":framework-connectivity.stubs{.jar}",
|
||||
":framework-graphics.stubs{.jar}",
|
||||
":framework-media.stubs{.jar}",
|
||||
":framework-mediaprovider.stubs{.jar}",
|
||||
":framework-permission.stubs{.jar}",
|
||||
":framework-permission-s.stubs{.jar}",
|
||||
":framework-scheduling.stubs{.jar}",
|
||||
":framework-sdkextensions.stubs{.jar}",
|
||||
":framework-statsd.stubs{.jar}",
|
||||
":framework-tethering.stubs{.jar}",
|
||||
":framework-wifi.stubs{.jar}",
|
||||
":i18n.module.public.api.stubs{.jar}",
|
||||
],
|
||||
out: ["api-versions-public-filtered.xml"],
|
||||
tools: ["api_versions_trimmer"],
|
||||
cmd: "$(location api_versions_trimmer) $(out) $(in)",
|
||||
dist: {
|
||||
targets: ["sdk"],
|
||||
},
|
||||
}
|
||||
|
||||
151
api/api.go
151
api/api.go
@@ -15,12 +15,19 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/genrule"
|
||||
"android/soong/java"
|
||||
)
|
||||
|
||||
const art = "art.module.public.api"
|
||||
const conscrypt = "conscrypt.module.public.api"
|
||||
const i18n = "i18n.module.public.api"
|
||||
|
||||
// The intention behind this soong plugin is to generate a number of "merged"
|
||||
// API-related modules that would otherwise require a large amount of very
|
||||
// similar Android.bp boilerplate to define. For example, the merged current.txt
|
||||
@@ -32,6 +39,8 @@ import (
|
||||
type CombinedApisProperties struct {
|
||||
// Module libraries in the bootclasspath
|
||||
Bootclasspath []string
|
||||
// Module libraries on the bootclasspath if include_nonpublic_framework_api is true.
|
||||
Conditional_bootclasspath []string
|
||||
// Module libraries in system server
|
||||
System_server_classpath []string
|
||||
}
|
||||
@@ -65,6 +74,19 @@ type genruleProps struct {
|
||||
Visibility []string
|
||||
}
|
||||
|
||||
type libraryProps struct {
|
||||
Name *string
|
||||
Sdk_version *string
|
||||
Static_libs []string
|
||||
Visibility []string
|
||||
}
|
||||
|
||||
type fgProps struct {
|
||||
Name *string
|
||||
Srcs []string
|
||||
Visibility []string
|
||||
}
|
||||
|
||||
// Struct to pass parameters for the various merged [current|removed].txt file modules we create.
|
||||
type MergedTxtDefinition struct {
|
||||
// "current.txt" or "removed.txt"
|
||||
@@ -95,7 +117,7 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) {
|
||||
props.Tools = []string{"metalava"}
|
||||
props.Out = []string{filename}
|
||||
props.Cmd = proptools.StringPtr(metalavaCmd + "$(in) --api $(out)")
|
||||
props.Srcs = createSrcs(txt.BaseTxt, txt.Modules, txt.ModuleTag)
|
||||
props.Srcs = append([]string{txt.BaseTxt}, createSrcs(txt.Modules, txt.ModuleTag)...)
|
||||
props.Dists = []android.Dist{
|
||||
{
|
||||
Targets: []string{"droidcore"},
|
||||
@@ -118,12 +140,36 @@ func createMergedStubsSrcjar(ctx android.LoadHookContext, modules []string) {
|
||||
props.Tools = []string{"merge_zips"}
|
||||
props.Out = []string{"current.srcjar"}
|
||||
props.Cmd = proptools.StringPtr("$(location merge_zips) $(out) $(in)")
|
||||
props.Srcs = createSrcs(":api-stubs-docs-non-updatable", modules, "{.public.stubs.source}")
|
||||
props.Srcs = append([]string{":api-stubs-docs-non-updatable"}, createSrcs(modules, "{.public.stubs.source}")...)
|
||||
props.Visibility = []string{"//visibility:private"} // Used by make module in //development, mind
|
||||
ctx.CreateModule(genrule.GenRuleFactory, &props)
|
||||
}
|
||||
|
||||
// This produces the same annotations.zip as framework-doc-stubs, but by using
|
||||
// outputs from individual modules instead of all the source code.
|
||||
func createMergedAnnotations(ctx android.LoadHookContext, modules []string) {
|
||||
// Conscrypt and i18n currently do not enable annotations
|
||||
modules = removeAll(modules, []string{conscrypt, i18n})
|
||||
props := genruleProps{}
|
||||
props.Name = proptools.StringPtr("sdk-annotations.zip")
|
||||
props.Tools = []string{"merge_annotation_zips", "soong_zip"}
|
||||
props.Out = []string{"annotations.zip"}
|
||||
props.Cmd = proptools.StringPtr("$(location merge_annotation_zips) $(genDir)/out $(in) && " +
|
||||
"$(location soong_zip) -o $(out) -C $(genDir)/out -D $(genDir)/out")
|
||||
props.Srcs = append([]string{":android-non-updatable-doc-stubs{.annotations.zip}"}, createSrcs(modules, "{.public.annotations.zip}")...)
|
||||
ctx.CreateModule(genrule.GenRuleFactory, &props)
|
||||
}
|
||||
|
||||
func createFilteredApiVersions(ctx android.LoadHookContext, modules []string) {
|
||||
// For the filtered api versions, we prune all APIs except art module's APIs. because
|
||||
// 1) ART apis are available by default to all modules, while other module-to-module deps are
|
||||
// explicit and probably receive more scrutiny anyway
|
||||
// 2) The number of ART/libcore APIs is large, so not linting them would create a large gap
|
||||
// 3) It's a compromise. Ideally we wouldn't be filtering out any module APIs, and have
|
||||
// per-module lint databases that excludes just that module's APIs. Alas, that's more
|
||||
// difficult to achieve.
|
||||
modules = remove(modules, art)
|
||||
|
||||
props := genruleProps{}
|
||||
props.Name = proptools.StringPtr("api-versions-xml-public-filtered")
|
||||
props.Tools = []string{"api_versions_trimmer"}
|
||||
@@ -132,43 +178,41 @@ func createFilteredApiVersions(ctx android.LoadHookContext, modules []string) {
|
||||
// Note: order matters: first parameter is the full api-versions.xml
|
||||
// after that the stubs files in any order
|
||||
// stubs files are all modules that export API surfaces EXCEPT ART
|
||||
props.Srcs = createSrcs(":framework-doc-stubs{.api_versions.xml}", modules, ".stubs{.jar}")
|
||||
props.Srcs = append([]string{":framework-doc-stubs{.api_versions.xml}"}, createSrcs(modules, ".stubs{.jar}")...)
|
||||
props.Dists = []android.Dist{{Targets: []string{"sdk"}}}
|
||||
ctx.CreateModule(genrule.GenRuleFactory, &props)
|
||||
}
|
||||
|
||||
func createSrcs(base string, modules []string, tag string) []string {
|
||||
a := make([]string, 0, len(modules)+1)
|
||||
a = append(a, base)
|
||||
for _, module := range modules {
|
||||
a = append(a, ":"+module+tag)
|
||||
}
|
||||
return a
|
||||
func createMergedModuleLibStubs(ctx android.LoadHookContext, modules []string) {
|
||||
// The user of this module compiles against the "core" SDK, so remove core libraries to avoid dupes.
|
||||
modules = removeAll(modules, []string{art, conscrypt, i18n})
|
||||
props := libraryProps{}
|
||||
props.Name = proptools.StringPtr("framework-updatable-stubs-module_libs_api")
|
||||
props.Static_libs = transformArray(modules, "", ".stubs.module_lib")
|
||||
props.Sdk_version = proptools.StringPtr("module_current")
|
||||
props.Visibility = []string{"//frameworks/base"}
|
||||
ctx.CreateModule(java.LibraryFactory, &props)
|
||||
}
|
||||
|
||||
func remove(s []string, v string) []string {
|
||||
s2 := make([]string, 0, len(s))
|
||||
for _, sv := range s {
|
||||
if sv != v {
|
||||
s2 = append(s2, sv)
|
||||
}
|
||||
}
|
||||
return s2
|
||||
func createPublicStubsSourceFilegroup(ctx android.LoadHookContext, modules []string) {
|
||||
props := fgProps{}
|
||||
props.Name = proptools.StringPtr("all-modules-public-stubs-source")
|
||||
props.Srcs = createSrcs(modules, "{.public.stubs.source}")
|
||||
props.Visibility = []string{"//frameworks/base"}
|
||||
ctx.CreateModule(android.FileGroupFactory, &props)
|
||||
}
|
||||
|
||||
func createMergedTxts(ctx android.LoadHookContext, props CombinedApisProperties) {
|
||||
func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_classpath []string) {
|
||||
var textFiles []MergedTxtDefinition
|
||||
// Two module libraries currently do not support @SystemApi so only have the public scope.
|
||||
bcpWithSystemApi := props.Bootclasspath
|
||||
bcpWithSystemApi = remove(bcpWithSystemApi, "conscrypt.module.public.api")
|
||||
bcpWithSystemApi = remove(bcpWithSystemApi, "i18n.module.public.api")
|
||||
bcpWithSystemApi := removeAll(bootclasspath, []string{conscrypt, i18n})
|
||||
|
||||
tagSuffix := []string{".api.txt}", ".removed-api.txt}"}
|
||||
for i, f := range []string{"current.txt", "removed.txt"} {
|
||||
textFiles = append(textFiles, MergedTxtDefinition{
|
||||
TxtFilename: f,
|
||||
BaseTxt: ":non-updatable-" + f,
|
||||
Modules: props.Bootclasspath,
|
||||
Modules: bootclasspath,
|
||||
ModuleTag: "{.public" + tagSuffix[i],
|
||||
Scope: "public",
|
||||
})
|
||||
@@ -189,7 +233,7 @@ func createMergedTxts(ctx android.LoadHookContext, props CombinedApisProperties)
|
||||
textFiles = append(textFiles, MergedTxtDefinition{
|
||||
TxtFilename: f,
|
||||
BaseTxt: ":non-updatable-system-server-" + f,
|
||||
Modules: props.System_server_classpath,
|
||||
Modules: system_server_classpath,
|
||||
ModuleTag: "{.system-server" + tagSuffix[i],
|
||||
Scope: "system-server",
|
||||
})
|
||||
@@ -200,20 +244,22 @@ func createMergedTxts(ctx android.LoadHookContext, props CombinedApisProperties)
|
||||
}
|
||||
|
||||
func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
|
||||
createMergedTxts(ctx, a.properties)
|
||||
bootclasspath := a.properties.Bootclasspath
|
||||
if ctx.Config().VendorConfig("ANDROID").Bool("include_nonpublic_framework_api") {
|
||||
bootclasspath = append(bootclasspath, a.properties.Conditional_bootclasspath...)
|
||||
sort.Strings(bootclasspath)
|
||||
}
|
||||
createMergedTxts(ctx, bootclasspath, a.properties.System_server_classpath)
|
||||
|
||||
createMergedStubsSrcjar(ctx, a.properties.Bootclasspath)
|
||||
createMergedStubsSrcjar(ctx, bootclasspath)
|
||||
|
||||
// For the filtered api versions, we prune all APIs except art module's APIs. because
|
||||
// 1) ART apis are available by default to all modules, while other module-to-module deps are
|
||||
// explicit and probably receive more scrutiny anyway
|
||||
// 2) The number of ART/libcore APIs is large, so not linting them would create a large gap
|
||||
// 3) It's a compromise. Ideally we wouldn't be filtering out any module APIs, and have
|
||||
// per-module lint databases that excludes just that module's APIs. Alas, that's more
|
||||
// difficult to achieve.
|
||||
filteredModules := a.properties.Bootclasspath
|
||||
filteredModules = remove(filteredModules, "art.module.public.api")
|
||||
createFilteredApiVersions(ctx, filteredModules)
|
||||
createMergedModuleLibStubs(ctx, bootclasspath)
|
||||
|
||||
createMergedAnnotations(ctx, bootclasspath)
|
||||
|
||||
createFilteredApiVersions(ctx, bootclasspath)
|
||||
|
||||
createPublicStubsSourceFilegroup(ctx, bootclasspath)
|
||||
}
|
||||
|
||||
func combinedApisModuleFactory() android.Module {
|
||||
@@ -223,3 +269,36 @@ func combinedApisModuleFactory() android.Module {
|
||||
android.AddLoadHook(module, func(ctx android.LoadHookContext) { module.createInternalModules(ctx) })
|
||||
return module
|
||||
}
|
||||
|
||||
// Various utility methods below.
|
||||
|
||||
// Creates an array of ":<m><tag>" for each m in <modules>.
|
||||
func createSrcs(modules []string, tag string) []string {
|
||||
return transformArray(modules, ":", tag)
|
||||
}
|
||||
|
||||
// Creates an array of "<prefix><m><suffix>", for each m in <modules>.
|
||||
func transformArray(modules []string, prefix, suffix string) []string {
|
||||
a := make([]string, 0, len(modules))
|
||||
for _, module := range modules {
|
||||
a = append(a, prefix+module+suffix)
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
func removeAll(s []string, vs []string) []string {
|
||||
for _, v := range vs {
|
||||
s = remove(s, v)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func remove(s []string, v string) []string {
|
||||
s2 := make([]string, 0, len(s))
|
||||
for _, sv := range s {
|
||||
if sv != v {
|
||||
s2 = append(s2, sv)
|
||||
}
|
||||
}
|
||||
return s2
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user