Migrate to Hilt KSP compiler (#3760)

* Migrate to Hilt KSP compiler

* Use generated code from AIDL

* Comment

* Revert "Use generated code from AIDL"

This reverts commit 64c3ecce84.

* Workaround for it
This commit is contained in:
Goooler
2023-11-24 19:38:29 +08:00
committed by GitHub
parent fa45d02526
commit 46fd9043fe
2 changed files with 14 additions and 4 deletions

View File

@@ -5,8 +5,6 @@ plugins {
id 'com.android.application' version "8.1.4"
id 'com.android.library' version "8.1.4" apply false
id 'org.jetbrains.kotlin.android' version "1.9.20"
// TODO: Remove this after Dagger/Hilt finished fully migration to KSP.
id 'org.jetbrains.kotlin.kapt' version "1.9.20" apply false
id 'org.jetbrains.kotlin.plugin.parcelize' version "1.9.20"
id 'org.jetbrains.kotlin.plugin.serialization' version "1.9.20"
id "com.google.devtools.ksp" version "1.9.20-1.0.14"

View File

@@ -1,7 +1,7 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.kapt'
id 'com.google.devtools.ksp'
}
android {
@@ -20,9 +20,21 @@ android {
addFrameworkJar('framework-13.jar')
compileOnlyCommonJars()
// Workaround for https://github.com/google/dagger/issues/4158
androidComponents {
onVariants(selector().all(), { variant ->
afterEvaluate {
def capName = variant.name.capitalize()
tasks.getByName("ksp${capName}Kotlin") {
setSource(tasks.getByName("compile${capName}Aidl").outputs)
}
}
})
}
dependencies {
implementation "com.google.dagger:hilt-android:$daggerVersion"
kapt "com.google.dagger:hilt-compiler:$daggerVersion"
ksp "com.google.dagger:hilt-compiler:$daggerVersion"
implementation "androidx.concurrent:concurrent-futures:1.1.0"
implementation "androidx.lifecycle:lifecycle-common:2.6.2"