Revert "Add sdk mutator for native modules"
Revert submission 1242911-sdk_version_variant
Reason for revert: b/153394225
Reverted Changes:
Ife99745fb:Use libnativewindow for platform variant of libagq...
I1bae84c43:Use libnativewindow for platform variant of androi...
I6e6021ed3:Use stl to depend on libc++
Ife99745fb:Use libnativewindow for platform variant of libRSS...
I2c9f439b9:Fix static dependency on libprotobuf-cpp-lite-ndk
Iff2aff9cf:Set sdk_version for cc_genrules used by modules wi...
I7d72934aa:Add sdk mutator for native modules
Ief378a007:Use sdk variant of Soong modules when LOCAL_SDK_VE...
Bug: 149591340
Change-Id: I798fa902c779469c6382b6699351e5d12bf14785
Fixes: 153394225
diff --git a/cc/cc.go b/cc/cc.go
index 794adf1..037b99c 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -42,7 +42,6 @@
ctx.RegisterModuleType("cc_defaults", defaultsFactory)
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
- ctx.BottomUp("sdk", sdkMutator).Parallel()
ctx.BottomUp("vndk", VndkMutator).Parallel()
ctx.BottomUp("link", LinkageMutator).Parallel()
ctx.BottomUp("ndk_api", NdkApiMutator).Parallel()
@@ -209,13 +208,9 @@
// Deprecated. true is the default, false is invalid.
Clang *bool `android:"arch_variant"`
- // Minimum sdk version supported when compiling against the ndk. Setting this property causes
- // two variants to be built, one for the platform and one for apps.
+ // Minimum sdk version supported when compiling against the ndk
Sdk_version *string
- // If true, always create an sdk variant and don't create a platform variant.
- Sdk_variant_only *bool
-
AndroidMkSharedLibs []string `blueprint:"mutated"`
AndroidMkStaticLibs []string `blueprint:"mutated"`
AndroidMkRuntimeLibs []string `blueprint:"mutated"`
@@ -257,16 +252,6 @@
SnapshotRuntimeLibs []string `blueprint:"mutated"`
Installable *bool
-
- // Set by factories of module types that can only be referenced from variants compiled against
- // the SDK.
- AlwaysSdk bool `blueprint:"mutated"`
-
- // Variant is an SDK variant created by sdkMutator
- IsSdkVariant bool `blueprint:"mutated"`
- // Set when both SDK and platform variants are exported to Make to trigger renaming the SDK
- // variant to have a ".sdk" suffix.
- SdkAndPlatformVariantVisibleToMake bool `blueprint:"mutated"`
}
type VendorProperties struct {
@@ -542,10 +527,7 @@
}
func (c *Module) SelectedStl() string {
- if c.stl != nil {
- return c.stl.Properties.SelectedStl
- }
- return ""
+ return c.stl.Properties.SelectedStl
}
func (c *Module) ToolchainLibrary() bool {
@@ -573,10 +555,6 @@
return String(c.Properties.Sdk_version)
}
-func (c *Module) AlwaysSdk() bool {
- return c.Properties.AlwaysSdk || Bool(c.Properties.Sdk_variant_only)
-}
-
func (c *Module) IncludeDirs() android.Paths {
if c.linker != nil {
if library, ok := c.linker.(exportedFlagsProducer); ok {
@@ -825,17 +803,6 @@
return c.Properties.VndkVersion != ""
}
-func (c *Module) canUseSdk() bool {
- return c.Os() == android.Android && !c.UseVndk() && !c.InRamdisk() && !c.InRecovery()
-}
-
-func (c *Module) UseSdk() bool {
- if c.canUseSdk() {
- return String(c.Properties.Sdk_version) != ""
- }
- return false
-}
-
func (c *Module) isCoverageVariant() bool {
return c.coverage.Properties.IsCoverageVariant
}
@@ -1093,11 +1060,14 @@
}
func (ctx *moduleContextImpl) canUseSdk() bool {
- return ctx.mod.canUseSdk()
+ return ctx.ctx.Device() && !ctx.useVndk() && !ctx.inRamdisk() && !ctx.inRecovery() && !ctx.ctx.Fuchsia()
}
func (ctx *moduleContextImpl) useSdk() bool {
- return ctx.mod.UseSdk()
+ if ctx.canUseSdk() {
+ return String(ctx.mod.Properties.Sdk_version) != ""
+ }
+ return false
}
func (ctx *moduleContextImpl) sdkVersion() string {
@@ -1416,8 +1386,6 @@
c.Properties.SubName += ramdiskSuffix
} else if c.InRecovery() && !c.OnlyInRecovery() {
c.Properties.SubName += recoverySuffix
- } else if c.Properties.IsSdkVariant && c.Properties.SdkAndPlatformVariantVisibleToMake {
- c.Properties.SubName += sdkSuffix
}
ctx := &moduleContext{