-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
213 lines (171 loc) · 5.88 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
group 'ca.mcgill.science.ctf.tepid'
version '1.5.0'
buildscript {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN"
classpath "ca.mcgill.tepid-commons:gradle-plugin:$TEPID_COMMONS"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: 'ca.mcgill.science.tepid.commons'
sourceCompatibility = JVM_TARGET
targetCompatibility = JVM_TARGET
ext {
// can be passed with -Ptepid_config_dir=CONFIG_DIR, or set in an environment variable "tepid_config_dir
if (! project.hasProperty('tepid_config_dir')){
tepid_config_dir = "$System.env.tepid_config_dir"
}
if (! project.hasProperty('tepid_config_dir')){
throw new GradleException('tepid_config_dir not found')
}
}
buildscript {
ext.kotlin_version = '1.3.31'
repositories {
jcenter()
maven { url "https://www.jitpack.io" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN"
classpath "ca.mcgill.tepid-commons:gradle-plugin:$TEPID_COMMONS"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
sourceSets {
main {
resources {
srcDirs "src/main/resources", "config"
}
}
}
repositories {
mavenCentral()
maven { url "https://www.jitpack.io" }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.github.cpicon92:Q:ccb4d8fb9d'
compile tepidDependency.kotlin
compile tepidDependency.rxJava
testCompile tepidDependency.junit
testCompile tepidDependency.kotlinTest
testCompile "ca.mcgill.tepid-commons:test:$TEPID_COMMONS"
compile "ca.mcgill.tepid-commons:retrofit:$TEPID_COMMONS"
compile "ca.mcgill.tepid-commons:models:$TEPID_COMMONS"
compile "ca.mcgill.tepid-commons:utils:$TEPID_COMMONS"
compile "com.bugsnag:bugsnag:3.+"
// https://mvnrepository.com/artifact/com.dorkbox/SystemTray
compile group: 'com.dorkbox', name: 'SystemTray', version: '3.12'
// compile group: 'org.apache.commons', name: 'commons-email', version: '1.4'
compile group: 'org.tukaani', name: 'xz', version: '1.8'
compile group: 'org.glassfish.jersey.core', name: 'jersey-common', version: '2.27'
compile group: 'org.glassfish.jersey.containers', name: 'jersey-container-servlet', version: '2.27'
compile group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: '2.27'
compile group: 'org.glassfish.jersey.media', name: 'jersey-media-json-jackson', version: '2.27'
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
task copyConfigs(type: Copy) {
from "$tepid_config_dir/LDAP.properties", "$tepid_config_dir/URL.properties", "$tepid_config_dir/creationInformation.properties", "$tepid_config_dir/printing.properties"
into "config"
}
task copyBuilder(type: Copy) {
into "$buildDir/libs"
from "files"
}
task copyLibs(type: Copy) {
into "$buildDir/libs"
from configurations.runtime
}
task copyLibsLibs(type: Copy) {
into "$buildDir/libs/libs"
from configurations.runtime
}
task commandLinux(type: Exec) {
workingDir "$buildDir/libs"
commandLine "java", "-classpath", "./*", "ca.mcgill.science.tepid.client.Main"
}
jar {
from('config') {
include '*.properties'
}
baseName = 'tepid'
manifest {
attributes 'Main-Class': 'ca.mcgill.science.tepid.client.Main'
attributes 'Class-Path': './*'
}
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
test {
useJUnitPlatform()
dependsOn cleanTest
testLogging.showStandardStreams = true
}
task tepidWindows(type: GradleBuild) {
tasks = ['copyBuilder', 'copyLibsLibs', 'copyConfigs', 'jar']
}
task tepidLinux(type: GradleBuild) {
tasks = ['copyLibs', 'copyConfigs', 'jar']
}
task msi() {
dependsOn "tepidWindows"
// probably C:\Program Files (x86)\WiX Toolset v3.11
def WIX = System.getenv ( 'WIX' )
def working_dir = "$buildDir/libs"
Map<String, Object> env = ["PRODUCTVERSION" : version, "WIX" : WIX]
doLast {
if (WIX) {
if (version == '') {
throw new GradleException('Version is blank')
}
exec {
workingDir working_dir
environment env
environment "WIX", WIX
commandLine "cmd", "/c", "\"%WIX%\"\\bin\\heat dir libs -ag -dr dir_libs -suid -cg libsDir -sreg -out libsDir.wxs"
}
exec {
workingDir working_dir
environment env
environment "WIX", WIX
commandLine "cmd", "/c", "\"%WIX%\"\\bin\\candle -arch x64 libsDir.wxs"
}
exec {
workingDir working_dir
environment env
environment "WIX", WIX
commandLine "cmd", "/c", "\"%WIX%\"\\bin\\candle installer.wxs"
}
exec {
workingDir working_dir
environment env
environment "WIX", WIX
commandLine "cmd", "/c", "\"%WIX%\"\\bin\\light -ext WixUIExtension -cultures:en-us installer.wixobj libsDir.wixobj -b libs -out TEPID-%PRODUCTVERSION%.msi"
}
exec {
workingDir working_dir
environment env
environment "WIX", WIX
commandLine "cmd", "/c", "del installer.wixobj libsDir.wixObj libsDir.wxs TEPID-%PRODUCTVERSION%.wixpdb"
println('Done')
}
} else {
throw new GradleException('WIX is not installed and added to path')
}
}
group 'build'
}
task run(dependsOn: 'copyConfigs', type: JavaExec) {
classpath sourceSets.main.runtimeClasspath
main = "ca.mcgill.science.tepid.client.Main"
}