-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
426 lines (357 loc) · 17.8 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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import java.nio.file.Files
import java.nio.file.StandardOpenOption
buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
mavenCentral()
}
dependencies {
classpath 'commons-configuration:commons-configuration:1.10'
classpath 'com.github.viswaramamoorthy:gradle-util-plugins:0.1.0-RELEASE'
classpath 'org.yaml:snakeyaml:1.29'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:5.2.2'
}
}
plugins {
id "de.undercouch.download" version "4.1.1"
}
//this task is used to update the gradle wrapper properties to a new version
// it also ensures that wrapper scripts and gradle-wrapper.jar are updates if necessary
wrapper {
gradleVersion = '8.8'
}
//Global Properties
ext {
logger.lifecycle('reading build properties file...')
props = new Properties()
file("${projectDir}/chemistry_base/src/main/resources/sirius.build.properties").withReader("UTF8", {
props.load(it)
})
file("${projectDir}/fingerid_base_oss/src/main/resources/csi_fingerid.build.properties").withReader("UTF8", {
props.load(it)
})
file("${projectDir}/sirius_cli/src/main/resources/sirius_frontend.build.properties").withReader("UTF8", {
props.load(it)
})
siriusVersion = props.getProperty('de.unijena.bioinf.sirius.version')
fingeridVersion = props.getProperty('de.unijena.bioinf.fingerid.version')
siriusFrontendVersion = props.getProperty('de.unijena.bioinf.siriusFrontend.version')
appName = props.getProperty('de.unijena.bioinf.utils.errorReport.softwareName').toLowerCase()
mztabm_version = props.getProperty('de.unijena.bioinf.mztabm.version')
//version for external libraries
jjobs_version = '0.9.36'
slf4j_version = '1.7.36'
jackson_version = '2.16.1'
lombok_version = '1.18.34'
cbc_version = props.getProperty('de.unijena.bioinf.sirius.build.cbc_version')
glpk_version = props.getProperty('de.unijena.bioinf.sirius.build.glpk_version')
gurobi_version = props.getProperty('de.unijena.bioinf.sirius.build.gurobi_version')
cplex_version = props.getProperty('de.unijena.bioinf.sirius.build.cplex_version')
cdk_version = "2.9"
jetbrains_version = "24.1.0"
okhttp_version = "4.12.0"
trove_version = '3.1.0' //DEPRECATED -> user fast util instead
fastutil_version = '8.5.12' //replaces trove
//not recommended anymore -> use pico cli instead
jewelcli_version = '0.8.9'
//apache commons
commons_math_version = '3.6.1'
commons_email_version = '1.6.0'
commons_text_version = '1.12.0'
commons_lang_version = '3.15.0'
commons_compress_version = '1.26.2'
commons_io_version = '2.16.1'//'2.11.0'
commons_configuration_version = '2.11.0'
json_version = '1.0'
json_impl_version = "1.0.4"
psql_version = "42.2.1"
jdbi_version = '3.34.0'
liblinear_version = "1.95"
libsvm_version = "3.20"
swagger_version = "2.2.22"
jaxb_version = "2.3.9"
picocli_version = '4.7.5'
jakarta_version = '3.1.0'
jakarta_annotation_version = "3.0.0"
spring_boot_version = "3.3.1"
springdoc_version = "2.3.0"
junit_version = '5.10.3'
siriusTargetPlatform = SiriusPlatform.fromDescriptor((
project.findProperty('build.sirius.platform') ?:
"${DefaultNativePlatform.getCurrentOperatingSystem().getName()}-${DefaultNativePlatform.getCurrentArchitecture().getName()}"
) as String)
System.out.println("----> Following platform detected: " + siriusTargetPlatform)
javaFX_modules = ['javafx-base', 'javafx-controls', 'javafx-swing', 'javafx-web', 'javafx-graphics', 'javafx-fxml', 'javafx-media']
//locations of runtime libraries
//jre path relative tu app home
lib_path = 'lib'
native_path = 'native'
libDir = project.findProperty("build.sirius.location.lib")
System.out.println("----> LibDir: " + libDir)
includeRuntime = Boolean.parseBoolean((project.findProperty("build.sirius.starter.jdk.include") ?: "true") as String)
System.out.println("----> includeRuntime: ${includeRuntime} | ${project.findProperty("build.sirius.starter.jdk.include")}")
launch4jJDKPath = project.findProperty("build.sirius.starter.jdk.location")
System.out.println("----> launch4jJDKPath: ${launch4jJDKPath}")
excludeCbcNative = project.findProperty("build.sirius.native.cbc.exclude")
System.out.println("----> excludeCbcNative: " + excludeCbcNative)
excludeJFX = Boolean.parseBoolean((project.findProperty("build.sirius.native.openjfx.exclude") ?: "false") as String)
System.out.println("----> excludeJFX: ${excludeJFX} | ${project.findProperty("build.sirius.native.openjfx.exclude")}")
}
/*################### DISTRIBUTION STUFF ################### */
project.ext.set("linSuffix", "linux")
project.ext.set("winSuffix", "win")
project.ext.set("macSuffix", "osx")
project.ext.set("arch", ['64', '32'])
project.ext.set("distPath", file('dist').absolutePath)
allprojects {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
targetCompatibility = 21
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
javadoc.options.encoding = 'UTF-8'
group = 'de.unijena.bioinf.ms'
repositories {
mavenLocal()
mavenCentral()
maven {//public libs only so anybody can build the frontend without login
url "https://bio.informatik.uni-jena.de/repository/libs-oss"
}
maven {
url "https://www.ebi.ac.uk/Tools/maven/repos/content/groups/ebi-repo/"
}
maven {
url "https://repo1.maven.org/maven2/" //glazed lists
}
maven {
url "http://eulergui.sourceforge.net/maven2/" //FTAlign stuff
allowInsecureProtocol = true
}
maven {
// only used for spectral hashs (Splash)
url "http://gose.fiehnlab.ucdavis.edu:55000/content/groups/public"
allowInsecureProtocol = true
}
repositories {
maven {
url "https://gitlab.com/api/v4/groups/bright-giant/-/packages/maven"
name "GitLab"
if (System.getenv("CI_JOB_TOKEN") != null) {
credentials(HttpHeaderCredentials) {
name = "Job-Token"
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
header(HttpHeaderAuthentication)
}
}else{
credentials(PasswordCredentials) {
username = project.findProperty("com.bright-giant.build.gitlab.username") as String
password = project.findProperty("com.bright-giant.build.gitlab.token") as String
// the variable resides in $GRADLE_USER_HOME/gradle.properties
// https://docs.gradle.org/current/userguide/directory_layout.html#dir:gradle_user_home
}
authentication {
basic(BasicAuthentication)
}
}
}
}
}
dependencies {
compileOnly "org.projectlombok:lombok:$lombok_version"
annotationProcessor "org.projectlombok:lombok:$lombok_version"
api "it.unimi.dsi:fastutil:$fastutil_version"
api "org.apache.commons:commons-lang3:$commons_lang_version"
api "org.apache.commons:commons-math3:$commons_math_version"
api "org.apache.commons:commons-compress:$commons_compress_version"
api "commons-io:commons-io:$commons_io_version"
api "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
api "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
api 'com.googlecode.concurrent-locks:concurrent-locks:1.0.0'
api "de.unijena.bioinf:jjobs-core:$jjobs_version"
api "org.slf4j:slf4j-api:$slf4j_version"
// Annotations
api "org.jetbrains:annotations:$jetbrains_version"
api "io.swagger.core.v3:swagger-annotations:$swagger_version"
//NOTE: cannot be provided as transitive dependency
implementation "jakarta.persistence:jakarta.persistence-api:$jakarta_version"
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
implementation "org.glassfish.jaxb:jaxb-runtime:$jaxb_version"
// TEST DEPENDENCIES
testCompileOnly "org.projectlombok:lombok:$lombok_version"
testAnnotationProcessor "org.projectlombok:lombok:$lombok_version"
testImplementation "org.slf4j:log4j-over-slf4j:$slf4j_version"
testImplementation "org.slf4j:jcl-over-slf4j:$slf4j_version"
// Aggregator dependency that also brings JUnit 5 parameterized tests etc.
testImplementation "org.junit.jupiter:junit-jupiter:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version"
testImplementation "org.mockito:mockito-junit-jupiter:5.12.0"
// The Vintage engine is needed to be able to run JUnit 4 tests
testImplementation "org.junit.vintage:junit-vintage-engine:$junit_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
}
test {
useJUnitPlatform()
maxHeapSize = "16G"
}
//there are some outdated incompatible trove dependencies in some libs.
// this is to exclude them and enforce the one we need.
configurations.configureEach {
//replaced by log4j-over-slf4j
it.exclude group: "log4j", module: "log4j"
//replaced by jcl-over-slf4j
it.exclude group: "commons-logging", module: "commons-logging"
it.exclude module: 'trove4j'
}
configurations {
compileClasspath {
resolutionStrategy.force 'net.sf.trove4j:core:3.1.0'
}
}
}
subprojects {
java {
withJavadocJar()
withSourcesJar()
}
//do not build javadoc for snapshot version to reduce build time
components.java.withVariantsFromConfiguration(configurations.javadocElements) {
if (version.toString().endsWith('-SNAPSHOT'))
skip()
}
//build only artifacts from modules that contain code
if (new File(projectDir, "src/main").isDirectory() && !"sirius_rest_service".equalsIgnoreCase(project.name) && !"buildSrc".equalsIgnoreCase(project.name)) {
publishing {
publications {
mavenJava(MavenPublication) {
from project.components.java
pom {
licenses {
license {
name = 'GNU Affero General Public License, Version 3.0'
url = 'https://www.gnu.org/licenses/agpl-3.0.txt'
}
}
}
}
}
repositories {
maven {
url = project.findProperty("io.sirius-ms.build.artifactory.url") as String
name "GitLab"
if (System.getenv("CI_JOB_TOKEN") != null) {
credentials(HttpHeaderCredentials) {
name = "Job-Token"
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
header(HttpHeaderAuthentication)
}
}else{
credentials(PasswordCredentials) {
username = project.findProperty("io.sirius-ms.build.artifactory.username") as String
password = project.findProperty("io.sirius-ms.build.artifactory.token") as String
// the variable resides in $GRADLE_USER_HOME/gradle.properties
// https://docs.gradle.org/current/userguide/directory_layout.html#dir:gradle_user_home
}
authentication {
basic(BasicAuthentication)
}
}
}
}
}
}
}
tasks.register('refreshDownloadLinks') {
File webPath = getBuildDir().toPath().resolve('tmp/webSite/').toFile()
group = 'publishing'
File outfile = new File(webPath, "sirius-download.md")
outputs.file(outfile)
doLast {
webPath.mkdirs()
List<String> lines = [
"### SIRIUS+CSI:FingerID GUI and CLI - Version $siriusFrontendVersion (${new Date().format('yyyy-MM-dd')})",
"##### These versions include the Java Runtime Environment, so there is no need to install Java separately! Just download, install/unpack and execute.",
"- for Windows (64bit): [msi](https://github.com/sirius-ms/sirius/releases/download/v$siriusFrontendVersion/sirius-$siriusFrontendVersion-win64.msi) / " +
"[zip](https://github.com/sirius-ms/sirius/releases/download/v$siriusFrontendVersion/sirius-$siriusFrontendVersion-win64.zip)",
"- for Mac (64bit): [pkg](https://github.com/sirius-ms/sirius/releases/download/v$siriusFrontendVersion/sirius-$siriusFrontendVersion-osx64.pkg) / " +
"[zip](https://github.com/sirius-ms/sirius/releases/download/v$siriusFrontendVersion/sirius-$siriusFrontendVersion-osx64.zip)",
"- for Linux (64bit): [zip](https://github.com/sirius-ms/sirius/releases/download/v$siriusFrontendVersion/sirius-$siriusFrontendVersion-linux64.zip)",
"",
"<!--", //DISABLED -> enable if needed
"### SIRIUS+CSI:FingerID Command-Line Interface only - Version $siriusFrontendVersion (${new Date().format('yyyy-MM-dd')})",
"##### These versions include the Java Runtime Environment, so there is no need to install Java separately! Just download, install/unpack and execute.",
"- for Windows (64bit): [msi](https://github.com/sirius-ms/sirius/releases/download/v$siriusFrontendVersion/sirius-$siriusFrontendVersion-win64-headless.msi) / " +
"[zip](https://github.com/sirius-ms/sirius/releases/download/v$siriusFrontendVersion/sirius-$siriusFrontendVersion-win64-headless.zip)",
"- for Mac (64bit): [pkg](https://github.com/sirius-ms/sirius/releases/download/v$siriusFrontendVersion/sirius-$siriusFrontendVersion-osx64-headless.pkg) / " +
"[zip](https://github.com/sirius-ms/sirius/releases/download/v$siriusFrontendVersion/sirius-$siriusFrontendVersion-osx64-headless.zip)",
"- for Linux (64bit): [zip](https://github.com/sirius-ms/sirius/releases/download/v$siriusFrontendVersion/sirius-$siriusFrontendVersion-linux64-headless.zip)",
"-->", //DISABLED -> enable if needed
""
] as List
Files.deleteIfExists(outfile.toPath())
Files.write(outfile.toPath(), lines, StandardOpenOption.CREATE)
}
}
String cleanVersion = fingeridVersion.toString().replace('-SNAPSHOT', '')
String minorVersion = "${cleanVersion.split('[.]')[0]}.${cleanVersion.split('[.]')[1]}"
tasks.register('refreshTrainingLinks') {
File webPath = getBuildDir().toPath().resolve('tmp/webSite/').toFile()
group = 'publishing'
File outfile = new File(webPath, "sirius-training.md")
outputs.file(outfile)
doLast {
webPath.mkdirs()
List<String> lines = [
"- https://www.csi-fingerid.uni-jena.de/v$minorVersion/api/fingerid/trainingstructures?predictor=1 (training structures for positive ion mode)",
"- https://www.csi-fingerid.uni-jena.de/v$minorVersion/api/fingerid/trainingstructures?predictor=2 (training structures for negative ion mode)"
] as List
Files.deleteIfExists(outfile.toPath())
Files.write(outfile.toPath(), lines, StandardOpenOption.CREATE)
}
}
tasks.register('refreshReadMe') {
inputs.files(refreshDownloadLinks.outputs.files.singleFile, refreshTrainingLinks.outputs.files.singleFile)
outputs.file("${getRootDir()}/README.md")
group = 'publishing'
doFirst {
File dld = inputs.files.getAt(0)
File clg = inputs.files.getAt(1)
File out = outputs.files.singleFile
List<String> links = Files.readAllLines(dld.toPath())
List<String> training = Files.readAllLines(clg.toPath())
Map<String, String> keywords = ['<!--begin download-->': '<!--end download-->', '<!--begin training-->': '<!--end training-->']
Map<String, List<String>> replacements = ['<!--begin download-->': links, '<!--begin training-->': training]
List<String> lines = Files.readAllLines(out.toPath())
List<String> nuLines = new LinkedList<>()
String keyword = null
String keywordEnd = null
lines.each { String line ->
if (line.startsWith("[![Generic badge](https://img.shields.io/badge/Version-")) {
nuLines.add("[![Generic badge](https://img.shields.io/badge/Version-${siriusFrontendVersion.replace("-", "--")}-informational.svg)](https://shields.io/)")
} else if (keyword == null) {
keywordEnd = keywords.get(line)
nuLines.add(line)
if (keywordEnd != null) {
keyword = line
def r = replacements.get(keyword)
nuLines.add('')
nuLines.addAll(r)
}
} else if (line.equals(keywordEnd)) {
nuLines.add('')
nuLines.add(line)
keyword = null
keywordEnd = null
}
}
Files.deleteIfExists(out.toPath())
Files.write(out.toPath(), nuLines, StandardOpenOption.CREATE)
}
}
refreshReadMe.dependsOn refreshTrainingLinks
refreshReadMe.dependsOn refreshDownloadLinks