diff options
author | Paul Duffin <paulduffin@google.com> | 2021-05-13 21:25:05 +0100 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2021-05-14 01:49:19 +0100 |
commit | 34827d4c0ec854bee766ec3db2be6e66b34ebb28 (patch) | |
tree | 4fdd91c94165de6fccdc3ff6e66717331a8d40a7 /java/bootclasspath_fragment_test.go | |
parent | dfa1083fee4d1bf62c582c4e6ece20343fed6f50 (diff) |
Use java_sdk_library in bootclasspath_fragment contents as stubs
A java_sdk_library specified in the bootclasspath_fragment contents
must be providing APIs for the bootclasspath_fragment and so must be
treated as if they were specified in the stub_libs. This avoids having
to specify them in both contents and stub_libs.
Bug: 179354495
Test: m nothing
Change-Id: I535065ee1a79b439e2676f35e06a75d4626adcaf
Diffstat (limited to 'java/bootclasspath_fragment_test.go')
-rw-r--r-- | java/bootclasspath_fragment_test.go | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/java/bootclasspath_fragment_test.go b/java/bootclasspath_fragment_test.go index a47e12748..db284c9ec 100644 --- a/java/bootclasspath_fragment_test.go +++ b/java/bootclasspath_fragment_test.go @@ -204,7 +204,7 @@ func TestBootclasspathFragment_StubLibs(t *testing.T) { result := android.GroupFixturePreparers( prepareForTestWithBootclasspathFragment, PrepareForTestWithJavaSdkLibraryFiles, - FixtureWithLastReleaseApis("mysdklibrary", "mycoreplatform"), + FixtureWithLastReleaseApis("mysdklibrary", "myothersdklibrary", "mycoreplatform"), ).RunTestWithBp(t, ` bootclasspath_fragment { name: "myfragment", @@ -212,7 +212,7 @@ func TestBootclasspathFragment_StubLibs(t *testing.T) { api: { stub_libs: [ "mystublib", - "mysdklibrary", + "myothersdklibrary", ], }, core_platform_api: { @@ -237,6 +237,13 @@ func TestBootclasspathFragment_StubLibs(t *testing.T) { } java_sdk_library { + name: "myothersdklibrary", + srcs: ["a.java"], + shared_library: false, + public: {enabled: true}, + } + + java_sdk_library { name: "mycoreplatform", srcs: ["a.java"], shared_library: false, @@ -249,16 +256,23 @@ func TestBootclasspathFragment_StubLibs(t *testing.T) { stubsJar := "out/soong/.intermediates/mystublib/android_common/dex/mystublib.jar" - // Check that SdkPublic uses public stubs. + // Stubs jars for mysdklibrary publicStubsJar := "out/soong/.intermediates/mysdklibrary.stubs/android_common/dex/mysdklibrary.stubs.jar" - android.AssertPathsRelativeToTopEquals(t, "public dex stubs jar", []string{stubsJar, publicStubsJar}, info.stubJarsByKind[android.SdkPublic]) - - // Check that SdkSystem uses system stubs. systemStubsJar := "out/soong/.intermediates/mysdklibrary.stubs.system/android_common/dex/mysdklibrary.stubs.system.jar" - android.AssertPathsRelativeToTopEquals(t, "system dex stubs jar", []string{stubsJar, systemStubsJar}, info.stubJarsByKind[android.SdkSystem]) - // Check that SdkTest also uses system stubs as the mysdklibrary does not provide test stubs. - android.AssertPathsRelativeToTopEquals(t, "test dex stubs jar", []string{stubsJar, systemStubsJar}, info.stubJarsByKind[android.SdkTest]) + // Stubs jars for myothersdklibrary + otherPublicStubsJar := "out/soong/.intermediates/myothersdklibrary.stubs/android_common/dex/myothersdklibrary.stubs.jar" + + // Check that SdkPublic uses public stubs for all sdk libraries. + android.AssertPathsRelativeToTopEquals(t, "public dex stubs jar", []string{otherPublicStubsJar, publicStubsJar, stubsJar}, info.stubJarsByKind[android.SdkPublic]) + + // Check that SdkSystem uses system stubs for mysdklibrary and public stubs for myothersdklibrary + // as it does not provide system stubs. + android.AssertPathsRelativeToTopEquals(t, "system dex stubs jar", []string{otherPublicStubsJar, systemStubsJar, stubsJar}, info.stubJarsByKind[android.SdkSystem]) + + // Check that SdkTest also uses system stubs for mysdklibrary as it does not provide test stubs + // and public stubs for myothersdklibrary as it does not provide test stubs either. + android.AssertPathsRelativeToTopEquals(t, "test dex stubs jar", []string{otherPublicStubsJar, systemStubsJar, stubsJar}, info.stubJarsByKind[android.SdkTest]) // Check that SdkCorePlatform uses public stubs from the mycoreplatform library. corePlatformStubsJar := "out/soong/.intermediates/mycoreplatform.stubs/android_common/dex/mycoreplatform.stubs.jar" |