summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
authorMartin Stjernholm <mast@google.com>2021-05-13 02:38:35 +0100
committerMartin Stjernholm <mast@google.com>2021-05-20 17:36:02 +0100
commitcae43e1c1665f50c0fb6c0444f5b787637ad2d4b (patch)
tree67f1f7199f49756b460b14810b35859b2153c494 /java/java.go
parent244aebd4f87bd72bc876fa8cb05c813474cd8e7a (diff)
Don't fail if the target module is disabled in dex2oat tool
dependencies. dexpreopt.RegisterToolDeps runs late after prebuilt dependencies have been resolved, and there's special code in dex2oatPathFromDep to resolve the prebuilt from the source module. However, if the source module is disabled then the dependencies check in validateAndroidModule will complain, so we need to disable that check in this particular situation. Also add a comment to explain why dexpreopt.RegisterToolDeps needs to run so late. Cherry-picked from https://r.android.com/1711292. Test: m nothing Bug: 145934348 Bug: 172480615 Change-Id: Ibc673303d0336768fa23261a2068e91a08f46a30 Merged-In: Ibc673303d0336768fa23261a2068e91a08f46a30
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/java/java.go b/java/java.go
index 45eb69339..2bbb5b102 100644
--- a/java/java.go
+++ b/java/java.go
@@ -57,6 +57,10 @@ func registerJavaBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("java_host_for_device", HostForDeviceFactory)
ctx.RegisterModuleType("dex_import", DexImportFactory)
+ // This mutator registers dependencies on dex2oat for modules that should be
+ // dexpreopted. This is done late when the final variants have been
+ // established, to not get the dependencies split into the wrong variants and
+ // to support the checks in dexpreoptDisabled().
ctx.FinalDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("dexpreopt_tool_deps", dexpreoptToolDepsMutator).Parallel()
})