From 36bc27cb47338de8f9a4f61e221037de8a3b1683 Mon Sep 17 00:00:00 2001 From: Anton Hansson Date: Tue, 14 Sep 2021 15:45:13 +0100 Subject: [PATCH] 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 --- StubLibraries.bp | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/StubLibraries.bp b/StubLibraries.bp index 5cb0a785bc2b..39fd511a90ca 100644 --- a/StubLibraries.bp +++ b/StubLibraries.bp @@ -365,6 +365,64 @@ java_library { }, } +//////////////////////////////////////////////////////////////////////// +// 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.