Hybrid mode fail without meaningful error message #71
-
Hi again, We're trying to prepare different Anvil setup to benchmark the build performance, including KSP-only mode and hybrid mode (mentioned in this blog post), but we couldn't get the hybrid mode working, it failed during KSP-only (everything is working fine) override fun apply(project: Project) {
project.apply(plugin = project.libs.plugins.ksp.get().pluginId)
project.dependencies {
ksp(project.libs.google.dagger.compiler)
}
} Hybrid override fun apply(project: Project) {
project.apply(plugin = project.libs.plugins.kotlin.kapt.get().pluginId)
project.dependencies {
kapt(project.libs.google.dagger.compiler)
}
project.extensions.configure<ApplicationAndroidComponentsExtension> {
onVariants(selector().all()) { variant ->
project.connectKspOutputsToKaptInputs(variant.name)
}
}
}
private fun Project.connectKspOutputsToKaptInputs(variantName: String) {
afterEvaluate {
val buildType = variantName.replaceFirstChar { it.titlecaseChar() }
val kspTaskName = "ksp${buildType}Kotlin"
val useKSP2 = providers.gradleProperty("ksp.useKSP2").getOrElse("false").toBoolean()
val generatedKspKotlinFiles =
if (useKSP2) {
val kspReleaseTask = tasks.named<KspAATask>(kspTaskName)
kspReleaseTask.flatMap { it.kspConfig.kotlinOutputDir }
} else {
val kspReleaseTask = tasks.named<KspTaskJvm>(kspTaskName)
kspReleaseTask.flatMap { it.destination }
}
tasks.named<KotlinCompile>("kaptGenerateStubs${buildType}Kotlin").configure {
source(generatedKspKotlinFiles)
}
}
} I understand that it's very vague without an error message, but we're stuck, we would appreciate if you have any guide or hunch where the issue could be, thank you! 🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Sorry but this isn't enough information to help. Error message or ideally a minimally reproducing project are needed to advise |
Beta Was this translation helpful? Give feedback.
We managed to figure out the issue, it's related to KAPT4, we've reverted to KAPT2 and the issue is gone. 🎉
google/dagger#4373