-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
I've noticed that the build can get into a bad state locally, with MockMethodDispatcher.raw
not being rebuilt if it's missing.
This is because the copyMockMethodDispatcher
task defined in inline-mock.gradle
is incorrectly defined. It's currently defined as:
task copyMockMethodDispatcher {
dependsOn compileJava
outputs.files files("${sourceSets.main.java.outputDir}/org/mockito/internal/creation/bytebuddy/inject")
.asFileTree
.matching { include "*.raw" }
.files
.collect { "${buildDir}/${it.name}" }
doLast {
copy {
from "${sourceSets.main.java.outputDir}/org/mockito/internal/creation/bytebuddy/inject"
into "${sourceSets.main.java.outputDir}/org/mockito/internal/creation/bytebuddy/inject"
include 'MockMethodDispatcher.class'
rename { String fileName ->
fileName.replace('.class', '.raw')
}
}
}
}
However:
- It's not defining any inputs! So the task doesn't know when to re-run.
- It's defining its output as "$buildDir/MockMethodDispatcher.raw", which is wrong, it should be in the
/org/mockito/internal/creation/bytebuddy/inject
directory...
The net result of this is that Gradle caches the fact the task has run and then even if the MockMethodDispatcher.raw
output file is deleted, the task does NOT re-run.
It looks like this was done to avoid warnings under Gradle 7.x about tasks sharing output directories.
A better solution would be to move the renamed file to a new location, outside of the output of compileJava
and include this in the jar.
Metadata
Metadata
Assignees
Labels
No labels