Merge "Propagate DirectlyInAnyApex to transitive dependencies" into main am: d02bd377da am: d6638ef5e9

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

Change-Id: I2fa7154d8e24ce8db740b83dbd35fa73d02e70a3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jihoon Kang
2024-05-24 01:17:03 +00:00
committed by Automerger Merge Worker
3 changed files with 19 additions and 12 deletions

View File

@@ -716,11 +716,7 @@ func (j *Module) shouldInstrumentInApex(ctx android.BaseModuleContext) bool {
apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
isJacocoAgent := ctx.ModuleName() == "jacocoagent"
isApexVariantSdkLibImplLib := j.SdkLibraryName() != nil &&
strings.HasSuffix(j.Name(), ".impl") &&
len(apexInfo.InApexVariants) > 0
if (j.DirectlyInAnyApex() || isApexVariantSdkLibImplLib) && !isJacocoAgent && !apexInfo.IsForPlatform() {
if j.DirectlyInAnyApex() && !isJacocoAgent && !apexInfo.IsForPlatform() {
if !inList(ctx.ModuleName(), config.InstrumentFrameworkModules) {
return true
} else if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {

View File

@@ -1506,6 +1506,12 @@ var implLibraryTag = sdkLibraryComponentTag{name: "impl-library"}
var _ android.InstallNeededDependencyTag = sdkLibraryComponentTag{}
// To satisfy the CopyDirectlyInAnyApexTag interface. Implementation library of the sdk library
// in an apex is considered to be directly in the apex, as if it was listed in java_libs.
func (t sdkLibraryComponentTag) CopyDirectlyInAnyApex() {}
var _ android.CopyDirectlyInAnyApexTag = implLibraryTag
func (t sdkLibraryComponentTag) InstallDepNeeded() bool {
return t.name == "xml-permissions-file" || t.name == "impl-library"
}