diff options
author | Paul Duffin <paulduffin@google.com> | 2020-01-22 16:30:37 +0000 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2020-01-31 13:42:41 +0000 |
commit | 726d23c26a763cdbded84cab92a2842122635420 (patch) | |
tree | 36dd6a34113456e3484a48052ae5a5d1593758ec /java/java_test.go | |
parent | 67edce7adbe4bbaeced39bc10df6157ede6b3826 (diff) |
Improve java_sdk_library handling of test_current
When building a library against sdk_version: system_current it uses the
system stubs of any java_sdk_library that it references. Previously,
when building against sdk_version: test_current this used the public
stubs of any java_sdk_library. This change causes it to use the
test stubs instead to be consistent with the handling of system and
public.
Bug: 148080325
Test: updated the test
ran m nothing which failed as expected
fixed the code
ran m nothing again which succeeded
Change-Id: I58ec5bd243701c5a5c75664e2bb615ce7b2f2441
Diffstat (limited to 'java/java_test.go')
-rw-r--r-- | java/java_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go index a2788cb8e..c4ab13d05 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -1043,6 +1043,12 @@ func TestJavaSdkLibrary(t *testing.T) { libs: ["baz"], sdk_version: "system_current", } + java_library { + name: "baz-test", + srcs: ["c.java"], + libs: ["foo"], + sdk_version: "test_current", + } `) // check the existence of the internal modules @@ -1075,6 +1081,13 @@ func TestJavaSdkLibrary(t *testing.T) { "foo.stubs.jar") } + bazTestJavac := ctx.ModuleForTests("baz-test", "android_common").Rule("javac") + // tests if baz-test is actually linked to the test stubs lib + if !strings.Contains(bazTestJavac.Args["classpath"], "foo.stubs.test.jar") { + t.Errorf("baz-test javac classpath %v does not contain %q", bazTestJavac.Args["classpath"], + "foo.stubs.test.jar") + } + // test if baz has exported SDK lib names foo and bar to qux qux := ctx.ModuleForTests("qux", "android_common") if quxLib, ok := qux.Module().(*Library); ok { |