summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-09-06 06:07:42 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-09-06 06:07:42 +0000
commitfae5ec8bbca887066716029a4923c110d819c958 (patch)
tree9ca819979f6141bab733c14445fe7b8083ed3744 /java
parent4301e29a02937b1ef1b50e7660ee33205bc33d9c (diff)
parent003452ff9c3b0dfe57be563d647c9a8dd76e0569 (diff)
Merge changes I505a7ad8,I92d88199 into main
* changes: Disable source apex variant using apex_available_name Skip `contents` validation of source bootclasspath fragments
Diffstat (limited to 'java')
-rw-r--r--java/bootclasspath_fragment.go6
-rw-r--r--java/dexpreopt.go11
2 files changed, 14 insertions, 3 deletions
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go
index bef3b58c8..fe4cc7685 100644
--- a/java/bootclasspath_fragment.go
+++ b/java/bootclasspath_fragment.go
@@ -463,6 +463,12 @@ func (b *BootclasspathFragmentModule) DepsMutator(ctx android.BottomUpMutatorCon
// Add a dependency onto the dex2oat tool which is needed for creating the boot image. The
// path is retrieved from the dependency by GetGlobalSoongConfig(ctx).
dexpreopt.RegisterToolDeps(ctx)
+
+ // Add a dependency to `all_apex_contributions` to determine if prebuilts are active.
+ // If prebuilts are active, `contents` validation on the source bootclasspath fragment should be disabled.
+ if _, isPrebuiltModule := ctx.Module().(*PrebuiltBootclasspathFragmentModule); !isPrebuiltModule {
+ ctx.AddDependency(b, android.AcDepTag, "all_apex_contributions")
+ }
}
func (b *BootclasspathFragmentModule) BootclasspathDepsMutator(ctx android.BottomUpMutatorContext) {
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 1c63e3f24..4734357ab 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -209,13 +209,18 @@ func disableSourceApexVariant(ctx android.BaseModuleContext) bool {
psi = prebuiltSelectionInfo
}
})
+
// Find the apex variant for this module
- var apexVariantsWithoutTestApexes []string
+ apexVariantsWithoutTestApexes := []string{}
if apexInfo.BaseApexName != "" {
// This is a transitive dependency of an override_apex
- apexVariantsWithoutTestApexes = []string{apexInfo.BaseApexName}
+ apexVariantsWithoutTestApexes = append(apexVariantsWithoutTestApexes, apexInfo.BaseApexName)
} else {
- _, apexVariantsWithoutTestApexes, _ = android.ListSetDifference(apexInfo.InApexVariants, apexInfo.TestApexes)
+ _, variants, _ := android.ListSetDifference(apexInfo.InApexVariants, apexInfo.TestApexes)
+ apexVariantsWithoutTestApexes = append(apexVariantsWithoutTestApexes, variants...)
+ }
+ if apexInfo.ApexAvailableName != "" {
+ apexVariantsWithoutTestApexes = append(apexVariantsWithoutTestApexes, apexInfo.ApexAvailableName)
}
disableSource := false
// find the selected apexes