Merge "Disable monolithic hiddenapi flags generation for non java devices." into main

This commit is contained in:
Spandan Das
2024-05-17 21:11:31 +00:00
committed by Gerrit Code Review
4 changed files with 61 additions and 6 deletions

View File

@@ -198,13 +198,22 @@ func TestHiddenAPISingletonSdks(t *testing.T) {
hiddenApiFixtureFactory,
tc.preparer,
prepareForTestWithDefaultPlatformBootclasspath,
// Make sure that we have atleast one platform library so that we can check the monolithic hiddenapi
// file creation.
FixtureConfigureBootJars("platform:foo"),
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.Always_use_prebuilt_sdks = proptools.BoolPtr(tc.unbundledBuild)
variables.BuildFlags = map[string]string{
"RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
}
}),
).RunTest(t)
).RunTestWithBp(t, `
java_library {
name: "foo",
srcs: ["a.java"],
compile_dex: true,
}
`)
hiddenAPI := result.ModuleForTests("platform-bootclasspath", "android_common")
hiddenapiRule := hiddenAPI.Rule("platform-bootclasspath-monolithic-hiddenapi-stub-flags")

View File

@@ -325,6 +325,11 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android.
// the fragments will have already provided the flags that are needed.
classesJars := monolithicInfo.ClassesJars
if len(classesJars) == 0 {
// This product does not include any monolithic jars. Monolithic hiddenapi flag generation is not required.
return bootDexJarByModule
}
// Create the input to pass to buildRuleToGenerateHiddenAPIStubFlagsFile
input := newHiddenAPIFlagInput()