diff options
author | Anton Hansson <hansson@google.com> | 2020-07-03 15:31:32 +0100 |
---|---|---|
committer | Liz Kammer <eakammer@google.com> | 2020-09-18 08:06:58 -0700 |
commit | a2adc37fc92587af0f09aa6f4aceacf8fc49aa66 (patch) | |
tree | 741c3d93ca9ce3e02ea3fd7c21ff9460abff99cd /java/hiddenapi_singleton.go | |
parent | 0fe609075dd5614ddc99d17f1afaa6306f9a8b10 (diff) |
Make hiddenapi use prebuilt stubs when it should
Bug: 160455085
Test: build_unbundled_mainline_module.sh (with disabled source-stubs)
Test: hiddenapi_singleton_test.go
Change-Id: Id93c974351b3f8efdf8e4efe4192d3809f4fcaa5
Diffstat (limited to 'java/hiddenapi_singleton.go')
-rw-r--r-- | java/hiddenapi_singleton.go | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go index b6af3bf28..61a9b97e4 100644 --- a/java/hiddenapi_singleton.go +++ b/java/hiddenapi_singleton.go @@ -92,31 +92,34 @@ func (h *hiddenAPISingleton) MakeVars(ctx android.MakeVarsContext) { // stubFlagsRule creates the rule to build hiddenapi-stub-flags.txt out of dex jars from stub modules and boot image // modules. func stubFlagsRule(ctx android.SingletonContext) { - // Public API stubs - publicStubModules := []string{ - "android_stubs_current", + var publicStubModules []string + var systemStubModules []string + var testStubModules []string + var corePlatformStubModules []string + + if ctx.Config().AlwaysUsePrebuiltSdks() { + // Build configuration mandates using prebuilt stub modules + publicStubModules = append(publicStubModules, "sdk_public_current_android") + systemStubModules = append(systemStubModules, "sdk_system_current_android") + testStubModules = append(testStubModules, "sdk_test_current_android") + } else { + // Use stub modules built from source + publicStubModules = append(publicStubModules, "android_stubs_current") + systemStubModules = append(systemStubModules, "android_system_stubs_current") + testStubModules = append(testStubModules, "android_test_stubs_current") } + // We do not have prebuilts of the core platform api yet + corePlatformStubModules = append(corePlatformStubModules, "legacy.core.platform.api.stubs") // Add the android.test.base to the set of stubs only if the android.test.base module is on // the boot jars list as the runtime will only enforce hiddenapi access against modules on // that list. - if inList("android.test.base", ctx.Config().BootJars()) && !ctx.Config().AlwaysUsePrebuiltSdks() { - publicStubModules = append(publicStubModules, "android.test.base.stubs") - } - - // System API stubs - systemStubModules := []string{ - "android_system_stubs_current", - } - - // Test API stubs - testStubModules := []string{ - "android_test_stubs_current", - } - - // Core Platform API stubs - corePlatformStubModules := []string{ - "legacy.core.platform.api.stubs", + if inList("android.test.base", ctx.Config().BootJars()) { + if ctx.Config().AlwaysUsePrebuiltSdks() { + publicStubModules = append(publicStubModules, "sdk_public_current_android.test.base") + } else { + publicStubModules = append(publicStubModules, "android.test.base.stubs") + } } // Allow products to define their own stubs for custom product jars that apps can use. |