diff options
author | 2023-09-20 13:39:57 +0000 | |
---|---|---|
committer | 2023-09-28 13:20:49 +0000 | |
commit | 0e73f9ee6db05504a5a586b931645a3da51ed9a8 (patch) | |
tree | d2be00c5b19f5e69f914b05d136fe706a26e7de8 /java/java_test.go | |
parent | 2863e4535eb65e15f955dc8ed48fa99b1d2a1db5 (diff) |
Collect transitive source files for java modules
This new entry in the JavaInfoProvider lists all the transitive source
files contained within the library. That is, the source files of the
module and all its static dependencies.
Bug: 151360309
Test: unit test in java_go + some manual testing
Change-Id: I7fe3035b9e46774095c0e9196cd77fa1027adf6d
Diffstat (limited to 'java/java_test.go')
-rw-r--r-- | java/java_test.go | 22 |
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 { |