Merge changes from topic "expose-system-test" am: 1b57531573

Change-Id: I449bc12e63fbb23ae0fb48973c179da0403a1314
This commit is contained in:
Automerger Merge Worker
2020-02-04 08:34:18 +00:00
2 changed files with 10 additions and 30 deletions

View File

@@ -458,7 +458,7 @@ func TestPrebuilts(t *testing.T) {
java_library { java_library {
name: "foo", name: "foo",
srcs: ["a.java", ":stubs-source"], srcs: ["a.java", ":stubs-source"],
libs: ["bar", "sdklib", "sdklib-legacy"], libs: ["bar", "sdklib"],
static_libs: ["baz"], static_libs: ["baz"],
} }
@@ -477,11 +477,6 @@ func TestPrebuilts(t *testing.T) {
jars: ["b.jar"], jars: ["b.jar"],
} }
java_sdk_library_import {
name: "sdklib-legacy",
jars: ["b.jar"],
}
java_sdk_library_import { java_sdk_library_import {
name: "sdklib", name: "sdklib",
public: { public: {

View File

@@ -849,6 +849,10 @@ type sdkLibraryScopeProperties struct {
} }
type sdkLibraryImportProperties struct { 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. // Properties associated with the public api scope.
Public sdkLibraryScopeProperties Public sdkLibraryScopeProperties
@@ -866,11 +870,6 @@ type sdkLibraryImport struct {
properties sdkLibraryImportProperties properties sdkLibraryImportProperties
// Legacy properties for the public api scope.
//
// Should use properties.Public instead.
legacyPublicProperties sdkLibraryScopeProperties
commonToSdkLibraryAndImport commonToSdkLibraryAndImport
} }
@@ -880,9 +879,9 @@ var _ SdkLibraryDependency = (*sdkLibraryImport)(nil)
func sdkLibraryImportFactory() android.Module { func sdkLibraryImportFactory() android.Module {
module := &sdkLibraryImport{} 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) InitJavaModule(module, android.HostAndDeviceSupported)
android.AddLoadHook(module, func(mctx android.LoadHookContext) { module.createInternalModules(mctx) }) android.AddLoadHook(module, func(mctx android.LoadHookContext) { module.createInternalModules(mctx) })
@@ -899,22 +898,6 @@ func (module *sdkLibraryImport) Name() string {
func (module *sdkLibraryImport) createInternalModules(mctx android.LoadHookContext) { 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() { for apiScope, scopeProperties := range module.scopeProperties() {
if len(scopeProperties.Jars) == 0 { if len(scopeProperties.Jars) == 0 {
continue continue
@@ -934,7 +917,9 @@ func (module *sdkLibraryImport) createInternalModules(mctx android.LoadHookConte
props.Name = proptools.StringPtr(apiScope.stubsModuleName(module.BaseModuleName())) props.Name = proptools.StringPtr(apiScope.stubsModuleName(module.BaseModuleName()))
props.Sdk_version = scopeProperties.Sdk_version 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 props.Jars = scopeProperties.Jars
if module.SocSpecific() { if module.SocSpecific() {