jansauer / gradle-print-coverage-plugin

Scraps jacoco test reports and prints the code coverage to the console
16 stars 9 forks source link

Gradle deprecation warning for Report.enabled #17

Open justfortherec opened 3 years ago

justfortherec commented 3 years ago

When upgrading my local gradle setup to version 3.7 I noticed this warning:

The Report.enabled property has been deprecated. This is scheduled to be removed in Gradle 8.0. Please use the required property instead. See https://docs.gradle.org/7.2/dsl/org.gradle.api.reporting.Report.html#org.gradle.api.reporting.Report:enabled for more detail
s.
        at org.gradle.api.reporting.internal.SimpleReport.setEnabled(SimpleReport.java:108)
        at org.gradle.api.reporting.internal.TaskGeneratedSingleFileReport_Decorated.setEnabled(Unknown Source)
        at org.gradle.api.reporting.internal.TaskGeneratedSingleFileReport_Decorated.enabled(Unknown Source)
        at org.gradle.api.reporting.internal.TaskGeneratedSingleFileReport_Decorated$enabled.call(Unknown Source)
        at de.jansauer.printcoverage.PrintCoveragePlugin$_apply_closure1$_closure3.doCall(PrintCoveragePlugin.groovy:13)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)

[remaining stacktrace is omitted for brevity]

The culprit seems to be https://github.com/jansauer/gradle-print-coverage-plugin/blob/master/src/main/groovy/de/jansauer/printcoverage/PrintCoveragePlugin.groovy#L13

The proposed solution is to use required instead of enabled.

manuelprinz commented 2 years ago

Yes, the JaCoCo plugin also uses task/configuration avoidance now. This is an issue also in other places, see #18 for example. In this case, the Gradle version used for this plugin needs to be updated to at least 6.1 in order to have this new API available.

manuelprinz commented 2 years ago

P.S.: I also assume you mean version 7.3, right?

davinkevin commented 1 year ago

I have to drop this plugin due to its incompatibility with Gradle 8.0, with the following error:

* What went wrong: |  
  | An exception occurred applying plugin request [id: 'org.gradle.jacoco'] |  
  | > Failed to apply plugin 'org.gradle.jacoco'. |  
  | > Could not create task ':backend:jacocoTestReport'. |  
  | > No signature of method: org.gradle.api.reporting.internal.TaskGeneratedSingleFileReport.enabled() is applicable for argument types: (Boolean) values: [true]

Build Scan

hosamaly commented 3 months ago

There is a fix in #22