Repository navigation
fix: remove kotlin-kapt if not used - #47
Conversation
| '', | ||
| ); | ||
| } | ||
| if (!gradleFile.includes('kapt(') && !gradleFile.includes('kapt ')) { |
There was a problem hiding this comment.
Wondering if we should worry about false positives (like 'kapt ' only inside a comment), or false negatives (kaptTest or kaptAndroidTest). Maybe a regex would cover those scenarios?
Then again maybe other places in the migration here don't take care of those kind of scenarios, so maybe we're fine.
Let me know what you think.
There was a problem hiding this comment.
I've added a regex to also include kaptTest and kaptAndroidTest.
Also added a check to see if the plugin is being applied before trying to remove.
Didn't do anything about kapt inside a comment as it's not a common word, if you mean that could be a dependency but it's commented, I think it's still good that we error as it will only happen if they are applying the plugin, so they can check and remove the commented dependency manually and reply, they could also have the apply plugin commented, but same thing, it will error and they can remove the commented apply.
There was a problem hiding this comment.
Yeah your reasoning makes sense, false positives are okay in this scenario I'd say. Thanks for making the change!
There are several plugins applying kotlin-kapt plugin but not using it.
kotlin-kapt is not compatible with the built-in Gradle 9 Kotlin, so if not used (no kapt dependencies declared), remove it, if used throw an error since kotlin-kapt plugin would make the migration fail with an ugly gradle error later.