Skip to content

fix: remove kotlin-kapt if not used - #47

Merged
jcesarmobile merged 2 commits into
mainfrom
KSP
Nov 13, 2026
Merged

jcesarmobile merged 2 commits into
mainfrom
KSP

Conversation

@jcesarmobile

Copy link
Copy Markdown
Member

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.

Comment thread src/index.ts Outdated
'',
);
}
if (!gradleFile.includes('kapt(') && !gradleFile.includes('kapt ')) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah your reasoning makes sense, false positives are okay in this scenario I'd say. Thanks for making the change!

@jcesarmobile
jcesarmobile merged commit 346e804 into main Nov 13, 2026
1 check passed
@jcesarmobile
jcesarmobile deleted the KSP branch November 13, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants