Created
October 23, 2013 12:43
-
-
Save orangeclover/7117957 to your computer and use it in GitHub Desktop.
Gradleで依存関係を設定して2つのタスクを1つにまとめる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | |
dependsOn downloadZip,unzip | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment