Generate an api-versions.xml from stubs jar
The current api-versions.xml shipped in the SDK and used internally in
the android build system is generated by the framework-doc-stubs target.
This CL adds a new target that generates an (almost) equivalent database
in a different way. There are a few upshots of using this method to
generate them:
- using the framework-doc-stubs target is inefficient. It runs late in
the build but also takes a long time, extending the critical path of
the modules that depend on api-versions.xml
- the framework-doc-system-stubs target is using module sources as
input, which is desireable to avoid because we want to separate
module sources from the rest of the platform.
Bug: 187398174
Bug: 186197911
Test: m api_versions_{public,system} && diff with "originals"
Change-Id: I8adab94ee7ca0bee4fc0be8d99f1125360387d89
diff --git a/StubLibraries.bp b/StubLibraries.bp
index 5cb0a78..39fd511 100644
--- a/StubLibraries.bp
+++ b/StubLibraries.bp
@@ -365,6 +365,64 @@
},
}
+////////////////////////////////////////////////////////////////////////
+// api-versions.xml generation, for public and system. This API database
+// also contains the android.test.* APIs.
+////////////////////////////////////////////////////////////////////////
+
+java_library {
+ name: "android_stubs_current_with_test_libs",
+ static_libs: [
+ "android_stubs_current",
+ "android.test.base.stubs",
+ "android.test.mock.stubs",
+ "android.test.runner.stubs",
+ ],
+ defaults: ["android.jar_defaults"],
+ visibility: [
+ "//visibility:override",
+ "//visibility:private",
+ ],
+}
+
+java_library {
+ name: "android_system_stubs_current_with_test_libs",
+ static_libs: [
+ "android_system_stubs_current",
+ "android.test.base.stubs.system",
+ "android.test.mock.stubs.system",
+ "android.test.runner.stubs.system",
+ ],
+ defaults: ["android.jar_defaults"],
+ visibility: [
+ "//visibility:override",
+ "//visibility:private",
+ ],
+}
+
+droidstubs {
+ name: "api_versions_public",
+ srcs: [":android_stubs_current_with_test_libs{.jar}"],
+ generate_stubs: false,
+ api_levels_annotations_enabled: true,
+ api_levels_annotations_dirs: [
+ "sdk-dir",
+ "api-versions-jars-dir",
+ ],
+}
+
+droidstubs {
+ name: "api_versions_system",
+ srcs: [":android_system_stubs_current_with_test_libs{.jar}"],
+ generate_stubs: false,
+ api_levels_annotations_enabled: true,
+ api_levels_annotations_dirs: [
+ "sdk-dir",
+ "api-versions-jars-dir",
+ ],
+ api_levels_sdk_type: "system",
+}
+
/////////////////////////////////////////////////////////////////////
// hwbinder.stubs provides APIs required for building HIDL Java
// libraries.