Merge "Disable from-text stub build for coverage build" into main am: 04803d4767 am: 89c8d9012c am: eda9671faf

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2789434

Change-Id: I15508f6af1f094d1be5073c62ed7a97b93e826a1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jihoon Kang
2023-10-20 00:09:54 +00:00
committed by Automerger Merge Worker
2 changed files with 38 additions and 1 deletions

View File

@@ -2599,3 +2599,33 @@ func TestApiLibraryDroidstubsDependency(t *testing.T) {
currentApiTimestampPath,
)
}
func TestDisableFromTextStubForCoverageBuild(t *testing.T) {
result := android.GroupFixturePreparers(
prepareForJavaTest,
PrepareForTestWithJavaSdkLibraryFiles,
PrepareForTestWithJacocoInstrumentation,
FixtureWithLastReleaseApis("foo"),
android.FixtureModifyConfig(func(config android.Config) {
config.SetApiLibraries([]string{"foo"})
config.SetBuildFromTextStub(true)
}),
android.FixtureModifyEnv(func(env map[string]string) {
env["EMMA_INSTRUMENT"] = "true"
}),
).RunTestWithBp(t, `
java_sdk_library {
name: "foo",
srcs: ["A.java"],
}
`)
android.AssertBoolEquals(t, "stub module expected to depend on from-source stub",
true, CheckModuleHasDependency(t, result.TestContext,
apiScopePublic.stubsLibraryModuleName("foo"), "android_common",
apiScopePublic.sourceStubLibraryModuleName("foo")))
android.AssertBoolEquals(t, "stub module expected to not depend on from-text stub",
false, CheckModuleHasDependency(t, result.TestContext,
apiScopePublic.stubsLibraryModuleName("foo"), "android_common",
apiScopePublic.apiLibraryModuleName("foo")))
}