Open jansorg opened 2 months ago
Thanks for reporting this. You are right that lazy configuration is not properly implemented in gradle-download-task yet. As a matter of fact, the properties that do allow it are almost always evaluated during initialization, which is too early for your use case. I could make it so that the checksum
property is evaluated later but I'd rather not mix different approaches in one version.
I'll keep this issue open and implement lazy task configuration properly in the next major version of gradle-download-task.
In the meantime, you can use the verifyChecksum
extension to achieve the same thing:
task downloadFile(type: Download) {
src 'http://yourserver.com/file.dat'
dest layout.buildDirectory
}
task downloadChecksumFile(type: Download) {
src 'http://yourserver.com/file.dat.md5'
dest layout.buildDirectory
}
task verifyFile(dependsOn: [downloadChecksumFile, downloadFile]) {
doLast {
verifyChecksum.run {
src downloadFile.outputs.files.singleFile
algorithm 'MD5'
checksum downloadChecksumFile.outputs.files.singleFile.text
}
}
}
I hope this helps. Let me know if you have questions.
Is your feature request related to a problem? Please describe.
The workflow is like this
Describe the solution you'd like
Because
checksum
is a plain string I need to assign a value when the task is configured. But the manifest's checksum is only available after the download of the manifest file.Describe alternatives you've considered
Seems to work, but not very nice: