forked from JabRef/jabref
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
701 lines (592 loc) · 25.2 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
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
import groovy.json.JsonSlurper
import org.gradle.internal.os.OperatingSystem
import org.jabref.build.antlr.JabRefAntlrPlugin
import org.jabref.build.localization.LocalizationPlugin
import org.jabref.build.xjc.XjcPlugin
import org.jabref.build.xjc.XjcTask
// to update the gradle wrapper, execute
// ./gradlew wrapper --gradle-version=4.4.1 --distribution-type=bin
buildscript {
repositories {
mavenLocal()
jcenter()
maven {
url 'https://oss.sonatype.org/content/groups/public'
}
}
}
plugins {
id 'application'
id 'com.gradle.build-scan' version '2.4.1'
id 'com.install4j.gradle' version '8.0.1'
id 'com.github.johnrengelman.shadow' version '5.1.0'
id "com.simonharrer.modernizer" version '1.8.0-1'
id 'me.champeau.gradle.jmh' version '0.4.8'
//id 'net.ltgt.errorprone' version '0.8.1'
id 'com.github.ben-manes.versions' version '0.24.0'
id 'org.javamodularity.moduleplugin' version '1.5.0'
id 'org.openjfx.javafxplugin' version '0.0.8'
id 'org.beryx.jlink' version '2.15.1'
}
// use the gradle build scan feature: https://scans.gradle.com/get-started
buildScan { termsOfServiceUrl = 'https://gradle.com/terms-of-service'; termsOfServiceAgree = 'yes' }
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'project-report'
apply plugin: 'jacoco'
apply plugin: 'install4j'
apply plugin: 'me.champeau.gradle.jmh'
apply plugin: 'checkstyle'
apply plugin: JabRefAntlrPlugin
apply plugin: XjcPlugin
apply plugin: LocalizationPlugin
apply from: 'eclipse.gradle'
group = "org.jabref"
version = "5.0-dev"
project.ext.threeDotVersion = "5.0.0.1"
project.ext.install4jDir = hasProperty("install4jDir") ? getProperty("install4jDir") : (OperatingSystem.current().isWindows() ? 'C:/Program Files/install4j8' : 'install4j8')
sourceCompatibility = 11
targetCompatibility = 11
mainClassName = "org.jabref.JabRefLauncher"
// TODO: Ugly workaround to temporarily ignore build errors to dependencies of latex2unicode
// These should be removed, as well as the files in the lib folder, as soon as they have valid module names
patchModules.config = [
"test=fastparse_2.12-1.0.0.jar",
"test2=fastparse-utils_2.12-1.0.0.jar",
"test3=sourcecode_2.12-0.1.4.jar"
]
// These are the Java version requirements we will check on each start of JabRef
ext.minRequiredJavaVersion = "1.8.0_171"
ext.allowJava9 = true
sourceSets {
main {
java {
srcDirs = ["src/main/java", "src/main/gen"]
}
resources {
srcDirs = ["src/main/java", "src/main/resources"]
}
}
test {
java {
srcDirs = ["src/test/java"]
}
resources {
srcDirs = ["src/test/resources"]
}
}
}
repositories {
mavenLocal()
jcenter()
maven {
url 'https://oss.sonatype.org/content/groups/public'
}
}
configurations {
//errorprone
libreoffice
// TODO: Remove the following workaround for split error messages such as
// error: module java.xml.bind reads package javax.annotation from both jsr305 and java.annotation
compile {
exclude group: "javax.activation"
}
}
javafx {
version = "11.0.2"
modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.web', 'javafx.swing' ]
}
dependencies {
// Include all jar-files in the 'lib' folder as dependencies
compile fileTree(dir: 'lib', includes: ['*.jar'])
compile 'org.apache.pdfbox:pdfbox:2.0.16'
compile 'org.apache.pdfbox:fontbox:2.0.16'
compile 'org.apache.pdfbox:xmpbox:2.0.16'
compile group: 'org.apache.tika', name: 'tika-core', version: '1.22'
// required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635
compile 'org.bouncycastle:bcprov-jdk15on:1.62'
compile 'commons-cli:commons-cli:1.4'
// For Java 9+ compatibility, we include a bundled version of the libreoffice libraries
// See https://bugs.documentfoundation.org/show_bug.cgi?id=117331#c8 for background information
// Use the task bundleLibreOffice to update the bundled jar
//compile "org.libreoffice:juh:6.2.3"
//compile "org.libreoffice:jurt:6.2.3"
//compile "org.libreoffice:ridl:6.2.3"
//compile "org.libreoffice:unoil:6.2.3"
compile 'io.github.java-diff-utils:java-diff-utils:4.0'
compile 'info.debatty:java-string-similarity:1.2.1'
antlr3 'org.antlr:antlr:3.5.2'
compile 'org.antlr:antlr-runtime:3.5.2'
antlr4 'org.antlr:antlr4:4.7.2'
compile 'org.antlr:antlr4-runtime:4.7.2'
compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.4.3'
compile 'org.postgresql:postgresql:42.2.6'
compile ('com.google.guava:guava:28.1-jre') {
// TODO: Remove this as soon as https://github.com/google/guava/issues/2960 is fixed
exclude module: "jsr305"
}
compile group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '1.3.5'
// JavaFX stuff
compile 'de.jensd:fontawesomefx-commons:11.0'
compile 'de.jensd:fontawesomefx-materialdesignfont:1.7.22-11'
compile 'de.saxsys:mvvmfx-validation:1.9.0-SNAPSHOT'
compile 'de.saxsys:mvvmfx:1.8.0'
compile 'org.fxmisc.easybind:easybind:1.0.3'
compile 'org.fxmisc.flowless:flowless:0.6.1'
compile 'org.fxmisc.richtext:richtextfx:0.10.2'
compile group: 'org.glassfish.hk2.external', name: 'jakarta.inject', version: '2.6.1'
compile 'com.jfoenix:jfoenix:9.0.9'
compile 'org.controlsfx:controlsfx:11.0.0'
compile 'org.jsoup:jsoup:1.12.1'
compile 'com.mashape.unirest:unirest-java:1.4.9'
// >1.8.0-beta is required for java 9 compatibility
compile 'org.slf4j:slf4j-api:2.0.0-alpha0'
compile 'org.apache.logging.log4j:log4j-slf4j18-impl:2.12.1'
compile 'org.apache.logging.log4j:log4j-jcl:2.12.1'
compile 'org.apache.logging.log4j:log4j-api:2.12.1'
compile 'org.apache.logging.log4j:log4j-core:2.12.1'
compile 'de.undercouch:citeproc-java:1.0.1'
compile group: 'jakarta.activation', name: 'jakarta.activation-api', version: '1.2.1'
compile group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '2.3.2'
compile group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '2.3.2'
compile ('com.github.tomtung:latex2unicode_2.12:0.2.6') {
exclude module: 'fastparse_2.12'
}
/*
TODO: Reenable error prone as soon as https://github.com/google/error-prone/issues/1210 is fixed
errorprone ('com.google.errorprone:error_prone_core:2.3.2') {
exclude module: "jsr305"
exclude group: 'org.checkerframework', module: 'checker-qual'
exclude group: 'com.google.errorprone', module: 'error_prone_annotation'
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
exclude group: 'com.google.errorprone', module: 'error_prone_check_api'
}
*/
compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '2.4.1'
compile group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '2.4.1'
testCompile 'junit:junit:4.12'
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.1'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.5.1'
testCompile 'org.junit.platform:junit-platform-launcher:1.5.1'
testCompile 'net.bytebuddy:byte-buddy-parent:1.10.1'
testRuntime 'org.apache.logging.log4j:log4j-core:2.12.0'
testRuntime 'org.apache.logging.log4j:log4j-jul:2.12.1'
testCompile 'org.mockito:mockito-core:3.0.0'
//testCompile 'com.github.tomakehurst:wiremock:2.24.1'
testCompile ('org.reflections:reflections:0.9.11') {
exclude module: "jsr305"
}
testCompile 'org.xmlunit:xmlunit-core:2.6.3'
testCompile 'org.xmlunit:xmlunit-matchers:2.6.3'
testCompile 'com.tngtech.archunit:archunit-junit5-api:0.11.0'
//testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.11.0'
testCompile 'com.tngtech.archunit:archunit-junit5-api:0.11.0'
testCompile "org.testfx:testfx-core:4.0.15-alpha"
testCompile "org.testfx:testfx-junit5:4.0.15-alpha"
checkstyle 'com.puppycrawl.tools:checkstyle:8.24'
xjc 'com.sun.xml.bind:jaxb-xjc:2.2.4-1'
jython 'org.python:jython-standalone:2.7.1'
}
jacoco {
toolVersion = '0.8.3'
}
dependencyUpdates {
outputFormatter = "json"
}
// We have some dependencies which cannot be updated due to various reasons.
dependencyUpdates.resolutionStrategy = {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'snapshot', 'beta', 'rc', 'cr', 'm', 'preview', 'b', 'ea'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]$qualifier[.\d-+]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
rules.withModule("com.github.tomtung:latex2unicode_2.12") { ComponentSelection selection ->
if (selection.candidate.version ==~ /0.2.*/) {
// Reject version higher than 2.0.2. see https://github.com/JabRef/jabref/pull/3781
selection.reject("Cannot be updated to 0.2.4 until JabRef is prepared for it")
}
}
rules.withModule("com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin") { ComponentSelection selection ->
if (selection.candidate.version ==~ /4.*/) {
selection.reject("Version 4.X breaks the release process.")
}
}
rules.withModule("com.google.errorprone:error_prone_core") { ComponentSelection selection ->
if (selection.candidate.version ==~ /2.3.3/) {
selection.reject("Does not work due to bug https://github.com/google/error-prone/issues/1240")
}
}
}
}
task checkOutdatedDependencies(dependsOn: dependencyUpdates) {
doLast {
def dependencyReport = new JsonSlurper().parseText(new File("build/dependencyUpdates/report.json").text)
assert dependencyReport.outdated.count == 0: "There are outdated dependencies in build.gradle!\n Run ./gradlew dependencyUpdates to see which"
}
}
clean {
delete "src/main/gen"
}
processResources {
filteringCharset = 'UTF-8'
filesMatching("build.properties") {
expand(version: project.version,
"year": String.valueOf(Calendar.getInstance().get(Calendar.YEAR)),
"authors": new File('AUTHORS').readLines().findAll { !it.startsWith("#") }.join(", "),
"developers": new File('DEVELOPERS').readLines().findAll { !it.startsWith("#") }.join(", "),
"azureInstrumentationKey": System.getenv('AzureInstrumentationKey'),
"minRequiredJavaVersion": minRequiredJavaVersion,
"allowJava9": allowJava9
)
filteringCharset = 'UTF-8'
}
filesMatching("resource/**/meta.xml") {
expand version: project.version
}
}
task generateSource(dependsOn: ["generateBstGrammarSource",
"generateSearchGrammarSource",
"generateMedlineSource",
"generateBibtexmlSource",
"generateEndnoteSource",
"generateModsSource"]) {
group = 'JabRef'
description 'Generates all Java source files.'
}
task generateBstGrammarSource(type: org.jabref.build.antlr.AntlrTask) {
group = "JabRef"
description = 'Generates BstLexer.java and BstParser.java from the Bst.g grammar file using antlr3.'
antlr = ANTLR3
inputFile = 'src/main/antlr3/org/jabref/bst/Bst.g'
outputDir = 'src/main/gen/org/jabref/logic/bst/'
}
task generateSearchGrammarSource(type: org.jabref.build.antlr.AntlrTask) {
group = 'JabRef'
description = "Generates java files for Search.g antlr4."
antlr = ANTLR4
inputFile = "src/main/antlr4/org/jabref/search/Search.g4"
outputDir = "src/main/gen/org/jabref/search"
javaPackage = "org.jabref.search"
}
task generateMedlineSource(type: XjcTask) {
group = 'JabRef'
description = "Generates java files for the medline importer."
schemaFile = "src/main/resources/xjc/medline/medline.xsd"
outputDirectory = "src/main/gen/"
javaPackage = "org.jabref.logic.importer.fileformat.medline"
}
task generateBibtexmlSource(type: XjcTask) {
group = 'JabRef'
description = "Generates java files for the bibtexml importer."
schemaFile = "src/main/resources/xjc/bibtexml/bibtexml.xsd"
outputDirectory = "src/main/gen"
javaPackage = "org.jabref.logic.importer.fileformat.bibtexml"
}
task generateEndnoteSource(type: XjcTask) {
group = 'JabRef'
description = "Generates java files for the endnote importer."
schemaFile = "src/main/resources/xjc/endnote/RSXML.dtd"
outputDirectory = "src/main/gen/"
javaPackage = "org.jabref.logic.importer.fileformat.endnote"
arguments = '-dtd'
}
task generateModsSource(type: XjcTask) {
group = 'JabRef'
description = "Generates java files for the mods importer."
schemaFile = "src/main/resources/xjc/mods/mods-3-7.xsd"
bindingFile = "src/main/resources/xjc/mods/mods-binding.xjb"
outputDirectory = "src/main/gen/"
javaPackage = "org.jabref.logic.importer.fileformat.mods"
arguments = '-npa'
}
tasks.withType(JavaCompile) {
// use UTF-8
options.encoding = 'UTF-8'
// ignore annotation processor from log4j2
options.compilerArgs += '-proc:none'
}
compileJava {
options.compilerArgs << "-Xlint:none"
dependsOn "generateSource"
moduleOptions {
// TODO: Remove access to internal api
addExports = [
'javafx.controls/com.sun.javafx.scene.control' : 'org.jabref',
'org.controlsfx.controls/impl.org.controlsfx.skin' : 'org.jabref'
]
}
}
run {
// TODO: Remove access to internal api
jvmArgs '--add-exports', 'javafx.controls/com.sun.javafx.scene.control=org.jabref',
'--add-exports', 'org.controlsfx.controls/impl.org.controlsfx.skin=org.jabref',
'--add-opens', 'javafx.controls/javafx.scene.control=org.jabref',
'--add-opens', 'org.controlsfx.controls/org.controlsfx.control.textfield=org.jabref',
// Not sure why we need to restate the controlfx exports
// Taken from here: https://github.com/controlsfx/controlsfx/blob/9.0.0/build.gradle#L1
"--add-exports", "javafx.graphics/com.sun.javafx.scene=org.controlsfx.controls",
"--add-exports", "javafx.graphics/com.sun.javafx.scene.traversal=org.controlsfx.controls",
"--add-exports", "javafx.graphics/com.sun.javafx.css=org.controlsfx.controls",
"--add-exports", "javafx.controls/com.sun.javafx.scene.control.behavior=org.controlsfx.controls",
"--add-exports", "javafx.controls/com.sun.javafx.scene.control=org.controlsfx.controls",
"--add-exports", "javafx.controls/com.sun.javafx.scene.control.inputmap=org.controlsfx.controls",
"--add-exports", "javafx.base/com.sun.javafx.event=org.controlsfx.controls",
"--add-exports", "javafx.base/com.sun.javafx.collections=org.controlsfx.controls",
"--add-exports", "javafx.base/com.sun.javafx.runtime=org.controlsfx.controls",
"--add-exports", "javafx.web/com.sun.webkit=org.controlsfx.controls",
"--add-exports", "javafx.graphics/com.sun.javafx.css=org.controlsfx.controls",
"--add-opens", "javafx.controls/javafx.scene.control.skin=org.controlsfx.controls",
"--add-opens", "javafx.graphics/javafx.scene=org.controlsfx.controls"
// TODO: The following code should have the same affect as the above one, but doesn't work for some reason
// https://github.com/java9-modularity/gradle-modules-plugin/issues/89
moduleOptions {
addExports = [
'javafx.controls/com.sun.javafx.scene.control' : 'org.jabref',
'org.controlsfx.controls/impl.org.controlsfx.skin' : 'org.jabref'
]
addOpens = [
'javafx.controls/javafx.scene.control' : 'org.jabref',
'org.controlsfx.controls/org.controlsfx.control.textfield' : 'org.jabref'
]
}
}
javadoc {
options {
encoding = 'UTF-8'
version = true
author = true
}
}
localization.script = 'scripts/syncLang.py'
// Test tasks
test {
useJUnitPlatform {
excludeTags 'DatabaseTest', 'FetcherTest', 'GUITest', 'org.jabref.testutils.category.FetcherTest', 'org.jabref.testutils.category.GUITest'
}
testLogging {
// set options for log level LIFECYCLE
events "failed"
exceptionFormat "full"
}
}
task databaseTest(type: Test) {
useJUnit {
includeCategories 'org.jabref.testutils.category.DatabaseTest'
}
}
task fetcherTest(type: Test) {
useJUnit {
includeCategories 'org.jabref.testutils.category.FetcherTest'
}
}
task guiTest(type: Test) {
useJUnit {
includeCategories 'org.jabref.testutils.category.GUITest'
}
}
// Test result tasks
task copyTestResources(type: Copy) {
from "${projectDir}/src/test/resources"
into "${buildDir}/classes/test"
}
processTestResources.dependsOn copyTestResources
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
jacoco {
append = true
}
}
task jacocoMerge(type: JacocoMerge) {
executionData file("$buildDir/jacoco/test.exec"), file("$buildDir/jacoco/databaseTest.exec"), file("$buildDir/jacoco/fetcherTest.exec")
dependsOn test, databaseTest, fetcherTest
}
jacocoTestReport {
executionData jacocoMerge.destinationFile
dependsOn jacocoMerge
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}
// Code quality tasks
checkstyle {
// will only run when called explicitly from the command line
sourceSets = []
}
modernizer {
// We have more than 20 issues, which are not fixed yet. Nevertheless, we produce the modernizer output.
// See https://github.com/andrewgaul/modernizer-maven-plugin for more information on modernizer
failOnViolations = false
}
// Release tasks
shadowJar {
transform(com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer)
classifier 'fat'
zip64 true
}
/*
* Changes project.version to VERSION--snapshot--DATE--GIT_HASH
*/
if (hasProperty('dev')) {
String command = "git log --pretty=format:%cd--%h -n 1 --date=short"
String commitInfo = ""
if (OperatingSystem.current().isWindows()) {
commitInfo = "cmd /c $command".execute().in.text
} else {
commitInfo = command.execute().in.text
}
// determine branch
command = "git symbolic-ref -q --short HEAD"
String branchName = ""
if (OperatingSystem.current().isWindows()) {
branchName = "cmd /c $command".execute().in.text
} else {
branchName = command.execute().in.text
}
// A newline is returned. Remove it. (trim())
// In the context of github, the branch name could be something like "pull/277"
// "/" is an illegal character. To be safe, all illegal filename characters are replaced by "_"
// http://stackoverflow.com/a/15075907/873282 describes the used pattern.
branchName = branchName.trim().replaceAll("[^a-zA-Z0-9.-]", "_")
// hack string
// first the date (%cd), then the branch name, and finally the commit id (%h)
String infoString = commitInfo.substring(0, 10) + "--" + branchName + "--" + commitInfo.substring(12)
project.version += "--snapshot--" + infoString
}
install4j {
installDir = file(project.ext.install4jDir)
}
task generateFinalJabRefPS1File(type: Copy) {
from('buildres') {
include 'JabRef.ps1'
}
into 'build'
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [jabRefJarFileName: jar.archiveName])
}
// has to be defined AFTER 'dev' things to have the correct project.version
task media(type: com.install4j.gradle.Install4jTask, dependsOn: ["releaseJar", "generateFinalJabRefPS1File"]) {
projectFile = file('jabref.install4j')
release = project.version
winKeystorePassword = System.getenv('CERTIFICATE_PW')
macKeystorePassword = System.getenv('CERTIFICATE_PW')
variables = [
versionFourDots: project.ext.threeDotVersion,
buildFileName : jar.archiveName,
version : project.version
]
doLast {
copy {
from "build/install4j"
into "build/releases"
}
}
}
task release(dependsOn: ["media", "releaseJar"]) {
group = 'JabRef - Release'
description 'Creates a release for all target platforms.'
}
task releaseJar(dependsOn: "shadowJar") {
group = 'JabRef - Release'
description "Creates a Jar release."
doLast {
copy {
from("$buildDir/libs/JabRef-${project.version}-fat.jar")
into("$buildDir/releases")
rename { String fileName ->
fileName.replace('-fat', '')
}
}
// set executable with read permissions (first true) and for all (false)
file("$buildDir/releases/JabRef-${project.version}.jar").setExecutable(true, false)
}
}
task snapJar(dependsOn: "releaseJar", type: Delete) {
delete fileTree(dir: "$buildDir/releases/", exclude: "JabRef-${project.version}.jar")
}
jlink {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
launcher {
name = 'JabRefMain'
}
addOptions("--bind-services")
// TODO: Remove the following as soon as the dependencies are fixed (upstream)
// forceMerge is usually needed when some non-modular artifacts in the dependency graph use code that was previously part of the JDK
// but it was removed in the newer releases.
// The pom.xml associated with such a non-modular artifact does not mention that the artifact depends on the removed code
// (because the artifact was published when this code was still available in the JDK).
forceMerge "javafx"
forceMerge "controlsfx", "bcprov", "jaxb", "istack", "stax", "log4j"
// TODO: Remove the following correction to the merged module
// The module descriptor automatically generated by the plugin for the merged module contained some invalid entries.
// Execute ./gradlew suggestMergedModuleInfo and include the incorrect directives here.
mergedModule {
requires 'java.logging'
requires 'jdk.xml.dom'
requires 'java.sql'
requires 'java.rmi'
requires 'java.xml'
requires 'com.sun.xml.txw2'
requires 'java.desktop'
requires 'java.security.jgss'
requires 'jdk.jsobject'
requires 'jdk.unsupported'
requires 'java.management'
requires 'java.naming'
requires 'jdk.unsupported.desktop'
requires 'java.security.sasl'
requires 'java.scripting'
requires 'java.datatransfer'
requires 'java.compiler'
requires 'java.transaction.xa'
requires 'com.sun.xml.fastinfoset'
requires 'org.slf4j'
uses 'com.airhacks.afterburner.injection.PresenterFactory'
uses 'org.controlsfx.glyphfont.GlyphFont'
uses 'com.airhacks.afterburner.views.ResourceLocator'
provides 'java.sql.Driver' with 'org.postgresql.Driver'
provides 'org.controlsfx.glyphfont.GlyphFont' with 'org.controlsfx.glyphfont.FontAwesome'
provides 'org.apache.commons.logging.LogFactory' with 'org.apache.logging.log4j.jcl.LogFactoryImpl'
provides 'org.slf4j.spi.SLF4JServiceProvider' with 'org.apache.logging.slf4j.SLF4JServiceProvider'
provides 'com.microsoft.applicationinsights.core.dependencies.io.grpc.ServerProvider' with 'com.microsoft.applicationinsights.core.dependencies.io.grpc.netty.shaded.io.grpc.netty.NettyServerProvider'
provides 'com.microsoft.applicationinsights.core.dependencies.io.grpc.NameResolverProvider' with 'com.microsoft.applicationinsights.core.dependencies.io.grpc.internal.DnsNameResolverProvider'
provides 'java.security.Provider' with 'org.bouncycastle.jce.provider.BouncyCastleProvider', 'org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider'
provides 'com.microsoft.applicationinsights.core.dependencies.io.grpc.ManagedChannelProvider' with 'com.microsoft.applicationinsights.core.dependencies.io.grpc.netty.shaded.io.grpc.netty.NettyChannelProvider'
}
// This is experimental thing; could replace install4j
jpackage {
// Download from https://jdk.java.net/jpackage/ and change path accordingly
jpackageHome = 'H:\\Downloading\\openjdk-13-jpackage+49_windows-x64_bin\\jdk-13'
}
}
jmh {
warmupIterations = 5
iterations = 10
fork = 2
}
// Source: https://stackoverflow.com/a/44168582/873282
task downloadDependencies {
description "Pre-downloads *most* dependencies"
doLast {
configurations.getAsMap().each { name, config ->
println "Retrieving dependencies for $name"
try {
config.files
} catch (e) {
// some cannot be resolved, just log them
project.logger.info e.message
}
}
}
}
task bundleLibreOffice(type: Jar) {
from configurations.libreoffice.collect { zipTree it }
manifest {
attributes 'Automatic-Module-Name': 'org.jabref.thirdparty.libreoffice'
}
destinationDir = file('lib')
archiveName = 'libreoffice.jar'
}