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
Merged-In: I7dbafd7164d5da600ca45c39a7f93a5a40027a1f
Change-Id: I7dbafd7164d5da600ca45c39a7f93a5a40027a1f
(cherry picked from commit 6b836ba566)
This commit is contained in:
Paul Duffin 2020-05-13 19:19:49 +01:00
parent dd89a28104
commit 0f27063a9e
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.
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.
//
@ -1702,7 +1706,7 @@ func (s *sdkLibrarySdkMemberProperties) PopulateFromVariant(ctx android.SdkMembe
func (s *sdkLibrarySdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
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)

View file

@ -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",
),
)
}