forked from crate/crate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
59 lines (50 loc) · 1.58 KB
/
Copy pathbuild.gradle
File metadata and controls
59 lines (50 loc) · 1.58 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
apply from: "$rootDir/gradle/javaModule.gradle"
archivesBaseName = 'crate-admin-ui'
dependencies {
compile project(':es')
compile project(':core')
}
ext {
plugin_crateadmin_version = '0.17.0'
downloadDir = new File(buildDir, 'downloads')
}
def extractTopfolder(File src, String trg){
copy {
includeEmptyDirs = false
FileTree ft
if(src.name.endsWith('.tar.gz')) {
ft = tarTree(src)
}
from(ft) {
eachFile { details ->
details.path =
details.path.substring(details.relativePath.segments[0].length())
}
}
into trg
}
}
task writePropertiesFile << {
def file = new File("${buildDir}/crate-admin/plugin-descriptor.properties");
if(!file.isFile()) {
def parentDir = new File(file.parent);
if (!parentDir.isDirectory()) {
parentDir.mkdirs();
}
file.createNewFile();
}
ant.propertyfile(file:file.path, comment:'Plugin Descriptor') {
ant.entry(key:'name', value:project.archivesBaseName)
ant.entry(key:'description', value:project.description)
ant.entry(key:'version', value:plugin_crateadmin_version)
ant.entry(key:'site', value:true)
}
}
task downloadPlugin (dependsOn: [writePropertiesFile]) << {
def dest = download(
downloadDir,
"https://cdn.crate.io/downloads/releases/crate-admin-${plugin_crateadmin_version}.tar.gz",
"crate-admin-${plugin_crateadmin_version}.tar.gz"
)
extractTopfolder(dest, "${buildDir}/crate-admin/_site")
}