Fix include order
Include order should be module includes, dependency exported includes,
and then global includes. Module includes and global includes are
computed during compileFlags, but dependency exported includes are
not handled until later. Move the global includes into a new
flags variable so that the dependency includes can be appended
to the module includes.
Test: m -j native
Change-Id: Ifc3894f0a898a070d6da8eed4f4b9e8cc0cd2523
diff --git a/cc/builder.go b/cc/builder.go
index cdfea92..0694cb7 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -201,6 +201,8 @@
tidy bool
coverage bool
+ systemIncludeFlags string
+
groupStaticLibs bool
stripKeepSymbols bool
@@ -244,9 +246,25 @@
coverageFiles = make(android.Paths, 0, len(srcFiles))
}
- cflags := flags.globalFlags + " " + flags.cFlags + " " + flags.conlyFlags
- cppflags := flags.globalFlags + " " + flags.cFlags + " " + flags.cppFlags
- asflags := flags.globalFlags + " " + flags.asFlags
+ cflags := strings.Join([]string{
+ flags.globalFlags,
+ flags.systemIncludeFlags,
+ flags.cFlags,
+ flags.conlyFlags,
+ }, " ")
+
+ cppflags := strings.Join([]string{
+ flags.globalFlags,
+ flags.systemIncludeFlags,
+ flags.cFlags,
+ flags.cppFlags,
+ }, " ")
+
+ asflags := strings.Join([]string{
+ flags.globalFlags,
+ flags.systemIncludeFlags,
+ flags.asFlags,
+ }, " ")
if flags.clang {
cflags += " ${config.NoOverrideClangGlobalCflags}"