Skip to content

Commit

Permalink
Remove the workaround to disable precise Java tracking. It's not need…
Browse files Browse the repository at this point in the history
…ed anymore with Kotlin 1.8.

Fixes #670
  • Loading branch information
vRallev committed Jan 9, 2023
1 parent f484141 commit dad6b3a
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 105 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

### Changed

- The [issue](https://youtrack.jetbrains.com/issue/KT-38576) that required disabling precise Java tracking is not needed anymore. The workaround has been removed.

### Deprecated

### Removed
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,7 @@ There is a bug that affects the Anvil Kotlin compiler plugin:

The Gradle plugin implements a workaround for this bug, so you shouldn't notice it. Side effects
are that incremental Kotlin compilation is disabled for stub generating tasks (which don't run a
full compilation before KAPT anyways). The flag `usePreciseJavaTracking` is disabled, if the
module contains Java code.
full compilation before KAPT anyways).

## Hilt

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ internal open class AnvilPlugin : KotlinCompilerPluginSupportPlugin {
.extendsFrom(getConfiguration(project, variant.name))

disableIncrementalKotlinCompilation(variant)
disablePreciseJavaTracking(variant)

if (!variant.variantFilter.generateDaggerFactoriesOnly) {
disableCorrectErrorTypes(variant)
Expand Down Expand Up @@ -185,35 +184,6 @@ internal open class AnvilPlugin : KotlinCompilerPluginSupportPlugin {
version = VERSION
)

private fun disablePreciseJavaTracking(variant: Variant) {
val configureAction: (KotlinCompile) -> Unit = { compileTask ->
val result = CheckMixedSourceSet.preparePreciseJavaTrackingCheck(variant)

compileTask.doFirstCompat {
// Disable precise java tracking if needed. Note that the doFirst() action only runs
// if the task is not up to date. That's ideal, because if nothing needs to be
// compiled, then we don't need to disable the flag.
//
// We also use the doFirst block to walk through the file system at execution time
// and minimize the IO at configuration time.
CheckMixedSourceSet.disablePreciseJavaTrackingIfNeeded(compileTask, result)

compileTask.log(
"Anvil: Use precise java tracking: ${compileTask.usePreciseJavaTracking}"
)
}
}

variant.compileTaskProvider.configure(configureAction)

variant.project.pluginManager.withPlugin(KAPT_PLUGIN_ID) {
variant.project
.namedLazy<KaptGenerateStubsTask>(variant.stubsTaskName) { stubsTaskProvider ->
stubsTaskProvider.configure(configureAction)
}
}
}

private fun disableCorrectErrorTypes(variant: Variant) {
variant.project.pluginManager.withPlugin(KAPT_PLUGIN_ID) {
// This needs to be disabled, otherwise compiler plugins fail in weird ways when
Expand Down

This file was deleted.

0 comments on commit dad6b3a

Please sign in to comment.