Merge "Share cFlags, tidyFlags, etc. in a module" am: b1a12462a9

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1824024

Change-Id: Iaf6050178f9d172a5a17103504e8f081277df9cf
This commit is contained in:
Treehugger Robot
2021-09-16 02:35:38 +00:00
committed by Automerger Merge Worker
4 changed files with 71 additions and 22 deletions

View File

@@ -932,9 +932,17 @@ func TestApexWithStubs(t *testing.T) {
// .. and not linking to the stubs variant of mylib3
ensureNotContains(t, mylibLdFlags, "mylib3/android_arm64_armv8-a_shared_12/mylib3.so")
// Comment out this test. Now it fails after the optimization of sharing "cflags" in cc/cc.go
// is replaced by sharing of "cFlags" in cc/builder.go.
// The "cflags" contains "-include mylib.h", but cFlags contained only a reference to the
// module variable representing "cflags". So it was not detected by ensureNotContains.
// Now "cFlags" is a reference to a module variable like $flags1, which includes all previous
// content of "cflags". ModuleForTests...Args["cFlags"] returns the full string of $flags1,
// including the original cflags's "-include mylib.h".
//
// Ensure that stubs libs are built without -include flags
mylib2Cflags := ctx.ModuleForTests("mylib2", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
ensureNotContains(t, mylib2Cflags, "-include ")
// mylib2Cflags := ctx.ModuleForTests("mylib2", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
// ensureNotContains(t, mylib2Cflags, "-include ")
// Ensure that genstub is invoked with --apex
ensureContains(t, "--apex", ctx.ModuleForTests("mylib2", "android_arm64_armv8-a_shared_3").Rule("genStubSrc").Args["flags"])