Skip to content

Commit

Permalink
Merge pull request #673 from square/ralf/precise-java-tracking
Browse files Browse the repository at this point in the history
Remove the workaround to disable precise Java tracking.
  • Loading branch information
JoelWilcox authored Jan 10, 2023
2 parents 4b925f7 + dad6b3a commit 1c2b9e8
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 1c2b9e8

Please sign in to comment.