Simplify file management for a download task
This commit is contained in:
parent
0bb899b503
commit
16ec6d7461
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue