Merge "Rename ApexName to ApexVariationName" am: a07777d434
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1399831 Change-Id: Ia9682ee4bbf068131fa6f807f9f74075faba14ed
This commit is contained in:
commit
be9a9035f2
|
@ -29,8 +29,8 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type ApexInfo struct {
|
type ApexInfo struct {
|
||||||
// Name of the apex variant that this module is mutated into
|
// Name of the apex variation that this module is mutated into
|
||||||
ApexName string
|
ApexVariationName string
|
||||||
|
|
||||||
MinSdkVersion int
|
MinSdkVersion int
|
||||||
Updatable bool
|
Updatable bool
|
||||||
|
@ -72,16 +72,16 @@ type ApexModule interface {
|
||||||
// Returns the APEXes that this module will be built for
|
// Returns the APEXes that this module will be built for
|
||||||
ApexVariations() []ApexInfo
|
ApexVariations() []ApexInfo
|
||||||
|
|
||||||
// Returns the name of APEX that this module will be built for. Empty string
|
// Returns the name of APEX variation that this module will be built for.
|
||||||
// is returned when 'IsForPlatform() == true'. Note that a module can be
|
//Empty string is returned when 'IsForPlatform() == true'. Note that a
|
||||||
// included in multiple APEXes, in which case, the module is mutated into
|
// module can be included in multiple APEXes, in which case, the module
|
||||||
// multiple modules each of which for an APEX. This method returns the
|
// is mutated into multiple modules each of which for an APEX. This method
|
||||||
// name of the APEX that a variant module is for.
|
// returns the name of the APEX that a variant module is for.
|
||||||
// Call this after apex.apexMutator is run.
|
// Call this after apex.apexMutator is run.
|
||||||
ApexName() string
|
ApexVariationName() string
|
||||||
|
|
||||||
// Tests whether this module will be built for the platform or not.
|
// 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
|
IsForPlatform() bool
|
||||||
|
|
||||||
// Tests if this module could have APEX variants. APEX variants are
|
// Tests if this module could have APEX variants. APEX variants are
|
||||||
|
@ -183,7 +183,7 @@ func (m *ApexModuleBase) BuildForApex(apex ApexInfo) {
|
||||||
m.apexVariationsLock.Lock()
|
m.apexVariationsLock.Lock()
|
||||||
defer m.apexVariationsLock.Unlock()
|
defer m.apexVariationsLock.Unlock()
|
||||||
for _, v := range m.apexVariations {
|
for _, v := range m.apexVariations {
|
||||||
if v.ApexName == apex.ApexName {
|
if v.ApexVariationName == apex.ApexVariationName {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,12 +194,12 @@ func (m *ApexModuleBase) ApexVariations() []ApexInfo {
|
||||||
return m.apexVariations
|
return m.apexVariations
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ApexModuleBase) ApexName() string {
|
func (m *ApexModuleBase) ApexVariationName() string {
|
||||||
return m.ApexProperties.Info.ApexName
|
return m.ApexProperties.Info.ApexVariationName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ApexModuleBase) IsForPlatform() bool {
|
func (m *ApexModuleBase) IsForPlatform() bool {
|
||||||
return m.ApexProperties.Info.ApexName == ""
|
return m.ApexProperties.Info.ApexVariationName == ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ApexModuleBase) CanHaveApexVariants() bool {
|
func (m *ApexModuleBase) CanHaveApexVariants() bool {
|
||||||
|
@ -276,7 +276,7 @@ type byApexName []ApexInfo
|
||||||
|
|
||||||
func (a byApexName) Len() int { return len(a) }
|
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) 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 {
|
func (m *ApexModuleBase) CreateApexVariations(mctx BottomUpMutatorContext) []Module {
|
||||||
if len(m.apexVariations) > 0 {
|
if len(m.apexVariations) > 0 {
|
||||||
|
@ -286,7 +286,7 @@ func (m *ApexModuleBase) CreateApexVariations(mctx BottomUpMutatorContext) []Mod
|
||||||
variations := []string{}
|
variations := []string{}
|
||||||
variations = append(variations, "") // Original variation for platform
|
variations = append(variations, "") // Original variation for platform
|
||||||
for _, apex := range m.apexVariations {
|
for _, apex := range m.apexVariations {
|
||||||
variations = append(variations, apex.ApexName)
|
variations = append(variations, apex.ApexVariationName)
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultVariation := ""
|
defaultVariation := ""
|
||||||
|
@ -338,7 +338,7 @@ func UpdateApexDependency(apex ApexInfo, moduleName string, directDep bool) {
|
||||||
apexesForModule = make(map[string]bool)
|
apexesForModule = make(map[string]bool)
|
||||||
apexNamesMap()[moduleName] = apexesForModule
|
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
|
// TODO(b/146393795): remove this when b/146393795 is fixed
|
||||||
|
|
|
@ -1331,7 +1331,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
||||||
suffix = append(suffix, ctx.Arch().ArchType.String())
|
suffix = append(suffix, ctx.Arch().ArchType.String())
|
||||||
}
|
}
|
||||||
if apex, ok := m.module.(ApexModule); ok && !apex.IsForPlatform() {
|
if apex, ok := m.module.(ApexModule); ok && !apex.IsForPlatform() {
|
||||||
suffix = append(suffix, apex.ApexName())
|
suffix = append(suffix, apex.ApexVariationName())
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Variable(pctx, "moduleDesc", desc)
|
ctx.Variable(pctx, "moduleDesc", desc)
|
||||||
|
|
|
@ -686,7 +686,7 @@ func apexDepsMutator(mctx android.TopDownMutatorContext) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
apexInfo := android.ApexInfo{
|
apexInfo := android.ApexInfo{
|
||||||
ApexName: mctx.ModuleName(),
|
ApexVariationName: mctx.ModuleName(),
|
||||||
MinSdkVersion: a.minSdkVersion(mctx),
|
MinSdkVersion: a.minSdkVersion(mctx),
|
||||||
Updatable: a.Updatable(),
|
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
|
// 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 */)
|
return do(ctx, parent, am, false /* externalDep */)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
// The original path becomes a symlink to the corresponding file in the
|
||||||
// runtime APEX.
|
// runtime APEX.
|
||||||
translatedArch := ctx.Target().NativeBridge == android.NativeBridgeEnabled
|
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()) {
|
if ctx.Device() && isBionic(ctx.baseModuleName()) {
|
||||||
binary.installSymlinkToRuntimeApex(ctx, file)
|
binary.installSymlinkToRuntimeApex(ctx, file)
|
||||||
}
|
}
|
||||||
|
|
10
cc/cc.go
10
cc/cc.go
|
@ -344,7 +344,7 @@ type ModuleContextIntf interface {
|
||||||
isNDKStubLibrary() bool
|
isNDKStubLibrary() bool
|
||||||
useClangLld(actx ModuleContext) bool
|
useClangLld(actx ModuleContext) bool
|
||||||
isForPlatform() bool
|
isForPlatform() bool
|
||||||
apexName() string
|
apexVariationName() string
|
||||||
apexSdkVersion() int
|
apexSdkVersion() int
|
||||||
hasStubsVariants() bool
|
hasStubsVariants() bool
|
||||||
isStubs() bool
|
isStubs() bool
|
||||||
|
@ -1290,8 +1290,8 @@ func (ctx *moduleContextImpl) isForPlatform() bool {
|
||||||
return ctx.mod.IsForPlatform()
|
return ctx.mod.IsForPlatform()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) apexName() string {
|
func (ctx *moduleContextImpl) apexVariationName() string {
|
||||||
return ctx.mod.ApexName()
|
return ctx.mod.ApexVariationName()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) apexSdkVersion() int {
|
func (ctx *moduleContextImpl) apexSdkVersion() int {
|
||||||
|
@ -2390,7 +2390,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
||||||
if ccDep.CcLibrary() && !libDepTag.static() {
|
if ccDep.CcLibrary() && !libDepTag.static() {
|
||||||
depIsStubs := ccDep.BuildStubs()
|
depIsStubs := ccDep.BuildStubs()
|
||||||
depHasStubs := VersionVariantAvailable(c) && ccDep.HasStubsVariants()
|
depHasStubs := VersionVariantAvailable(c) && ccDep.HasStubsVariants()
|
||||||
depInSameApex := android.DirectlyInApex(c.ApexName(), depName)
|
depInSameApex := android.DirectlyInApex(c.ApexVariationName(), depName)
|
||||||
depInPlatform := !android.DirectlyInAnyApex(ctx, depName)
|
depInPlatform := !android.DirectlyInAnyApex(ctx, depName)
|
||||||
|
|
||||||
var useThisDep bool
|
var useThisDep bool
|
||||||
|
@ -2446,7 +2446,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
||||||
// by default, use current version of LLNDK
|
// by default, use current version of LLNDK
|
||||||
versionToUse := ""
|
versionToUse := ""
|
||||||
versions := stubsVersionsFor(ctx.Config())[depName]
|
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
|
// if this is for use_vendor apex && dep has stubsVersions
|
||||||
// apply the same rule of apex sdk enforcement to choose right version
|
// apply the same rule of apex sdk enforcement to choose right version
|
||||||
var err error
|
var err error
|
||||||
|
|
|
@ -335,10 +335,10 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
||||||
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_RECOVERY__")
|
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_RECOVERY__")
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.apexName() != "" {
|
if ctx.apexVariationName() != "" {
|
||||||
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_APEX__")
|
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_APEX__")
|
||||||
if Bool(compiler.Properties.Use_apex_name_macro) {
|
if Bool(compiler.Properties.Use_apex_name_macro) {
|
||||||
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_APEX_"+makeDefineString(ctx.apexName())+"__")
|
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_APEX_"+makeDefineString(ctx.apexVariationName())+"__")
|
||||||
}
|
}
|
||||||
if ctx.Device() {
|
if ctx.Device() {
|
||||||
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_SDK_VERSION__="+strconv.Itoa(ctx.apexSdkVersion()))
|
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_SDK_VERSION__="+strconv.Itoa(ctx.apexSdkVersion()))
|
||||||
|
|
|
@ -262,7 +262,7 @@ func getBootImageJar(ctx android.SingletonContext, image *bootImageConfig, modul
|
||||||
apex, isApexModule := module.(android.ApexModule)
|
apex, isApexModule := module.(android.ApexModule)
|
||||||
fromUpdatableApex := isApexModule && apex.Updatable()
|
fromUpdatableApex := isApexModule && apex.Updatable()
|
||||||
if image.name == artBootImageName {
|
if image.name == artBootImageName {
|
||||||
if isApexModule && strings.HasPrefix(apex.ApexName(), "com.android.art.") {
|
if isApexModule && strings.HasPrefix(apex.ApexVariationName(), "com.android.art.") {
|
||||||
// ok: found the jar in the ART apex
|
// ok: found the jar in the ART apex
|
||||||
} else if isApexModule && apex.IsForPlatform() && Bool(module.(*Library).deviceProperties.Hostdex) {
|
} else if isApexModule && apex.IsForPlatform() && Bool(module.(*Library).deviceProperties.Hostdex) {
|
||||||
// exception (skip and continue): special "hostdex" platform variant
|
// exception (skip and continue): special "hostdex" platform variant
|
||||||
|
@ -272,7 +272,7 @@ func getBootImageJar(ctx android.SingletonContext, image *bootImageConfig, modul
|
||||||
return -1, nil
|
return -1, nil
|
||||||
} else if fromUpdatableApex {
|
} else if fromUpdatableApex {
|
||||||
// error: this jar is part of an updatable apex other than ART
|
// error: this jar is part of an updatable apex other than ART
|
||||||
ctx.Errorf("module '%s' from updatable apex '%s' is not allowed in the ART boot image", name, apex.ApexName())
|
ctx.Errorf("module '%s' from updatable apex '%s' is not allowed in the ART boot image", name, apex.ApexVariationName())
|
||||||
} else {
|
} else {
|
||||||
// error: this jar is part of the platform or a non-updatable apex
|
// error: this jar is part of the platform or a non-updatable apex
|
||||||
ctx.Errorf("module '%s' is not allowed in the ART boot image", name)
|
ctx.Errorf("module '%s' is not allowed in the ART boot image", name)
|
||||||
|
@ -282,7 +282,7 @@ func getBootImageJar(ctx android.SingletonContext, image *bootImageConfig, modul
|
||||||
// ok: this jar is part of the platform or a non-updatable apex
|
// ok: this jar is part of the platform or a non-updatable apex
|
||||||
} else {
|
} else {
|
||||||
// error: this jar is part of an updatable apex
|
// error: this jar is part of an updatable apex
|
||||||
ctx.Errorf("module '%s' from updatable apex '%s' is not allowed in the framework boot image", name, apex.ApexName())
|
ctx.Errorf("module '%s' from updatable apex '%s' is not allowed in the framework boot image", name, apex.ApexVariationName())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic("unknown boot image: " + image.name)
|
panic("unknown boot image: " + image.name)
|
||||||
|
|
|
@ -1680,7 +1680,7 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
|
||||||
j.linter.compileSdkVersion = lintSDKVersionString(j.sdkVersion())
|
j.linter.compileSdkVersion = lintSDKVersionString(j.sdkVersion())
|
||||||
j.linter.javaLanguageLevel = flags.javaVersion.String()
|
j.linter.javaLanguageLevel = flags.javaVersion.String()
|
||||||
j.linter.kotlinLanguageLevel = "1.3"
|
j.linter.kotlinLanguageLevel = "1.3"
|
||||||
if j.ApexName() != "" && ctx.Config().UnbundledBuildApps() {
|
if j.ApexVariationName() != "" && ctx.Config().UnbundledBuildApps() {
|
||||||
j.linter.buildModuleReportZip = true
|
j.linter.buildModuleReportZip = true
|
||||||
}
|
}
|
||||||
j.linter.lint(ctx)
|
j.linter.lint(ctx)
|
||||||
|
|
|
@ -1379,7 +1379,7 @@ func PrebuiltJars(ctx android.BaseModuleContext, baseName string, s sdkSpec) and
|
||||||
// Get the apex name for module, "" if it is for platform.
|
// Get the apex name for module, "" if it is for platform.
|
||||||
func getApexNameForModule(module android.Module) string {
|
func getApexNameForModule(module android.Module) string {
|
||||||
if apex, ok := module.(android.ApexModule); ok {
|
if apex, ok := module.(android.ApexModule); ok {
|
||||||
return apex.ApexName()
|
return apex.ApexVariationName()
|
||||||
}
|
}
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
@ -1390,7 +1390,7 @@ func getApexNameForModule(module android.Module) string {
|
||||||
// If either this or the other module are on the platform then this will return
|
// If either this or the other module are on the platform then this will return
|
||||||
// false.
|
// false.
|
||||||
func withinSameApexAs(module android.ApexModule, other android.Module) bool {
|
func withinSameApexAs(module android.ApexModule, other android.Module) bool {
|
||||||
name := module.ApexName()
|
name := module.ApexVariationName()
|
||||||
return name != "" && getApexNameForModule(other) == name
|
return name != "" && getApexNameForModule(other) == name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2083,8 +2083,8 @@ func (module *sdkLibraryXml) ShouldSupportSdkVersion(ctx android.BaseModuleConte
|
||||||
// File path to the runtime implementation library
|
// File path to the runtime implementation library
|
||||||
func (module *sdkLibraryXml) implPath() string {
|
func (module *sdkLibraryXml) implPath() string {
|
||||||
implName := proptools.String(module.properties.Lib_name)
|
implName := proptools.String(module.properties.Lib_name)
|
||||||
if apexName := module.ApexName(); apexName != "" {
|
if apexName := module.ApexVariationName(); apexName != "" {
|
||||||
// TODO(b/146468504): ApexName() is only a soong module name, not apex name.
|
// TODO(b/146468504): ApexVariationName() is only a soong module name, not apex name.
|
||||||
// In most cases, this works fine. But when apex_name is set or override_apex is used
|
// In most cases, this works fine. But when apex_name is set or override_apex is used
|
||||||
// this can be wrong.
|
// this can be wrong.
|
||||||
return fmt.Sprintf("/apex/%s/javalib/%s.jar", apexName, implName)
|
return fmt.Sprintf("/apex/%s/javalib/%s.jar", apexName, implName)
|
||||||
|
|
Loading…
Reference in New Issue