Split local and global cflags
Native compiler flags are currently applied in approximately:
global cflags
local cflags
local include dirs
global include dirs
global conlyflags
local conlyflags
global cppflags
local cppflags
This means that a flag that is enabled in the global cppflags
cannot be disabled in the local cflags, and an Android.bp author
must know to disable it in the local cppflags. A better order
would be:
global cflags
global conlyflags
global cppflags
local cflags
local conlyflags
local cppflags
local include dirs
global include dirs
We are mixing both the global and local cflags into a single
variable, and similar for conlyflags and cppflags, which
prevents reordering them. This CL prepares to reorder them
by splitting the global and local cflags into separate variables.
Bug: 143713277
Test: m native
Change-Id: Ic55a8c3516c331dc5f2af9d00e59ceca9d3e6c15
diff --git a/cc/test.go b/cc/test.go
index 5c49d6e..05e6fe5 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -220,20 +220,20 @@
return flags
}
- flags.CFlags = append(flags.CFlags, "-DGTEST_HAS_STD_STRING")
+ flags.Local.CFlags = append(flags.Local.CFlags, "-DGTEST_HAS_STD_STRING")
if ctx.Host() {
- flags.CFlags = append(flags.CFlags, "-O0", "-g")
+ flags.Local.CFlags = append(flags.Local.CFlags, "-O0", "-g")
switch ctx.Os() {
case android.Windows:
- flags.CFlags = append(flags.CFlags, "-DGTEST_OS_WINDOWS")
+ flags.Local.CFlags = append(flags.Local.CFlags, "-DGTEST_OS_WINDOWS")
case android.Linux:
- flags.CFlags = append(flags.CFlags, "-DGTEST_OS_LINUX")
+ flags.Local.CFlags = append(flags.Local.CFlags, "-DGTEST_OS_LINUX")
case android.Darwin:
- flags.CFlags = append(flags.CFlags, "-DGTEST_OS_MAC")
+ flags.Local.CFlags = append(flags.Local.CFlags, "-DGTEST_OS_MAC")
}
} else {
- flags.CFlags = append(flags.CFlags, "-DGTEST_OS_LINUX_ANDROID")
+ flags.Local.CFlags = append(flags.Local.CFlags, "-DGTEST_OS_LINUX_ANDROID")
}
return flags