Revert "Skip creating variants for disabled OSes"
This reverts commit d976af0cb4
.
Reason for revert: broke windows SDK build: missing bin/dexdump.exe
Bug: 173663545
Change-Id: Ibb541507650beabd2d94885dd8d66f724a358ca7
This commit is contained in:
@@ -757,7 +757,7 @@ func osMutator(bpctx blueprint.BottomUpMutatorContext) {
|
|||||||
|
|
||||||
for _, os := range OsTypeList {
|
for _, os := range OsTypeList {
|
||||||
for _, t := range mctx.Config().Targets[os] {
|
for _, t := range mctx.Config().Targets[os] {
|
||||||
if base.supportsTarget(t) && base.osEnabled(os) {
|
if base.supportsTarget(t) {
|
||||||
moduleOSList = append(moduleOSList, os)
|
moduleOSList = append(moduleOSList, os)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -1183,16 +1183,6 @@ func InitArchModule(m Module) {
|
|||||||
}
|
}
|
||||||
base.archProperties = append(base.archProperties, archProperties)
|
base.archProperties = append(base.archProperties, archProperties)
|
||||||
m.AddProperties(archProperties...)
|
m.AddProperties(archProperties...)
|
||||||
|
|
||||||
// Special case the enabled property so the osMutator can skip creating variants that
|
|
||||||
// are disabled.
|
|
||||||
if properties == &base.enabledProperties {
|
|
||||||
if len(archProperties) != 1 {
|
|
||||||
panic(fmt.Errorf("expected a single arch-specific enabledProperties type, found %d",
|
|
||||||
len(archProperties)))
|
|
||||||
}
|
|
||||||
base.archEnabledProperties = archProperties[0].(*archPropRoot)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
base.customizableProperties = m.GetProperties()
|
base.customizableProperties = m.GetProperties()
|
||||||
|
@@ -174,22 +174,20 @@ func (d *DefaultsModuleBase) GenerateAndroidBuildActions(ctx ModuleContext) {
|
|||||||
|
|
||||||
func InitDefaultsModule(module DefaultsModule) {
|
func InitDefaultsModule(module DefaultsModule) {
|
||||||
commonProperties := &commonProperties{}
|
commonProperties := &commonProperties{}
|
||||||
enabledProperties := &enabledProperties{}
|
|
||||||
|
|
||||||
module.AddProperties(
|
module.AddProperties(
|
||||||
&hostAndDeviceProperties{},
|
&hostAndDeviceProperties{},
|
||||||
enabledProperties,
|
|
||||||
commonProperties,
|
commonProperties,
|
||||||
&ApexProperties{},
|
&ApexProperties{},
|
||||||
&distProperties{})
|
&distProperties{})
|
||||||
|
|
||||||
base := module.base()
|
|
||||||
initAndroidModuleBase(module)
|
initAndroidModuleBase(module)
|
||||||
initProductVariableModule(module)
|
initProductVariableModule(module)
|
||||||
InitArchModule(module)
|
InitArchModule(module)
|
||||||
InitDefaultableModule(module)
|
InitDefaultableModule(module)
|
||||||
|
|
||||||
// Add properties that will not have defaults applied to them.
|
// Add properties that will not have defaults applied to them.
|
||||||
|
base := module.base()
|
||||||
defaultsVisibility := &DefaultsVisibilityProperties{}
|
defaultsVisibility := &DefaultsVisibilityProperties{}
|
||||||
module.AddProperties(&base.nameProperties, defaultsVisibility)
|
module.AddProperties(&base.nameProperties, defaultsVisibility)
|
||||||
|
|
||||||
|
@@ -19,7 +19,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"text/scanner"
|
"text/scanner"
|
||||||
@@ -513,7 +512,7 @@ type nameProperties struct {
|
|||||||
Name *string
|
Name *string
|
||||||
}
|
}
|
||||||
|
|
||||||
type enabledProperties struct {
|
type commonProperties struct {
|
||||||
// emit build rules for this module
|
// emit build rules for this module
|
||||||
//
|
//
|
||||||
// Disabling a module should only be done for those modules that cannot be built
|
// Disabling a module should only be done for those modules that cannot be built
|
||||||
@@ -522,9 +521,7 @@ type enabledProperties struct {
|
|||||||
// disabled as that will prevent them from being built by the checkbuild target
|
// 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.
|
// and so prevent early detection of changes that have broken those modules.
|
||||||
Enabled *bool `android:"arch_variant"`
|
Enabled *bool `android:"arch_variant"`
|
||||||
}
|
|
||||||
|
|
||||||
type commonProperties struct {
|
|
||||||
// Controls the visibility of this module to other modules. Allowable values are one or more of
|
// Controls the visibility of this module to other modules. Allowable values are one or more of
|
||||||
// these formats:
|
// these formats:
|
||||||
//
|
//
|
||||||
@@ -833,7 +830,6 @@ func InitAndroidModule(m Module) {
|
|||||||
|
|
||||||
m.AddProperties(
|
m.AddProperties(
|
||||||
&base.nameProperties,
|
&base.nameProperties,
|
||||||
&base.enabledProperties,
|
|
||||||
&base.commonProperties,
|
&base.commonProperties,
|
||||||
&base.distProperties)
|
&base.distProperties)
|
||||||
|
|
||||||
@@ -932,11 +928,6 @@ type ModuleBase struct {
|
|||||||
archProperties [][]interface{}
|
archProperties [][]interface{}
|
||||||
customizableProperties []interface{}
|
customizableProperties []interface{}
|
||||||
|
|
||||||
// The enabled property is special-cased so that the osMutator can skip creating variants
|
|
||||||
// that are disabled.
|
|
||||||
enabledProperties enabledProperties
|
|
||||||
archEnabledProperties *archPropRoot
|
|
||||||
|
|
||||||
// Information about all the properties on the module that contains visibility rules that need
|
// Information about all the properties on the module that contains visibility rules that need
|
||||||
// checking.
|
// checking.
|
||||||
visibilityPropertyInfo []visibilityProperty
|
visibilityPropertyInfo []visibilityProperty
|
||||||
@@ -1127,33 +1118,6 @@ func (m *ModuleBase) supportsTarget(target Target) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// osEnabled returns true if the given OS is enabled for the current module.
|
|
||||||
func (m *ModuleBase) osEnabled(os OsType) bool {
|
|
||||||
targetStruct := reflect.ValueOf(m.archEnabledProperties.Target)
|
|
||||||
|
|
||||||
if targetStruct.Kind() != reflect.Ptr || targetStruct.Type().Elem().Kind() != reflect.Struct {
|
|
||||||
panic(fmt.Errorf("expected a pointer to a struct, found %s", targetStruct.Type()))
|
|
||||||
}
|
|
||||||
|
|
||||||
if targetStruct.IsNil() {
|
|
||||||
return !os.DefaultDisabled
|
|
||||||
}
|
|
||||||
|
|
||||||
osStruct := targetStruct.Elem().FieldByName(os.Field)
|
|
||||||
|
|
||||||
if targetStruct.Kind() != reflect.Ptr || targetStruct.Type().Elem().Kind() != reflect.Struct {
|
|
||||||
panic(fmt.Errorf("expected a pointer to a struct, found %s", targetStruct.Type()))
|
|
||||||
}
|
|
||||||
|
|
||||||
if osStruct.IsNil() {
|
|
||||||
return !os.DefaultDisabled
|
|
||||||
}
|
|
||||||
|
|
||||||
enabledField := osStruct.Elem().FieldByName("Enabled")
|
|
||||||
|
|
||||||
return proptools.BoolDefault(enabledField.Interface().(*bool), !os.DefaultDisabled)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeviceSupported returns true if the current module is supported and enabled for device targets,
|
// DeviceSupported returns true if the current module is supported and enabled for device targets,
|
||||||
// i.e. the factory method set the HostOrDeviceSupported value to include device support and
|
// i.e. the factory method set the HostOrDeviceSupported value to include device support and
|
||||||
// the device support is enabled by default or enabled by the device_supported property.
|
// the device support is enabled by default or enabled by the device_supported property.
|
||||||
@@ -1253,7 +1217,10 @@ func (m *ModuleBase) Enabled() bool {
|
|||||||
if m.commonProperties.ForcedDisabled {
|
if m.commonProperties.ForcedDisabled {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return proptools.BoolDefault(m.enabledProperties.Enabled, !m.Os().DefaultDisabled)
|
if m.commonProperties.Enabled == nil {
|
||||||
|
return !m.Os().DefaultDisabled
|
||||||
|
}
|
||||||
|
return *m.commonProperties.Enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ModuleBase) Disable() {
|
func (m *ModuleBase) Disable() {
|
||||||
|
@@ -29,7 +29,7 @@ func registerPathDepsMutator(ctx RegisterMutatorsContext) {
|
|||||||
// property that is tagged with android:"path".
|
// property that is tagged with android:"path".
|
||||||
func pathDepsMutator(ctx BottomUpMutatorContext) {
|
func pathDepsMutator(ctx BottomUpMutatorContext) {
|
||||||
m := ctx.Module().(Module)
|
m := ctx.Module().(Module)
|
||||||
if m == nil || !m.Enabled() {
|
if m == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -184,9 +184,6 @@ func (g *Module) GeneratedDeps() android.Paths {
|
|||||||
|
|
||||||
func toolDepsMutator(ctx android.BottomUpMutatorContext) {
|
func toolDepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
if g, ok := ctx.Module().(*Module); ok {
|
if g, ok := ctx.Module().(*Module); ok {
|
||||||
if !g.Enabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for _, tool := range g.properties.Tools {
|
for _, tool := range g.properties.Tools {
|
||||||
tag := hostToolDependencyTag{label: tool}
|
tag := hostToolDependencyTag{label: tool}
|
||||||
if m := android.SrcIsModule(tool); m != "" {
|
if m := android.SrcIsModule(tool); m != "" {
|
||||||
|
Reference in New Issue
Block a user