otormaigh / lazyotp-android

Apache License 2.0
2 stars 0 forks source link

KSP breaks Hilt + SqlDelight #452

Open otormaigh opened 8 months ago

otormaigh commented 8 months ago
e: [ksp] InjectProcessingStep was unable to process 'SmsProviderStore(error.NonExistentClass)' because 'error.NonExistentClass' could not be resolved.

Dependency trace:
=> element (CLASS): ie.otormaigh.lazyotp.data.SmsProviderStore
=> element (CONSTRUCTOR): SmsProviderStore(error.NonExistentClass)
=> type (EXECUTABLE constructor): (error.NonExistentClass)void
=> type (ERROR parameter type): error.NonExistentClass

If type 'error.NonExistentClass' is a generated type, check above for compilation errors that may have prevented the type from being generated. Otherwise, ensure that type 'error.NonExistentClass' is on your classpath.
e: [ksp] InjectProcessingStep was unable to process 'smsCodeProviderQueries' because 'error.NonExistentClass' could not be resolved.

See: https://github.com/google/dagger/issues/4158

otormaigh commented 8 months ago

Workaround is to add this to the bottom of the app/build.gradle.kts files:

androidComponents {
  onVariants(selector().all()) { variant ->
    afterEvaluate {
      val variantName = variant.name.capitalize()
      tasks.getByName<KotlinCompile>("ksp${variantName}Kotlin") {
        setSource(tasks.getByName("generate${variantName}LazyOtpDatabaseInterface").outputs)
      }
    }
  }
}