Remove legacy properties from java_sdk_library_import
The legacy usages have all been updated so the legacy properties
can be safely removed. The Libs property is kept so it can be used to
specify properties common to all scopes.
Bug: 148080325
Test: m droid
TARGET_BUILD_APPS=Camera2 m
Change-Id: I252ebbedbb463db3c7346e86d86b5880eea76fe9
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 503f1d6..cd22e6e 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -849,6 +849,10 @@
}
type sdkLibraryImportProperties struct {
+ // List of shared java libs, common to all scopes, that this module has
+ // dependencies to
+ Libs []string
+
// Properties associated with the public api scope.
Public sdkLibraryScopeProperties
@@ -866,11 +870,6 @@
properties sdkLibraryImportProperties
- // Legacy properties for the public api scope.
- //
- // Should use properties.Public instead.
- legacyPublicProperties sdkLibraryScopeProperties
-
commonToSdkLibraryAndImport
}
@@ -880,9 +879,9 @@
func sdkLibraryImportFactory() android.Module {
module := &sdkLibraryImport{}
- module.AddProperties(&module.properties, &module.legacyPublicProperties)
+ module.AddProperties(&module.properties)
- android.InitPrebuiltModule(module, &module.legacyPublicProperties.Jars)
+ android.InitPrebuiltModule(module, &[]string{})
InitJavaModule(module, android.HostAndDeviceSupported)
android.AddLoadHook(module, func(mctx android.LoadHookContext) { module.createInternalModules(mctx) })
@@ -899,22 +898,6 @@
func (module *sdkLibraryImport) createInternalModules(mctx android.LoadHookContext) {
- // Prepend any of the libs from the legacy public properties to the libs for each of the
- // scopes to avoid having to duplicate them in each scope.
- for _, scopeProperties := range module.scopeProperties() {
- scopeProperties.Libs = append(module.legacyPublicProperties.Libs, scopeProperties.Libs...)
- }
-
- if module.legacyPublicProperties.Jars != nil {
- if module.properties.Public.Jars != nil {
- mctx.ModuleErrorf("cannot set both `jars` and `public.jars`")
- return
- }
-
- // The legacy set of properties has been used so copy them over the public properties.
- module.properties.Public = module.legacyPublicProperties
- }
-
for apiScope, scopeProperties := range module.scopeProperties() {
if len(scopeProperties.Jars) == 0 {
continue
@@ -934,7 +917,9 @@
props.Name = proptools.StringPtr(apiScope.stubsModuleName(module.BaseModuleName()))
props.Sdk_version = scopeProperties.Sdk_version
- props.Libs = scopeProperties.Libs
+ // Prepend any of the libs from the legacy public properties to the libs for each of the
+ // scopes to avoid having to duplicate them in each scope.
+ props.Libs = append(module.properties.Libs, scopeProperties.Libs...)
props.Jars = scopeProperties.Jars
if module.SocSpecific() {