diff options
| author | 2020-01-03 13:25:54 +0000 | |
|---|---|---|
| committer | 2020-01-06 16:52:56 +0000 | |
| commit | 4456188939ebadae8e38cc15c8f99bbbf1c989f8 (patch) | |
| tree | 89c326dfdb42ae5824e28d1ad3f8f724f3f3bc18 | |
| parent | 3afbc923dc0fd1e00f75e445787b65167e40900a (diff) | |
Include jacoco in the ART boot image if EMMA_INSTRUMENT_FRAMEWORK=true.
Test: aosp_walleye-userdebug boots.
Test: Coverage build boots:
$ lunch aosp_walleye-userdebug
$ cd $ANDROID_BUILD_TOP
$ build/soong/soong_ui.bash --make-mode droid \
SKIP_ABI_CHECKS=true \
TARGET_PRODUCT=aosp_walleye \
TARGET_BUILD_VARIANT=userdebug \
EMMA_INSTRUMENT=true \
NATIVE_COVERAGE=true
$ adb reboot bootloader && fastboot flashall -w
Test: Coverage build with framework coverage boots:
$ lunch aosp_walleye-userdebug
$ cd $ANDROID_BUILD_TOP
$ build/soong/soong_ui.bash --make-mode droid \
SKIP_ABI_CHECKS=true \
TARGET_PRODUCT=aosp_walleye \
TARGET_BUILD_VARIANT=userdebug \
EMMA_INSTRUMENT=true \
EMMA_INSTRUMENT_FRAMEWORK=true \
NATIVE_COVERAGE=true
$ adb reboot bootloader && fastboot flashall -w
Test: Static coverage build with framework coverage boots:
$ lunch aosp_walleye-userdebug
$ cd $ANDROID_BUILD_TOP
$ build/soong/soong_ui.bash --make-mode droid \
SKIP_ABI_CHECKS=true \
TARGET_PRODUCT=aosp_walleye \
TARGET_BUILD_VARIANT=userdebug \
EMMA_INSTRUMENT=true \
EMMA_INSTRUMENT_FRAMEWORK=true \
EMMA_INSTRUMENT_STATIC=true \
NATIVE_COVERAGE=true
$ adb reboot bootloader && fastboot flashall -w
Change-Id: Iaa198b8505aaff36e6685559642ff721637ce55f
| -rw-r--r-- | apex/apex.go | 6 | ||||
| -rw-r--r-- | java/dexpreopt_bootjars.go | 14 | ||||
| -rw-r--r-- | java/dexpreopt_config.go | 4 |
3 files changed, 13 insertions, 11 deletions
diff --git a/apex/apex.go b/apex/apex.go index b27b54e3e..55f67e78e 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -692,6 +692,12 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) { ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(), javaLibTag, a.properties.Java_libs...) + // With EMMA_INSTRUMENT_FRAMEWORK=true the ART boot image includes jacoco library. + if a.artApex && ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") { + ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(), + javaLibTag, "jacocoagent") + } + if String(a.properties.Key) == "" { ctx.ModuleErrorf("key is missing") return diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index 1d363c963..88e3bc2b3 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -178,12 +178,6 @@ func skipDexpreoptBootJars(ctx android.PathContext) bool { return false } -func skipDexpreoptArtBootJars(ctx android.BuilderContext) bool { - // with EMMA_INSTRUMENT_FRAMEWORK=true ART boot class path libraries have dependencies on framework, - // therefore dexpreopt ART libraries cannot be dexpreopted in isolation => no ART boot image - return ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") -} - type dexpreoptBootJars struct { defaultBootImage *bootImage otherImages []*bootImage @@ -193,7 +187,7 @@ type dexpreoptBootJars struct { // Accessor function for the apex package. Returns nil if dexpreopt is disabled. func DexpreoptedArtApexJars(ctx android.BuilderContext) map[android.ArchType]android.OutputPaths { - if skipDexpreoptBootJars(ctx) || skipDexpreoptArtBootJars(ctx) { + if skipDexpreoptBootJars(ctx) { return nil } return artBootImageConfig(ctx).imagesDeps @@ -222,10 +216,8 @@ func (d *dexpreoptBootJars) GenerateBuildActions(ctx android.SingletonContext) { // Always create the default boot image first, to get a unique profile rule for all images. d.defaultBootImage = buildBootImage(ctx, defaultBootImageConfig(ctx)) - if !skipDexpreoptArtBootJars(ctx) { - // Create boot image for the ART apex (build artifacts are accessed via the global boot image config). - d.otherImages = append(d.otherImages, buildBootImage(ctx, artBootImageConfig(ctx))) - } + // Create boot image for the ART apex (build artifacts are accessed via the global boot image config). + d.otherImages = append(d.otherImages, buildBootImage(ctx, artBootImageConfig(ctx))) if global.GenerateApexImage { // Create boot images for the JIT-zygote experiment. d.otherImages = append(d.otherImages, buildBootImage(ctx, apexBootImageConfig(ctx))) diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go index 91e0dfbdd..76bda612e 100644 --- a/java/dexpreopt_config.go +++ b/java/dexpreopt_config.go @@ -135,6 +135,10 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig { deviceDir := android.PathForOutput(ctx, ctx.Config().DeviceName()) artModules := global.ArtApexJars + // With EMMA_INSTRUMENT_FRAMEWORK=true the Core libraries depend on jacoco. + if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") { + artModules = append(artModules, "jacocoagent") + } frameworkModules := android.RemoveListFromList(global.BootJars, concat(artModules, getJarsFromApexJarPairs(global.UpdatableBootJars))) |