summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
author Anton Hansson <hansson@google.com> 2023-09-28 16:46:30 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2023-09-28 16:46:30 +0000
commit9231132099ffa64063c6fdda440293f0bccf0a48 (patch)
tree6dacaa097f108a7c1e8511de1ef9b10e6cfe0f73 /java/java_test.go
parent6ed1e0fd590f8866e3933c20aa85f168c5b62869 (diff)
parent0e73f9ee6db05504a5a586b931645a3da51ed9a8 (diff)
Merge "Collect transitive source files for java modules" into main
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go
index b555a9513..d51604a25 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2263,6 +2263,28 @@ func TestJavaApiLibraryFullApiSurfaceStub(t *testing.T) {
android.AssertStringDoesContain(t, "Command expected to contain full_api_surface_stub output jar", manifestCommand, "lib1.jar")
}
+func TestTransitiveSrcFiles(t *testing.T) {
+ ctx, _ := testJava(t, `
+ java_library {
+ name: "a",
+ srcs: ["a.java"],
+ }
+ java_library {
+ name: "b",
+ srcs: ["b.java"],
+ }
+ java_library {
+ name: "c",
+ srcs: ["c.java"],
+ libs: ["a"],
+ static_libs: ["b"],
+ }
+ `)
+ c := ctx.ModuleForTests("c", "android_common").Module()
+ transitiveSrcFiles := android.Paths(ctx.ModuleProvider(c, JavaInfoProvider).(JavaInfo).TransitiveSrcFiles.ToList())
+ android.AssertArrayString(t, "unexpected jar deps", []string{"b.java", "c.java"}, transitiveSrcFiles.Strings())
+}
+
func TestTradefedOptions(t *testing.T) {
result := PrepareForTestWithJavaBuildComponents.RunTestWithBp(t, `
java_test_host {