diff options
author | 2023-04-24 18:06:44 +0000 | |
---|---|---|
committer | 2023-05-22 07:13:25 +0000 | |
commit | 7e9e20e389d065e73c26f4b2dc54333292bc931c (patch) | |
tree | 44ddefc062bb4308e35fb1a317f1ea95059ed673 /java/bootclasspath_fragment_test.go | |
parent | d0f9520414c41f3c78a0147c1b56b86672151686 (diff) |
Fix bootclasspath_fragment build failure during from-text stub build
This change enables bootclasspath_fragment module to be correctly built
during from-text stub build by android-non-updatable module to be
interpreted as its java_api_library equivalent.
Test: go test ./java
Bug: 279460171
Change-Id: Ia6b60edcb60782977cc59855f1cf5d3a46e9f682
Diffstat (limited to 'java/bootclasspath_fragment_test.go')
-rw-r--r-- | java/bootclasspath_fragment_test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/java/bootclasspath_fragment_test.go b/java/bootclasspath_fragment_test.go index 2541f14ff..9bdef749b 100644 --- a/java/bootclasspath_fragment_test.go +++ b/java/bootclasspath_fragment_test.go @@ -432,3 +432,39 @@ func TestBootclasspathFragment_Test(t *testing.T) { fragment = result.Module("a_test_fragment", "android_common").(*BootclasspathFragmentModule) android.AssertBoolEquals(t, "is a test fragment by type", true, fragment.isTestFragment()) } + +func TestBootclassFragment_LinkTextStub(t *testing.T) { + result := android.GroupFixturePreparers( + prepareForJavaTest, + prepareForTestWithBootclasspathFragment, + PrepareForTestWithJavaSdkLibraryFiles, + FixtureWithLastReleaseApis("mysdklibrary"), + android.FixtureModifyConfig(func(config android.Config) { + config.SetBuildFromTextStub(true) + }), + ).RunTestWithBp(t, ` + bootclasspath_fragment { + name: "myfragment", + contents: ["mysdklibrary"], + hidden_api: {split_packages: ["*"]}, + additional_stubs: [ + "android-non-updatable", + ], + } + java_sdk_library { + name: "mysdklibrary", + srcs: ["a.java"], + shared_library: false, + public: {enabled: true}, + system: {enabled: true}, + } + `) + + fragment := result.ModuleForTests("myfragment", "android_common") + ruleCommand := fragment.Rule("modularHiddenAPIStubFlagsFile").RuleParams.Command + android.AssertStringDoesContain(t, "Command expected to contain library as dependency stub dex", + ruleCommand, "--dependency-stub-dex=out/soong/.intermediates/default/java/android-non-updatable.stubs.module_lib.from-text/android_common/dex/android-non-updatable.stubs.module_lib.from-text.jar") + android.AssertStringDoesNotContain(t, + "Command not expected to contain multiple api_library as dependency stub dex", ruleCommand, + "--dependency-stub-dex=out/soong/.intermediates/default/java/android-non-updatable.stubs.from-text/android_common/dex/android-non-updatable.stubs.from-text.jar") +} |