summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2022-12-08 03:24:16 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-12-08 03:24:16 +0000
commit93ca271c21db1455d454546c20be1eec58a9131d (patch)
tree9c2eefd0e255a18226ebc44c2f3c6134cb26d0a1
parent333304310d1b9de54df24c86876e6f33bba9e3f3 (diff)
parentda62908229eaaa7c4521bfed1c815a8c2eb8173a (diff)
Merge "Vendor apex sets "vndkVersion" when it uses vndk libs" am: da62908229
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2330035 Change-Id: Ie7557b723485adc600f52e5bbd585a6ce0d4721d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--apex/apex.go23
-rw-r--r--apex/builder.go6
2 files changed, 22 insertions, 7 deletions
diff --git a/apex/apex.go b/apex/apex.go
index 354c30c46..01e4f1222 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -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
-// android.CoreVariation, but gets complicated for the vendor APEXes and the VNDK APEX.
-func (a *apexBundle) getImageVariation(ctx android.BottomUpMutatorContext) string {
- deviceConfig := ctx.DeviceConfig()
+// getImageVariationPair returns a pair for the image variation name as its
+// prefix and suffix. The prefix indicates whether it's core/vendor/product and the
+// suffix indicates the vndk version when it's vendor or product.
+// 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 {
- return cc.VendorVariationPrefix + a.vndkVersion(deviceConfig)
+ return cc.VendorVariationPrefix, a.vndkVersion(deviceConfig)
}
var prefix string
@@ -757,10 +759,17 @@ func (a *apexBundle) getImageVariation(ctx android.BottomUpMutatorContext) strin
vndkVersion = deviceConfig.PlatformVndkVersion()
}
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) {
diff --git a/apex/builder.go b/apex/builder.go
index 4be34d22b..82a523c78 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -235,6 +235,12 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs,
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")
defaultVersion := android.DefaultUpdatableModuleVersion
if override := ctx.Config().Getenv("OVERRIDE_APEX_MANIFEST_DEFAULT_VERSION"); override != "" {