Migrate Hilt plugin to KSP (#274)

This commit is contained in:
Kirill Kamakin
2024-06-30 17:01:44 +02:00
committed by GitHub
parent b6c9ace18f
commit bfdf89ae1c
11 changed files with 27 additions and 39 deletions

View File

@@ -5,7 +5,6 @@ import java.util.Properties
plugins { plugins {
id("gq.kirmanak.mealient.application") id("gq.kirmanak.mealient.application")
id("kotlin-kapt")
id("dagger.hilt.android.plugin") id("dagger.hilt.android.plugin")
alias(libs.plugins.ksp) alias(libs.plugins.ksp)
id("gq.kirmanak.mealient.compose.app") id("gq.kirmanak.mealient.compose.app")
@@ -108,11 +107,11 @@ dependencies {
kover(project(":datastore")) kover(project(":datastore"))
kover(project(":datasource")) kover(project(":datasource"))
kapt(libs.google.dagger.hiltCompiler) ksp(libs.google.dagger.hiltCompiler)
kaptTest(libs.google.dagger.hiltAndroidCompiler) kspTest(libs.google.dagger.hiltAndroidCompiler)
kaptAndroidTest(libs.google.dagger.hiltAndroidCompiler) kspAndroidTest(libs.google.dagger.hiltAndroidCompiler)
testImplementation(project(":datasource_test")) testImplementation(project(":datasource_test"))
testImplementation(project(":database_test")) testImplementation(project(":database_test"))

View File

@@ -1,7 +1,7 @@
plugins { plugins {
id("gq.kirmanak.mealient.library") id("gq.kirmanak.mealient.library")
id("dagger.hilt.android.plugin") id("dagger.hilt.android.plugin")
id("kotlin-kapt") alias(libs.plugins.ksp)
} }
android { android {
@@ -10,7 +10,7 @@ android {
dependencies { dependencies {
implementation(libs.google.dagger.hiltAndroid) implementation(libs.google.dagger.hiltAndroid)
kapt(libs.google.dagger.hiltCompiler) ksp(libs.google.dagger.hiltCompiler)
testImplementation(libs.jetbrains.kotlinx.coroutinesTest) testImplementation(libs.jetbrains.kotlinx.coroutinesTest)
testImplementation(libs.androidx.test.junit) testImplementation(libs.androidx.test.junit)

View File

@@ -1,6 +1,5 @@
plugins { plugins {
id("gq.kirmanak.mealient.library") id("gq.kirmanak.mealient.library")
id("kotlin-kapt")
id("dagger.hilt.android.plugin") id("dagger.hilt.android.plugin")
alias(libs.plugins.ksp) alias(libs.plugins.ksp)
} }
@@ -15,8 +14,8 @@ dependencies {
testImplementation(project(":database_test")) testImplementation(project(":database_test"))
implementation(libs.google.dagger.hiltAndroid) implementation(libs.google.dagger.hiltAndroid)
kapt(libs.google.dagger.hiltCompiler) ksp(libs.google.dagger.hiltCompiler)
kaptTest(libs.google.dagger.hiltAndroidCompiler) kspTest(libs.google.dagger.hiltAndroidCompiler)
testImplementation(libs.google.dagger.hiltAndroidTesting) testImplementation(libs.google.dagger.hiltAndroidTesting)
implementation(libs.androidx.room.ktx) implementation(libs.androidx.room.ktx)

View File

@@ -1,8 +1,8 @@
plugins { plugins {
id("gq.kirmanak.mealient.library") id("gq.kirmanak.mealient.library")
id("kotlin-kapt")
id("dagger.hilt.android.plugin") id("dagger.hilt.android.plugin")
id("org.jetbrains.kotlin.plugin.serialization") id("org.jetbrains.kotlin.plugin.serialization")
alias(libs.plugins.ksp)
} }
android { android {
@@ -21,8 +21,8 @@ dependencies {
testImplementation(project(":testing")) testImplementation(project(":testing"))
implementation(libs.google.dagger.hiltAndroid) implementation(libs.google.dagger.hiltAndroid)
kapt(libs.google.dagger.hiltCompiler) ksp(libs.google.dagger.hiltCompiler)
kaptTest(libs.google.dagger.hiltAndroidCompiler) kspTest(libs.google.dagger.hiltAndroidCompiler)
testImplementation(libs.google.dagger.hiltAndroidTesting) testImplementation(libs.google.dagger.hiltAndroidTesting)
api(libs.jetbrains.kotlinx.datetime) api(libs.jetbrains.kotlinx.datetime)

View File

@@ -1,8 +1,8 @@
plugins { plugins {
id("gq.kirmanak.mealient.library") id("gq.kirmanak.mealient.library")
id("kotlin-kapt")
id("dagger.hilt.android.plugin") id("dagger.hilt.android.plugin")
alias(libs.plugins.protobuf) alias(libs.plugins.protobuf)
alias(libs.plugins.ksp)
} }
android { android {
@@ -20,8 +20,8 @@ dependencies {
implementation(libs.androidx.security.crypto) implementation(libs.androidx.security.crypto)
implementation(libs.google.dagger.hiltAndroid) implementation(libs.google.dagger.hiltAndroid)
kapt(libs.google.dagger.hiltCompiler) ksp(libs.google.dagger.hiltCompiler)
kaptTest(libs.google.dagger.hiltAndroidCompiler) kspTest(libs.google.dagger.hiltAndroidCompiler)
testImplementation(libs.google.dagger.hiltAndroidTesting) testImplementation(libs.google.dagger.hiltAndroidTesting)
implementation(libs.jetbrains.kotlinx.datetime) implementation(libs.jetbrains.kotlinx.datetime)
@@ -52,6 +52,6 @@ protobuf {
} }
} }
kapt { ksp {
correctErrorTypes = true allowSourcesFromOtherPlugins = true
} }

View File

@@ -4,7 +4,6 @@ plugins {
id("gq.kirmanak.mealient.library") id("gq.kirmanak.mealient.library")
alias(libs.plugins.ksp) alias(libs.plugins.ksp)
id("gq.kirmanak.mealient.compose") id("gq.kirmanak.mealient.compose")
id("kotlin-kapt")
id("dagger.hilt.android.plugin") id("dagger.hilt.android.plugin")
} }
@@ -30,9 +29,9 @@ dependencies {
implementation(libs.androidx.hilt.navigationCompose) implementation(libs.androidx.hilt.navigationCompose)
implementation(libs.jetbrains.kotlinx.coroutinesAndroid) implementation(libs.jetbrains.kotlinx.coroutinesAndroid)
kapt(libs.google.dagger.hiltCompiler) ksp(libs.google.dagger.hiltCompiler)
kaptTest(libs.google.dagger.hiltAndroidCompiler) kspTest(libs.google.dagger.hiltAndroidCompiler)
testImplementation(project(":testing")) testImplementation(project(":testing"))
testImplementation(libs.google.dagger.hiltAndroidTesting) testImplementation(libs.google.dagger.hiltAndroidTesting)
@@ -41,7 +40,3 @@ dependencies {
testImplementation(libs.google.truth) testImplementation(libs.google.truth)
testImplementation(libs.io.mockk) testImplementation(libs.io.mockk)
} }
kapt {
correctErrorTypes = true
}

View File

@@ -4,6 +4,5 @@ org.gradle.caching=true
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=false android.enableJetifier=false
kotlin.code.style=official kotlin.code.style=official
kapt.incremental.apt=true
android.nonTransitiveRClass=false android.nonTransitiveRClass=false
android.nonFinalResIds=false android.nonFinalResIds=false

View File

@@ -1,7 +1,7 @@
plugins { plugins {
id("gq.kirmanak.mealient.library") id("gq.kirmanak.mealient.library")
id("dagger.hilt.android.plugin") id("dagger.hilt.android.plugin")
id("kotlin-kapt") alias(libs.plugins.ksp)
} }
android { android {
@@ -12,5 +12,5 @@ dependencies {
implementation(project(":architecture")) implementation(project(":architecture"))
implementation(libs.google.dagger.hiltAndroid) implementation(libs.google.dagger.hiltAndroid)
kapt(libs.google.dagger.hiltCompiler) ksp(libs.google.dagger.hiltCompiler)
} }

View File

@@ -1,7 +1,7 @@
plugins { plugins {
id("gq.kirmanak.mealient.library") id("gq.kirmanak.mealient.library")
id("kotlin-kapt")
id("dagger.hilt.android.plugin") id("dagger.hilt.android.plugin")
alias(libs.plugins.ksp)
} }
android { android {
@@ -18,8 +18,8 @@ dependencies {
testImplementation(project(":testing")) testImplementation(project(":testing"))
implementation(libs.google.dagger.hiltAndroid) implementation(libs.google.dagger.hiltAndroid)
kapt(libs.google.dagger.hiltCompiler) ksp(libs.google.dagger.hiltCompiler)
kaptTest(libs.google.dagger.hiltAndroidCompiler) kspTest(libs.google.dagger.hiltAndroidCompiler)
testImplementation(libs.google.dagger.hiltAndroidTesting) testImplementation(libs.google.dagger.hiltAndroidTesting)
testImplementation(libs.androidx.test.junit) testImplementation(libs.androidx.test.junit)

View File

@@ -1,6 +1,6 @@
plugins { plugins {
id("gq.kirmanak.mealient.library") id("gq.kirmanak.mealient.library")
id("kotlin-kapt") alias(libs.plugins.ksp)
id("dagger.hilt.android.plugin") id("dagger.hilt.android.plugin")
} }
@@ -18,8 +18,8 @@ dependencies {
implementation(project(":architecture")) implementation(project(":architecture"))
implementation(libs.google.dagger.hiltAndroid) implementation(libs.google.dagger.hiltAndroid)
kapt(libs.google.dagger.hiltCompiler) ksp(libs.google.dagger.hiltCompiler)
kapt(libs.google.dagger.hiltAndroidCompiler) ksp(libs.google.dagger.hiltAndroidCompiler)
implementation(libs.google.dagger.hiltAndroidTesting) implementation(libs.google.dagger.hiltAndroidTesting)
implementation(libs.jetbrains.kotlinx.coroutinesAndroid) implementation(libs.jetbrains.kotlinx.coroutinesAndroid)
@@ -35,6 +35,3 @@ dependencies {
implementation(libs.robolectric) implementation(libs.robolectric)
} }
kapt {
correctErrorTypes = true
}

View File

@@ -2,7 +2,6 @@ plugins {
id("gq.kirmanak.mealient.library") id("gq.kirmanak.mealient.library")
alias(libs.plugins.ksp) alias(libs.plugins.ksp)
id("gq.kirmanak.mealient.compose") id("gq.kirmanak.mealient.compose")
id("kotlin-kapt")
id("dagger.hilt.android.plugin") id("dagger.hilt.android.plugin")
} }
@@ -14,8 +13,8 @@ dependencies {
implementation(project(":logging")) implementation(project(":logging"))
implementation(libs.google.dagger.hiltAndroid) implementation(libs.google.dagger.hiltAndroid)
kapt(libs.google.dagger.hiltCompiler) ksp(libs.google.dagger.hiltCompiler)
kaptTest(libs.google.dagger.hiltAndroidCompiler) kspTest(libs.google.dagger.hiltAndroidCompiler)
testImplementation(libs.google.dagger.hiltAndroidTesting) testImplementation(libs.google.dagger.hiltAndroidTesting)
implementation(libs.android.material.material) implementation(libs.android.material.material)