How would I use dagger-reflect with a pure kotlin ...
# dagger
p
How would I use dagger-reflect with a pure kotlin module? For the android modules I have set a
Dev
build type where I use dagger reflect and the
Debug
and
Release
build types use the regular dagger.
w
You could check a Gradle property and set proper dependency, something like
Copy code
if (hasProperty("daggerReflect") {
  implementation daggerReflect
} else {
  implementation daggerRegular
}
and pass property during build
./gradlew app:assemble -PdaggerReflect
. You can also set this property from the AS configuration settings as default one, or set dagger-reflect as the default and not use it in the CI etc.
p
Thanks that worked 🙂
Hm but is there a way to check if the project that requests this is actually a release build? Because on release builds I don't want to use dagger reflect
w
If you want to guard against that I think the best you can use something like
project.gradle.taskGraph.whenReady
and check if you have any release tasks there
p
Hm it seems that in general kotlin-android and pure kotlin don't go well together because of the missing buildvariant concept