Merge changes Ifd2858dd,I2585dd99,I65e7a456 am: 0c6f111d7b am: d6b1515935

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1348951

Change-Id: Idcc16a40f953019278ea34829ca297a353da0820
This commit is contained in:
Treehugger Robot
2020-06-29 02:47:14 +00:00
committed by Automerger Merge Worker
4 changed files with 218 additions and 38 deletions

View File

@@ -1431,6 +1431,7 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
targets := ctx.MultiTargets()
config := ctx.DeviceConfig()
imageVariation := a.getImageVariation(ctx)
a.combineProperties(ctx)
@@ -1450,13 +1451,13 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
Jni_libs: a.properties.Jni_libs,
Binaries: nil,
},
target, a.getImageVariation(config))
target, imageVariation)
// Add native modules targetting both ABIs
addDependenciesForNativeModules(ctx,
a.properties.Multilib.Both,
target,
a.getImageVariation(config))
imageVariation)
isPrimaryAbi := i == 0
if isPrimaryAbi {
@@ -1469,13 +1470,13 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
Jni_libs: nil,
Binaries: a.properties.Binaries,
},
target, a.getImageVariation(config))
target, imageVariation)
// Add native modules targetting the first ABI
addDependenciesForNativeModules(ctx,
a.properties.Multilib.First,
target,
a.getImageVariation(config))
imageVariation)
}
switch target.Arch.ArchType.Multilib {
@@ -1484,24 +1485,24 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
addDependenciesForNativeModules(ctx,
a.properties.Multilib.Lib32,
target,
a.getImageVariation(config))
imageVariation)
addDependenciesForNativeModules(ctx,
a.properties.Multilib.Prefer32,
target,
a.getImageVariation(config))
imageVariation)
case "lib64":
// Add native modules targetting 64-bit ABI
addDependenciesForNativeModules(ctx,
a.properties.Multilib.Lib64,
target,
a.getImageVariation(config))
imageVariation)
if !has32BitTarget {
addDependenciesForNativeModules(ctx,
a.properties.Multilib.Prefer32,
target,
a.getImageVariation(config))
imageVariation)
}
}
}
@@ -1603,15 +1604,33 @@ func (a *apexBundle) testOnlyShouldSkipPayloadSign() bool {
return proptools.Bool(a.properties.Test_only_unsigned_payload)
}
func (a *apexBundle) getImageVariation(config android.DeviceConfig) string {
func (a *apexBundle) getImageVariation(ctx android.BottomUpMutatorContext) string {
deviceConfig := ctx.DeviceConfig()
if a.vndkApex {
return cc.VendorVariationPrefix + a.vndkVersion(config)
return cc.VendorVariationPrefix + a.vndkVersion(deviceConfig)
}
if config.VndkVersion() != "" && proptools.Bool(a.properties.Use_vendor) {
return cc.VendorVariationPrefix + config.PlatformVndkVersion()
} else {
return android.CoreVariation
var prefix string
var vndkVersion string
if deviceConfig.VndkVersion() != "" {
if proptools.Bool(a.properties.Use_vendor) {
prefix = cc.VendorVariationPrefix
vndkVersion = deviceConfig.PlatformVndkVersion()
} else if a.SocSpecific() || a.DeviceSpecific() {
prefix = cc.VendorVariationPrefix
vndkVersion = deviceConfig.VndkVersion()
} else if a.ProductSpecific() {
prefix = cc.ProductVariationPrefix
vndkVersion = deviceConfig.ProductVndkVersion()
}
}
if vndkVersion == "current" {
vndkVersion = deviceConfig.PlatformVndkVersion()
}
if vndkVersion != "" {
return prefix + vndkVersion
}
return android.CoreVariation
}
func (a *apexBundle) EnableSanitizer(sanitizerName string) {
@@ -1643,7 +1662,7 @@ func (a *apexBundle) AddSanitizerDependencies(ctx android.BottomUpMutatorContext
for _, target := range ctx.MultiTargets() {
if target.Arch.ArchType.Multilib == "lib64" {
ctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
{Mutator: "image", Variation: a.getImageVariation(ctx.DeviceConfig())},
{Mutator: "image", Variation: a.getImageVariation(ctx)},
{Mutator: "link", Variation: "shared"},
{Mutator: "version", Variation: ""}, // "" is the non-stub variant
}...), sharedLibTag, "libclang_rt.hwasan-aarch64-android")
@@ -1887,6 +1906,12 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) {
return
}
// Because APEXes targeting other than system/system_ext partitions
// can't set apex_available, we skip checks for these APEXes
if ctx.SocSpecific() || ctx.DeviceSpecific() || ctx.ProductSpecific() {
return
}
// Coverage build adds additional dependencies for the coverage-only runtime libraries.
// Requiring them and their transitive depencies with apex_available is not right
// because they just add noise.
@@ -2194,7 +2219,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
af := apexFileForNativeLibrary(ctx, cc, handleSpecialLibs)
af.transitiveDep = true
if !a.Host() && !android.DirectlyInApex(ctx.ModuleName(), ctx.OtherModuleName(cc)) && (cc.IsStubs() || cc.HasStubsVariants()) {
if !a.Host() && !android.DirectlyInApex(ctx.ModuleName(), depName) && (cc.IsStubs() || cc.HasStubsVariants()) {
// If the dependency is a stubs lib, don't include it in this APEX,
// but make sure that the lib is installed on the device.
// In case no APEX is having the lib, the lib is installed to the system
@@ -2202,8 +2227,17 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
//
// Always include if we are a host-apex however since those won't have any
// system libraries.
if !android.DirectlyInAnyApex(ctx, cc.Name()) && !android.InList(cc.BaseModuleName(), a.requiredDeps) {
a.requiredDeps = append(a.requiredDeps, cc.BaseModuleName())
if !android.DirectlyInAnyApex(ctx, depName) {
// we need a module name for Make
name := cc.BaseModuleName() + cc.Properties.SubName
if proptools.Bool(a.properties.Use_vendor) {
// we don't use subName(.vendor) for a "use_vendor: true" apex
// which is supposed to be installed in /system
name = cc.BaseModuleName()
}
if !android.InList(name, a.requiredDeps) {
a.requiredDeps = append(a.requiredDeps, name)
}
}
requireNativeLibs = append(requireNativeLibs, af.Stem())
// Don't track further
@@ -2298,6 +2332,12 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
a.installable() &&
!proptools.Bool(a.properties.Use_vendor)
// APEXes targeting other than system/system_ext partitions use vendor/product variants.
// So we can't link them to /system/lib libs which are core variants.
if a.SocSpecific() || a.DeviceSpecific() || a.ProductSpecific() {
a.linkToSystemLib = false
}
// We don't need the optimization for updatable APEXes, as it might give false signal
// to the system health when the APEXes are still bundled (b/149805758)
if a.Updatable() && a.properties.ApexType == imageApex {