Colton Idle
09/22/2021, 8:22 PM./gradlew detektMain
, but I get an error:
Task 'detektMain' not found in root project 'rollertoaster'.
2. If I run ./gradlew detekt, I get a success message in 1s, but I don't think detekt actually analyzed my code.
The following Kotlin source sets were configured but not added to any Kotlin compilation:
* androidAndroidTestRelease
* androidTestFixtures
* androidTestFixturesDebug
* androidTestFixturesRelease
You can add a source set to a target's compilation by connecting it with the compilation's default source set using 'dependsOn'.
See <https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#connecting-source-sets>
BUILD SUCCESSFUL in 1s
3. I can't add detekt into spotless right? I use spotless in order to run ktfmt, so being able to add detekt into spotless would be cool.
Can I get help on those three?ephemient
09/22/2021, 8:32 PMColton Idle
09/22/2021, 8:38 PMephemient
09/22/2021, 8:53 PMColton Idle
09/22/2021, 8:58 PMdetektAll
task that can depend on all the detekt*
tasks." and thought they implementedColton Idle
09/22/2021, 9:22 PMephemient
09/22/2021, 9:23 PMdetektDebug
etc.ephemient
09/22/2021, 9:24 PMdetekt
wouldn't work in an Android app, the sources should be in the right place by default...Colton Idle
09/22/2021, 9:31 PMgammax
09/23/2021, 7:51 AMvia the plugins block in my root build.gradle.That’s actually the problem. If you add Detekt to your root project
plugins{}
, you’re applying to a non-Android project. Therefore all the Android specific tasks will not be added.gammax
09/23/2021, 7:51 AM--info
and see if actually something is happening.gammax
09/23/2021, 7:52 AMdetekt
task is just running syntactic analysis so it will be quite fast.gammax
09/23/2021, 7:52 AMColton Idle
09/23/2021, 1:32 PMColton Idle
09/23/2021, 1:33 PMgammax
09/23/2021, 1:42 PMbuild.gradle
file” no? They never mention root 🤔Colton Idle
09/23/2021, 2:05 PMColton Idle
09/23/2021, 2:06 PMephemient
09/23/2021, 7:30 PMColton Idle
09/23/2021, 7:32 PMgammax
09/23/2021, 8:36 PMproject
as Gradle do. So what in Android you would call a module
for Gradle is a `project`: https://docs.gradle.org/current/userguide/multi_project_builds.html#sec:creating_multi_project_buildsgammax
09/23/2021, 8:37 PMit run on like 2 of 8 modules.Either you use
subprojects{}
and you put an if
inside. Or you just apply the plugin only to the modules that should use it (recommended).Colton Idle
09/23/2021, 8:44 PM./gradle :module2:detekt
?gammax
09/23/2021, 8:45 PMgammax
09/23/2021, 8:45 PM./gradle detekt
which will call detekt
on all your submodules (if you don’t have a top level detekt
task).Colton Idle
09/23/2021, 8:50 PMColton Idle
09/23/2021, 8:50 PMColton Idle
09/23/2021, 8:51 PMgammax
09/23/2021, 8:53 PMgammax
09/23/2021, 8:54 PMBut all of the results will still be placed into the modulename/build/whatever right?Correct
Colton Idle
09/23/2021, 8:56 PMeygraber
10/06/2021, 10:12 PMval artifactType = Attribute.of("artifactType", String::class.java)
class DisambiguationRule : AttributeDisambiguationRule<String> {
override fun execute(t: MultipleCandidatesDetails<String>) {
/**
* The default disambiguation rules exclude the jar variants because they define the `org.gradle.libraryelements`
*
* See <https://github.com/gradle/gradle/blob/master/subprojects/dependency-management/src/main/java/org/gradle/internal/component/model/MultipleCandidateMatcher.java#L221>
*
* Not 100% sure why this happens but forcing to use the jar in this specific case fixes the issue
*/
val jar = t.candidateValues.firstOrNull { it == "jar" }
if(jar != null) {
t.closestMatch(jar)
}
}
}
dependencies.attributesSchema.attribute(artifactType).disambiguationRules.add(DisambiguationRule::class.java)e