Experimental combined task for download and checksum verification
Not working yet: <https://github.com/michel-kraemer/gradle-download-task/issues/108>.
This commit is contained in:
parent
ba455f4737
commit
4749fe47c0
|
@ -6,23 +6,33 @@ sourceSets.test.java.srcDirs = ['src']
|
||||||
// download JLex
|
// download JLex
|
||||||
//
|
//
|
||||||
|
|
||||||
task downloadJLex {
|
class VerifiedDownload extends org.gradle.api.DefaultTask {
|
||||||
outputs.file 'src/JLex/Main.java'
|
|
||||||
doLast {
|
@Input String src
|
||||||
|
@Input String checksum
|
||||||
|
@OutputFile File dest
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
downloadAndVerify() {
|
||||||
download {
|
download {
|
||||||
src 'http://www.cs.princeton.edu/~appel/modern/java/JLex/current/Main.java'
|
src this.src
|
||||||
dest outputs.files.singleFile
|
dest this.dest
|
||||||
overwrite true
|
overwrite true
|
||||||
onlyIfModified true
|
onlyIfModified true
|
||||||
useETag true
|
|
||||||
}
|
}
|
||||||
verifyChecksum {
|
verifyChecksum {
|
||||||
src outputs.files.singleFile
|
src this.dest
|
||||||
checksum 'fe0cff5db3e2f0f5d67a153cf6c783af'
|
checksum this.checksum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task downloadJLex(type: VerifiedDownload) {
|
||||||
|
src 'http://www.cs.princeton.edu/~appel/modern/java/JLex/current/Main.java'
|
||||||
|
checksum 'fe0cff5db3e2f0f5d67a153cf6c783af'
|
||||||
|
dest file('src/JLex/Main.java')
|
||||||
|
}
|
||||||
|
|
||||||
task cleanDownloadJLex(type: Delete) {
|
task cleanDownloadJLex(type: Delete) {
|
||||||
delete files(downloadJLex).singleFile.parent
|
delete files(downloadJLex).singleFile.parent
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue