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

Commit 54fb18d4 authored by Ioana Alexandru's avatar Ioana Alexandru Committed by Gerrit Code Review
Browse files

Merge "Revert "Export non-apex variants of modules to make""

parents e75fcf4d 8ac7d7d0
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -560,8 +560,6 @@ func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint
		a.SetPaths("LOCAL_SOONG_INSTALL_SYMLINKS", base.katiSymlinks.InstallPaths().Paths())
	}

	a.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", base.commonProperties.SkipInstall)

	if am, ok := mod.(ApexModule); ok {
		a.SetBoolIfTrue("LOCAL_NOT_AVAILABLE_FOR_PLATFORM", am.NotAvailableForPlatform())
	}
+1 −1
Original line number Diff line number Diff line
@@ -603,7 +603,7 @@ func CreateApexVariations(mctx BottomUpMutatorContext, module ApexModule) []Modu
			// Do not install the module for platform, but still allow it to output
			// uninstallable AndroidMk entries in certain cases when they have side
			// effects.  TODO(jiyong): move this routine to somewhere else
			mod.SkipInstall()
			mod.MakeUninstallable()
		}
		if !platformVariation {
			mctx.SetVariationProvider(mod, ApexInfoProvider, apexInfos[i-1])
+10 −1
Original line number Diff line number Diff line
@@ -505,8 +505,8 @@ type Module interface {
	PartitionTag(DeviceConfig) string
	HideFromMake()
	IsHideFromMake() bool
	SkipInstall()
	IsSkipInstall() bool
	MakeUninstallable()
	ReplacedByPrebuilt()
	IsReplacedByPrebuilt() bool
	ExportedToMake() bool
@@ -1964,6 +1964,15 @@ func (m *ModuleBase) IsSkipInstall() bool {
	return m.commonProperties.SkipInstall
}

// Similar to HideFromMake, but if the AndroidMk entry would set
// LOCAL_UNINSTALLABLE_MODULE then this variant may still output that entry
// rather than leaving it out altogether. That happens in cases where it would
// have other side effects, in particular when it adds a NOTICE file target,
// which other install targets might depend on.
func (m *ModuleBase) MakeUninstallable() {
	m.HideFromMake()
}

func (m *ModuleBase) ReplacedByPrebuilt() {
	m.commonProperties.ReplacedByPrebuilt = true
	m.HideFromMake()
+2 −42
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
package android

import (
	"strings"
	"testing"

	"github.com/google/blueprint"
@@ -29,8 +28,6 @@ type componentTestModule struct {
		Deps         []string
		Skip_install *bool
	}

	builtFile Path
}

// dep tag used in this test. All dependencies are considered as installable.
@@ -51,21 +48,13 @@ func (m *componentTestModule) DepsMutator(ctx BottomUpMutatorContext) {
}

func (m *componentTestModule) GenerateAndroidBuildActions(ctx ModuleContext) {
	m.builtFile = PathForModuleOut(ctx, m.Name())
	builtFile := PathForModuleOut(ctx, m.Name())
	dir := ctx.Target().Arch.ArchType.Multilib
	installDir := PathForModuleInstall(ctx, dir)
	if proptools.Bool(m.props.Skip_install) {
		m.SkipInstall()
	}
	ctx.InstallFile(installDir, m.Name(), m.builtFile)
}

func (m *componentTestModule) AndroidMkEntries() []AndroidMkEntries {
	return []AndroidMkEntries{
		{
			OutputFile: OptionalPathForPath(m.builtFile),
		},
	}
	ctx.InstallFile(installDir, m.Name(), builtFile)
}

// Module that itself is a package
@@ -262,35 +251,6 @@ func TestPackagingBaseMultiTarget(t *testing.T) {
		`, []string{"lib32/foo", "lib64/foo", "lib64/bar"})
}

func TestSkipInstallProducesLocalUninstallableModule(t *testing.T) {
	result := GroupFixturePreparers(
		PrepareForTestWithArchMutator,
		FixtureRegisterWithContext(func(ctx RegistrationContext) {
			ctx.RegisterModuleType("component", componentTestModuleFactory)
			ctx.RegisterModuleType("package_module", packageTestModuleFactory)
		}),
		FixtureWithRootAndroidBp(`
component {
	name: "foo",
	skip_install: true,
}

package_module {
	name: "package",
	deps: ["foo"],
}
`),
	).RunTest(t)
	module := result.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*componentTestModule)
	entries := AndroidMkEntriesForTest(t, result.TestContext, module)
	builder := &strings.Builder{}
	entries[0].write(builder)
	androidMkString := builder.String()
	if !strings.Contains(androidMkString, "LOCAL_UNINSTALLABLE_MODULE := true") {
		t.Errorf("Expected android mk entries to contain \"LOCAL_UNINSTALLABLE_MODULE := true\", got: \n%s", androidMkString)
	}
}

func TestPackagingBaseSingleTarget(t *testing.T) {
	multiTarget := false
	runPackagingTest(t, multiTarget,
+9 −0
Original line number Diff line number Diff line
@@ -609,6 +609,7 @@ type installer interface {
	inSanitizerDir() bool
	hostToolPath() android.OptionalPath
	relativeInstallPath() string
	makeUninstallable(mod *Module)
	installInRoot() bool
}

@@ -3524,6 +3525,14 @@ func (c *Module) InstallInRecovery() bool {
	return c.InRecovery()
}

func (c *Module) MakeUninstallable() {
	if c.installer == nil {
		c.ModuleBase.MakeUninstallable()
		return
	}
	c.installer.makeUninstallable(c)
}

func (c *Module) HostToolPath() android.OptionalPath {
	if c.installer == nil {
		return android.OptionalPath{}
Loading