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 {