Loading api/StubLibraries.bp +6 −6 Original line number Original line Diff line number Diff line Loading @@ -341,7 +341,7 @@ java_defaults { } } java_library { java_library { name: "android_stubs_current", name: "android_stubs_current.from-source", static_libs: [ static_libs: [ "all-modules-public-stubs", "all-modules-public-stubs", "android-non-updatable.stubs", "android-non-updatable.stubs", Loading @@ -351,7 +351,7 @@ java_library { } } java_library { java_library { name: "android_system_stubs_current", name: "android_system_stubs_current.from-source", static_libs: [ static_libs: [ "all-modules-system-stubs", "all-modules-system-stubs", "android-non-updatable.stubs.system", "android-non-updatable.stubs.system", Loading @@ -375,7 +375,7 @@ java_library { } } java_library { java_library { name: "android_test_stubs_current", name: "android_test_stubs_current.from-source", static_libs: [ static_libs: [ // Updatable modules do not have test APIs, but we want to include their SystemApis, like we // Updatable modules do not have test APIs, but we want to include their SystemApis, like we // include the SystemApi of framework-non-updatable-sources. // include the SystemApi of framework-non-updatable-sources. Loading @@ -395,7 +395,7 @@ java_library { } } java_library { java_library { name: "android_module_lib_stubs_current", name: "android_module_lib_stubs_current.from-source", defaults: [ defaults: [ "android.jar_defaults", "android.jar_defaults", "android_stubs_dists_default", "android_stubs_dists_default", Loading @@ -411,7 +411,7 @@ java_library { } } java_library { java_library { name: "android_system_server_stubs_current", name: "android_system_server_stubs_current.from-source", defaults: [ defaults: [ "android.jar_defaults", "android.jar_defaults", "android_stubs_dists_default", "android_stubs_dists_default", Loading @@ -419,7 +419,7 @@ java_library { srcs: [":services-non-updatable-stubs"], srcs: [":services-non-updatable-stubs"], installable: false, installable: false, static_libs: [ static_libs: [ "android_module_lib_stubs_current", "android_module_lib_stubs_current.from-source", ], ], dist: { dist: { dir: "apistubs/android/system-server", dir: "apistubs/android/system-server", Loading api/api.go +27 −0 Original line number Original line Diff line number Diff line Loading @@ -96,6 +96,7 @@ type libraryProps struct { Sdk_version *string Sdk_version *string Static_libs []string Static_libs []string Visibility []string Visibility []string Defaults []string } } type fgProps struct { type fgProps struct { Loading Loading @@ -362,6 +363,30 @@ func createApiContributionDefaults(ctx android.LoadHookContext, modules []string } } } } func createFullApiLibraries(ctx android.LoadHookContext) { javaLibraryNames := []string{ "android_stubs_current", "android_system_stubs_current", "android_test_stubs_current", "android_module_lib_stubs_current", "android_system_server_stubs_current", } for _, libraryName := range javaLibraryNames { props := libraryProps{} props.Name = proptools.StringPtr(libraryName) staticLib := libraryName + ".from-source" if ctx.Config().BuildFromTextStub() { staticLib = libraryName + ".from-text" } props.Static_libs = []string{staticLib} props.Defaults = []string{"android.jar_defaults"} props.Visibility = []string{"//visibility:public"} ctx.CreateModule(java.LibraryFactory, &props) } } func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) { func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) { bootclasspath := a.properties.Bootclasspath bootclasspath := a.properties.Bootclasspath system_server_classpath := a.properties.System_server_classpath system_server_classpath := a.properties.System_server_classpath Loading @@ -382,6 +407,8 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) { createPublicStubsSourceFilegroup(ctx, bootclasspath) createPublicStubsSourceFilegroup(ctx, bootclasspath) createApiContributionDefaults(ctx, bootclasspath) createApiContributionDefaults(ctx, bootclasspath) createFullApiLibraries(ctx) } } func combinedApisModuleFactory() android.Module { func combinedApisModuleFactory() android.Module { Loading api/api_test.go +11 −1 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ import ( "android/soong/android" "android/soong/android" "android/soong/bp2build" "android/soong/bp2build" "android/soong/java" ) ) func runCombinedApisTestCaseWithRegistrationCtxFunc(t *testing.T, tc bp2build.Bp2buildTestCase, registrationCtxFunc func(ctx android.RegistrationContext)) { func runCombinedApisTestCaseWithRegistrationCtxFunc(t *testing.T, tc bp2build.Bp2buildTestCase, registrationCtxFunc func(ctx android.RegistrationContext)) { Loading @@ -30,7 +31,9 @@ func runCombinedApisTestCaseWithRegistrationCtxFunc(t *testing.T, tc bp2build.Bp func runCombinedApisTestCase(t *testing.T, tc bp2build.Bp2buildTestCase) { func runCombinedApisTestCase(t *testing.T, tc bp2build.Bp2buildTestCase) { t.Helper() t.Helper() runCombinedApisTestCaseWithRegistrationCtxFunc(t, tc, func(ctx android.RegistrationContext) {}) runCombinedApisTestCaseWithRegistrationCtxFunc(t, tc, func(ctx android.RegistrationContext) { ctx.RegisterModuleType("java_defaults", java.DefaultsFactory) }) } } func TestCombinedApisGeneral(t *testing.T) { func TestCombinedApisGeneral(t *testing.T) { Loading @@ -42,6 +45,13 @@ func TestCombinedApisGeneral(t *testing.T) { system_server_classpath: ["ssc"], system_server_classpath: ["ssc"], } } `, `, Filesystem: map[string]string{ "a/Android.bp": ` java_defaults { name: "android.jar_defaults", } `, }, ExpectedBazelTargets: []string{ ExpectedBazelTargets: []string{ bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-current.txt", bp2build.AttrNameToString{ bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-current.txt", bp2build.AttrNameToString{ "scope": `"public"`, "scope": `"public"`, Loading Loading
api/StubLibraries.bp +6 −6 Original line number Original line Diff line number Diff line Loading @@ -341,7 +341,7 @@ java_defaults { } } java_library { java_library { name: "android_stubs_current", name: "android_stubs_current.from-source", static_libs: [ static_libs: [ "all-modules-public-stubs", "all-modules-public-stubs", "android-non-updatable.stubs", "android-non-updatable.stubs", Loading @@ -351,7 +351,7 @@ java_library { } } java_library { java_library { name: "android_system_stubs_current", name: "android_system_stubs_current.from-source", static_libs: [ static_libs: [ "all-modules-system-stubs", "all-modules-system-stubs", "android-non-updatable.stubs.system", "android-non-updatable.stubs.system", Loading @@ -375,7 +375,7 @@ java_library { } } java_library { java_library { name: "android_test_stubs_current", name: "android_test_stubs_current.from-source", static_libs: [ static_libs: [ // Updatable modules do not have test APIs, but we want to include their SystemApis, like we // Updatable modules do not have test APIs, but we want to include their SystemApis, like we // include the SystemApi of framework-non-updatable-sources. // include the SystemApi of framework-non-updatable-sources. Loading @@ -395,7 +395,7 @@ java_library { } } java_library { java_library { name: "android_module_lib_stubs_current", name: "android_module_lib_stubs_current.from-source", defaults: [ defaults: [ "android.jar_defaults", "android.jar_defaults", "android_stubs_dists_default", "android_stubs_dists_default", Loading @@ -411,7 +411,7 @@ java_library { } } java_library { java_library { name: "android_system_server_stubs_current", name: "android_system_server_stubs_current.from-source", defaults: [ defaults: [ "android.jar_defaults", "android.jar_defaults", "android_stubs_dists_default", "android_stubs_dists_default", Loading @@ -419,7 +419,7 @@ java_library { srcs: [":services-non-updatable-stubs"], srcs: [":services-non-updatable-stubs"], installable: false, installable: false, static_libs: [ static_libs: [ "android_module_lib_stubs_current", "android_module_lib_stubs_current.from-source", ], ], dist: { dist: { dir: "apistubs/android/system-server", dir: "apistubs/android/system-server", Loading
api/api.go +27 −0 Original line number Original line Diff line number Diff line Loading @@ -96,6 +96,7 @@ type libraryProps struct { Sdk_version *string Sdk_version *string Static_libs []string Static_libs []string Visibility []string Visibility []string Defaults []string } } type fgProps struct { type fgProps struct { Loading Loading @@ -362,6 +363,30 @@ func createApiContributionDefaults(ctx android.LoadHookContext, modules []string } } } } func createFullApiLibraries(ctx android.LoadHookContext) { javaLibraryNames := []string{ "android_stubs_current", "android_system_stubs_current", "android_test_stubs_current", "android_module_lib_stubs_current", "android_system_server_stubs_current", } for _, libraryName := range javaLibraryNames { props := libraryProps{} props.Name = proptools.StringPtr(libraryName) staticLib := libraryName + ".from-source" if ctx.Config().BuildFromTextStub() { staticLib = libraryName + ".from-text" } props.Static_libs = []string{staticLib} props.Defaults = []string{"android.jar_defaults"} props.Visibility = []string{"//visibility:public"} ctx.CreateModule(java.LibraryFactory, &props) } } func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) { func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) { bootclasspath := a.properties.Bootclasspath bootclasspath := a.properties.Bootclasspath system_server_classpath := a.properties.System_server_classpath system_server_classpath := a.properties.System_server_classpath Loading @@ -382,6 +407,8 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) { createPublicStubsSourceFilegroup(ctx, bootclasspath) createPublicStubsSourceFilegroup(ctx, bootclasspath) createApiContributionDefaults(ctx, bootclasspath) createApiContributionDefaults(ctx, bootclasspath) createFullApiLibraries(ctx) } } func combinedApisModuleFactory() android.Module { func combinedApisModuleFactory() android.Module { Loading
api/api_test.go +11 −1 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ import ( "android/soong/android" "android/soong/android" "android/soong/bp2build" "android/soong/bp2build" "android/soong/java" ) ) func runCombinedApisTestCaseWithRegistrationCtxFunc(t *testing.T, tc bp2build.Bp2buildTestCase, registrationCtxFunc func(ctx android.RegistrationContext)) { func runCombinedApisTestCaseWithRegistrationCtxFunc(t *testing.T, tc bp2build.Bp2buildTestCase, registrationCtxFunc func(ctx android.RegistrationContext)) { Loading @@ -30,7 +31,9 @@ func runCombinedApisTestCaseWithRegistrationCtxFunc(t *testing.T, tc bp2build.Bp func runCombinedApisTestCase(t *testing.T, tc bp2build.Bp2buildTestCase) { func runCombinedApisTestCase(t *testing.T, tc bp2build.Bp2buildTestCase) { t.Helper() t.Helper() runCombinedApisTestCaseWithRegistrationCtxFunc(t, tc, func(ctx android.RegistrationContext) {}) runCombinedApisTestCaseWithRegistrationCtxFunc(t, tc, func(ctx android.RegistrationContext) { ctx.RegisterModuleType("java_defaults", java.DefaultsFactory) }) } } func TestCombinedApisGeneral(t *testing.T) { func TestCombinedApisGeneral(t *testing.T) { Loading @@ -42,6 +45,13 @@ func TestCombinedApisGeneral(t *testing.T) { system_server_classpath: ["ssc"], system_server_classpath: ["ssc"], } } `, `, Filesystem: map[string]string{ "a/Android.bp": ` java_defaults { name: "android.jar_defaults", } `, }, ExpectedBazelTargets: []string{ ExpectedBazelTargets: []string{ bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-current.txt", bp2build.AttrNameToString{ bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-current.txt", bp2build.AttrNameToString{ "scope": `"public"`, "scope": `"public"`, Loading