summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2018-04-10 13:07:42 -0700
committerColin Cross <ccross@android.com>2018-04-10 20:12:47 +0000
commit0ead1d75cefa92e0d5da1cad29c10c6203094c18 (patch)
tree8c0f7cc4147b1680674baf1f4d4e38d19d34f104 /java/java_test.go
parentf19b9bb9819fbe36a05c31e193135a9b3b2e8388 (diff)
Allow wildcards in java_resource_dirs
Expand java_resource_dirs using ctx.Glob before globbing inside it in case it has wildcards in it. Fixes: internal error: panic in GenerateBuildActions for module "icu4j" variant "linux_glibc_common" path "external/icu/icu4j/main/classes/charset/src/META-INF" does not start with "external/icu/icu4j/main/classes/*/src" Test: java_test.go Change-Id: Icd28b7a3dd14752642fb0ec8d41bbd6e30f81a68
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go34
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)