Add ctx.Windows()
Replace ctx.Os() == android.Windows with ctx.Windows()
Test: builds
Change-Id: I7c24c39bcf54a51ad152b21c0021e40a0c07f189
diff --git a/android/module.go b/android/module.go
index 4fba1cf..3c09b3e 100644
--- a/android/module.go
+++ b/android/module.go
@@ -57,6 +57,7 @@
Host() bool
Device() bool
Darwin() bool
+ Windows() bool
Debug() bool
PrimaryArch() bool
Proprietary() bool
@@ -611,6 +612,10 @@
return a.target.Os == Darwin
}
+func (a *androidBaseContextImpl) Windows() bool {
+ return a.target.Os == Windows
+}
+
func (a *androidBaseContextImpl) Debug() bool {
return a.debug
}
diff --git a/cc/binary.go b/cc/binary.go
index 637f6c7..2578311 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -204,7 +204,7 @@
if ctx.Host() && !binary.static() {
if !ctx.AConfig().IsEnvTrue("DISABLE_HOST_PIE") {
flags.LdFlags = append(flags.LdFlags, "-pie")
- if ctx.Os() == android.Windows {
+ if ctx.Windows() {
flags.LdFlags = append(flags.LdFlags, "-Wl,-e_mainCRTStartup")
}
}
@@ -213,7 +213,7 @@
// MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because
// all code is position independent, and then those warnings get promoted to
// errors.
- if ctx.Os() != android.Windows {
+ if !ctx.Windows() {
flags.CFlags = append(flags.CFlags, "-fpie")
}
diff --git a/cc/library.go b/cc/library.go
index 953c37a..1871696 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -228,7 +228,7 @@
// MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because
// all code is position independent, and then those warnings get promoted to
// errors.
- if ctx.Os() != android.Windows {
+ if !ctx.Windows() {
flags.CFlags = append(flags.CFlags, "-fPIC")
}
diff --git a/cc/linker.go b/cc/linker.go
index 07d9aa8..4d21d99 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -156,7 +156,7 @@
}
}
- if ctx.Os() == android.Windows {
+ if ctx.Windows() {
deps.LateStaticLibs = append(deps.LateStaticLibs, "libwinpthread")
}
diff --git a/cc/stl.go b/cc/stl.go
index 43776f7..9e67145 100644
--- a/cc/stl.go
+++ b/cc/stl.go
@@ -60,7 +60,7 @@
ctx.ModuleErrorf("stl: %q is not a supported STL with sdk_version set", s)
return ""
}
- } else if ctx.Os() == android.Windows {
+ } else if ctx.Windows() {
switch s {
case "libc++", "libc++_static", "libstdc++", "":
// libc++ is not supported on mingw