From d649580f3d46b39f8837d668063f9b8ebde0474a Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 14 Jan 2025 15:50:48 -0800 Subject: Convert apex transition tag to dependency on apex When the apex mutator moves to using an info struct instead of a simple string it becomes difficult to add a dependency directly on the apex variation of a module, as that would require constructing a matching ApexInfo to locate it. Simplify adding the dependency by adding it on the apex instead, and then traversing from the apex to the desired module inside the apex. This causes a few changes in behaviors that require updating tests to match. When AlwaysUsePrebuiltSdks is set, the previous behavior was to use the fragment and its dependencies from the source module for the platform bootclasspath. Since the fragment is now found by traversing from the apex, and the prebuilt apex is preferred, the fragment from the prebuilt will now be found instead. prebuilt_bootclasspath lists fragments in apexes that it depends on. Previously it would depend on the apex variant of the fragment, which then allowed the fragment to be replaced by the variant from an override apex that set apex_name. Now it always depends on the original apex to find the fragment. Test: go test ./... Bug: 372543712 Change-Id: I1a92ff461d4706cf68a0b8b37e53dea412efb8bf --- java/bootclasspath_fragment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'java/bootclasspath_fragment.go') diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go index 4d35b9fa5..f3bff12f2 100644 --- a/java/bootclasspath_fragment.go +++ b/java/bootclasspath_fragment.go @@ -621,7 +621,7 @@ func (b *BootclasspathFragmentModule) configuredJars(ctx android.ModuleContext) if android.IsModulePrebuilt(ctx.Module()) { // prebuilt bcpf. the validation of this will be done at the top-level apex providerClasspathFragmentValidationInfoProvider(ctx, unknown) - } else if !disableSourceApexVariant(ctx) { + } else if !disableSourceApexVariant(ctx) && android.IsModulePreferred(ctx.Module()) { // source bcpf, and prebuilt apex are not selected. ctx.ModuleErrorf("%s in contents must also be declared in PRODUCT_APEX_BOOT_JARS", unknown) } -- cgit v1.2.3-59-g8ed1b