forked from guilhermejccavalcanti/s3m
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
66 lines (55 loc) · 1.68 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
apply plugin: 'java'
repositories {
mavenCentral()
}
// most of the jar libraries is available in the /dependencies folder, not in a remote repository
dependencies {
compile fileTree(dir: 'dependencies', include: ['*.jar'])
compile 'com.google.guava:guava:26.0-jre'
testCompile 'junit:junit:4.12'
testCompile 'org.assertj:assertj-core:3.11.0'
}
// the lines bellow deal with exporting a running jar
jar {
manifest {
attributes 'Main-Class': 'br.ufpe.cin.app.JFSTMerge'
}
}
task fatJar(type: Jar) {
manifest.from jar.manifest
classifier = 'all'
from {
configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
with jar
}
artifacts {
archives fatJar
}
task copyBinary(type: Copy, dependsOn: assemble, group: "Binaries", description: "Copies binaries to /binary folder.") {
from fatJar
into "binary"
rename "jFSTMerge.*", "jFSTMerge.jar"
}
task updateInstaller(type: Copy, dependsOn: assemble, group: "Binaries", description: "Updates installer jar.") {
from fatJar
into "installer"
rename "jFSTMerge.*", "s3m.jar"
doLast {
File installer = file("installer/s3mInstaller.jar");
if(!installer.exists() || installer.length() < 5000) {
exec {
commandLine("git", "lfs", "pull", "-I", "installer/s3mInstaller.jar")
}
}
ant.jar(update: "true", destfile: installer) {
zipfileset(file: "installer/s3m.jar")
}
delete "installer/s3m.jar"
}
}
build.finalizedBy(copyBinary, updateInstaller)