Prevent sdk variants from install

Platform variants should be available even when unbundled_build so that
unbundled build of com.android.virt apex can correctly have microdroid
image with system variants.

Bug: 268582372
Test: m (soong test)
Test: banchan com.android.virt aosp_arm64
      UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true m apps_only dist
      (microdroid should have the same contents)
Change-Id: I682e4f1f477f3024f7719dfaa67006ef335e0640
This commit is contained in:
Jooyung Han
2023-02-20 18:17:47 +09:00
parent dcc6b241a7
commit 54f780505d
4 changed files with 144 additions and 9 deletions

View File

@@ -47,16 +47,16 @@ func sdkMutator(ctx android.BottomUpMutatorContext) {
// Mark the SDK variant.
modules[1].(*Module).Properties.IsSdkVariant = true
// SDK variant is not supposed to be installed
modules[1].(*Module).Properties.PreventInstall = true
if ctx.Config().UnbundledBuildApps() {
// For an unbundled apps build, hide the platform variant from Make.
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
}
ctx.AliasVariation("")
} else if isCcModule && ccModule.isImportedApiLibrary() {
@@ -64,16 +64,19 @@ func sdkMutator(ctx android.BottomUpMutatorContext) {
if apiLibrary.hasNDKStubs() && ccModule.canUseSdk() {
// Handle cc_api_library module with NDK stubs and variants only which can use SDK
modules := ctx.CreateVariations("", "sdk")
// Mark the SDK variant.
modules[1].(*Module).Properties.IsSdkVariant = true
// SDK variant is not supposed to be installed
modules[1].(*Module).Properties.PreventInstall = true
if ctx.Config().UnbundledBuildApps() {
// For an unbundled apps build, hide the platform variant from Make.
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
}
} else {
ccModule.Properties.Sdk_version = nil