Merge "Vendor apex sets "vndkVersion" when it uses vndk libs"

This commit is contained in:
Treehugger Robot
2022-12-08 03:06:30 +00:00
committed by Gerrit Code Review
2 changed files with 22 additions and 7 deletions

View File

@@ -734,12 +734,14 @@ func (a *apexBundle) combineProperties(ctx android.BottomUpMutatorContext) {
} }
} }
// getImageVariation returns the image variant name for this apexBundle. In most cases, it's simply // getImageVariationPair returns a pair for the image variation name as its
// android.CoreVariation, but gets complicated for the vendor APEXes and the VNDK APEX. // prefix and suffix. The prefix indicates whether it's core/vendor/product and the
func (a *apexBundle) getImageVariation(ctx android.BottomUpMutatorContext) string { // suffix indicates the vndk version when it's vendor or product.
deviceConfig := ctx.DeviceConfig() // getImageVariation can simply join the result of this function to get the
// image variation name.
func (a *apexBundle) getImageVariationPair(deviceConfig android.DeviceConfig) (string, string) {
if a.vndkApex { if a.vndkApex {
return cc.VendorVariationPrefix + a.vndkVersion(deviceConfig) return cc.VendorVariationPrefix, a.vndkVersion(deviceConfig)
} }
var prefix string var prefix string
@@ -757,10 +759,17 @@ func (a *apexBundle) getImageVariation(ctx android.BottomUpMutatorContext) strin
vndkVersion = deviceConfig.PlatformVndkVersion() vndkVersion = deviceConfig.PlatformVndkVersion()
} }
if vndkVersion != "" { if vndkVersion != "" {
return prefix + vndkVersion return prefix, vndkVersion
} }
return android.CoreVariation // The usual case return android.CoreVariation, "" // The usual case
}
// getImageVariation returns the image variant name for this apexBundle. In most cases, it's simply
// android.CoreVariation, but gets complicated for the vendor APEXes and the VNDK APEX.
func (a *apexBundle) getImageVariation(ctx android.BottomUpMutatorContext) string {
prefix, vndkVersion := a.getImageVariationPair(ctx.DeviceConfig())
return prefix + vndkVersion
} }
func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) { func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {

View File

@@ -235,6 +235,12 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs,
optCommands = append(optCommands, "-a jniLibs "+strings.Join(jniLibs, " ")) optCommands = append(optCommands, "-a jniLibs "+strings.Join(jniLibs, " "))
} }
if android.InList(":vndk", requireNativeLibs) {
if _, vndkVersion := a.getImageVariationPair(ctx.DeviceConfig()); vndkVersion != "" {
optCommands = append(optCommands, "-v vndkVersion "+vndkVersion)
}
}
manifestJsonFullOut := android.PathForModuleOut(ctx, "apex_manifest_full.json") manifestJsonFullOut := android.PathForModuleOut(ctx, "apex_manifest_full.json")
defaultVersion := android.DefaultUpdatableModuleVersion defaultVersion := android.DefaultUpdatableModuleVersion
if override := ctx.Config().Getenv("OVERRIDE_APEX_MANIFEST_DEFAULT_VERSION"); override != "" { if override := ctx.Config().Getenv("OVERRIDE_APEX_MANIFEST_DEFAULT_VERSION"); override != "" {