Integrate hiddenapi processing into boot jars test

This change registers the hiddenapi singleton so that hiddenapi
processing is performed as part of
TestBootDexJarsFromSourcesAndPrebuilts so that additional hiddenapi
related tests can be added later.

The hiddenapi singleton uses the BootJars/UpdatableBootJars properties
from productVariables not the dexpreopt.GlobalConfig so this change
makes sure that they are consistent.

Performing hiddenapi processing causes the dex file used in "prebuilt
with source apex preferred" test to be encoded with hiddenapi
information which changes the path in the test.

Bug: 178361284
Test: m nothing
Change-Id: I2eb3d8cf11f6fb3bf4a34d6e4ae0c397c890191e
This commit is contained in:
Paul Duffin 2021-02-05 16:58:28 +00:00
parent 219b177279
commit f38931c287
1 changed files with 7 additions and 1 deletions

View File

@ -4631,7 +4631,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
`
ctx := testDexpreoptWithApexes(t, bp, "", transform)
checkBootDexJarPath(t, ctx, ".intermediates/libfoo/android_common_apex10000/aligned/libfoo.jar")
checkBootDexJarPath(t, ctx, ".intermediates/libfoo/android_common_apex10000/hiddenapi/libfoo.jar")
})
t.Run("prebuilt preferred with source apex disabled", func(t *testing.T) {
@ -6304,6 +6304,7 @@ func testDexpreoptWithApexes(t *testing.T, bp, errmsg string, transformDexpreopt
android.RegisterPrebuiltMutators(ctx)
cc.RegisterRequiredBuildComponentsForTest(ctx)
java.RegisterRequiredBuildComponentsForTest(ctx)
java.RegisterHiddenApiSingletonComponents(ctx)
ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators)
ctx.PreDepsMutators(RegisterPreDepsMutators)
ctx.PostDepsMutators(RegisterPostDepsMutators)
@ -6315,6 +6316,11 @@ func testDexpreoptWithApexes(t *testing.T, bp, errmsg string, transformDexpreopt
transformDexpreoptConfig(dexpreoptConfig)
dexpreopt.SetTestGlobalConfig(config, dexpreoptConfig)
// Make sure that any changes to these dexpreopt properties are mirrored in the corresponding
// product variables that are used by hiddenapi.
config.TestProductVariables.BootJars = dexpreoptConfig.BootJars
config.TestProductVariables.UpdatableBootJars = dexpreoptConfig.UpdatableBootJars
_, errs := ctx.ParseBlueprintsFiles("Android.bp")
android.FailIfErrored(t, errs)