Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the workaround to disable precise Java tracking. #673

Merged
merged 1 commit into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.