We now download and verify checksums as a single task, rather than as two separate tasks. This simplifies other task dependencies, since we no longer have a checksum-verified "stamp" file separate from the download itself. Unfortunately the combined task now has a significant amount of repeated boilerplate. I'm hoping to refactor that all out into a custom task class, but haven't yet figured out the details: <https://github.com/michel-kraemer/gradle-download-task/issues/108>. We now also use ETags to be smarter about when a fresh download is or is not actually needed. I think there are still opportunities for improved caching here, but this is a step in the right direction.
33 lines
830 B
Groovy
33 lines
830 B
Groovy
apply plugin: 'base'
|
|
|
|
task downloadAjaxslt {
|
|
def version = '0.8.1'
|
|
def versionedArchive = "ajaxslt-${version}.tar.gz"
|
|
outputs.file "$temporaryDir/$versionedArchive"
|
|
doLast {
|
|
download {
|
|
src "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ajaxslt/$versionedArchive"
|
|
dest outputs.files.singleFile
|
|
overwrite true
|
|
onlyIfModified true
|
|
useETag true
|
|
}
|
|
verifyChecksum {
|
|
src outputs.files.singleFile
|
|
checksum 'c995abe3310a401bb4db7f28a6409756'
|
|
}
|
|
}
|
|
}
|
|
|
|
task unpackAjaxslt(type: Sync, dependsOn: downloadAjaxslt) {
|
|
from(tarTree(files(downloadAjaxslt).singleFile)) {
|
|
eachFile {
|
|
def newSegments = relativePath.segments[1 .. -1] as String[]
|
|
relativePath new RelativePath(!directory, newSegments)
|
|
}
|
|
}
|
|
into 'examples-src/ajaxslt'
|
|
}
|
|
|
|
clean.dependsOn cleanUnpackAjaxslt
|