-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
executable file
·117 lines (95 loc) · 2.44 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
apply plugin: 'java'
apply plugin: 'application'
defaultTasks 'distribute'
// Start Project configuration
sourceCompatibility = '10'
targetCompatibility = '10'
project.group = 'blacksmyth.personalfinancier'
project.version = '0.4'
project.ext {
title = 'PersonalFinancier'
contact = 'Lindsay Willian Bradford (lindsay.w.bradford_at_gmail.com)'
libsDirectory = 'libs'
distributionDirectory = 'dist'
}
mainClassName = project.group + '.' + project.title
List testLibs = [
'junit:junit:4.12',
'org.mockito:mockito-all:1.10.19'
]
List libsToMerge = [
'com.jtattoo:JTattoo:1.6.11',
'com.cedarsoftware:json-io:4.10.0',
'de.erichseifert.gral:gral-core:0.10',
'org.apache.logging.log4j:log4j-api:2.11.0',
'org.apache.logging.log4j:log4j-core:2.11.0'
]
List libsToShip = [
'org.bouncycastle:bcprov-jdk15on:1.58'
]
repositories {
mavenCentral()
maven {
url 'http://mvn.erichseifert.de/maven2'
}
}
configurations {
mergeLibs
shipLibs
}
dependencies {
mergeLibs libsToMerge
shipLibs libsToShip
compile libsToMerge, libsToShip
testCompile testLibs
}
jar {
from {
configurations.mergeLibs.collect { zipTree(it) }
}
manifest {
attributes (
'Implementation-Title': project.title,
'Implementation-Version': project.version,
'Contact': project.contact,
'Built-With': "gradle-${project.getGradle().getGradleVersion()}, groovy-${GroovySystem.getVersion()}",
'Created-By': System.getProperty('java.version') + ' (' + System.getProperty('java.vendor') + ')',
'Main-Class' : mainClassName,
'Class-Path' : configurations.shipLibs.collect{ it.getName() }.join(' '),
)
}
doLast {
file(jar.archivePath).setExecutable(true)
println "$jar.archiveName created and is executable."
}
}
task syncLibs(type: Sync) {
from configurations.compile, configurations.testCompile
into project.libsDirectory
doLast {
println "Synchronised library dependencies into directory ($project.libsDirectory)."
}
}
task distribute(type: Copy) {
dependsOn jar,syncLibs
from jar
from configurations.shipLibs
into project.distributionDirectory
doLast {
println "Distributed $project.title and support libraries to directory ($project.distributionDirectory)."
}
}
test {
testLogging {
events 'passed', 'skipped', 'failed'
}
}
run {
dependsOn distribute
doLast {
println "Running $project.title"
}
}
task full {
dependsOn clean, distribute
}