-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.gradle
66 lines (62 loc) · 1.79 KB
/
common.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
task(sh) {
String distShName = distSh;
String jarName = "${project.projectDir}/build/libs/${project.name}-${version}.jar";
String shName = "${project.name}-${version}.sh"
dependsOn jar;
inputs.file distShName;
inputs.file jarName;
outputs.file shName;
doLast {
ant.concat(destfile: shName, binary: true) {
fileset(file: distShName)
fileset(file: jarName, erroronmissingdir: false)
}
ant.chmod(file: shName, perm: 'a+x')
}
}
task(bat) {
String distBatName = distBat
String jarName = "${project.projectDir}/build/libs/${project.name}-${version}.jar";
String batName = "${project.name}-${version}.bat"
dependsOn jar;
inputs.file distBatName;
inputs.file jarName;
outputs.file batName;
doLast {
ant.concat(destfile: batName, binary: true) {
fileset(file: distBatName)
fileset(file: jarName, erroronmissingdir: false)
}
}
}
task copyToOutputLibs(type: Copy) {
into "${project.buildDir}/output/libs"
from configurations.runtime
}
task(groovyJar, dependsOn: copyToOutputLibs) {
doLast {
def files = [];
new File("${project.buildDir}/output/libs").eachFile { files.add(it.getAbsolutePath()) };
String classpath = files.join(File.pathSeparator);
ant.java(classpath: classpath, classname: 'org.codehaus.groovy.tools.FileSystemCompiler') {
arg(value: '-d')
arg(value: "${project.buildDir}/classes/main")
arg(value: project.groovyScriptName)
}
}
}
/*
task(jarsToLib) {
doLast {
from {
configurations.runtime.collect {
it.isDirectory() ? it : zipTree(it).matching {
exclude { detail ->
detail.getFile().getParentFile().getName().equals("META-INF") && !detail.getFile().getName().equals("dgminfo")
}
}
}
}
}
}
*/