@@ -135,8 +135,8 @@ class HiltGradlePlugin @Inject constructor(private val providers: ProviderFactor
135135 androidExtension.onRootVariants { variant, testedVariant ->
136136 if (! isExperimentalClasspathAggregationEnabled()) {
137137 // Option is not enabled, don't configure compile classpath. Note that the option can't be
138- // checked earlier (before iterating over the variants) since it would have been too early for
139- // the value to be populated from the build file.
138+ // checked earlier (before iterating over the variants) since it would have been too early
139+ // for the value to be populated from the build file.
140140 return @onRootVariants
141141 }
142142
@@ -193,16 +193,15 @@ class HiltGradlePlugin @Inject constructor(private val providers: ProviderFactor
193193 // javac/kotlinc compile tasks and R.jar dependencies, and tested classes if the variant is
194194 // androidTest. Note: These configurations should be filtered using
195195 // getHiltTransformedDependencies to only include what Hilt needs in the classpath.
196- val configurations =
197- buildList {
198- testedVariant?.let {
199- add(it.runtimeConfiguration)
200- add(it.compileConfiguration)
201- }
202- add(variant.runtimeConfiguration)
203- add(variant.compileConfiguration)
204- add(createHiltCompileOnlyConfiguration(variant, testedVariant))
196+ val configurations = buildList {
197+ testedVariant?.let {
198+ add(it.runtimeConfiguration)
199+ add(it.compileConfiguration)
205200 }
201+ add(variant.runtimeConfiguration)
202+ add(variant.compileConfiguration)
203+ add(createHiltCompileOnlyConfiguration(variant, testedVariant))
204+ }
206205
207206 val aggregatingTask =
208207 configureAggregateDepsTask(
@@ -211,7 +210,7 @@ class HiltGradlePlugin @Inject constructor(private val providers: ProviderFactor
211210 classpath =
212211 project.files(
213212 getHiltTransformedDependencies(configurations, AGGREGATED_HILT_ARTIFACT_TYPE_VALUE )
214- )
213+ ),
215214 )
216215
217216 val javaCompileTask =
@@ -234,13 +233,11 @@ class HiltGradlePlugin @Inject constructor(private val providers: ProviderFactor
234233
235234 private fun HiltPluginEnvironment.createHiltCompileOnlyConfiguration (
236235 variant : Component ,
237- testedVariant : Component ?
236+ testedVariant : Component ? ,
238237 ): Configuration {
239238 val hiltSyncTask =
240- project.tasks.register(
241- " hiltSync${variant.name.capitalize()} " ,
242- HiltSyncTask ::class .java
243- ) { task ->
239+ project.tasks.register(" hiltSync${variant.name.capitalize()} " , HiltSyncTask ::class .java) {
240+ task ->
244241 task.duplicatesStrategy = DuplicatesStrategy .EXCLUDE
245242 task.from(task.classesJars)
246243 task.from(task.classesDirectories)
@@ -255,16 +252,17 @@ class HiltGradlePlugin @Inject constructor(private val providers: ProviderFactor
255252 .toGet(
256253 type = ScopedArtifact .POST_COMPILATION_CLASSES ,
257254 inputJars = HiltSyncTask ::classesJars,
258- inputDirectories = HiltSyncTask ::classesDirectories
255+ inputDirectories = HiltSyncTask ::classesDirectories,
259256 )
260257
261- testedVariant?.artifacts
258+ testedVariant
259+ ?.artifacts
262260 ?.forScope(ScopedArtifacts .Scope .PROJECT )
263261 ?.use(hiltSyncTask)
264262 ?.toGet(
265263 type = ScopedArtifact .CLASSES ,
266264 inputJars = HiltSyncTask ::testedClassesJars,
267- inputDirectories = HiltSyncTask ::testedClassesDirectories
265+ inputDirectories = HiltSyncTask ::testedClassesDirectories,
268266 )
269267
270268 return project.configurations.create(" hiltCompileOnly${variant.name.capitalize()} " ).apply {
@@ -274,9 +272,7 @@ class HiltGradlePlugin @Inject constructor(private val providers: ProviderFactor
274272
275273 // Add the current variant's JavaCompile output to the configuration. This includes the
276274 // compiled classes from any Java/Kotlin sources (including those generated by KAPT/KSP).
277- project.dependencies.apply {
278- add(name, project.files(hiltSyncTask.map { it.outputs.files }))
279- }
275+ project.dependencies.apply { add(name, project.files(hiltSyncTask.map { it.outputs.files })) }
280276 }
281277 }
282278
@@ -319,7 +315,9 @@ class HiltGradlePlugin @Inject constructor(private val providers: ProviderFactor
319315 if (commonExtension.compileOptions.isJava9Compatible()) {
320316 compileTask.classpath = classpath.plus(mainBootstrapClasspath)
321317 // Copies argument providers from original task, which should contain the JdkImageInput
322- variant.javaCompilation?.annotationProcessor?.argumentProviders
318+ variant.javaCompilation
319+ ?.annotationProcessor
320+ ?.argumentProviders
323321 ?.filter { it is HiltCommandLineArgumentProvider || it is JdkImageInput }
324322 ?.forEach { compileTask.options.compilerArgumentProviders.add(it) }
325323 compileTask.options.compilerArgs.add(" -XDstringConcat=inline" )
@@ -348,7 +346,7 @@ class HiltGradlePlugin @Inject constructor(private val providers: ProviderFactor
348346 }
349347
350348 private fun HiltPluginEnvironment.configureHiltAnnotationProcessorConfiguration (
351- variant : Component ,
349+ variant : Component
352350 ): Configuration {
353351 val configName = " hiltAnnotationProcessor${variant.name.capitalize()} "
354352 return project.configurations.create(configName).apply {
@@ -392,7 +390,7 @@ class HiltGradlePlugin @Inject constructor(private val providers: ProviderFactor
392390 forKsp = task.isKspTask(),
393391 projectType = projectType,
394392 enableAggregatingTask = isAggregatingTaskEnabled(),
395- disableCrossCompilationRootValidation = ! isCrossCompilationRootValidationEnabled()
393+ disableCrossCompilationRootValidation = ! isCrossCompilationRootValidationEnabled(),
396394 )
397395 }
398396 addJavaTaskProcessorOptions(project, variant, argsProducer)
@@ -425,7 +423,7 @@ class HiltGradlePlugin @Inject constructor(private val providers: ProviderFactor
425423 }
426424 if (
427425 ! dependencies.contains(LIBRARY_GROUP to " hilt-android-compiler" ) &&
428- ! dependencies.contains(LIBRARY_GROUP to " hilt-compiler" )
426+ ! dependencies.contains(LIBRARY_GROUP to " hilt-compiler" )
429427 ) {
430428 error(getMissingDepMsg(" $LIBRARY_GROUP :hilt-compiler" ))
431429 }
@@ -478,7 +476,7 @@ class HiltGradlePlugin @Inject constructor(private val providers: ProviderFactor
478476
479477private class HiltPluginEnvironment (
480478 val project : Project ,
481- private val hiltExtension : HiltExtension
479+ private val hiltExtension : HiltExtension ,
482480) {
483481 val androidExtension =
484482 project.extensions.findByType(AndroidComponentsExtension ::class .java)?.also {
0 commit comments