summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jiyong Park <jiyong@google.com> 2024-05-08 11:22:38 +0900
committer Jiyong Park <jiyong@google.com> 2024-05-08 11:29:11 +0900
commitacd5f590afb54d5245dd17f4d1f62d03d3691ea0 (patch)
tree17864138fa56a0a908dacfa43422defdbd3c38cb
parent0d4a9ca79225bac10e4b62a663ee0cd09e3b314d (diff)
Don't install sdk variants, not platform variants
Background: if a lib has `sdk_version` set, it is mutated into two variants: platform and sdk. The latter is for the inclusion into unbundled APKs which can be installed on older platforms. The former is what is installed to the platform. So far, for unbundled app builds, (1) the platform variant was marked as uninstallable, (2) while the sdk variant was left installable. (1) is causing a problem (b/339262059) when an APEX containing a filesystem module is built as unbundled. The filesystem skips installing the platform variant. (2) is not causing a problem, but is unnecessary because the sdk variant is not something to be installed (on the platform). It is built into the APK via the jni_libs property. It's not considered an installation. This change fixes (1) and (2). For (1), the platform variant is always marked installable even for unbundled build. For (2), the sdk variant is always marked non-installable.. because, again, it's not designed to be installed to the platform. Bug: 339262059 Test: banchan com.android.virt aosp_arm64 UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true m apps_only dist check libc++.so, libcrypto.so are in the microdroid image in the APEX. Change-Id: I8999b724926cd9ab6d56796133e218fefcc1910b
-rw-r--r--cc/androidmk.go7
-rw-r--r--cc/sdk.go9
2 files changed, 9 insertions, 7 deletions
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 071d829bf..df356df0e 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -119,16 +119,15 @@ func (c *Module) AndroidMkEntries() []android.AndroidMkEntries {
} else if c.InProduct() {
entries.SetBool("LOCAL_IN_PRODUCT", true)
}
- if c.Properties.IsSdkVariant && c.Properties.SdkAndPlatformVariantVisibleToMake {
- // Make the SDK variant uninstallable so that there are not two rules to install
- // to the same location.
- entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
+ if c.Properties.SdkAndPlatformVariantVisibleToMake {
// Add the unsuffixed name to SOONG_SDK_VARIANT_MODULES so that Make can rewrite
// dependencies to the .sdk suffix when building a module that uses the SDK.
entries.SetString("SOONG_SDK_VARIANT_MODULES",
"$(SOONG_SDK_VARIANT_MODULES) $(patsubst %.sdk,%,$(LOCAL_MODULE))")
}
android.SetAconfigFileMkEntries(c.AndroidModuleBase(), entries, c.mergedAconfigFiles)
+
+ entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", c.IsSkipInstall())
},
},
ExtraFooters: []android.AndroidMkExtraFootersFunc{
diff --git a/cc/sdk.go b/cc/sdk.go
index ce0fdc2e3..4925ce166 100644
--- a/cc/sdk.go
+++ b/cc/sdk.go
@@ -49,15 +49,18 @@ func sdkMutator(ctx android.BottomUpMutatorContext) {
modules[1].(*Module).Properties.IsSdkVariant = true
if ctx.Config().UnbundledBuildApps() {
- // For an unbundled apps build, hide the platform variant from Make.
+ // For an unbundled apps build, hide the platform variant from Make
+ // so that other Make modules don't link against it, but against the
+ // SDK variant.
modules[0].(*Module).Properties.HideFromMake = true
- modules[0].(*Module).Properties.PreventInstall = true
} else {
// For a platform build, mark the SDK variant so that it gets a ".sdk" suffix when
// exposed to Make.
modules[1].(*Module).Properties.SdkAndPlatformVariantVisibleToMake = true
- modules[1].(*Module).Properties.PreventInstall = true
}
+ // SDK variant never gets installed because the variant is to be embedded in
+ // APKs, not to be installed to the platform.
+ modules[1].(*Module).Properties.PreventInstall = true
ctx.AliasVariation("")
} else {
if isCcModule {