JLLeitschuh / ktlint-gradle

A ktlint gradle plugin
MIT License
1.47k stars 160 forks source link

Make KtlintCheckTask implement org.gradle.api.reporting.Reporting #349

Closed Mahoney closed 4 years ago

Mahoney commented 4 years ago

The Build Dashboard Plugin (and a plugin I'm writing to aggregate reports from subprojects) rely on a task implementing org.gradle.api.reporting.Reporting to recognise it as a task that generates reports.

It would be nice if KtlintCheckTask could participate in this by implementing org.gradle.api.reporting.Reporting, allowing its outputs to be aggregated up as well.

JLLeitschuh commented 4 years ago

@Mahoney are you willing to submit a PR to add this?

Mahoney commented 4 years ago

Possibly. Need to work out timings.

Tapchicoma commented 4 years ago

Interesting idea. We could adapt our extension to use the same api, though it will be a breaking change.

3flex commented 4 years ago

Just to note this same request came in on the detekt project, and it's something I've looked into previously. I'll copy the comment I made on the detekt issue:

I looked into this some time back, and it doesn't seem feasible - see https://github.com/gradle/gradle/issues/7063 for some of the background. The Checkstyle tasks can implement Reporting interface easily by taking advantage of implementations in Gradle's internal API, but since detekt is a third party plugin it can't do the same.

Note also the first comment on that issue, written by one of the Gradle team, which says

The Reporting interface isn't really intended to be implemented outside of the Gradle core plugins.

If you have any suggestions on how to implement that would be welcome, but otherwise I recommend closing as wontfix.

JLLeitschuh commented 4 years ago

@3flex thanks for the feedback.

@Mahoney implementing this feature is blocked by the need for support in Gradle for this. If you'd like to see this feature implemented here, please consider contributing a PR to Gradle/Gradle that makes this API easier to implement for plugin authors. Sorry I don't have a better answer.

Mahoney commented 4 years ago

NP, makes sense

JLLeitschuh commented 4 years ago

Added 'wontfix' until there is official support offered from Gradle. Once Gradle supports this for plugin authors, I'm happy to use it.