Export monolithic hidden API files from platform_bootclasspath
Makes the monolithic hidden API files accessible from the platform_bootclasspath so they can be output to the dist build target and used by other modules, e.g. by doing something like this: java_resources: [ ":platform-bootclasspath{hiddenapi-flags.csv}", ], It makes the paths relative to the out/soong/hiddenapi directory rather than the out/soong directory to make them easier to use in the java_resources property without changing the structure of the APK. Without that attempting to use them in a java_resources property will result in them being copied to a hiddenapi/ within the APK instead of being used at the top level as existing APKs like CtsHiddenApiBlocklistTestApiTestCases expect. Bug: 177892522 Test: m nothing Change-Id: I829412fc7d25411e0c2e0713d0d219a18f4af2ee
This commit is contained in:
@@ -131,3 +131,44 @@ func TestPlatformBootclasspath(t *testing.T) {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func TestPlatformBootclasspath_Dist(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForTestWithPlatformBootclasspath,
|
||||
dexpreopt.FixtureSetBootJars("platform:foo", "platform:bar"),
|
||||
android.PrepareForTestWithAndroidMk,
|
||||
android.FixtureWithRootAndroidBp(`
|
||||
platform_bootclasspath {
|
||||
name: "platform-bootclasspath",
|
||||
dists: [
|
||||
{
|
||||
targets: ["droidcore"],
|
||||
tag: "hiddenapi-flags.csv",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "bar",
|
||||
srcs: ["a.java"],
|
||||
system_modules: "none",
|
||||
sdk_version: "none",
|
||||
compile_dex: true,
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "foo",
|
||||
srcs: ["a.java"],
|
||||
system_modules: "none",
|
||||
sdk_version: "none",
|
||||
compile_dex: true,
|
||||
}
|
||||
`),
|
||||
).RunTest(t)
|
||||
|
||||
platformBootclasspath := result.Module("platform-bootclasspath", "android_common").(*platformBootclasspathModule)
|
||||
entries := android.AndroidMkEntriesForTest(t, result.TestContext, platformBootclasspath)
|
||||
goals := entries[0].GetDistForGoals(platformBootclasspath)
|
||||
android.AssertStringEquals(t, "platform dist goals phony", ".PHONY: droidcore\n", goals[0])
|
||||
android.AssertStringEquals(t, "platform dist goals call", "$(call dist-for-goals,droidcore,out/soong/hiddenapi/hiddenapi-flags.csv:hiddenapi-flags.csv)\n", android.StringRelativeToTop(result.Config, goals[1]))
|
||||
}
|
||||
|
Reference in New Issue
Block a user