diff --git a/java/sdk_library.go b/java/sdk_library.go index 3e7bc724a..7e81c1e33 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -92,6 +92,9 @@ type apiScope struct { // The name of the field in the dynamically created structure. fieldName string + // The name of the property in the java_sdk_library_import + propertyName string + // The tag to use to depend on the stubs library module. stubsTag scopeDependencyTag @@ -142,7 +145,8 @@ type apiScope struct { // Initialize a scope, creating and adding appropriate dependency tags func initApiScope(scope *apiScope) *apiScope { name := scope.name - scope.fieldName = proptools.FieldNameForProperty(name) + scope.propertyName = strings.ReplaceAll(name, "-", "_") + scope.fieldName = proptools.FieldNameForProperty(scope.propertyName) scope.stubsTag = scopeDependencyTag{ name: name + "-stubs", apiScope: scope, @@ -253,7 +257,7 @@ var ( unstable: true, }) apiScopeModuleLib = initApiScope(&apiScope{ - name: "module_lib", + name: "module-lib", extends: apiScopeSystem, // Module_lib scope is disabled by default in legacy mode. // @@ -1710,7 +1714,7 @@ func (s *sdkLibrarySdkMemberProperties) AddToPropertySet(ctx android.SdkMemberCo for _, apiScope := range allApiScopes { if properties, ok := s.Scopes[apiScope]; ok { - scopeSet := propertySet.AddPropertySet(apiScope.name) + scopeSet := propertySet.AddPropertySet(apiScope.propertyName) scopeDir := filepath.Join("sdk_library", s.OsPrefix(), apiScope.name) diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go index f67053fba..bbd638494 100644 --- a/sdk/java_sdk_test.go +++ b/sdk/java_sdk_test.go @@ -1328,10 +1328,10 @@ java_sdk_library_import { sdk_version: "system_current", }, module_lib: { - jars: ["sdk_library/module_lib/myjavalib-stubs.jar"], - stub_srcs: ["sdk_library/module_lib/myjavalib_stub_sources"], - current_api: "sdk_library/module_lib/myjavalib.txt", - removed_api: "sdk_library/module_lib/myjavalib-removed.txt", + jars: ["sdk_library/module-lib/myjavalib-stubs.jar"], + stub_srcs: ["sdk_library/module-lib/myjavalib_stub_sources"], + current_api: "sdk_library/module-lib/myjavalib.txt", + removed_api: "sdk_library/module-lib/myjavalib-removed.txt", sdk_version: "module_current", }, } @@ -1355,10 +1355,10 @@ java_sdk_library_import { sdk_version: "system_current", }, module_lib: { - jars: ["sdk_library/module_lib/myjavalib-stubs.jar"], - stub_srcs: ["sdk_library/module_lib/myjavalib_stub_sources"], - current_api: "sdk_library/module_lib/myjavalib.txt", - removed_api: "sdk_library/module_lib/myjavalib-removed.txt", + jars: ["sdk_library/module-lib/myjavalib-stubs.jar"], + stub_srcs: ["sdk_library/module-lib/myjavalib_stub_sources"], + current_api: "sdk_library/module-lib/myjavalib.txt", + removed_api: "sdk_library/module-lib/myjavalib-removed.txt", sdk_version: "module_current", }, } @@ -1375,14 +1375,14 @@ sdk_snapshot { .intermediates/myjavalib.stubs.system/android_common/javac/myjavalib.stubs.system.jar -> sdk_library/system/myjavalib-stubs.jar .intermediates/myjavalib.stubs.source.system/android_common/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt .intermediates/myjavalib.stubs.source.system/android_common/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib-removed.txt -.intermediates/myjavalib.stubs.module_lib/android_common/javac/myjavalib.stubs.module_lib.jar -> sdk_library/module_lib/myjavalib-stubs.jar -.intermediates/myjavalib.api.module_lib/android_common/myjavalib.api.module_lib_api.txt -> sdk_library/module_lib/myjavalib.txt -.intermediates/myjavalib.api.module_lib/android_common/myjavalib.api.module_lib_api.txt -> sdk_library/module_lib/myjavalib-removed.txt +.intermediates/myjavalib.stubs.module_lib/android_common/javac/myjavalib.stubs.module_lib.jar -> sdk_library/module-lib/myjavalib-stubs.jar +.intermediates/myjavalib.api.module_lib/android_common/myjavalib.api.module_lib_api.txt -> sdk_library/module-lib/myjavalib.txt +.intermediates/myjavalib.api.module_lib/android_common/myjavalib.api.module_lib_api.txt -> sdk_library/module-lib/myjavalib-removed.txt `), checkMergeZips( ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", ".intermediates/mysdk/common_os/tmp/sdk_library/system/myjavalib_stub_sources.zip", - ".intermediates/mysdk/common_os/tmp/sdk_library/module_lib/myjavalib_stub_sources.zip", + ".intermediates/mysdk/common_os/tmp/sdk_library/module-lib/myjavalib_stub_sources.zip", ), ) }