-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
78 lines (62 loc) · 1.65 KB
/
build.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
67
68
69
70
71
72
73
74
75
76
77
78
apply plugin: 'java'
apply plugin: 'idea'
group 'wtf.log'
version '1.0-SNAPSHOT'
buildscript {
ext.versions = [
kotlin: '1.1-M04',
shadow: '1.2.4',
okio: '1.11.0',
rebound: '0.3.8',
rxjava: '1.2.4',
rxrelay: '1.2.0',
javaosc: '0.3',
jSerialComm: '1.3.11',
jcommander: '2.1.0'
]
repositories {
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' }
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
}
}
allprojects {
repositories {
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' }
mavenCentral()
jcenter()
}
}
subprojects.each { subproject ->
evaluationDependsOn(subproject.path)
}
task fatJar(type: Jar, dependsOn: subprojects.jar) {
manifest {
attributes 'Main-Class': 'wtf.log.lederhosen.cli.MainKt'
}
subprojects.each { subproject ->
from (subproject.configurations.archives.allArtifacts.files.collect { zipTree(it) }) {
exclude 'META-INF/MANIFEST.MF'
}
from (subproject.configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }) {
exclude 'META-INF/MANIFEST.MF'
}
}
}
def binaryFile = new File(buildDir, "libs/$name-binary.jar")
task binaryJar << {
def jarFile = fatJar.archivePath
binaryFile.getParentFile().mkdirs()
binaryFile << "#!/bin/sh\n\nexec java -jar \$0 \"\$@\"\n\n"
jarFile.withInputStream { binaryFile.append it }
binaryFile.setExecutable true, false
}
binaryJar.dependsOn(fatJar)
task copyBinary(type: Copy, dependsOn: 'binaryJar') {
from(binaryFile)
into buildDir
rename(".*", project.name)
}
tasks.getByName('assemble').dependsOn('copyBinary')