aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-11-13 10:16:05 -0800
committerDan Willemsen <dwillemsen@google.com>2016-11-17 01:49:39 -0800
commit0a37a2a2b8a88759e3e5dccec9dfc05ac2eb375e (patch)
treed1ae873324a32aa9c4169fcfa8d71db77899c47a /android
parentebedf678de4a013590c29bfb97bd445c12e7b010 (diff)
downloadbuild_soong-0a37a2a2b8a88759e3e5dccec9dfc05ac2eb375e.tar.gz
build_soong-0a37a2a2b8a88759e3e5dccec9dfc05ac2eb375e.tar.bz2
build_soong-0a37a2a2b8a88759e3e5dccec9dfc05ac2eb375e.zip
Encode default enabled state in OsType
Currently our only default-disabled Os is Windows since it's HostCross, but we'll be adding non-default Host and Device types in the future. Bug: 31559095 Test: out/soong/build.ninja is identical Change-Id: I2bc3a3cc76f2c95ea040bc34ba6706fcc178c68d
Diffstat (limited to 'android')
-rw-r--r--android/arch.go14
-rw-r--r--android/module.go2
2 files changed, 10 insertions, 6 deletions
diff --git a/android/arch.go b/android/arch.go
index 6c996849..2ef6e248 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -192,10 +192,10 @@ var (
osTypeList []OsType
NoOsType OsType
- Linux = NewOsType("linux", Host)
- Darwin = NewOsType("darwin", Host)
- Windows = NewOsType("windows", HostCross)
- Android = NewOsType("android", Device)
+ Linux = NewOsType("linux", Host, false)
+ Darwin = NewOsType("darwin", Host, false)
+ Windows = NewOsType("windows", HostCross, true)
+ Android = NewOsType("android", Device, false)
osArchTypeMap = map[OsType][]ArchType{
Linux: []ArchType{X86, X86_64},
@@ -208,6 +208,8 @@ var (
type OsType struct {
Name, Field string
Class OsClass
+
+ DefaultDisabled bool
}
type OsClass int
@@ -222,11 +224,13 @@ func (os OsType) String() string {
return os.Name
}
-func NewOsType(name string, class OsClass) OsType {
+func NewOsType(name string, class OsClass, defDisabled bool) OsType {
os := OsType{
Name: name,
Field: strings.Title(name),
Class: class,
+
+ DefaultDisabled: defDisabled,
}
osTypeList = append(osTypeList, os)
return os
diff --git a/android/module.go b/android/module.go
index 0dae3a54..2b6f8ba5 100644
--- a/android/module.go
+++ b/android/module.go
@@ -355,7 +355,7 @@ func (a *ModuleBase) DeviceSupported() bool {
func (a *ModuleBase) Enabled() bool {
if a.commonProperties.Enabled == nil {
- return a.Os().Class != HostCross
+ return !a.Os().DefaultDisabled
}
return *a.commonProperties.Enabled
}