I suspect that pull_common.pl sometimes doesn’t create ‘build/repo/versions’, but doesn’t fail either. In that case, the output file does not exist and the task completed successfully, so that looks like the output of the task is for ‘build/repo/versions’ to not exist. If that’s the case, just running gradlew pullCommon should also be up-to-date.
I’d check if pull_common.pl creates the path to the versions file, if it doesn’t, then I think perl silently fails to write anything.
If you don’t want to touch pull_common.pl, you could wrap this into a custom task (roughly something like this):
class PerlVersions extends DefaultTask {
@OutputFile
File getOutputFile() {
return new File(buildDir, "repo/versions")
}
@TaskAction
def exec() {
project.exec { // do perl thing
}
}
}
And I think Gradle will automatically create the path to the output file this way.
Yup, I think you’re right on the money. I changed the pullCommon script to return 1 when there’s an error (it was returning 0 before for some reason), so hopefully I won’t run into this anymore. Sounds like I just have to force the task again, and I won’t run into this problem.