Replace android.BuildOs with Config.BuildOS
Replace the android.BuildOs constant with Config.BuildOS so that it
can vary based on the product config.
Bug: 190084016
Test: all Soong tests
Change-Id: Ia67f872d8b2ab788747a22e3a9659dc21c9775cd
diff --git a/cc/config/global.go b/cc/config/global.go
index dfbe6c4..55e0d79 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -15,6 +15,7 @@
package config
import (
+ "runtime"
"strings"
"android/soong/android"
@@ -282,7 +283,7 @@
var pctx = android.NewPackageContext("android/soong/cc/config")
func init() {
- if android.BuildOs == android.Linux {
+ if runtime.GOOS == "linux" {
commonGlobalCflags = append(commonGlobalCflags, "-fdebug-prefix-map=/proc/self/cwd=")
}
diff --git a/cc/makevars.go b/cc/makevars.go
index 393170a..8d7a163 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -165,7 +165,7 @@
sort.Strings(ndkKnownLibs)
ctx.Strict("NDK_KNOWN_LIBS", strings.Join(ndkKnownLibs, " "))
- hostTargets := ctx.Config().Targets[android.BuildOs]
+ hostTargets := ctx.Config().Targets[ctx.Config().BuildOS]
makeVarsToolchain(ctx, "", hostTargets[0])
if len(hostTargets) > 1 {
makeVarsToolchain(ctx, "2ND_", hostTargets[1])
diff --git a/cc/prebuilt_test.go b/cc/prebuilt_test.go
index fa6dd87..c8f8103 100644
--- a/cc/prebuilt_test.go
+++ b/cc/prebuilt_test.go
@@ -15,6 +15,7 @@
package cc
import (
+ "runtime"
"testing"
"android/soong/android"
@@ -271,8 +272,8 @@
}
func TestPrebuiltSymlinkedHostBinary(t *testing.T) {
- if android.BuildOs != android.Linux {
- t.Skipf("Skipping host prebuilt testing that is only supported on %s not %s", android.Linux, android.BuildOs)
+ if runtime.GOOS != "linux" {
+ t.Skipf("Skipping host prebuilt testing that is only supported on linux not %s", runtime.GOOS)
}
ctx := testPrebuilt(t, `
diff --git a/cc/proto_test.go b/cc/proto_test.go
index b9c89c7..abcb273 100644
--- a/cc/proto_test.go
+++ b/cc/proto_test.go
@@ -51,7 +51,7 @@
},
}`)
- buildOS := android.BuildOs.String()
+ buildOS := ctx.Config().BuildOS.String()
proto := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Output("proto/a.pb.cc")
foobar := ctx.ModuleForTests("protoc-gen-foobar", buildOS+"_x86_64")