Merge "Revert "Make the enabled property configurable"" into aosp-main-future
This commit is contained in:
committed by
Android (Google) Code Review
commit
c4466a6387
@@ -41,7 +41,6 @@ bootstrap_go_package {
|
||||
"buildinfo_prop.go",
|
||||
"config.go",
|
||||
"test_config.go",
|
||||
"configurable_properties.go",
|
||||
"configured_jars.go",
|
||||
"csuite_config.go",
|
||||
"deapexer.go",
|
||||
|
@@ -849,7 +849,7 @@ func translateAndroidModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs *
|
||||
mod blueprint.Module, provider AndroidMkDataProvider) error {
|
||||
|
||||
amod := mod.(Module).base()
|
||||
if shouldSkipAndroidMkProcessing(ctx, amod) {
|
||||
if shouldSkipAndroidMkProcessing(amod) {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -939,7 +939,7 @@ func WriteAndroidMkData(w io.Writer, data AndroidMkData) {
|
||||
|
||||
func translateAndroidMkEntriesModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs *[]*ModuleInfoJSON,
|
||||
mod blueprint.Module, provider AndroidMkEntriesProvider) error {
|
||||
if shouldSkipAndroidMkProcessing(ctx, mod.(Module).base()) {
|
||||
if shouldSkipAndroidMkProcessing(mod.(Module).base()) {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -961,11 +961,11 @@ func translateAndroidMkEntriesModule(ctx SingletonContext, w io.Writer, moduleIn
|
||||
return nil
|
||||
}
|
||||
|
||||
func ShouldSkipAndroidMkProcessing(ctx ConfigAndErrorContext, module Module) bool {
|
||||
return shouldSkipAndroidMkProcessing(ctx, module.base())
|
||||
func ShouldSkipAndroidMkProcessing(module Module) bool {
|
||||
return shouldSkipAndroidMkProcessing(module.base())
|
||||
}
|
||||
|
||||
func shouldSkipAndroidMkProcessing(ctx ConfigAndErrorContext, module *ModuleBase) bool {
|
||||
func shouldSkipAndroidMkProcessing(module *ModuleBase) bool {
|
||||
if !module.commonProperties.NamespaceExportedToMake {
|
||||
// TODO(jeffrygaston) do we want to validate that there are no modules being
|
||||
// exported to Kati that depend on this module?
|
||||
@@ -984,7 +984,7 @@ func shouldSkipAndroidMkProcessing(ctx ConfigAndErrorContext, module *ModuleBase
|
||||
return true
|
||||
}
|
||||
|
||||
return !module.Enabled(ctx) ||
|
||||
return !module.Enabled() ||
|
||||
module.commonProperties.HideFromMake ||
|
||||
// Make does not understand LinuxBionic
|
||||
module.Os() == LinuxBionic ||
|
||||
|
@@ -486,7 +486,7 @@ func osMutator(bpctx blueprint.BottomUpMutatorContext) {
|
||||
// dependencies on OsType variants that are explicitly disabled in their
|
||||
// properties. The CommonOS variant will still depend on disabled variants
|
||||
// if they are disabled afterwards, e.g. in archMutator if
|
||||
if module.Enabled(mctx) {
|
||||
if module.Enabled() {
|
||||
mctx.AddInterVariantDependency(commonOsToOsSpecificVariantTag, commonOSVariant, module)
|
||||
}
|
||||
}
|
||||
@@ -511,7 +511,7 @@ func GetOsSpecificVariantsOfCommonOSVariant(mctx BaseModuleContext) []Module {
|
||||
var variants []Module
|
||||
mctx.VisitDirectDeps(func(m Module) {
|
||||
if mctx.OtherModuleDependencyTag(m) == commonOsToOsSpecificVariantTag {
|
||||
if m.Enabled(mctx) {
|
||||
if m.Enabled() {
|
||||
variants = append(variants, m)
|
||||
}
|
||||
}
|
||||
|
@@ -423,7 +423,7 @@ func TestArchMutator(t *testing.T) {
|
||||
variants := ctx.ModuleVariantsForTests(name)
|
||||
for _, variant := range variants {
|
||||
m := ctx.ModuleForTests(name, variant)
|
||||
if m.Module().Enabled(PanickingConfigAndErrorContext(ctx)) {
|
||||
if m.Module().Enabled() {
|
||||
ret = append(ret, variant)
|
||||
}
|
||||
}
|
||||
@@ -533,7 +533,7 @@ func TestArchMutatorNativeBridge(t *testing.T) {
|
||||
variants := ctx.ModuleVariantsForTests(name)
|
||||
for _, variant := range variants {
|
||||
m := ctx.ModuleForTests(name, variant)
|
||||
if m.Module().Enabled(PanickingConfigAndErrorContext(ctx)) {
|
||||
if m.Module().Enabled() {
|
||||
ret = append(ret, variant)
|
||||
}
|
||||
}
|
||||
|
@@ -325,7 +325,7 @@ func (b *baseModuleContext) validateAndroidModule(module blueprint.Module, tag b
|
||||
return nil
|
||||
}
|
||||
|
||||
if !aModule.Enabled(b) {
|
||||
if !aModule.Enabled() {
|
||||
if t, ok := tag.(AllowDisabledModuleDependency); !ok || !t.AllowDisabledModuleDependency(aModule) {
|
||||
if b.Config().AllowMissingDependencies() {
|
||||
b.AddMissingDependencies([]string{b.OtherModuleName(aModule)})
|
||||
|
@@ -1,28 +0,0 @@
|
||||
package android
|
||||
|
||||
import "github.com/google/blueprint/proptools"
|
||||
|
||||
// CreateSelectOsToBool is a utility function that makes it easy to create a
|
||||
// Configurable property value that maps from os to a bool. Use an empty string
|
||||
// to indicate a "default" case.
|
||||
func CreateSelectOsToBool(cases map[string]*bool) proptools.Configurable[bool] {
|
||||
var resultCases []proptools.ConfigurableCase[bool]
|
||||
for pattern, value := range cases {
|
||||
if pattern == "" {
|
||||
resultCases = append(resultCases, proptools.NewConfigurableCase(
|
||||
[]proptools.ConfigurablePattern{proptools.NewDefaultConfigurablePattern()},
|
||||
value,
|
||||
))
|
||||
} else {
|
||||
resultCases = append(resultCases, proptools.NewConfigurableCase(
|
||||
[]proptools.ConfigurablePattern{proptools.NewStringConfigurablePattern(pattern)},
|
||||
value,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
return proptools.NewConfigurable(
|
||||
[]proptools.ConfigurableCondition{proptools.NewConfigurableCondition("os", nil)},
|
||||
resultCases,
|
||||
)
|
||||
}
|
@@ -173,5 +173,5 @@ func (e *earlyModuleContext) Namespace() *Namespace {
|
||||
}
|
||||
|
||||
func (e *earlyModuleContext) OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{}) {
|
||||
e.EarlyModuleContext.OtherModulePropertyErrorf(module, property, fmt, args...)
|
||||
e.EarlyModuleContext.OtherModulePropertyErrorf(module, property, fmt, args)
|
||||
}
|
||||
|
@@ -62,7 +62,7 @@ func (s *genNoticeBuildRules) GenerateBuildActions(ctx SingletonContext) {
|
||||
if mod == nil {
|
||||
continue
|
||||
}
|
||||
if !mod.Enabled(ctx) { // don't depend on variants without build rules
|
||||
if !mod.Enabled() { // don't depend on variants without build rules
|
||||
continue
|
||||
}
|
||||
modules = append(modules, mod)
|
||||
|
@@ -36,7 +36,7 @@ var (
|
||||
func buildLicenseMetadata(ctx ModuleContext, licenseMetadataFile WritablePath) {
|
||||
base := ctx.Module().base()
|
||||
|
||||
if !base.Enabled(ctx) {
|
||||
if !base.Enabled() {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ func buildLicenseMetadata(ctx ModuleContext, licenseMetadataFile WritablePath) {
|
||||
if dep == nil {
|
||||
return
|
||||
}
|
||||
if !dep.Enabled(ctx) {
|
||||
if !dep.Enabled() {
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -98,7 +98,6 @@ type MakeVarsContext interface {
|
||||
BlueprintFile(module blueprint.Module) string
|
||||
|
||||
ModuleErrorf(module blueprint.Module, format string, args ...interface{})
|
||||
OtherModulePropertyErrorf(module Module, property, format string, args ...interface{})
|
||||
Errorf(format string, args ...interface{})
|
||||
|
||||
VisitAllModules(visit func(Module))
|
||||
@@ -266,7 +265,7 @@ func (s *makeVarsSingleton) GenerateBuildActions(ctx SingletonContext) {
|
||||
}
|
||||
|
||||
ctx.VisitAllModules(func(m Module) {
|
||||
if provider, ok := m.(ModuleMakeVarsProvider); ok && m.Enabled(ctx) {
|
||||
if provider, ok := m.(ModuleMakeVarsProvider); ok && m.Enabled() {
|
||||
mctx := &makeVarsContext{
|
||||
SingletonContext: ctx,
|
||||
}
|
||||
|
@@ -60,7 +60,7 @@ type Module interface {
|
||||
|
||||
base() *ModuleBase
|
||||
Disable()
|
||||
Enabled(ctx ConfigAndErrorContext) bool
|
||||
Enabled() bool
|
||||
Target() Target
|
||||
MultiTargets() []Target
|
||||
|
||||
@@ -287,7 +287,7 @@ type commonProperties struct {
|
||||
// but are not usually required (e.g. superceded by a prebuilt) should not be
|
||||
// disabled as that will prevent them from being built by the checkbuild target
|
||||
// and so prevent early detection of changes that have broken those modules.
|
||||
Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"`
|
||||
Enabled *bool `android:"arch_variant"`
|
||||
|
||||
// Controls the visibility of this module to other modules. Allowable values are one or more of
|
||||
// these formats:
|
||||
@@ -1392,11 +1392,14 @@ func (m *ModuleBase) PartitionTag(config DeviceConfig) string {
|
||||
return partition
|
||||
}
|
||||
|
||||
func (m *ModuleBase) Enabled(ctx ConfigAndErrorContext) bool {
|
||||
func (m *ModuleBase) Enabled() bool {
|
||||
if m.commonProperties.ForcedDisabled {
|
||||
return false
|
||||
}
|
||||
return m.commonProperties.Enabled.GetOrDefault(m.ConfigurableEvaluator(ctx), !m.Os().DefaultDisabled)
|
||||
if m.commonProperties.Enabled == nil {
|
||||
return !m.Os().DefaultDisabled
|
||||
}
|
||||
return *m.commonProperties.Enabled
|
||||
}
|
||||
|
||||
func (m *ModuleBase) Disable() {
|
||||
@@ -1640,7 +1643,7 @@ func (m *ModuleBase) generateModuleTarget(ctx ModuleContext) {
|
||||
// not be created if the module is not exported to make.
|
||||
// Those could depend on the build target and fail to compile
|
||||
// for the current build target.
|
||||
if !ctx.Config().KatiEnabled() || !shouldSkipAndroidMkProcessing(ctx, a) {
|
||||
if !ctx.Config().KatiEnabled() || !shouldSkipAndroidMkProcessing(a) {
|
||||
allCheckbuildFiles = append(allCheckbuildFiles, a.checkbuildFiles...)
|
||||
}
|
||||
})
|
||||
@@ -1832,7 +1835,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
||||
checkDistProperties(ctx, fmt.Sprintf("dists[%d]", i), &m.distProperties.Dists[i])
|
||||
}
|
||||
|
||||
if m.Enabled(ctx) {
|
||||
if m.Enabled() {
|
||||
// ensure all direct android.Module deps are enabled
|
||||
ctx.VisitDirectDepsBlueprint(func(bm blueprint.Module) {
|
||||
if m, ok := bm.(Module); ok {
|
||||
@@ -2133,7 +2136,7 @@ func (m *ModuleBase) ConfigurableEvaluator(ctx ConfigAndErrorContext) proptools.
|
||||
}
|
||||
|
||||
func (e configurationEvalutor) PropertyErrorf(property string, fmt string, args ...interface{}) {
|
||||
e.ctx.OtherModulePropertyErrorf(e.m, property, fmt, args...)
|
||||
e.ctx.OtherModulePropertyErrorf(e.m, property, fmt, args)
|
||||
}
|
||||
|
||||
func (e configurationEvalutor) EvaluateConfiguration(condition proptools.ConfigurableCondition, property string) proptools.ConfigurableValue {
|
||||
@@ -2532,7 +2535,7 @@ func (c *buildTargetSingleton) GenerateBuildActions(ctx SingletonContext) {
|
||||
}
|
||||
osDeps := map[osAndCross]Paths{}
|
||||
ctx.VisitAllModules(func(module Module) {
|
||||
if module.Enabled(ctx) {
|
||||
if module.Enabled() {
|
||||
key := osAndCross{os: module.Target().Os, hostCross: module.Target().HostCross}
|
||||
osDeps[key] = append(osDeps[key], module.base().checkbuildFiles...)
|
||||
}
|
||||
|
@@ -674,11 +674,13 @@ func RegisterComponentsMutator(ctx RegisterMutatorsContext) {
|
||||
// on component modules to be added so that they can depend directly on a prebuilt
|
||||
// module.
|
||||
func componentDepsMutator(ctx BottomUpMutatorContext) {
|
||||
ctx.Module().ComponentDepsMutator(ctx)
|
||||
if m := ctx.Module(); m.Enabled() {
|
||||
m.ComponentDepsMutator(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
func depsMutator(ctx BottomUpMutatorContext) {
|
||||
if m := ctx.Module(); m.Enabled(ctx) {
|
||||
if m := ctx.Module(); m.Enabled() {
|
||||
m.base().baseDepsMutator(ctx)
|
||||
m.DepsMutator(ctx)
|
||||
}
|
||||
|
@@ -322,7 +322,7 @@ func performOverrideMutator(ctx BottomUpMutatorContext) {
|
||||
}
|
||||
|
||||
func overridableModuleDepsMutator(ctx BottomUpMutatorContext) {
|
||||
if b, ok := ctx.Module().(OverridableModule); ok && b.Enabled(ctx) {
|
||||
if b, ok := ctx.Module().(OverridableModule); ok && b.Enabled() {
|
||||
b.OverridablePropertiesDepsMutator(ctx)
|
||||
}
|
||||
}
|
||||
|
@@ -60,7 +60,6 @@ type EarlyModulePathContext interface {
|
||||
|
||||
ModuleDir() string
|
||||
ModuleErrorf(fmt string, args ...interface{})
|
||||
OtherModulePropertyErrorf(module Module, property, fmt string, args ...interface{})
|
||||
}
|
||||
|
||||
var _ EarlyModulePathContext = ModuleContext(nil)
|
||||
@@ -551,7 +550,7 @@ func getPathsFromModuleDep(ctx ModuleWithDepsPathContext, path, moduleName, tag
|
||||
if module == nil {
|
||||
return nil, missingDependencyError{[]string{moduleName}}
|
||||
}
|
||||
if aModule, ok := module.(Module); ok && !aModule.Enabled(ctx) {
|
||||
if aModule, ok := module.(Module); ok && !aModule.Enabled() {
|
||||
return nil, missingDependencyError{[]string{moduleName}}
|
||||
}
|
||||
if outProducer, ok := module.(OutputFileProducer); ok {
|
||||
|
@@ -275,7 +275,7 @@ func InitSingleSourcePrebuiltModule(module PrebuiltInterface, srcProps interface
|
||||
srcPropertyName := proptools.PropertyNameForField(srcField)
|
||||
|
||||
srcsSupplier := func(ctx BaseModuleContext, _ Module) []string {
|
||||
if !module.Enabled(ctx) {
|
||||
if !module.Enabled() {
|
||||
return nil
|
||||
}
|
||||
value := srcPropsValue.FieldByIndex(srcFieldIndex)
|
||||
@@ -425,7 +425,7 @@ func PrebuiltSourceDepsMutator(ctx BottomUpMutatorContext) {
|
||||
m := ctx.Module()
|
||||
// If this module is a prebuilt, is enabled and has not been renamed to source then add a
|
||||
// dependency onto the source if it is present.
|
||||
if p := GetEmbeddedPrebuilt(m); p != nil && m.Enabled(ctx) && !p.properties.PrebuiltRenamedToSource {
|
||||
if p := GetEmbeddedPrebuilt(m); p != nil && m.Enabled() && !p.properties.PrebuiltRenamedToSource {
|
||||
bmn, _ := m.(baseModuleName)
|
||||
name := bmn.BaseModuleName()
|
||||
if ctx.OtherModuleReverseDependencyVariantExists(name) {
|
||||
@@ -702,7 +702,7 @@ func (p *Prebuilt) usePrebuilt(ctx BaseMutatorContext, source Module, prebuilt M
|
||||
}
|
||||
|
||||
// If source is not available or is disabled then always use the prebuilt.
|
||||
if source == nil || !source.Enabled(ctx) {
|
||||
if source == nil || !source.Enabled() {
|
||||
return true
|
||||
}
|
||||
|
||||
|
@@ -351,7 +351,7 @@ func TestPrebuilts(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
moduleIsDisabled := !foo.Module().Enabled(PanickingConfigAndErrorContext(result.TestContext))
|
||||
moduleIsDisabled := !foo.Module().Enabled()
|
||||
deps := foo.Module().(*sourceModule).deps
|
||||
if moduleIsDisabled {
|
||||
if len(deps) > 0 {
|
||||
|
@@ -16,9 +16,8 @@ package android
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// A sortable component is one whose registration order affects the order in which it is executed
|
||||
|
@@ -284,5 +284,5 @@ func (s *singletonContextAdaptor) moduleProvider(module blueprint.Module, provid
|
||||
}
|
||||
|
||||
func (s *singletonContextAdaptor) OtherModulePropertyErrorf(module Module, property string, format string, args ...interface{}) {
|
||||
s.blueprintSingletonContext().OtherModulePropertyErrorf(module, property, format, args...)
|
||||
s.blueprintSingletonContext().OtherModulePropertyErrorf(module, property, format, args)
|
||||
}
|
||||
|
@@ -1287,21 +1287,3 @@ func EnsureListContainsSuffix(t *testing.T, result []string, expected string) {
|
||||
t.Errorf("%q is not found in %v", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
type panickingConfigAndErrorContext struct {
|
||||
ctx *TestContext
|
||||
}
|
||||
|
||||
func (ctx *panickingConfigAndErrorContext) OtherModulePropertyErrorf(module Module, property, fmt string, args ...interface{}) {
|
||||
panic(ctx.ctx.PropertyErrorf(module, property, fmt, args...).Error())
|
||||
}
|
||||
|
||||
func (ctx *panickingConfigAndErrorContext) Config() Config {
|
||||
return ctx.ctx.Config()
|
||||
}
|
||||
|
||||
func PanickingConfigAndErrorContext(ctx *TestContext) ConfigAndErrorContext {
|
||||
return &panickingConfigAndErrorContext{
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
@@ -58,13 +58,13 @@ type variableProperties struct {
|
||||
// unbundled_build is a catch-all property to annotate modules that don't build in one or
|
||||
// more unbundled branches, usually due to dependencies missing from the manifest.
|
||||
Unbundled_build struct {
|
||||
Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"`
|
||||
Enabled *bool `android:"arch_variant"`
|
||||
} `android:"arch_variant"`
|
||||
|
||||
// similar to `Unbundled_build`, but `Always_use_prebuilt_sdks` means that it uses prebuilt
|
||||
// sdk specifically.
|
||||
Always_use_prebuilt_sdks struct {
|
||||
Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"`
|
||||
Enabled *bool `android:"arch_variant"`
|
||||
} `android:"arch_variant"`
|
||||
|
||||
Malloc_not_svelte struct {
|
||||
|
Reference in New Issue
Block a user