-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Describe the bug
When running a task like:
./gradlew clean testDebugUnitTestCoverage diffCoverage --no-build-cache
And configuring where the location of the class files can be found. Diff Coverage will through an error:
- What went wrong:
Could not determine the dependencies of task ':lib:diffCoverage'.
'diffCoverageReport.classesDirs' file collection is empty.
This is becuase the clean will have wiped out the location of the files and the configuration happens before the files are loaded.
Currently:
calls collectFilesOrThrow which eagerly collects the files instead of lazily doing it after the configuration phase has completed.
Ideally these should take Providers instead of FileCollections directly, so that when the task is executing it can get the files at that particular time instead of eagerly doing it whenever the get method is called.
Line 6 in 980b305
| internal fun DiffCoverageTask.collectFileCollectionOrThrow( |
That will always throw an error if clean is used. If clean is not used and the coverage has run before as a seperate step it'll pass.
Ideally a FileCollectionProvider should be used and read from the ReportGenerator.
Desktop (please complete the following information):
- OS: all
- Gradle version: 7.4.1
- Diff Coverage plugin version: 0.9.3
To Reproduce
./gradlew clean jacocoReport diffCoverage
Works if:
./gradlew clean jacocoReport
./gradlew diffCoverage
Expected behavior
./gradlew clean jacocoReport diffCoverage
should work without crashing
A clear and concise description of what you expected to happen.
Logs
Could not determine the dependencies of task ':lib:diffCoverage'.
'diffCoverageReport.classesDirs' file collection is empty.