• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 The Dagger Authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package dagger.hilt.android.plugin
17 
18 /** Configuration options for the Hilt Gradle Plugin */
19 interface HiltExtension {
20 
21   /**
22    * If set to `true`, Hilt will adjust the compile classpath such that it includes transitive
23    * dependencies, ignoring `api` or `implementation` boundaries during compilation. You should
24    * enable this option if your project has multiple level of transitive dependencies that contain
25    * injected classes or entry points.
26    *
27    * Enabling this option also requires android.lintOptions.checkReleaseBuilds to be set to 'false'
28    * if the Android Gradle Plugin version being used is less than 7.0.
29    *
30    * See https://github.com/google/dagger/issues/1991 for more context.
31    */
32   var enableExperimentalClasspathAggregation: Boolean
33 
34   /**
35    * If set to `true`, Hilt will register a transform task that will rewrite `@AndroidEntryPoint`
36    * annotated classes before the host-side JVM tests run. You should enable this option if you are
37    * running Robolectric UI tests as part of your JUnit tests.
38    *
39    * This flag is not necessary if when com.android.tools.build:gradle:4.2.0+ is used and will be
40    * deprecated in a future version.
41    */
42   var enableTransformForLocalTests: Boolean
43 
44   /**
45    * If set to `true`, Hilt will perform module and entry points aggregation in a task instead of an
46    * aggregating annotation processor. Enabling this flag improves incremental build times.
47    *
48    * When this flag is enabled, 'enableExperimentalClasspathAggregation' has no effect since
49    * classpath aggregation will be done by default.
50    */
51   var enableAggregatingTask: Boolean
52 
53   /**
54    * If set to `true`, Hilt will disable cross compilation root validation.
55    *
56    * See [documentation](https://dagger.dev/hilt/flags#disable-cross-compilation-root-validation)
57    * for more information.
58    */
59   var disableCrossCompilationRootValidation: Boolean
60 }
61 
62 internal open class HiltExtensionImpl : HiltExtension {
63   override var enableExperimentalClasspathAggregation: Boolean = false
64   override var enableTransformForLocalTests: Boolean = false
65   override var enableAggregatingTask: Boolean = true
66   override var disableCrossCompilationRootValidation: Boolean = false
67 }
68