Revert "Deduplicate APEX variants that would build identically"
This reverts commit d6b2525b00
.
Reason for revert: <Breaks tests - confirmed by Forrest: b/165188843>
Change-Id: I7cb68cb87522415004390c0672dc774e0067b122
This commit is contained in:
@@ -262,7 +262,7 @@ func getBootImageJar(ctx android.SingletonContext, image *bootImageConfig, modul
|
||||
apex, isApexModule := module.(android.ApexModule)
|
||||
fromUpdatableApex := isApexModule && apex.Updatable()
|
||||
if image.name == artBootImageName {
|
||||
if isApexModule && len(apex.InApexes()) > 0 && allHavePrefix(apex.InApexes(), "com.android.art.") {
|
||||
if isApexModule && strings.HasPrefix(apex.ApexVariationName(), "com.android.art.") {
|
||||
// ok: found the jar in the ART apex
|
||||
} else if isApexModule && apex.IsForPlatform() && Bool(module.(*Library).deviceProperties.Hostdex) {
|
||||
// exception (skip and continue): special "hostdex" platform variant
|
||||
@@ -272,17 +272,17 @@ func getBootImageJar(ctx android.SingletonContext, image *bootImageConfig, modul
|
||||
return -1, nil
|
||||
} else if fromUpdatableApex {
|
||||
// error: this jar is part of an updatable apex other than ART
|
||||
ctx.Errorf("module %q from updatable apexes %q is not allowed in the ART boot image", name, apex.InApexes())
|
||||
ctx.Errorf("module '%s' from updatable apex '%s' is not allowed in the ART boot image", name, apex.ApexVariationName())
|
||||
} else {
|
||||
// error: this jar is part of the platform or a non-updatable apex
|
||||
ctx.Errorf("module %q is not allowed in the ART boot image", name)
|
||||
ctx.Errorf("module '%s' is not allowed in the ART boot image", name)
|
||||
}
|
||||
} else if image.name == frameworkBootImageName {
|
||||
if !fromUpdatableApex {
|
||||
// ok: this jar is part of the platform or a non-updatable apex
|
||||
} else {
|
||||
// error: this jar is part of an updatable apex
|
||||
ctx.Errorf("module %q from updatable apexes %q is not allowed in the framework boot image", name, apex.InApexes())
|
||||
ctx.Errorf("module '%s' from updatable apex '%s' is not allowed in the framework boot image", name, apex.ApexVariationName())
|
||||
}
|
||||
} else {
|
||||
panic("unknown boot image: " + image.name)
|
||||
@@ -291,15 +291,6 @@ func getBootImageJar(ctx android.SingletonContext, image *bootImageConfig, modul
|
||||
return index, jar.DexJarBuildPath()
|
||||
}
|
||||
|
||||
func allHavePrefix(list []string, prefix string) bool {
|
||||
for _, s := range list {
|
||||
if !strings.HasPrefix(s, prefix) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// buildBootImage takes a bootImageConfig, creates rules to build it, and returns the image.
|
||||
func buildBootImage(ctx android.SingletonContext, image *bootImageConfig) *bootImageConfig {
|
||||
// Collect dex jar paths for the boot image modules.
|
||||
|
@@ -1376,22 +1376,22 @@ func PrebuiltJars(ctx android.BaseModuleContext, baseName string, s sdkSpec) and
|
||||
return android.Paths{jarPath.Path()}
|
||||
}
|
||||
|
||||
// Get the apex names for module, nil if it is for platform.
|
||||
func getApexNamesForModule(module android.Module) []string {
|
||||
// Get the apex name for module, "" if it is for platform.
|
||||
func getApexNameForModule(module android.Module) string {
|
||||
if apex, ok := module.(android.ApexModule); ok {
|
||||
return apex.InApexes()
|
||||
return apex.ApexVariationName()
|
||||
}
|
||||
|
||||
return nil
|
||||
return ""
|
||||
}
|
||||
|
||||
// Check to see if the other module is within the same set of named APEXes as this module.
|
||||
// Check to see if the other module is within the same named APEX as this module.
|
||||
//
|
||||
// If either this or the other module are on the platform then this will return
|
||||
// false.
|
||||
func withinSameApexesAs(module android.ApexModule, other android.Module) bool {
|
||||
names := module.InApexes()
|
||||
return len(names) > 0 && reflect.DeepEqual(names, getApexNamesForModule(other))
|
||||
func withinSameApexAs(module android.ApexModule, other android.Module) bool {
|
||||
name := module.ApexVariationName()
|
||||
return name != "" && getApexNameForModule(other) == name
|
||||
}
|
||||
|
||||
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 || withinSameApexesAs(module, ctx.Module()) {
|
||||
if sdkVersion.kind == sdkPrivate || withinSameApexAs(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 && withinSameApexesAs(module, ctx.Module()) {
|
||||
if implLibraryModule != nil && withinSameApexAs(module, ctx.Module()) {
|
||||
if headerJars {
|
||||
return implLibraryModule.HeaderJars()
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user