Correct module_lib scope name

The module_lib scope should be called module-lib in order to pick up
the latest filegroup. Without it the API lint does not use a baseline
and so reports issues with released and unchangeable APIs.

It is also needed for the correct dist path.

Test: m update-api
Bug: 155164730
Change-Id: I7dbafd7164d5da600ca45c39a7f93a5a40027a1f
This commit is contained in:
Paul Duffin 2020-05-13 19:19:49 +01:00
parent f9088b03c2
commit 6b836ba566
2 changed files with 19 additions and 15 deletions

View file

@ -92,6 +92,9 @@ type apiScope struct {
// The name of the field in the dynamically created structure. // The name of the field in the dynamically created structure.
fieldName string 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. // The tag to use to depend on the stubs library module.
stubsTag scopeDependencyTag stubsTag scopeDependencyTag
@ -142,7 +145,8 @@ type apiScope struct {
// Initialize a scope, creating and adding appropriate dependency tags // Initialize a scope, creating and adding appropriate dependency tags
func initApiScope(scope *apiScope) *apiScope { func initApiScope(scope *apiScope) *apiScope {
name := scope.name name := scope.name
scope.fieldName = proptools.FieldNameForProperty(name) scope.propertyName = strings.ReplaceAll(name, "-", "_")
scope.fieldName = proptools.FieldNameForProperty(scope.propertyName)
scope.stubsTag = scopeDependencyTag{ scope.stubsTag = scopeDependencyTag{
name: name + "-stubs", name: name + "-stubs",
apiScope: scope, apiScope: scope,
@ -253,7 +257,7 @@ var (
unstable: true, unstable: true,
}) })
apiScopeModuleLib = initApiScope(&apiScope{ apiScopeModuleLib = initApiScope(&apiScope{
name: "module_lib", name: "module-lib",
extends: apiScopeSystem, extends: apiScopeSystem,
// Module_lib scope is disabled by default in legacy mode. // 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 { for _, apiScope := range allApiScopes {
if properties, ok := s.Scopes[apiScope]; ok { 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) scopeDir := filepath.Join("sdk_library", s.OsPrefix(), apiScope.name)

View file

@ -1328,10 +1328,10 @@ java_sdk_library_import {
sdk_version: "system_current", sdk_version: "system_current",
}, },
module_lib: { module_lib: {
jars: ["sdk_library/module_lib/myjavalib-stubs.jar"], jars: ["sdk_library/module-lib/myjavalib-stubs.jar"],
stub_srcs: ["sdk_library/module_lib/myjavalib_stub_sources"], stub_srcs: ["sdk_library/module-lib/myjavalib_stub_sources"],
current_api: "sdk_library/module_lib/myjavalib.txt", current_api: "sdk_library/module-lib/myjavalib.txt",
removed_api: "sdk_library/module_lib/myjavalib-removed.txt", removed_api: "sdk_library/module-lib/myjavalib-removed.txt",
sdk_version: "module_current", sdk_version: "module_current",
}, },
} }
@ -1355,10 +1355,10 @@ java_sdk_library_import {
sdk_version: "system_current", sdk_version: "system_current",
}, },
module_lib: { module_lib: {
jars: ["sdk_library/module_lib/myjavalib-stubs.jar"], jars: ["sdk_library/module-lib/myjavalib-stubs.jar"],
stub_srcs: ["sdk_library/module_lib/myjavalib_stub_sources"], stub_srcs: ["sdk_library/module-lib/myjavalib_stub_sources"],
current_api: "sdk_library/module_lib/myjavalib.txt", current_api: "sdk_library/module-lib/myjavalib.txt",
removed_api: "sdk_library/module_lib/myjavalib-removed.txt", removed_api: "sdk_library/module-lib/myjavalib-removed.txt",
sdk_version: "module_current", 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.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.txt
.intermediates/myjavalib.stubs.source.system/android_common/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib-removed.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.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.txt
.intermediates/myjavalib.api.module_lib/android_common/myjavalib.api.module_lib_api.txt -> sdk_library/module_lib/myjavalib-removed.txt .intermediates/myjavalib.api.module_lib/android_common/myjavalib.api.module_lib_api.txt -> sdk_library/module-lib/myjavalib-removed.txt
`), `),
checkMergeZips( checkMergeZips(
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", ".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/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",
), ),
) )
} }