Merge "Instrument impl library belonging to apexes" into main am: b07e7fd542

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

Change-Id: I12d4e387702fa38a777195ca8f6db83aa5f51801
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2024-05-22 19:08:14 +00:00
committed by Automerger Merge Worker

View File

@@ -715,7 +715,12 @@ func (j *Module) shouldInstrumentInApex(ctx android.BaseModuleContext) bool {
// doesn't make sense) or framework libraries (e.g. libraries found in the InstrumentFrameworkModules list) unless EMMA_INSTRUMENT_FRAMEWORK is true.
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
isJacocoAgent := ctx.ModuleName() == "jacocoagent"
if j.DirectlyInAnyApex() && !isJacocoAgent && !apexInfo.IsForPlatform() {
isApexVariantSdkLibImplLib := j.SdkLibraryName() != nil &&
strings.HasSuffix(j.Name(), ".impl") &&
len(apexInfo.InApexVariants) > 0
if (j.DirectlyInAnyApex() || isApexVariantSdkLibImplLib) && !isJacocoAgent && !apexInfo.IsForPlatform() {
if !inList(ctx.ModuleName(), config.InstrumentFrameworkModules) {
return true
} else if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {