summaryrefslogtreecommitdiff
path: root/java/sdk_library.go
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2020-08-18 05:07:22 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2020-08-18 05:07:22 +0000
commitaa3235edcc79f76bb66f5bcad3a47c8c60b64ec3 (patch)
treee91b202cf5f10ae8af7a82d3b30a283769816442 /java/sdk_library.go
parentb8b19daf9ddcb0f884e68e82cb5849d617a3c21c (diff)
parentca29a25d38b6fcd4845720404f56fb8d8726e246 (diff)
Merge "Deduplicate APEX variants that would build identically" am: ca29a25d38
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1399832 Change-Id: Ic3727a541bb7a098fe81ca0d4cf92e2139f1a7ab
Diffstat (limited to 'java/sdk_library.go')
-rw-r--r--java/sdk_library.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 2aae42fc9..de1617328 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1376,22 +1376,22 @@ func PrebuiltJars(ctx android.BaseModuleContext, baseName string, s sdkSpec) and
return android.Paths{jarPath.Path()}
}
-// Get the apex name for module, "" if it is for platform.
-func getApexNameForModule(module android.Module) string {
+// Get the apex names for module, nil if it is for platform.
+func getApexNamesForModule(module android.Module) []string {
if apex, ok := module.(android.ApexModule); ok {
- return apex.ApexVariationName()
+ return apex.InApexes()
}
- return ""
+ return nil
}
-// Check to see if the other module is within the same named APEX as this module.
+// Check to see if the other module is within the same set of named APEXes as this module.
//
// If either this or the other module are on the platform then this will return
// false.
-func withinSameApexAs(module android.ApexModule, other android.Module) bool {
- name := module.ApexVariationName()
- return name != "" && getApexNameForModule(other) == name
+func withinSameApexesAs(module android.ApexModule, other android.Module) bool {
+ names := module.InApexes()
+ return len(names) > 0 && reflect.DeepEqual(names, getApexNamesForModule(other))
}
func (module *SdkLibrary) sdkJars(ctx android.BaseModuleContext, sdkVersion sdkSpec, headerJars bool) android.Paths {
@@ -1410,7 +1410,7 @@ func (module *SdkLibrary) sdkJars(ctx android.BaseModuleContext, sdkVersion sdkS
// Only allow access to the implementation library in the following condition:
// * No sdk_version specified on the referencing module.
// * The referencing module is in the same apex as this.
- if sdkVersion.kind == sdkPrivate || withinSameApexAs(module, ctx.Module()) {
+ if sdkVersion.kind == sdkPrivate || withinSameApexesAs(module, ctx.Module()) {
if headerJars {
return module.HeaderJars()
} else {
@@ -1949,7 +1949,7 @@ func (module *SdkLibraryImport) sdkJars(ctx android.BaseModuleContext, sdkVersio
// For consistency with SdkLibrary make the implementation jar available to libraries that
// are within the same APEX.
implLibraryModule := module.implLibraryModule
- if implLibraryModule != nil && withinSameApexAs(module, ctx.Module()) {
+ if implLibraryModule != nil && withinSameApexesAs(module, ctx.Module()) {
if headerJars {
return implLibraryModule.HeaderJars()
} else {