diff options
author | Paul Duffin <paulduffin@google.com> | 2020-01-22 17:11:15 +0000 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2020-02-04 14:47:04 +0000 |
commit | a2db18fb1e721c63d9ad3e87c33718749d50c25e (patch) | |
tree | e5e02bcaf1c2be9975fec3676aa9ac103475f378 /java/java_test.go | |
parent | 1b57531573108a6f13eef8d36437122842c707d8 (diff) |
java_sdk_library use prebuilt jars for numeric sdk_version
Previously, when a library that used a numeric sdk version also
referenced a java_sdk_library it would use the current version of its
API. That was dangerous as there is an expectation that an app building
against a numbered version will also be targeted at that version and
so building against a later version of the API could hide runtime
incompatibilities.
This change will use prebuilt versions of the java_sdk_library's api
when being built for a numbered sdk version.
Bug: 148080325
Test: m droid
Change-Id: I3fd416553950785a443c1702e495a96debc33331
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 0e987a624..8815c09db 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -1099,6 +1099,12 @@ func TestJavaSdkLibrary(t *testing.T) { libs: ["foo"], sdk_version: "test_current", } + java_library { + name: "baz-29", + srcs: ["c.java"], + libs: ["foo"], + sdk_version: "system_29", + } `) // check the existence of the internal modules @@ -1138,6 +1144,13 @@ func TestJavaSdkLibrary(t *testing.T) { "foo.stubs.test.jar") } + baz29Javac := ctx.ModuleForTests("baz-29", "android_common").Rule("javac") + // tests if baz-29 is actually linked to the system 29 stubs lib + if !strings.Contains(baz29Javac.Args["classpath"], "prebuilts/sdk/29/system/foo.jar") { + t.Errorf("baz-29 javac classpath %v does not contain %q", baz29Javac.Args["classpath"], + "prebuilts/sdk/29/system/foo.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 { |