Skip to content
This repository was archived by the owner on Jan 29, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions docs/plugin-development/reporting-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ object.
We’ll be working with the [VerifyPluginProjectConfigurationTask](https://github.com/JetBrains/intellij-platform-gradle-plugin/blob/476130fa41347ef4e5480fb44b9d454e51aa7a18/src/main/kotlin/org/jetbrains/intellij/platform/gradle/tasks/VerifyPluginProjectConfigurationTask.kt#L44), a task from the [IntelliJ Platform Gradle Plugin](https://github.com/JetBrains/intellij-platform-gradle-plugin/tree/476130fa41347ef4e5480fb44b9d454e51aa7a18)
that does the simple job of validating a plugin project’s configuration.

!!! note
Tested with Gradle 9.0.0

## Declaring Reporting Support in a Task

Tasks that produce reports must implement the `Reporting` interface with a type argument that extends `ReportContainer`:

```kotlin
Expand All @@ -23,6 +28,8 @@ abstract class VerifyPluginProjectConfigurationTask : DefaultTask(), Reporting<V
}
```

## Defining the `ReportContainer` Contract

`VerifyPluginConfigurationReports` is an interface that extends `ReportContainer<SingleFileReport>`. `SingleFileReport`
is a useful wrapper around `Report` that represents that our output will be a single file. If your report was a group of files
you’d want to put in a directory, of which a `DirectoryReport` would be used instead.
Expand Down Expand Up @@ -61,6 +68,8 @@ class VerifyPluginConfigurationReportsImpl : VerifyPluginConfigurationReports {
}
```

## Implementing the `ReportContainer`

Providing an implementation of our report container requires that we override over 40 different methods.
To avoid doing this, we can delegate access to these methods to another `ReportContainer` class with the help of `DelegatingReportContainer`.

Expand Down Expand Up @@ -112,6 +121,8 @@ class VerifyPluginConfigurationReportsImpl @Inject constructor(
}
```

## Wiring the `ReportContainer` into the Task

After defining our report container and report objects, back to our task to start working with them:

```kotlin
Expand Down Expand Up @@ -163,6 +174,8 @@ abstract class VerifyPluginProjectConfigurationTask : DefaultTask(), Reporting<V

We annotate `getReports()` with `@Nested` so Gradle inspects the returned report container’s properties (like `txt`, `html`, `markdown`) and their annotations.

## Setting up Report Outputs

When configuring our task, we can go ahead to use our function to set up our reports:

```kotlin
Expand All @@ -172,6 +185,8 @@ reports {
}
```

## Writing Data to Reports

Finally, writing to our reports can be done in this fashion:

```kotlin
Expand All @@ -182,11 +197,10 @@ if (verifyPluginProjectReports.txt.required.get()) {

## References

- https://docs.gradle.org/current/dsl/org.gradle.api.reporting.ReportContainer.html
- https://docs.gradle.org/current/dsl/org.gradle.api.reporting.Reporting.html
- https://docs.gradle.org/current/dsl/org.gradle.api.reporting.Report.html
- https://docs.gradle.org/current/dsl/org.gradle.api.reporting.SingleFileReport.html
- https://docs.gradle.org/current/dsl/org.gradle.api.reporting.DirectoryReport.html
- https://github.com/gradle/gradle/issues/7063

Tested with: Gradle 9.0.0
- [PR for VerifyPluginProjectConfigurationTask, GSoC 2025](https://github.com/JetBrains/intellij-platform-gradle-plugin/pull/2016)
- [ReportContainer DSL](https://docs.gradle.org/current/dsl/org.gradle.api.reporting.ReportContainer.html)
- [Reporting DSL](https://docs.gradle.org/current/dsl/org.gradle.api.reporting.Reporting.html)
- [Report DSL](https://docs.gradle.org/current/dsl/org.gradle.api.reporting.Report.html)
- [SingleFileReport DSL](https://docs.gradle.org/current/dsl/org.gradle.api.reporting.SingleFileReport.html)
- [DirectoryReport DSL](https://docs.gradle.org/current/dsl/org.gradle.api.reporting.DirectoryReport.html)
- [https://github.com/gradle/gradle/issues/7063](https://github.com/gradle/gradle/issues/7063)
Loading