summaryrefslogtreecommitdiff
path: root/cc
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2020-10-01 13:37:16 -0700
committer Colin Cross <ccross@android.com> 2020-10-02 13:00:19 -0700
commit1348ce3f1399ce7cf51dec139e1292846975e953 (patch)
tree721a749421b0bae1073ca9e44e649eef56146c6c /cc
parentb6135218a4e9788c3f7a40a82775216a64100652 (diff)
Don't make SplitPerApiLevel imply UseSdk
UseSdk was returning true when SplitPerApiLevel returned true, which was causing the platform variant of SplitPerApiLevel module to compile against the SDK. Check SplitPerApiLevel separately in the sdkMutator instead. Test: m checkbuild Change-Id: I0ae667d48a3b7b96709a6cad8e8ea9701659fc2a
Diffstat (limited to 'cc')
-rw-r--r--cc/cc.go5
-rw-r--r--cc/linkable.go2
-rw-r--r--cc/sdk.go4
3 files changed, 8 insertions, 3 deletions
diff --git a/cc/cc.go b/cc/cc.go
index caefea4f6..006a4a596 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -697,6 +697,9 @@ func (c *Module) MinSdkVersion() string {
}
func (c *Module) SplitPerApiLevel() bool {
+ if !c.canUseSdk() {
+ return false
+ }
if linker, ok := c.linker.(*objectLinker); ok {
return linker.isCrt()
}
@@ -1026,7 +1029,7 @@ func (c *Module) canUseSdk() bool {
func (c *Module) UseSdk() bool {
if c.canUseSdk() {
- return String(c.Properties.Sdk_version) != "" || c.SplitPerApiLevel()
+ return String(c.Properties.Sdk_version) != ""
}
return false
}
diff --git a/cc/linkable.go b/cc/linkable.go
index 6d8a4b71e..a67cd4e4c 100644
--- a/cc/linkable.go
+++ b/cc/linkable.go
@@ -63,6 +63,8 @@ type LinkableInterface interface {
ToolchainLibrary() bool
NdkPrebuiltStl() bool
StubDecorator() bool
+
+ SplitPerApiLevel() bool
}
var (
diff --git a/cc/sdk.go b/cc/sdk.go
index b68baad01..ec57f06f4 100644
--- a/cc/sdk.go
+++ b/cc/sdk.go
@@ -32,11 +32,11 @@ func sdkMutator(ctx android.BottomUpMutatorContext) {
switch m := ctx.Module().(type) {
case LinkableInterface:
if m.AlwaysSdk() {
- if !m.UseSdk() {
+ if !m.UseSdk() && !m.SplitPerApiLevel() {
ctx.ModuleErrorf("UseSdk() must return true when AlwaysSdk is set, did the factory forget to set Sdk_version?")
}
ctx.CreateVariations("sdk")
- } else if m.UseSdk() {
+ } else if m.UseSdk() || m.SplitPerApiLevel() {
modules := ctx.CreateVariations("", "sdk")
modules[0].(*Module).Properties.Sdk_version = nil
modules[1].(*Module).Properties.IsSdkVariant = true