Merge "Move coverage builds prebuilt special case to make" into main
This commit is contained in:
@@ -15,8 +15,6 @@
|
|||||||
package android
|
package android
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
)
|
)
|
||||||
@@ -115,15 +113,6 @@ func (a *allApexContributions) DepsMutator(ctx BottomUpMutatorContext) {
|
|||||||
func (a *allApexContributions) SetPrebuiltSelectionInfoProvider(ctx BaseModuleContext) {
|
func (a *allApexContributions) SetPrebuiltSelectionInfoProvider(ctx BaseModuleContext) {
|
||||||
addContentsToProvider := func(p *PrebuiltSelectionInfoMap, m *apexContributions) {
|
addContentsToProvider := func(p *PrebuiltSelectionInfoMap, m *apexContributions) {
|
||||||
for _, content := range m.Contents() {
|
for _, content := range m.Contents() {
|
||||||
// Coverage builds for TARGET_RELEASE=foo should always build from source,
|
|
||||||
// even if TARGET_RELEASE=foo uses prebuilt mainline modules.
|
|
||||||
// This is necessary because the checked-in prebuilts were generated with
|
|
||||||
// instrumentation turned off.
|
|
||||||
//
|
|
||||||
// Skip any prebuilt contents in coverage builds
|
|
||||||
if strings.HasPrefix(content, "prebuilt_") && (ctx.Config().JavaCoverageEnabled() || ctx.DeviceConfig().NativeCoverageEnabled()) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if !ctx.OtherModuleExists(content) && !ctx.Config().AllowMissingDependencies() {
|
if !ctx.OtherModuleExists(content) && !ctx.Config().AllowMissingDependencies() {
|
||||||
ctx.ModuleErrorf("%s listed in apex_contributions %s does not exist\n", content, m.Name())
|
ctx.ModuleErrorf("%s listed in apex_contributions %s does not exist\n", content, m.Name())
|
||||||
}
|
}
|
||||||
|
@@ -610,45 +610,3 @@ func TestPrebuiltErrorCannotListBothSourceAndPrebuiltInContributions(t *testing.
|
|||||||
}
|
}
|
||||||
`, selectMainlineModuleContritbutions)
|
`, selectMainlineModuleContritbutions)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that apex_contributions of prebuilt modules are ignored in coverage builds
|
|
||||||
func TestSourceIsSelectedInCoverageBuilds(t *testing.T) {
|
|
||||||
prebuiltMainlineContributions := GroupFixturePreparers(
|
|
||||||
FixtureModifyProductVariables(func(variables FixtureProductVariables) {
|
|
||||||
variables.BuildFlags = map[string]string{
|
|
||||||
"RELEASE_APEX_CONTRIBUTIONS_ADSERVICES": "my_prebuilt_apex_contributions",
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
FixtureMergeEnv(map[string]string{
|
|
||||||
"EMMA_INSTRUMENT_FRAMEWORK": "true",
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
bp := `
|
|
||||||
source {
|
|
||||||
name: "foo",
|
|
||||||
}
|
|
||||||
prebuilt {
|
|
||||||
name: "foo",
|
|
||||||
srcs: ["prebuilt_file"],
|
|
||||||
}
|
|
||||||
apex_contributions {
|
|
||||||
name: "my_prebuilt_apex_contributions",
|
|
||||||
api_domain: "my_mainline_module",
|
|
||||||
contents: [
|
|
||||||
"prebuilt_foo",
|
|
||||||
],
|
|
||||||
}
|
|
||||||
all_apex_contributions {
|
|
||||||
name: "all_apex_contributions",
|
|
||||||
}
|
|
||||||
`
|
|
||||||
ctx := GroupFixturePreparers(
|
|
||||||
PrepareForTestWithArchMutator,
|
|
||||||
PrepareForTestWithPrebuilts,
|
|
||||||
FixtureRegisterWithContext(registerTestPrebuiltModules),
|
|
||||||
prebuiltMainlineContributions).RunTestWithBp(t, bp)
|
|
||||||
source := ctx.ModuleForTests("foo", "android_common").Module()
|
|
||||||
AssertBoolEquals(t, "Source should be preferred in coverage builds", true, !source.IsHideFromMake())
|
|
||||||
prebuilt := ctx.ModuleForTests("prebuilt_foo", "android_common").Module()
|
|
||||||
AssertBoolEquals(t, "Prebuilt should not be preferred in coverage builds", false, !prebuilt.IsHideFromMake())
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user