https://kotlinlang.org logo
#detekt
Title
# detekt
a

Artur Bosch

02/07/2018, 12:20 PM
@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

toto

02/07/2018, 1:13 PM
@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

Artur Bosch

02/07/2018, 1:50 PM
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

toto

02/07/2018, 1:51 PM
I’m keen to help, as I have collected quite some knowledge writing few Gradle plugin in Groovy
a

Artur Bosch

02/07/2018, 1:54 PM
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

toto

02/07/2018, 1:55 PM
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

Artur Bosch

02/07/2018, 1:57 PM
does the ktlint plugin depend on it?
a

Artur Bosch

02/07/2018, 1:59 PM
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

toto

02/07/2018, 2:17 PM
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

Artur Bosch

02/09/2018, 10:50 PM
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!
2 Views