diff --git a/src/index.ts b/src/index.ts index 50dfe73..5bd07ed 100644 --- a/src/index.ts +++ b/src/index.ts @@ -586,6 +586,13 @@ async function updateBuildGradle( '', ); } + const kaptPlugin = `apply plugin: 'kotlin-kapt'`; + if (gradleFile.includes(kaptPlugin)) { + if (/\bkapt(?:Test|AndroidTest)?[ (]/.test(gradleFile)) { + throw 'kotlin-kapt is not compatible with Gradle 9 built-in Kotlin, migrate to KSP and run plugin-migration-v8-to-v9 again'; + } + gradleFile = gradleFile.replace(`${kaptPlugin}\n`, ''); + } gradleFile = gradleFile.replace(`apply plugin: 'org.jetbrains.kotlin.android'\n`, ''); gradleFile = gradleFile.replace(