From 7d9e69f9bea213309ed2ff0a9b379a072bbcc86e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3bert=20Papp?= Date: Mon, 17 Jun 2024 10:16:59 +0100 Subject: [PATCH] Move Hilt from KAPT to KSP (#434) --- android/build.gradle | 2 -- android/data/build.gradle | 1 - android/data/svg/build.gradle | 1 - .../inventory/build/hilt.gradle.kts | 32 +++++-------------- 4 files changed, 8 insertions(+), 28 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 28a3e238..6ab6c9d4 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -3,7 +3,6 @@ plugins { id("net.twisterrob.inventory.mapping") id("net.twisterrob.inventory.upgradeTest") id("net.twisterrob.inventory.build.tests.instrumentation") - id("com.google.devtools.ksp") } dependencies { @@ -35,7 +34,6 @@ dependencies { implementation(libs.androidx.swiperefreshlayout) implementation(libs.androidx.webkit) implementation(libs.slf4j.api) - annotationProcessor(libs.dagger.hilt.apt) ksp(libs.glide.ksp) // Class.forName("org.apache.xml.serializer.Version").getDeclaredMethod("main", String[].class) diff --git a/android/data/build.gradle b/android/data/build.gradle index 1b07b389..bd0af961 100644 --- a/android/data/build.gradle +++ b/android/data/build.gradle @@ -1,6 +1,5 @@ plugins { id("net.twisterrob.inventory.android.module") - id("com.google.devtools.ksp") } dependencies { diff --git a/android/data/svg/build.gradle b/android/data/svg/build.gradle index 29231029..87ec9e52 100644 --- a/android/data/svg/build.gradle +++ b/android/data/svg/build.gradle @@ -1,6 +1,5 @@ plugins { id("net.twisterrob.inventory.android.app") - id("com.google.devtools.ksp") } dependencies { diff --git a/gradle/plugins-inventory/src/main/kotlin/net/twisterrob/inventory/build/hilt.gradle.kts b/gradle/plugins-inventory/src/main/kotlin/net/twisterrob/inventory/build/hilt.gradle.kts index 6c65038f..4c50d5c1 100644 --- a/gradle/plugins-inventory/src/main/kotlin/net/twisterrob/inventory/build/hilt.gradle.kts +++ b/gradle/plugins-inventory/src/main/kotlin/net/twisterrob/inventory/build/hilt.gradle.kts @@ -12,13 +12,17 @@ plugins { id("org.gradle.java-base") id("com.google.dagger.hilt.android") id("org.jetbrains.kotlin.android") - id("org.jetbrains.kotlin.kapt") id("org.gradle.idea") } +plugins.withId("com.android.base") { + // REPORT ordering matters, this has to be after AGP. + plugins.apply("com.google.devtools.ksp") +} + dependencies { "implementation"(libs.dagger.hilt) - "kapt"(libs.dagger.hilt.apt) + "ksp"(libs.dagger.hilt.apt) } tasks.withType().configureEach javac@{ @@ -41,28 +45,8 @@ hilt { // disableCrossCompilationRootValidation = false // default (2.46.1): false } -//val daggerFlags = mapOf( -// "dagger.experimentalDaggerErrorMessages" to "disabled", -//) -// -//android { -// defaultConfig { -// javaCompileOptions { -// annotationProcessorOptions { -// daggerFlags.forEach { (key, value) -> -// argument(key, value) -// } -// } -// } -// } -//} -// -//kapt { -// arguments { -// daggerFlags.forEach { (key, value) -> -// arg(key, value) -// } -// } +//ksp { +// arg("dagger.experimentalDaggerErrorMessages" to "disabled") //} androidComponents.onVariants { variant ->