Add module dir to includes for cc_preprocess_no_configuration
This is needed to create the same behavior as other cc modules.
Bug: 372091092
Test: go test
Change-Id: I2c15dbc2c6a2b2ba693ef0f2a732525dd2f72d0f
diff --git a/cc/cc_preprocess_no_configuration.go b/cc/cc_preprocess_no_configuration.go
index 3d1d0a5..3d4b077 100644
--- a/cc/cc_preprocess_no_configuration.go
+++ b/cc/cc_preprocess_no_configuration.go
@@ -16,6 +16,7 @@
import (
"android/soong/android"
+ "slices"
"strings"
)
@@ -78,6 +79,12 @@
return
}
+ cflags := slices.Clone(m.properties.Cflags)
+
+ // Match behavior of other cc modules:
+ // https://cs.android.com/android/platform/superproject/main/+/main:build/soong/cc/compiler.go;l=422;drc=7297f05ee8cda422ccb32c4af4d9d715d6bac10e
+ cflags = append(cflags, "-I"+ctx.ModuleDir())
+
var ccCmd string
switch src.Ext() {
case ".c":
@@ -99,7 +106,7 @@
Output: outFile,
Input: src,
Args: map[string]string{
- "cFlags": strings.Join(m.properties.Cflags, " "),
+ "cFlags": strings.Join(cflags, " "),
"ccCmd": ccCmd,
},
})