Merge "Disable from-text stub build for coverage build" into main am: 04803d4767
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2789434 Change-Id: I326b3fc11d21ca9e5e3834810ad54dff92668f40 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -2063,8 +2063,15 @@ func (c *config) ApiSurfacesDir(s ApiSurface, version string) string {
|
||||
version)
|
||||
}
|
||||
|
||||
func (c *config) JavaCoverageEnabled() bool {
|
||||
return c.IsEnvTrue("EMMA_INSTRUMENT") || c.IsEnvTrue("EMMA_INSTRUMENT_STATIC") || c.IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK")
|
||||
}
|
||||
|
||||
func (c *config) BuildFromTextStub() bool {
|
||||
return c.buildFromTextStub
|
||||
// TODO: b/302320354 - Remove the coverage build specific logic once the
|
||||
// robust solution for handling native properties in from-text stub build
|
||||
// is implemented.
|
||||
return c.buildFromTextStub && !c.JavaCoverageEnabled()
|
||||
}
|
||||
|
||||
func (c *config) SetBuildFromTextStub(b bool) {
|
||||
|
@@ -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")))
|
||||
}
|
||||
|
Reference in New Issue
Block a user