diff --git a/gradle-plugin/build.gradle.kts b/gradle-plugin/build.gradle.kts index 9ebf5e6..6e461b6 100644 --- a/gradle-plugin/build.gradle.kts +++ b/gradle-plugin/build.gradle.kts @@ -2,7 +2,6 @@ import com.vanniktech.maven.publish.SonatypeHost.Companion.S01 import org.jetbrains.kotlin.gradle.internal.ensureParentDirsCreated -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { alias(libs.plugins.kotlin.jvm) diff --git a/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/LightsaberPlugin.kt b/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/LightsaberPlugin.kt index ca42498..9969076 100644 --- a/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/LightsaberPlugin.kt +++ b/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/LightsaberPlugin.kt @@ -1,6 +1,5 @@ package schwarz.it.lightsaber.gradle -import com.android.build.gradle.BaseExtension import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.provider.Property @@ -56,7 +55,7 @@ private fun Project.apply() { } private fun Project.androidPluginApplied(): Boolean { - return extensions.findByType(BaseExtension::class.java) != null + return extensions.findByName("android") != null } internal fun Project.registerTask( diff --git a/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/Android.kt b/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/Android.kt index 5b22161..18179c2 100644 --- a/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/Android.kt +++ b/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/Android.kt @@ -21,9 +21,9 @@ fun Project.applyAndroidAnnotationProcessor(extension: LightsaberExtension) { androidComponents.onVariants { variant -> withDaggerCompiler { processor -> val lightsaberVariantCheck = when (processor) { - Processor.AnnotationProcessor -> registerAnnotationProcessorTask(extension, variant) - Processor.Kapt -> registerKaptTask(extension, variant) - Processor.Ksp -> registerKspTask(extension, variant) + Processor.AnnotationProcessor -> registerAnnotationProcessorTask(extension, variant.name) + Processor.Kapt -> registerKaptTask(extension, variant.name) + Processor.Ksp -> registerKspTask(extension, variant.name) } lightsaberVariantCheck.configure { diff --git a/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/AnnotationProcessor.kt b/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/AnnotationProcessor.kt index b34595e..eeaef2c 100644 --- a/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/AnnotationProcessor.kt +++ b/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/AnnotationProcessor.kt @@ -1,6 +1,5 @@ package schwarz.it.lightsaber.gradle.processors -import com.android.build.api.variant.Variant import org.gradle.api.Project import org.gradle.api.tasks.TaskProvider import org.gradle.api.tasks.compile.JavaCompile @@ -13,9 +12,9 @@ import schwarz.it.lightsaber.gradle.registerTask internal fun Project.registerAnnotationProcessorTask( extension: LightsaberExtension, - variant: Variant? = null, + variant: String? = null, ): TaskProvider { - val variantName = variant?.name?.capitalized() + val variantName = variant?.capitalized() val lightsaberCheck = registerTask(extension, variantName.orEmpty()) lightsaberCheck.configure { task -> val taskProvider = provider { diff --git a/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/Kapt.kt b/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/Kapt.kt index c5d724b..6e52a96 100644 --- a/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/Kapt.kt +++ b/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/Kapt.kt @@ -1,6 +1,5 @@ package schwarz.it.lightsaber.gradle.processors -import com.android.build.api.variant.Variant import org.gradle.api.Project import org.gradle.api.tasks.TaskProvider import org.jetbrains.kotlin.gradle.plugin.KaptExtension @@ -14,9 +13,9 @@ import schwarz.it.lightsaber.gradle.registerTask internal fun Project.registerKaptTask( extension: LightsaberExtension, - variant: Variant? = null, + variant: String? = null, ): TaskProvider { - val variantName = variant?.name?.capitalized() + val variantName = variant?.capitalized() val lightsaberCheck = registerTask(extension, variantName.orEmpty()) lightsaberCheck.configure { task -> val taskProvider = provider { diff --git a/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/Ksp.kt b/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/Ksp.kt index ade0994..e664cf4 100644 --- a/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/Ksp.kt +++ b/gradle-plugin/src/main/kotlin/schwarz/it/lightsaber/gradle/processors/Ksp.kt @@ -1,6 +1,5 @@ package schwarz.it.lightsaber.gradle.processors -import com.android.build.api.variant.Variant import com.google.devtools.ksp.gradle.KspExtension import com.google.devtools.ksp.gradle.KspTaskJvm import org.gradle.api.Project @@ -14,9 +13,9 @@ import schwarz.it.lightsaber.gradle.registerTask internal fun Project.registerKspTask( extension: LightsaberExtension, - variant: Variant? = null, + variant: String? = null, ): TaskProvider { - val variantName = variant?.name?.capitalized() + val variantName = variant?.capitalized() val lightsaberCheck = registerTask(extension, variantName.orEmpty()) lightsaberCheck.configure { task -> val taskProvider = provider {