Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1348ce3f authored by Colin Cross's avatar Colin Cross
Browse files

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
parent b6135218
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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
}
+2 −0
Original line number Diff line number Diff line
@@ -63,6 +63,8 @@ type LinkableInterface interface {
	ToolchainLibrary() bool
	NdkPrebuiltStl() bool
	StubDecorator() bool

	SplitPerApiLevel() bool
}

var (
+2 −2
Original line number Diff line number Diff line
@@ -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
+4 −0
Original line number Diff line number Diff line
@@ -221,6 +221,10 @@ func (mod *Module) IsSdkVariant() bool {
	return false
}

func (mod *Module) SplitPerApiLevel() bool {
	return false
}

func (mod *Module) ToolchainLibrary() bool {
	return false
}