Loading apex/apex_test.go +2 −2 Original line number Diff line number Diff line Loading @@ -4566,8 +4566,8 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { checkHiddenAPIIndexInputs := func(t *testing.T, ctx *android.TestContext, expectedInputs string) { t.Helper() hiddenAPIIndex := ctx.SingletonForTests("hiddenapi_index") indexRule := hiddenAPIIndex.Rule("singleton-merged-hiddenapi-index") platformBootclasspath := ctx.ModuleForTests("platform-bootclasspath", "android_common") indexRule := platformBootclasspath.Rule("platform-bootclasspath-monolithic-hiddenapi-index") java.CheckHiddenAPIRuleInputs(t, expectedInputs, indexRule) } Loading java/hiddenapi_singleton.go +0 −28 Original line number Diff line number Diff line Loading @@ -416,32 +416,4 @@ func (h *hiddenAPIIndexSingleton) GenerateBuildActions(ctx android.SingletonCont h.index = outputPath return } indexes := android.Paths{} ctx.VisitAllModules(func(module android.Module) { if h, ok := module.(hiddenAPIIntf); ok { if h.indexCSV() != nil { indexes = append(indexes, h.indexCSV()) } } }) rule := android.NewRuleBuilder(pctx, ctx) rule.Command(). BuiltTool("merge_csv"). Flag("--key_field signature"). FlagWithArg("--header=", "signature,file,startline,startcol,endline,endcol,properties"). FlagWithOutput("--output=", hiddenAPISingletonPaths(ctx).index). Inputs(indexes) rule.Build("singleton-merged-hiddenapi-index", "Singleton merged Hidden API index") h.index = hiddenAPISingletonPaths(ctx).index } func (h *hiddenAPIIndexSingleton) MakeVars(ctx android.MakeVarsContext) { if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") { return } ctx.Strict("INTERNAL_PLATFORM_HIDDENAPI_INDEX", h.index.String()) } java/hiddenapi_singleton_test.go +0 −55 Original line number Diff line number Diff line Loading @@ -50,61 +50,6 @@ func TestHiddenAPISingleton(t *testing.T) { android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, want) } func TestHiddenAPIIndexSingleton(t *testing.T) { result := android.GroupFixturePreparers( hiddenApiFixtureFactory, PrepareForTestWithJavaSdkLibraryFiles, FixtureWithLastReleaseApis("bar"), FixtureConfigureBootJars("platform:foo", "platform:bar"), ).RunTestWithBp(t, ` java_library { name: "foo", srcs: ["a.java"], compile_dex: true, hiddenapi_additional_annotations: [ "foo-hiddenapi-annotations", ], } java_library { name: "foo-hiddenapi-annotations", srcs: ["a.java"], compile_dex: true, } java_import { name: "foo", jars: ["a.jar"], compile_dex: true, prefer: false, } java_sdk_library { name: "bar", srcs: ["a.java"], compile_dex: true, } `) hiddenAPIIndex := result.SingletonForTests("hiddenapi_index") indexRule := hiddenAPIIndex.Rule("singleton-merged-hiddenapi-index") CheckHiddenAPIRuleInputs(t, ` .intermediates/bar/android_common/hiddenapi/index.csv .intermediates/foo/android_common/hiddenapi/index.csv `, indexRule) // Make sure that the foo-hiddenapi-annotations.jar is included in the inputs to the rules that // creates the index.csv file. foo := result.ModuleForTests("foo", "android_common") indexParams := foo.Output("hiddenapi/index.csv") CheckHiddenAPIRuleInputs(t, ` .intermediates/foo-hiddenapi-annotations/android_common/javac/foo-hiddenapi-annotations.jar .intermediates/foo/android_common/javac/foo.jar `, indexParams) } func TestHiddenAPISingletonWithSourceAndPrebuiltPreferredButNoDex(t *testing.T) { expectedErrorMessage := "hiddenapi has determined that the source module \"foo\" should be ignored as it has been" + Loading java/platform_bootclasspath.go +18 −0 Original line number Diff line number Diff line Loading @@ -339,4 +339,22 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android. outputPath := hiddenAPISingletonPaths(ctx).flags baseFlagsPath := hiddenAPISingletonPaths(ctx).stubFlags ruleToGenerateHiddenApiFlags(ctx, outputPath, baseFlagsPath, moduleSpecificFlagsPaths, augmentationInfo) b.generateHiddenAPIIndexRules(ctx, hiddenAPISupportingModules) } func (b *platformBootclasspathModule) generateHiddenAPIIndexRules(ctx android.ModuleContext, modules []hiddenAPISupportingModule) { indexes := android.Paths{} for _, module := range modules { indexes = append(indexes, module.indexCSV()) } rule := android.NewRuleBuilder(pctx, ctx) rule.Command(). BuiltTool("merge_csv"). Flag("--key_field signature"). FlagWithArg("--header=", "signature,file,startline,startcol,endline,endcol,properties"). FlagWithOutput("--output=", hiddenAPISingletonPaths(ctx).index). Inputs(indexes) rule.Build("platform-bootclasspath-monolithic-hiddenapi-index", "monolithic hidden API index") } java/platform_bootclasspath_test.go +59 −0 Original line number Diff line number Diff line Loading @@ -172,3 +172,62 @@ func TestPlatformBootclasspath_Dist(t *testing.T) { 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])) } func TestPlatformBootclasspath_HiddenAPIMonolithicIndexFile(t *testing.T) { result := android.GroupFixturePreparers( hiddenApiFixtureFactory, PrepareForTestWithJavaSdkLibraryFiles, FixtureWithLastReleaseApis("bar"), FixtureConfigureBootJars("platform:foo", "platform:bar"), ).RunTestWithBp(t, ` java_library { name: "foo", srcs: ["a.java"], compile_dex: true, hiddenapi_additional_annotations: [ "foo-hiddenapi-annotations", ], } java_library { name: "foo-hiddenapi-annotations", srcs: ["a.java"], compile_dex: true, } java_import { name: "foo", jars: ["a.jar"], compile_dex: true, prefer: false, } java_sdk_library { name: "bar", srcs: ["a.java"], compile_dex: true, } platform_bootclasspath { name: "myplatform-bootclasspath", } `) platformBootclasspath := result.ModuleForTests("myplatform-bootclasspath", "android_common") indexRule := platformBootclasspath.Rule("platform-bootclasspath-monolithic-hiddenapi-index") CheckHiddenAPIRuleInputs(t, ` .intermediates/bar/android_common/hiddenapi/index.csv .intermediates/foo/android_common/hiddenapi/index.csv `, indexRule) // Make sure that the foo-hiddenapi-annotations.jar is included in the inputs to the rules that // creates the index.csv file. foo := result.ModuleForTests("foo", "android_common") indexParams := foo.Output("hiddenapi/index.csv") CheckHiddenAPIRuleInputs(t, ` .intermediates/foo-hiddenapi-annotations/android_common/javac/foo-hiddenapi-annotations.jar .intermediates/foo/android_common/javac/foo.jar `, indexParams) } Loading
apex/apex_test.go +2 −2 Original line number Diff line number Diff line Loading @@ -4566,8 +4566,8 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { checkHiddenAPIIndexInputs := func(t *testing.T, ctx *android.TestContext, expectedInputs string) { t.Helper() hiddenAPIIndex := ctx.SingletonForTests("hiddenapi_index") indexRule := hiddenAPIIndex.Rule("singleton-merged-hiddenapi-index") platformBootclasspath := ctx.ModuleForTests("platform-bootclasspath", "android_common") indexRule := platformBootclasspath.Rule("platform-bootclasspath-monolithic-hiddenapi-index") java.CheckHiddenAPIRuleInputs(t, expectedInputs, indexRule) } Loading
java/hiddenapi_singleton.go +0 −28 Original line number Diff line number Diff line Loading @@ -416,32 +416,4 @@ func (h *hiddenAPIIndexSingleton) GenerateBuildActions(ctx android.SingletonCont h.index = outputPath return } indexes := android.Paths{} ctx.VisitAllModules(func(module android.Module) { if h, ok := module.(hiddenAPIIntf); ok { if h.indexCSV() != nil { indexes = append(indexes, h.indexCSV()) } } }) rule := android.NewRuleBuilder(pctx, ctx) rule.Command(). BuiltTool("merge_csv"). Flag("--key_field signature"). FlagWithArg("--header=", "signature,file,startline,startcol,endline,endcol,properties"). FlagWithOutput("--output=", hiddenAPISingletonPaths(ctx).index). Inputs(indexes) rule.Build("singleton-merged-hiddenapi-index", "Singleton merged Hidden API index") h.index = hiddenAPISingletonPaths(ctx).index } func (h *hiddenAPIIndexSingleton) MakeVars(ctx android.MakeVarsContext) { if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") { return } ctx.Strict("INTERNAL_PLATFORM_HIDDENAPI_INDEX", h.index.String()) }
java/hiddenapi_singleton_test.go +0 −55 Original line number Diff line number Diff line Loading @@ -50,61 +50,6 @@ func TestHiddenAPISingleton(t *testing.T) { android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, want) } func TestHiddenAPIIndexSingleton(t *testing.T) { result := android.GroupFixturePreparers( hiddenApiFixtureFactory, PrepareForTestWithJavaSdkLibraryFiles, FixtureWithLastReleaseApis("bar"), FixtureConfigureBootJars("platform:foo", "platform:bar"), ).RunTestWithBp(t, ` java_library { name: "foo", srcs: ["a.java"], compile_dex: true, hiddenapi_additional_annotations: [ "foo-hiddenapi-annotations", ], } java_library { name: "foo-hiddenapi-annotations", srcs: ["a.java"], compile_dex: true, } java_import { name: "foo", jars: ["a.jar"], compile_dex: true, prefer: false, } java_sdk_library { name: "bar", srcs: ["a.java"], compile_dex: true, } `) hiddenAPIIndex := result.SingletonForTests("hiddenapi_index") indexRule := hiddenAPIIndex.Rule("singleton-merged-hiddenapi-index") CheckHiddenAPIRuleInputs(t, ` .intermediates/bar/android_common/hiddenapi/index.csv .intermediates/foo/android_common/hiddenapi/index.csv `, indexRule) // Make sure that the foo-hiddenapi-annotations.jar is included in the inputs to the rules that // creates the index.csv file. foo := result.ModuleForTests("foo", "android_common") indexParams := foo.Output("hiddenapi/index.csv") CheckHiddenAPIRuleInputs(t, ` .intermediates/foo-hiddenapi-annotations/android_common/javac/foo-hiddenapi-annotations.jar .intermediates/foo/android_common/javac/foo.jar `, indexParams) } func TestHiddenAPISingletonWithSourceAndPrebuiltPreferredButNoDex(t *testing.T) { expectedErrorMessage := "hiddenapi has determined that the source module \"foo\" should be ignored as it has been" + Loading
java/platform_bootclasspath.go +18 −0 Original line number Diff line number Diff line Loading @@ -339,4 +339,22 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android. outputPath := hiddenAPISingletonPaths(ctx).flags baseFlagsPath := hiddenAPISingletonPaths(ctx).stubFlags ruleToGenerateHiddenApiFlags(ctx, outputPath, baseFlagsPath, moduleSpecificFlagsPaths, augmentationInfo) b.generateHiddenAPIIndexRules(ctx, hiddenAPISupportingModules) } func (b *platformBootclasspathModule) generateHiddenAPIIndexRules(ctx android.ModuleContext, modules []hiddenAPISupportingModule) { indexes := android.Paths{} for _, module := range modules { indexes = append(indexes, module.indexCSV()) } rule := android.NewRuleBuilder(pctx, ctx) rule.Command(). BuiltTool("merge_csv"). Flag("--key_field signature"). FlagWithArg("--header=", "signature,file,startline,startcol,endline,endcol,properties"). FlagWithOutput("--output=", hiddenAPISingletonPaths(ctx).index). Inputs(indexes) rule.Build("platform-bootclasspath-monolithic-hiddenapi-index", "monolithic hidden API index") }
java/platform_bootclasspath_test.go +59 −0 Original line number Diff line number Diff line Loading @@ -172,3 +172,62 @@ func TestPlatformBootclasspath_Dist(t *testing.T) { 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])) } func TestPlatformBootclasspath_HiddenAPIMonolithicIndexFile(t *testing.T) { result := android.GroupFixturePreparers( hiddenApiFixtureFactory, PrepareForTestWithJavaSdkLibraryFiles, FixtureWithLastReleaseApis("bar"), FixtureConfigureBootJars("platform:foo", "platform:bar"), ).RunTestWithBp(t, ` java_library { name: "foo", srcs: ["a.java"], compile_dex: true, hiddenapi_additional_annotations: [ "foo-hiddenapi-annotations", ], } java_library { name: "foo-hiddenapi-annotations", srcs: ["a.java"], compile_dex: true, } java_import { name: "foo", jars: ["a.jar"], compile_dex: true, prefer: false, } java_sdk_library { name: "bar", srcs: ["a.java"], compile_dex: true, } platform_bootclasspath { name: "myplatform-bootclasspath", } `) platformBootclasspath := result.ModuleForTests("myplatform-bootclasspath", "android_common") indexRule := platformBootclasspath.Rule("platform-bootclasspath-monolithic-hiddenapi-index") CheckHiddenAPIRuleInputs(t, ` .intermediates/bar/android_common/hiddenapi/index.csv .intermediates/foo/android_common/hiddenapi/index.csv `, indexRule) // Make sure that the foo-hiddenapi-annotations.jar is included in the inputs to the rules that // creates the index.csv file. foo := result.ModuleForTests("foo", "android_common") indexParams := foo.Output("hiddenapi/index.csv") CheckHiddenAPIRuleInputs(t, ` .intermediates/foo-hiddenapi-annotations/android_common/javac/foo-hiddenapi-annotations.jar .intermediates/foo/android_common/javac/foo.jar `, indexParams) }