iliask
12/16/2021, 2:23 PMdetekt (without type resolution at the moment) always run after assemble tasks automatically, either through a detekt configuration or some gradle magic?gammax
12/16/2021, 2:24 PMassemble.dependsOn(detektMain) should do the job for you điliask
12/16/2021, 2:34 PMdetektAll task in the root build.gradle
tasks.register("detektAll", Detekt) {
...
}
When adding assemble.dependsOn(detektAll) in the root build.gradle then gradle sync fails đ¤
Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'assemble' for root projectgammax
12/16/2021, 2:35 PMCould not get unknown property âassembleâ for root projectThis happens because you donât have an
assemble task (yet)iliask
12/16/2021, 2:38 PM./gradlew tasks the assemble task is present.
When I add the suggested snippet in the app module build.gradle then gradle syncs successfully. Perhaps the assemble tasks are not "seen" by the root build.gradle ?gammax
12/16/2021, 2:41 PMPerhaps the assemble tasks are not âseenâ by the rootÂSort of. The ?build.gradle
assemble task are âlocalâ to your subprojects. While I suppose your detektAll task is declared in the top level build.gradleiliask
12/16/2021, 2:46 PMgammax
12/16/2021, 2:47 PMdetetkAll task provided by default?iliask
12/16/2021, 2:49 PMgammax
12/16/2021, 3:09 PMdetektAll goes against the Gradle philosophyiliask
12/16/2021, 3:18 PMdetektAll .
Would you recommend instead to add detekt dependency in every module via allprojects {} or something else?gammax
12/16/2021, 3:21 PM./gradlew detektMain youâre essentially saying to Gradle to invoke detetkMain on all the subprojects. That should be sufficient to run detekt on all the subprojects (i.e. you donât need a detetkAll ).
You can specify the dependency between assemble and detektAll a the project level then.iliask
12/16/2021, 3:28 PMephemient
12/16/2021, 6:22 PMdetekt is already added as a dependency to the standard check task, which means if you run either gradle check or gradle build, it will also run detektgammax
12/16/2021, 8:22 PM