diff options
author | Colin Cross <ccross@android.com> | 2017-10-02 16:57:40 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-10-03 02:13:16 +0000 |
commit | 0532fb0d4c2f477f6b87ecbc9d715dde322c509c (patch) | |
tree | 54c98a7b6e9ba082399b4f63a3000955d25bd1f3 /java/java_test.go | |
parent | 5a727dfa117a92d889282fc8473aff1fdc30c573 (diff) |
Fix excluding resource directories
Using a glob as a path failed the existence check. Append the
glob after converting the path to a string.
Test: TestExcludeResources in java_test.go
Change-Id: Ic1fd40aa283f3b0d59c1c589dbeec411583eddf1
Diffstat (limited to 'java/java_test.go')
-rw-r--r-- | java/java_test.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go index 7154f5e37..3b73fddd5 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -96,6 +96,8 @@ func testJava(t *testing.T, bp string) *android.TestContext { "b.jar": nil, "res/a": nil, "res/b": nil, + "res2/a": nil, + "prebuilts/sdk/14/android.jar": nil, "prebuilts/sdk/14/framework.aidl": nil, }) @@ -434,6 +436,42 @@ func TestResources(t *testing.T) { } } +func TestExcludeResources(t *testing.T) { + ctx := testJava(t, ` + java_library { + name: "foo", + srcs: ["a.java"], + java_resource_dirs: ["res", "res2"], + exclude_java_resource_dirs: ["res2"], + } + + java_library { + name: "bar", + srcs: ["a.java"], + java_resources: ["res/*"], + exclude_java_resources: ["res/b"], + } + `) + + fooRes := ctx.ModuleForTests("foo", "android_common").Output("res.jar") + + expected := "-C res -l " + fooRes.Implicits[0].String() + 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.jar") + + expected = "-C . -f res/a" + if barRes.Args["jarArgs"] != expected { + t.Errorf("bar resource jar args %q is not %q", + barRes.Args["jarArgs"], expected) + + } +} + func fail(t *testing.T, errs []error) { if len(errs) > 0 { for _, err := range errs { |