From 194ec84f16f428f0d7a7870cc5e1b3d1f9c2e2a3 Mon Sep 17 00:00:00 2001 From: Brad Corso Date: Mon, 26 Apr 2021 17:08:32 -0700 Subject: [PATCH] Add flag to disable cross-compilation root validation. Fixes #2577 RELNOTES=Fixes #2577: Add flag to disable cross-compilation root validation. PiperOrigin-RevId: 370573954 --- hilt/compiler-options.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hilt/compiler-options.md b/hilt/compiler-options.md index a57229cd753..d20d558dc9e 100644 --- a/hilt/compiler-options.md +++ b/hilt/compiler-options.md @@ -56,3 +56,18 @@ option. Because the shared components must include entry points from every test class, explicit `@EntryPoint` methods may not clash. Test `@EntryPoint` methods must either be uniquely named across test classes, or must return the same type. + +## Turning off the cross compilation root validation {#disable-cross-compilation-root-validation} + +By default, Hilt checks that: + + * If there are `@HiltAndroidTest` or `@HiltAndroidApp` usages in the current + compilation unit, then there cannot be `@HiltAndroidTest` usages in any + previous compilation units. + * If there are `@HiltAndroidApp` usages in the current compilation unit, then + there cannot be `@HiltAndroidApp` usages in any previous compilation units. + +This check can sometimes be overly broad though, especially if in the middle of +a migration. To turn off this check, this flag can be used: + +`-Adagger.hilt.disableCrossCompilationRootValidation=true`.