summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
authorJiyong Park <jiyong@google.com>2018-05-28 18:02:19 +0900
committerJiyong Park <jiyong@google.com>2018-06-20 12:13:33 +0900
commit1be969191015edabdb55c5f618d5fcbab19c9d21 (patch)
tree5199ef93f3e5a8303a4cb8305cc0d80c04827a6e /java/java_test.go
parentc08f46fdfc5f20e000852c5f53d9010d8fd1ad14 (diff)
Export SDK library names
java_library, java_import, and android_library export SDK library names that they are using directly or indirectly via its dependencies. When building an apk, the manifest fixer uses the SDK lib names to automatically add <uses-library> tags. The SDK lib names are exported to the make world via LOCAL_EXPORT_SDK_LIBRARIES flag. Bug: 77575606 Test: m -j Change-Id: I4fe606eb7ed23843c58eebe6a324405fe1da34e5
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go
index 16782967c..96bf22436 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -1095,6 +1095,12 @@ func TestJavaSdkLibrary(t *testing.T) {
libs: ["foo", "bar"],
sdk_version: "system_current",
}
+ java_library {
+ name: "qux",
+ srcs: ["c.java"],
+ libs: ["baz"],
+ sdk_version: "system_current",
+ }
`)
// check the existence of the internal modules
@@ -1127,4 +1133,13 @@ func TestJavaSdkLibrary(t *testing.T) {
t.Errorf("baz javac classpath %v should not contain %q", bazJavac.Args["classpath"],
"foo.stubs.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 {
+ sdkLibs := quxLib.ExportedSdkLibs()
+ if len(sdkLibs) != 2 || !android.InList("foo", sdkLibs) || !android.InList("bar", sdkLibs) {
+ t.Errorf("qux should export \"foo\" and \"bar\" but exports %v", sdkLibs)
+ }
+ }
}