Simplify file management for a download task

This commit is contained in:
Ben Liblit 2018-01-16 12:14:46 -06:00
parent cf9281719a
commit e4cc086476
1 changed files with 10 additions and 13 deletions

View File

@ -2,34 +2,31 @@ apply plugin: 'base'
import de.undercouch.gradle.tasks.download.*
def versionedArchive = 'ajaxslt-0.8.1'
def packedArchive = "${versionedArchive}.tar.gz"
task downloadAjaxslt(type: Download) {
src "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ajaxslt/${packedArchive}"
dest new File(buildDir, packedArchive)
def version = '0.8.1'
ext {
versionedArchive = "ajaxslt-$version"
}
src "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ajaxslt/${versionedArchive}.tar.gz"
dest temporaryDir
overwrite false
}
task verifyAjaxslt(type: Verify, dependsOn: downloadAjaxslt) {
src downloadAjaxslt.dest
src files(downloadAjaxslt)[0]
checksum 'c995abe3310a401bb4db7f28a6409756'
}
task unpackAjaxslt(type: Sync, dependsOn: verifyAjaxslt) {
from tarTree(verifyAjaxslt.src)
into buildDir
into temporaryDir
}
task unversionAjaxslt(type: Sync, dependsOn: unpackAjaxslt) {
from new File(buildDir, versionedArchive)
from new File(files(unpackAjaxslt)[0], downloadAjaxslt.versionedArchive)
into 'examples-src/ajaxslt'
clean { delete unversionAjaxslt }
}
task processTestResources(dependsOn: unversionAjaxslt) {
}
clean {
delete unversionAjaxslt
delete downloadAjaxslt
}