diff options
author | Colin Cross <ccross@android.com> | 2018-09-13 11:26:19 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2018-09-13 18:28:03 +0000 |
commit | cedd4768f58eab69cfbce8c2dc599d83a0c7dd26 (patch) | |
tree | 553b8eb33b0663b12a80420a3945503d5a1d6be0 /java/java_test.go | |
parent | fe4bc36f87b9d4f529bfd486b89176f3f3045323 (diff) |
Allow exclude_java_resources to affect java_resource_dirs
Allow excluding files from directory globbed by java_resource_dirs.
Test: java_test.go
Change-Id: I9922842248be1a386ab111a5187608438638ffb1
Diffstat (limited to 'java/java_test.go')
-rw-r--r-- | java/java_test.go | 60 |
1 files changed, 24 insertions, 36 deletions
diff --git a/java/java_test.go b/java/java_test.go index 3ace528da..82accd5a5 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -702,6 +702,30 @@ func TestResources(t *testing.T) { prop: `java_resource_dirs: ["java-res/*"], exclude_java_resource_dirs: ["java-res/b"]`, args: "-C java-res/a -f java-res/a/a", }, + { + // Test wildcards in java_resources + name: "wildcard files", + prop: `java_resources: ["java-res/**/*"]`, + args: "-C . -f java-res/a/a -f java-res/b/b", + }, + { + // Test exclude_java_resources with java_resources + name: "wildcard files with exclude", + prop: `java_resources: ["java-res/**/*"], exclude_java_resources: ["java-res/b/*"]`, + args: "-C . -f java-res/a/a", + }, + { + // Test exclude_java_resources with java_resource_dirs + name: "resource dirs with exclude files", + prop: `java_resource_dirs: ["java-res"], exclude_java_resources: ["java-res/b/b"]`, + args: "-C java-res -f java-res/a/a", + }, + { + // Test exclude_java_resource_dirs with java_resource_dirs + name: "resource dirs with exclude files", + prop: `java_resource_dirs: ["java-res", "java-res2"], exclude_java_resource_dirs: ["java-res2"]`, + args: "-C java-res -f java-res/a/a -f java-res/b/b", + }, } for _, test := range table { @@ -734,42 +758,6 @@ func TestResources(t *testing.T) { } } -func TestExcludeResources(t *testing.T) { - ctx := testJava(t, ` - java_library { - name: "foo", - srcs: ["a.java"], - java_resource_dirs: ["java-res", "java-res2"], - exclude_java_resource_dirs: ["java-res2"], - } - - java_library { - name: "bar", - srcs: ["a.java"], - java_resources: ["java-res/*/*"], - exclude_java_resources: ["java-res/b/*"], - } - `) - - fooRes := ctx.ModuleForTests("foo", "android_common").Output("res/foo.jar") - - expected := "-C java-res -f java-res/a/a -f java-res/b/b" - if fooRes.Args["jarArgs"] != expected { - t.Errorf("foo resource jar args %q is not %q", - fooRes.Args["jarArgs"], expected) - - } - - barRes := ctx.ModuleForTests("bar", "android_common").Output("res/bar.jar") - - expected = "-C . -f java-res/a/a" - if barRes.Args["jarArgs"] != expected { - t.Errorf("bar resource jar args %q is not %q", - barRes.Args["jarArgs"], expected) - - } -} - func TestGeneratedSources(t *testing.T) { ctx := testJava(t, ` java_library { |