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

Commit be9a9035 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Rename ApexName to ApexVariationName" am: a07777d4

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1399831

Change-Id: Ia9682ee4bbf068131fa6f807f9f74075faba14ed
parents ce59a881 a07777d4
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -29,8 +29,8 @@ const (
)

type ApexInfo struct {
	// Name of the apex variant that this module is mutated into
	ApexName string
	// Name of the apex variation that this module is mutated into
	ApexVariationName string

	MinSdkVersion int
	Updatable     bool
@@ -72,16 +72,16 @@ type ApexModule interface {
	// Returns the APEXes that this module will be built for
	ApexVariations() []ApexInfo

	// Returns the name of APEX that this module will be built for. Empty string
	// is returned when 'IsForPlatform() == true'. Note that a module can be
	// included in multiple APEXes, in which case, the module is mutated into
	// multiple modules each of which for an APEX. This method returns the
	// name of the APEX that a variant module is for.
	// Returns the name of APEX variation that this module will be built for.
	//Empty string is returned when 'IsForPlatform() == true'. Note that a
	// module can be included in multiple APEXes, in which case, the module
	// is mutated into multiple modules each of which for an APEX. This method
	// returns the name of the APEX that a variant module is for.
	// Call this after apex.apexMutator is run.
	ApexName() string
	ApexVariationName() string

	// Tests whether this module will be built for the platform or not.
	// This is a shortcut for ApexName() == ""
	// This is a shortcut for ApexVariationName() == ""
	IsForPlatform() bool

	// Tests if this module could have APEX variants. APEX variants are
@@ -183,7 +183,7 @@ func (m *ApexModuleBase) BuildForApex(apex ApexInfo) {
	m.apexVariationsLock.Lock()
	defer m.apexVariationsLock.Unlock()
	for _, v := range m.apexVariations {
		if v.ApexName == apex.ApexName {
		if v.ApexVariationName == apex.ApexVariationName {
			return
		}
	}
@@ -194,12 +194,12 @@ func (m *ApexModuleBase) ApexVariations() []ApexInfo {
	return m.apexVariations
}

func (m *ApexModuleBase) ApexName() string {
	return m.ApexProperties.Info.ApexName
func (m *ApexModuleBase) ApexVariationName() string {
	return m.ApexProperties.Info.ApexVariationName
}

func (m *ApexModuleBase) IsForPlatform() bool {
	return m.ApexProperties.Info.ApexName == ""
	return m.ApexProperties.Info.ApexVariationName == ""
}

func (m *ApexModuleBase) CanHaveApexVariants() bool {
@@ -276,7 +276,7 @@ type byApexName []ApexInfo

func (a byApexName) Len() int           { return len(a) }
func (a byApexName) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a byApexName) Less(i, j int) bool { return a[i].ApexName < a[j].ApexName }
func (a byApexName) Less(i, j int) bool { return a[i].ApexVariationName < a[j].ApexVariationName }

func (m *ApexModuleBase) CreateApexVariations(mctx BottomUpMutatorContext) []Module {
	if len(m.apexVariations) > 0 {
@@ -286,7 +286,7 @@ func (m *ApexModuleBase) CreateApexVariations(mctx BottomUpMutatorContext) []Mod
		variations := []string{}
		variations = append(variations, "") // Original variation for platform
		for _, apex := range m.apexVariations {
			variations = append(variations, apex.ApexName)
			variations = append(variations, apex.ApexVariationName)
		}

		defaultVariation := ""
@@ -338,7 +338,7 @@ func UpdateApexDependency(apex ApexInfo, moduleName string, directDep bool) {
		apexesForModule = make(map[string]bool)
		apexNamesMap()[moduleName] = apexesForModule
	}
	apexesForModule[apex.ApexName] = apexesForModule[apex.ApexName] || directDep
	apexesForModule[apex.ApexVariationName] = apexesForModule[apex.ApexVariationName] || directDep
}

// TODO(b/146393795): remove this when b/146393795 is fixed
+1 −1
Original line number Diff line number Diff line
@@ -1331,7 +1331,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
		suffix = append(suffix, ctx.Arch().ArchType.String())
	}
	if apex, ok := m.module.(ApexModule); ok && !apex.IsForPlatform() {
		suffix = append(suffix, apex.ApexName())
		suffix = append(suffix, apex.ApexVariationName())
	}

	ctx.Variable(pctx, "moduleDesc", desc)
+4 −4
Original line number Diff line number Diff line
@@ -686,7 +686,7 @@ func apexDepsMutator(mctx android.TopDownMutatorContext) {
		return
	}
	apexInfo := android.ApexInfo{
		ApexName:      mctx.ModuleName(),
		ApexVariationName: mctx.ModuleName(),
		MinSdkVersion:     a.minSdkVersion(mctx),
		Updatable:         a.Updatable(),
	}
@@ -1797,7 +1797,7 @@ func (a *apexBundle) WalkPayloadDeps(ctx android.ModuleContext, do android.Paylo
		}

		// Check for the indirect dependencies if it is considered as part of the APEX
		if am.ApexName() != "" {
		if am.ApexVariationName() != "" {
			return do(ctx, parent, am, false /* externalDep */)
		}

+1 −1
Original line number Diff line number Diff line
@@ -445,7 +445,7 @@ func (binary *binaryDecorator) install(ctx ModuleContext, file android.Path) {
	// The original path becomes a symlink to the corresponding file in the
	// runtime APEX.
	translatedArch := ctx.Target().NativeBridge == android.NativeBridgeEnabled
	if InstallToBootstrap(ctx.baseModuleName(), ctx.Config()) && !translatedArch && ctx.apexName() == "" && !ctx.inRamdisk() && !ctx.inRecovery() {
	if InstallToBootstrap(ctx.baseModuleName(), ctx.Config()) && !translatedArch && ctx.apexVariationName() == "" && !ctx.inRamdisk() && !ctx.inRecovery() {
		if ctx.Device() && isBionic(ctx.baseModuleName()) {
			binary.installSymlinkToRuntimeApex(ctx, file)
		}
+5 −5
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@ type ModuleContextIntf interface {
	isNDKStubLibrary() bool
	useClangLld(actx ModuleContext) bool
	isForPlatform() bool
	apexName() string
	apexVariationName() string
	apexSdkVersion() int
	hasStubsVariants() bool
	isStubs() bool
@@ -1290,8 +1290,8 @@ func (ctx *moduleContextImpl) isForPlatform() bool {
	return ctx.mod.IsForPlatform()
}

func (ctx *moduleContextImpl) apexName() string {
	return ctx.mod.ApexName()
func (ctx *moduleContextImpl) apexVariationName() string {
	return ctx.mod.ApexVariationName()
}

func (ctx *moduleContextImpl) apexSdkVersion() int {
@@ -2390,7 +2390,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
			if ccDep.CcLibrary() && !libDepTag.static() {
				depIsStubs := ccDep.BuildStubs()
				depHasStubs := VersionVariantAvailable(c) && ccDep.HasStubsVariants()
				depInSameApex := android.DirectlyInApex(c.ApexName(), depName)
				depInSameApex := android.DirectlyInApex(c.ApexVariationName(), depName)
				depInPlatform := !android.DirectlyInAnyApex(ctx, depName)

				var useThisDep bool
@@ -2446,7 +2446,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
					// by default, use current version of LLNDK
					versionToUse := ""
					versions := stubsVersionsFor(ctx.Config())[depName]
					if c.ApexName() != "" && len(versions) > 0 {
					if c.ApexVariationName() != "" && len(versions) > 0 {
						// if this is for use_vendor apex && dep has stubsVersions
						// apply the same rule of apex sdk enforcement to choose right version
						var err error
Loading