Merge "Share cFlags, tidyFlags, etc. in a module" am: b1a12462a9 am: 6e5aabb91b am: 535abf1d28 am: 6aeeba8976 am: 966a8bf5db

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

Change-Id: Ic65c6f02aefe7bc718121490a9afa0a63dda0a94
This commit is contained in:
Treehugger Robot
2021-09-16 03:31:19 +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"])