/
srcAndDestClosure.gradle
46 lines (40 loc) 路 973 Bytes
/
srcAndDestClosure.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* Include the gradle-download-task plugin
*/
plugins {
id 'de.undercouch.download' version '2.1.0'
}
/**
* Import the Download task. This line is optional.
* You can of course also always use the full qualified name
* when you specify a task of type 'Download'.
*/
import de.undercouch.gradle.tasks.download.Download
ext {
downloadToBuildDir = true
}
def getMavenCentralUrl() {
return "http://central.maven.org/maven2/"
}
def getStylesJar() {
return "org/citationstyles/styles/1.0/styles-1.0.jar"
}
/**
* Download a single file to a directory. Use closures for the src and dest
* property.
*/
task downloadFile(type: Download) {
src {
def mavenUrl = getMavenCentralUrl()
def stylesJar = getStylesJar()
return mavenUrl + stylesJar
}
dest {
if (downloadToBuildDir) {
return buildDir
}
return File.createTempDir()
}
overwrite true
}
defaultTasks 'downloadFile'