diff options
author | 2023-10-05 17:26:09 +0000 | |
---|---|---|
committer | 2023-10-09 17:44:54 +0000 | |
commit | 4ec24870e03eee77911d787d6d160e2389fc2a9f (patch) | |
tree | 8699441a3d2b6f49f3a6c9535ba1a3c023358ae4 /java/java_test.go | |
parent | b0f3ff43e57391ba95b661b7830e6e967979e071 (diff) |
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
Diffstat (limited to 'java/java_test.go')
-rw-r--r-- | java/java_test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go index d51604a25..6b8b735f7 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -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) +} |