gradle / kotlin-dsl-samples

Samples builds using the Gradle Kotlin DSL
https://gradle.org/kotlin/
Other
3.71k stars 434 forks source link

Extending JacocoReport class causes crash #1365

Closed BulatMukhutdinov closed 5 years ago

BulatMukhutdinov commented 5 years ago

Expected Behavior

Running testCoverageReport task generates a report

Current Behavior

Running testCoverageReport task raises an error

> java.lang.NullPointerException (no error message)

Context

I am trying to convert gradle typed task to kotlin class. https://gist.github.com/BulatMukhutdinov/c6355d84a34ed40d1031a879f3e0a523 I have jacoco.gradle.kts file with testCoverageReport task wich generates coverage report. Now I am trying to convert it to custom class TestCoverageReportTask and registering new typed task. But when I running this task I get an error

Your Environment

gradle version is

Gradle 4.10.1
------------------------------------------------------------

Build time:   2018-09-12 11:33:27 UTC
Revision:     76c9179ea9bddc32810f9125ad97c3315c544919

Kotlin DSL:   1.0-rc-6
Kotlin:       1.2.61
Groovy:       2.4.15
Ant:          Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM:          1.8.0_201 (Oracle Corporation 25.201-b09)
OS:           Mac OS X 10.14.3 x86_64

Android Studio version is

Android Studio 3.3.2
Build #AI-182.5107.16.33.5314842, built on February 16, 2019
JRE: 1.8.0_152-release-1248-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.3

Kotlin version is

1.3.21-release-Studio3.3-1
eskatos commented 5 years ago

I tried putting the task code in the linked Gist into a build but the example simply fails to compile. The gist is missing how you use the extracted task type. After some minor changes unrelated to this issue your task type compiles. I was able to create and run it without any issue.

Please use the Gradle forums for support questions https://discuss.gradle.org/ and provide a build ready to reproduce if possible.