<@U0B854PM2> yep currently the detekt does not car...
# detekt
a
@seb yep currently the detekt does not care about sourcesets and just parses from
project.projectDir
. In the rework I will make the gradle plugin sourceset aware ^^
t
@Artur Bosch have you considered how this will impact the support for Android projects? the project model differs quite a bit because of how variants and sourcesets work.
also: would you be open to write the plugin in Groovy (to take advantage of its dynamic language features)?
a
I'm aware that android needs special treatment. The dsl is ready and was not hard, but the whole sourceSet and task creation is way above my knownledge. Just now I'm experimenting with the gradle classes: CodeQualityPlugin, CodeQualityExtension and SourceTask. Pmd etc are implemented that way. I don't gt the results I want and some sort of groovy magic is still missing to make it work ....
groovy is ok for me, do you have experience writing plugins that are sourceset aware?
t
I’m keen to help, as I have collected quite some knowledge writing few Gradle plugin in Groovy
a
thanks I will take a look, I also found https://github.com/JLLeitschuh/ktlint-gradle, they are also generating tasks for each sourceset for kotlin 😮
t
yeah, we’re planning to add KTlint support in our plugin soon
and I gave a look at that, looks cool too
the thing I would avoid is making your plugin to depend on the Android Gradle Plugin
that’s where groovy can help a little
a
does the ktlint plugin depend on it?
a
hm
there is no way to extract android source sets without the dependency?
well, if you have ideas how to extract all kotlin sourceSets based on my PR with the dsl changes, I would be grateful
t
not sure you can do that without having the AGP in your classpath, as you need to use the Android extension API
groovy is more flexible in that regard, as it tries to resolve properties dynamically, so as long as you guard your block against the fact you have applied the AGP or not you’re golden
a
hey, I merged the new dsl stuff into master. If you have ideas how to generate detektCheck tasks for the sourceset, that would be great!