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

Commit 001ca325 authored by Paul Duffin's avatar Paul Duffin Committed by Gerrit Code Review
Browse files

Merge changes Iedcff7df,I4cb294c2

* changes:
  Copy white listed apex available settings into snapshot
  Disable installation for sdk snapshot versioned prebuilts
parents bc32a50f 7d74e7be
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ func (m *ApexModuleBase) IsInstallableToApex() bool {

const (
	AvailableToPlatform = "//apex_available:platform"
	availableToAnyApex  = "//apex_available:anyapex"
	AvailableToAnyApex  = "//apex_available:anyapex"
)

func CheckAvailableForApex(what string, apex_available []string) bool {
@@ -178,7 +178,7 @@ func CheckAvailableForApex(what string, apex_available []string) bool {
		return what == AvailableToPlatform
	}
	return InList(what, apex_available) ||
		(what != AvailableToPlatform && InList(availableToAnyApex, apex_available))
		(what != AvailableToPlatform && InList(AvailableToAnyApex, apex_available))
}

func (m *ApexModuleBase) AvailableFor(what string) bool {
@@ -212,7 +212,7 @@ func (m *ApexModuleBase) ShouldSupportAndroid10() bool {

func (m *ApexModuleBase) checkApexAvailableProperty(mctx BaseModuleContext) {
	for _, n := range m.ApexProperties.Apex_available {
		if n == AvailableToPlatform || n == availableToAnyApex {
		if n == AvailableToPlatform || n == AvailableToAnyApex {
			continue
		}
		if !mctx.OtherModuleExists(n) && !mctx.Config().AllowMissingDependencies() {
+33 −10
Original line number Diff line number Diff line
@@ -63,8 +63,26 @@ var (
	usesTag        = dependencyTag{name: "uses"}
	androidAppTag  = dependencyTag{name: "androidApp", payload: true}
	apexAvailWl    = makeApexAvailableWhitelist()

	inverseApexAvailWl = invertApexWhiteList(apexAvailWl)
)

// Transform the map of apex -> modules to module -> apexes.
func invertApexWhiteList(m map[string][]string) map[string][]string {
	r := make(map[string][]string)
	for apex, modules := range m {
		for _, module := range modules {
			r[module] = append(r[module], apex)
		}
	}
	return r
}

// Retrieve the while list of apexes to which the supplied module belongs.
func WhitelistedApexAvailable(moduleName string) []string {
	return inverseApexAvailWl[normalizeModuleName(moduleName)]
}

// This is a map from apex to modules, which overrides the
// apex_available setting for that particular module to make
// it available for the apex regardless of its setting.
@@ -964,7 +982,7 @@ func makeApexAvailableWhitelist() map[string][]string {
	//
	// Module separator
	//
	m["//any"] = []string{
	m[android.AvailableToAnyApex] = []string{
		"crtbegin_dynamic",
		"crtbegin_dynamic1",
		"crtbegin_so",
@@ -2395,20 +2413,13 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {

func whitelistedApexAvailable(apex, moduleName string) bool {
	key := apex
	// Prebuilt modules (e.g. java_import, etc.) have "prebuilt_" prefix added by the build
	// system. Trim the prefix for the check since they are confusing
	moduleName = strings.TrimPrefix(moduleName, "prebuilt_")
	if strings.HasPrefix(moduleName, "libclang_rt.") {
		// This module has many arch variants that depend on the product being built.
		// We don't want to list them all
		moduleName = "libclang_rt"
	}
	moduleName = normalizeModuleName(moduleName)

	if val, ok := apexAvailWl[key]; ok && android.InList(moduleName, val) {
		return true
	}

	key = "//any"
	key = android.AvailableToAnyApex
	if val, ok := apexAvailWl[key]; ok && android.InList(moduleName, val) {
		return true
	}
@@ -2416,6 +2427,18 @@ func whitelistedApexAvailable(apex, moduleName string) bool {
	return false
}

func normalizeModuleName(moduleName string) string {
	// Prebuilt modules (e.g. java_import, etc.) have "prebuilt_" prefix added by the build
	// system. Trim the prefix for the check since they are confusing
	moduleName = strings.TrimPrefix(moduleName, "prebuilt_")
	if strings.HasPrefix(moduleName, "libclang_rt.") {
		// This module has many arch variants that depend on the product being built.
		// We don't want to list them all
		moduleName = "libclang_rt"
	}
	return moduleName
}

func newApexBundle() *apexBundle {
	module := &apexBundle{}
	module.AddProperties(&module.properties)
+21 −1
Original line number Diff line number Diff line
@@ -250,6 +250,8 @@ type BaseProperties struct {
	// Used by vendor snapshot to record dependencies from snapshot modules.
	SnapshotSharedLibs  []string `blueprint:"mutated"`
	SnapshotRuntimeLibs []string `blueprint:"mutated"`

	Installable *bool
}

type VendorProperties struct {
@@ -371,6 +373,7 @@ type linker interface {
type installer interface {
	installerProps() []interface{}
	install(ctx ModuleContext, path android.Path)
	everInstallable() bool
	inData() bool
	inSanitizerDir() bool
	hostToolPath() android.OptionalPath
@@ -1488,6 +1491,13 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
		if ctx.Failed() {
			return
		}
	} else if !proptools.BoolDefault(c.Properties.Installable, true) {
		// If the module has been specifically configure to not be installed then
		// skip the installation as otherwise it will break when running inside make
		// as the output path to install will not be specified. Not all uninstallable
		// modules can skip installation as some are needed for resolving make side
		// dependencies.
		c.SkipInstall()
	}
}

@@ -2629,8 +2639,18 @@ func (c *Module) AvailableFor(what string) bool {
	}
}

// Return true if the module is ever installable.
func (c *Module) EverInstallable() bool {
	return c.installer != nil &&
		// Check to see whether the module is actually ever installable.
		c.installer.everInstallable()
}

func (c *Module) installable() bool {
	ret := c.installer != nil && !c.Properties.PreventInstall && c.outputFile.Valid()
	ret := c.EverInstallable() &&
		// Check to see whether the module has been configured to not be installed.
		proptools.BoolDefault(c.Properties.Installable, true) &&
		!c.Properties.PreventInstall && c.outputFile.Valid()

	// The platform variant doesn't need further condition. Apex variants however might not
	// be installable because it will likely to be included in the APEX and won't appear
+5 −0
Original line number Diff line number Diff line
@@ -86,6 +86,11 @@ func (installer *baseInstaller) install(ctx ModuleContext, file android.Path) {
	installer.path = ctx.InstallFile(installer.installDir(ctx), file.Base(), file)
}

func (installer *baseInstaller) everInstallable() bool {
	// Most cc modules are installable.
	return true
}

func (installer *baseInstaller) inData() bool {
	return installer.location == InstallInData
}
+6 −0
Original line number Diff line number Diff line
@@ -1220,6 +1220,12 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
	}
}

func (library *libraryDecorator) everInstallable() bool {
	// Only shared and static libraries are installed. Header libraries (which are
	// neither static or shared) are not installed.
	return library.shared() || library.static()
}

func (library *libraryDecorator) static() bool {
	return library.MutatedProperties.VariantIsStatic
}
Loading