summaryrefslogtreecommitdiff
path: root/apex/apex.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2024-12-20 16:32:37 -0800
committer Colin Cross <ccross@android.com> 2025-02-07 16:00:56 -0800
commitd8d8b85c5666b3ded986f1b5c64df31dea5076ee (patch)
treef088754b04d70b6a28f3c727b58c370c989cfadc /apex/apex.go
parent22558312b9c07ddda22fcd00d6a84aa0f73f4d10 (diff)
Move prebuilt mutators earlier
Move the prebuilt mutators from postdeps to predeps mutators. This ensures that the decisions on whether the source or prebuilt will be used can be made earlier, which simplifies the apex and dexpreopt code, allowing it to directly depend on the correct module. This requires some mutators that previously ran before the prebuilt mutator and now run after the prebuilt mutator be aware of prebuilts. In particular, the cc.linkageTransitionMutator and rust.libraryTransitionMutator now have to manually disable prebuilts when they don't produce a static or shared variant that the source module produces, and some mutators have to ignore PrebuiltDepTag dependencies when propagating transitions. The apexTransitionMutator also needs to temporarily use an interface on the dependency tag to correctly resolve some dependencies that exist before the apex variation is created onto the correct variation. This will shortly be replaced with depending on the apex itself instead, and then walking the dependencies of the apex to find the necessary module. Bug: 372543712 Test: go test ./... Change-Id: If125ea981be87673bae3bd0a7e3b2c16c337e8f7
Diffstat (limited to 'apex/apex.go')
-rw-r--r--apex/apex.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/apex/apex.go b/apex/apex.go
index fa796e534..bbcc4cc58 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1193,6 +1193,13 @@ func markPlatformAvailability(mctx android.BottomUpMutatorContext) {
}
}
+type apexTransitionTag interface {
+ // ApexTransition is a temporary interface used to tag dependencies with the apex variation they should use
+ // when the dependency is added before the apex transition mutator has run. These will be replaced with
+ // dependencies on the apex instead, which will then be used to find the necessary module inside the apex.
+ ApexTransition() string
+}
+
type apexTransitionMutator struct{}
func (a *apexTransitionMutator) Split(ctx android.BaseModuleContext) []string {
@@ -1207,6 +1214,9 @@ func (a *apexTransitionMutator) Split(ctx android.BaseModuleContext) []string {
}
func (a *apexTransitionMutator) OutgoingTransition(ctx android.OutgoingTransitionContext, sourceVariation string) string {
+ if tag, ok := ctx.DepTag().(apexTransitionTag); ok {
+ return tag.ApexTransition()
+ }
return sourceVariation
}