Introduce system_modules property to java_api_library
System_modules property provides the jars passed as bootclasspath when compiling the stubs in the java_api_library where its creating java_sdk_library's sdk_version is none, as the jars will not be provided from the full_surface_stub_libs but compiled by itself in the child change. The jar provided by the system_modules will also be passed to metalava to resolve hierarchy coming from outer dependencies. Test: m --build-from-text-stub Bug: 288624417 Change-Id: I8f3b89efa24bceb070d7a37fae3c7334dd7f0868
This commit is contained in:
@@ -2447,3 +2447,39 @@ func TestJavaApiLibraryApiFilesSorting(t *testing.T) {
|
||||
"default/java/api/module-lib-current.txt default/java/api/system-server-current.txt"
|
||||
android.AssertStringDoesContain(t, "source text files not in api scope order", manifestCommand, sourceFilesFlag)
|
||||
}
|
||||
|
||||
func TestSdkLibraryProvidesSystemModulesToApiLibrary(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForJavaTest,
|
||||
PrepareForTestWithJavaSdkLibraryFiles,
|
||||
FixtureWithLastReleaseApis("foo"),
|
||||
android.FixtureModifyConfig(func(config android.Config) {
|
||||
config.SetApiLibraries([]string{"foo"})
|
||||
}),
|
||||
android.FixtureMergeMockFs(
|
||||
map[string][]byte{
|
||||
"A.java": nil,
|
||||
},
|
||||
),
|
||||
).RunTestWithBp(t, `
|
||||
java_library {
|
||||
name: "bar",
|
||||
srcs: ["a.java"],
|
||||
}
|
||||
java_system_modules {
|
||||
name: "baz",
|
||||
libs: ["bar"],
|
||||
}
|
||||
java_sdk_library {
|
||||
name: "foo",
|
||||
srcs: ["A.java"],
|
||||
system_modules: "baz",
|
||||
}
|
||||
`)
|
||||
m := result.ModuleForTests(apiScopePublic.apiLibraryModuleName("foo"), "android_common")
|
||||
manifest := m.Output("metalava.sbox.textproto")
|
||||
sboxProto := android.RuleBuilderSboxProtoForTests(t, manifest)
|
||||
manifestCommand := sboxProto.Commands[0].GetCommand()
|
||||
classPathFlag := "--classpath __SBOX_SANDBOX_DIR__/out/.intermediates/bar/android_common/turbine-combined/bar.jar"
|
||||
android.AssertStringDoesContain(t, "command expected to contain classpath flag", manifestCommand, classPathFlag)
|
||||
}
|
||||
|
Reference in New Issue
Block a user