Skip to content

Instantly share code, notes, and snippets.

@orangeclover
Created October 24, 2013 12:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orangeclover/7136711 to your computer and use it in GitHub Desktop.
Save orangeclover/7136711 to your computer and use it in GitHub Desktop.
Gradleでタスクから別のタスクを呼び出す
def zipFile =''
task downloadZip(type: MyDownload) {
sourceUrl = 'https://dl.dropboxusercontent.com/u/645223/gradle/quickstart.zip'
target = file("${temporaryDir}/quickstart.zip")
zipFile = target
}
class MyDownload extends DefaultTask {
@Input
String sourceUrl
@OutputFile
File target
@TaskAction
void download() {
ant.get(src: sourceUrl, dest: target)
}
}
task unzip(type: Copy) {
def outputDir = file("build")
from zipTree(zipFile)
into outputDir
}
task deploy {
tasks.downloadZip.execute()
tasks.unzip.execute()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment