violations-gradle-plugin icon indicating copy to clipboard operation
violations-gradle-plugin copied to clipboard

[Question] How to setup gradle build for use KOTLINGRADLE.

Open Nov1kov opened this issue 4 years ago • 2 comments

Sorry for the questions on this topic, but I believe the answer helps for documentation for this project.

as far as I understand this plugin reads only report files.

If I build an Android project with Kotlin via ./gradlew build I have some output from the Kotlin compiler (25, 17): Variable 'some' is never used

but I can't find any output with this text image

Have any idea, how Kotlin Gradle output to integrate with the plugin?

Nov1kov avatar Nov 25 '20 18:11 Nov1kov

I'm not using that feature, so I don't know.

tomasbjerre avatar Nov 27 '20 13:11 tomasbjerre

So, I found a solution for my CI. (gitlab)

mkdir -p build/gradle_output
./gradlew lintRelease -w > build/gradle_output/lint_release.txt
./gradlew violationCommentsToGitLab

and in root build.gradle:

task violationCommentsToGitLab(type: ViolationCommentsToGitLabTask) {
    // ....
    violations = [
            ["ANDROIDLINT", "${rootDir}".toString(), ".*/reports/.*\\.xml\$", "Android lint"],
            ["KOTLINGRADLE", "${rootDir}".toString(), ".*/gradle_output/.*\\.txt\$", "Kotlinc"],
    ]
}

It will show errors from Kotlin compiler and Android lint

Nov1kov avatar Dec 03 '20 08:12 Nov1kov