Merge "jacoco libs dependency for instrumented libraries" am: 3dca115dda
am: 882253d037
am: 370f703987
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2201682 Change-Id: I7e90f0935b68456bc9749ec71c65e078fede4602 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -8846,6 +8846,16 @@ func TestApexJavaCoverage(t *testing.T) {
|
|||||||
android.FixtureMergeEnv(map[string]string{
|
android.FixtureMergeEnv(map[string]string{
|
||||||
"EMMA_INSTRUMENT": "true",
|
"EMMA_INSTRUMENT": "true",
|
||||||
}),
|
}),
|
||||||
|
// need to mock jacocoagent here to satisfy dependency added for
|
||||||
|
// instrumented libraries at build time
|
||||||
|
android.FixtureAddFile("jacocoagent/Android.bp", []byte(`
|
||||||
|
java_library {
|
||||||
|
name: "jacocoagent",
|
||||||
|
srcs: ["Test.java"],
|
||||||
|
system_modules: "none",
|
||||||
|
sdk_version: "none",
|
||||||
|
}
|
||||||
|
`)),
|
||||||
).RunTest(t)
|
).RunTest(t)
|
||||||
|
|
||||||
// Make sure jacoco ran on both mylib and mybootclasspathlib
|
// Make sure jacoco ran on both mylib and mybootclasspathlib
|
||||||
|
@@ -169,6 +169,8 @@ type CommonProperties struct {
|
|||||||
Output_params []string
|
Output_params []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If true, then jacocoagent is automatically added as a libs dependency so that
|
||||||
|
// r8 will not strip instrumentation classes out of dexed libraries.
|
||||||
Instrument bool `blueprint:"mutated"`
|
Instrument bool `blueprint:"mutated"`
|
||||||
// If true, then the module supports statically including the jacocoagent
|
// If true, then the module supports statically including the jacocoagent
|
||||||
// into the library.
|
// into the library.
|
||||||
@@ -787,6 +789,9 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
|
|||||||
} else if j.shouldInstrumentStatic(ctx) {
|
} else if j.shouldInstrumentStatic(ctx) {
|
||||||
ctx.AddVariationDependencies(nil, staticLibTag, "jacocoagent")
|
ctx.AddVariationDependencies(nil, staticLibTag, "jacocoagent")
|
||||||
}
|
}
|
||||||
|
if j.shouldInstrument(ctx) {
|
||||||
|
ctx.AddVariationDependencies(nil, libTag, "jacocoagent")
|
||||||
|
}
|
||||||
|
|
||||||
if j.useCompose() {
|
if j.useCompose() {
|
||||||
ctx.AddVariationDependencies(ctx.Config().BuildOSCommonTarget.Variations(), kotlinPluginTag,
|
ctx.AddVariationDependencies(ctx.Config().BuildOSCommonTarget.Variations(), kotlinPluginTag,
|
||||||
|
@@ -96,10 +96,22 @@ func TestBootclasspathFragmentInconsistentArtConfiguration_ApexMixture(t *testin
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestBootclasspathFragment_Coverage(t *testing.T) {
|
func TestBootclasspathFragment_Coverage(t *testing.T) {
|
||||||
prepareForTestWithFrameworkCoverage := android.FixtureMergeEnv(map[string]string{
|
prepareForTestWithFrameworkCoverage := android.GroupFixturePreparers(
|
||||||
"EMMA_INSTRUMENT": "true",
|
android.FixtureMergeEnv(map[string]string{
|
||||||
"EMMA_INSTRUMENT_FRAMEWORK": "true",
|
"EMMA_INSTRUMENT": "true",
|
||||||
})
|
"EMMA_INSTRUMENT_FRAMEWORK": "true",
|
||||||
|
}),
|
||||||
|
// need to mock jacocoagent here to satisfy dependency added for
|
||||||
|
// instrumented libraries at build time
|
||||||
|
android.FixtureAddFile("jacocoagent/Android.bp", []byte(`
|
||||||
|
java_library {
|
||||||
|
name: "jacocoagent",
|
||||||
|
srcs: ["Test.java"],
|
||||||
|
system_modules: "none",
|
||||||
|
sdk_version: "none",
|
||||||
|
}
|
||||||
|
`)),
|
||||||
|
)
|
||||||
|
|
||||||
prepareWithBp := android.FixtureWithRootAndroidBp(`
|
prepareWithBp := android.FixtureWithRootAndroidBp(`
|
||||||
bootclasspath_fragment {
|
bootclasspath_fragment {
|
||||||
|
Reference in New Issue
Block a user