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
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user