Revert "Revert "Support filegroup in exclude_srcs""
This reverts commit 606e9de344fae07473dd79e5ac556886a72035de.
Reason for revert: <try to fix the broken build yesterday>
Change-Id: I2963b9af63c7c7398159e5e9a1e448266e1c81d5
Test: unittest
diff --git a/java/java_test.go b/java/java_test.go
index 60d9a40..19c5f21 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -131,16 +131,19 @@
}
mockFS := map[string][]byte{
- "Android.bp": []byte(bp),
- "a.java": nil,
- "b.java": nil,
- "c.java": nil,
- "b.kt": nil,
- "a.jar": nil,
- "b.jar": nil,
- "java-res/a": nil,
- "java-res/b": nil,
- "java-res2/a": nil,
+ "Android.bp": []byte(bp),
+ "a.java": nil,
+ "b.java": nil,
+ "c.java": nil,
+ "b.kt": nil,
+ "a.jar": nil,
+ "b.jar": nil,
+ "java-res/a": nil,
+ "java-res/b": nil,
+ "java-res2/a": nil,
+ "java-fg/a.java": nil,
+ "java-fg/b.java": nil,
+ "java-fg/c.java": nil,
"prebuilts/sdk/14/android.jar": nil,
"prebuilts/sdk/14/framework.aidl": nil,
@@ -907,6 +910,32 @@
}
}
+func TestExcludeFileGroupInSrcs(t *testing.T) {
+ ctx := testJava(t, `
+ java_library {
+ name: "foo",
+ srcs: ["a.java", ":foo-srcs"],
+ exclude_srcs: ["a.java", ":foo-excludes"],
+ }
+
+ filegroup {
+ name: "foo-srcs",
+ srcs: ["java-fg/a.java", "java-fg/b.java", "java-fg/c.java"],
+ }
+
+ filegroup {
+ name: "foo-excludes",
+ srcs: ["java-fg/a.java", "java-fg/b.java"],
+ }
+ `)
+
+ javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
+
+ if len(javac.Inputs) != 1 || javac.Inputs[0].String() != "java-fg/c.java" {
+ t.Errorf(`foo inputs %v != ["java-fg/c.java"]`, javac.Inputs)
+ }
+}
+
func fail(t *testing.T, errs []error) {
t.Helper()
if len(errs) > 0 {