diff options
Diffstat (limited to 'java/java_test.go')
-rw-r--r-- | java/java_test.go | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/java/java_test.go b/java/java_test.go index c790342a1..64b6bf8d3 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -143,8 +143,8 @@ func testContext(config android.Config, bp string, "b.kt": nil, "a.jar": nil, "b.jar": nil, - "java-res/a": nil, - "java-res/b": nil, + "java-res/a/a": nil, + "java-res/b/b": nil, "java-res2/a": nil, "java-fg/a.java": nil, "java-fg/b.java": nil, @@ -606,13 +606,13 @@ func TestResources(t *testing.T) { // Test that a module with java_resource_dirs includes the files name: "resource dirs", prop: `java_resource_dirs: ["java-res"]`, - args: "-C java-res -f java-res/a -f java-res/b", + args: "-C java-res -f java-res/a/a -f java-res/b/b", }, { // Test that a module with java_resources includes the files name: "resource files", - prop: `java_resources: ["java-res/a", "java-res/b"]`, - args: "-C . -f java-res/a -f java-res/b", + prop: `java_resources: ["java-res/a/a", "java-res/b/b"]`, + args: "-C . -f java-res/a/a -f java-res/b/b", }, { // Test that a module with a filegroup in java_resources includes the files with the @@ -623,9 +623,9 @@ func TestResources(t *testing.T) { filegroup { name: "foo-res", path: "java-res", - srcs: ["java-res/a", "java-res/b"], + srcs: ["java-res/a/a", "java-res/b/b"], }`, - args: "-C java-res -f java-res/a -f java-res/b", + args: "-C java-res -f java-res/a/a -f java-res/b/b", }, { // Test that a module with "include_srcs: true" includes its source files in the resources jar @@ -633,6 +633,18 @@ func TestResources(t *testing.T) { prop: `include_srcs: true`, args: "-C . -f a.java -f b.java -f c.java", }, + { + // Test that a module with wildcards in java_resource_dirs has the correct path prefixes + name: "wildcard dirs", + prop: `java_resource_dirs: ["java-res/*"]`, + args: "-C java-res/a -f java-res/a/a -C java-res/b -f java-res/b/b", + }, + { + // Test that a module exclude_java_resource_dirs excludes the files + name: "wildcard dirs", + prop: `java_resource_dirs: ["java-res/*"], exclude_java_resource_dirs: ["java-res/b"]`, + args: "-C java-res/a -f java-res/a/a", + }, } for _, test := range table { @@ -677,14 +689,14 @@ func TestExcludeResources(t *testing.T) { java_library { name: "bar", srcs: ["a.java"], - java_resources: ["java-res/*"], - exclude_java_resources: ["java-res/b"], + 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 -f java-res/b" + 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) @@ -693,7 +705,7 @@ func TestExcludeResources(t *testing.T) { barRes := ctx.ModuleForTests("bar", "android_common").Output("res/bar.jar") - expected = "-C . -f java-res/a" + 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) |