Remove TestApexes from ApexInfo
TestApexes is used to enforce the "Stub libraries should have a single
apex_available" check, but requires propagating information from
multiple apexes in order to filter out the test apexes. Instead,
all test apexes used by stub libraries will set apex_available_name
to masquerade as their non-test counterpart for apex_available
checks.
Bug: 383592644
Test: TestStubLibrariesMultipleApexViolation
Change-Id: I57dcf1e6fabbe70f40d702490b93fc7f28d6eba2
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 5928446..44ba80a 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -211,20 +211,19 @@
})
// Find the apex variant for this module
- apexVariantsWithoutTestApexes := []string{}
+ apexVariants := []string{}
if apexInfo.BaseApexName != "" {
// This is a transitive dependency of an override_apex
- apexVariantsWithoutTestApexes = append(apexVariantsWithoutTestApexes, apexInfo.BaseApexName)
+ apexVariants = append(apexVariants, apexInfo.BaseApexName)
} else {
- _, variants, _ := android.ListSetDifference(apexInfo.InApexVariants, apexInfo.TestApexes)
- apexVariantsWithoutTestApexes = append(apexVariantsWithoutTestApexes, variants...)
+ apexVariants = append(apexVariants, apexInfo.InApexVariants...)
}
if apexInfo.ApexAvailableName != "" {
- apexVariantsWithoutTestApexes = append(apexVariantsWithoutTestApexes, apexInfo.ApexAvailableName)
+ apexVariants = append(apexVariants, apexInfo.ApexAvailableName)
}
disableSource := false
// find the selected apexes
- for _, apexVariant := range apexVariantsWithoutTestApexes {
+ for _, apexVariant := range apexVariants {
if len(psi.GetSelectedModulesForApiDomain(apexVariant)) > 0 {
// If the apex_contribution for this api domain is non-empty, disable the source variant
disableSource = true