forked from PCGen/pcgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
739 lines (636 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
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
/*
* PCGen build using the Gradle tool. This file specifies the core build tasks
* and refers to other files in the code/gradle directory for additional tasks
* for specific output.
*
* Developer build: gradle
* Incremental dev build: gradle build
* Full build: gradle all
* Build and run all tests: gradle clean build slowtest
* Run the data tests: gradle datatest
* Run the character integration tests: gradle inttest
*/
// import Ant helper static values to differ system families
import org.apache.tools.ant.filters.FixCrLfFilter
import org.apache.tools.ant.taskdefs.condition.Os
plugins {
id 'eclipse'
id 'application'
id 'build-dashboard'
id 'checkstyle'
id "com.github.spotbugs" version '4.5.1'
id 'java'
id 'maven-publish'
id 'pmd'
id 'idea'
id "de.undercouch.download" version '4.1.1'
id 'edu.sc.seis.launch4j' version '2.4.8'
id 'com.github.ben-manes.versions' version '0.33.0'
id "com.dorongold.task-tree" version '1.5'
id 'org.openjfx.javafxplugin' version '0.0.9'
id 'org.beryx.runtime' version '1.11.4'
}
javafx {
version = "14.0.1"
modules = [ 'javafx.controls', 'javafx.web', 'javafx.swing', 'javafx.fxml', 'javafx.graphics' ]
//Check if running in ide. If so bundles javafx in to jar. If not only compiles so that runtime can add different platform javafx later.
//Also allows for gradle property which if true will force the single platforms javafx to be bundled to create local build. Can be added in command line with "-PlocalOnly=true."
if (!System.getProperty('idea.active') && !(localOnly.toBoolean())) {
configuration = "compileOnly"
}
}
group = 'net.sourceforge.pcgen'
description = """PCGen"""
defaultTasks 'build'
sourceCompatibility = "1.11"
targetCompatibility = "1.11"
ext {
binDir = "code/bin"
//Folder where the build stuff is placed.
outputDir = "$projectDir/output"
//Installer is placed here
releaseDir = "${buildDir}/release"
}
//The gradle plugin for netbeans sets the 'mainClass' property instead of 'mainClassName'
//if other IDEs set different properties when trying to execute a given class
//feel free to add them here.
mainClassName = project.hasProperty('mainClass') ? mainClass : 'pcgen.system.Main';
repositories {
mavenCentral()
ivy {
url "http://pcgen.sourceforge.net/mvnrepo"
allowInsecureProtocol = true
patternLayout {
artifact "[organisation]/jars/[artifact]-[revision].[ext]"
}
}
ivy {
name "fileRepo"
url 'http://pc-gen.org/librepo/'
allowInsecureProtocol = true
}
maven {
url "https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/"
}
jcenter()
}
sourceSets {
main {
java {
srcDirs 'code/src/java'
}
resources {
srcDirs = ['code/src/resources']
}
}
test {
java {
srcDirs = ['code/src/utest', 'code/src/testcommon']
}
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
resources {
srcDirs = ['code/src/testResources']
}
}
itest {
java {
srcDirs = ['code/src/itest', 'code/src/testcommon']
}
resources {
srcDirs = ['code/src/testResources']
}
compileClasspath += sourceSets.test.compileClasspath
runtimeClasspath += sourceSets.test.runtimeClasspath
}
slowtest {
java {
srcDirs = ['code/src/test', 'code/src/testcommon']
}
resources {
srcDirs = ['code/src/testResources']
}
compileClasspath += sourceSets.test.compileClasspath
runtimeClasspath += sourceSets.test.runtimeClasspath
}
}
/* Copy 'master' outputsheets into different genre folders */
task copyMasterSheets(type: Copy) {
outputs.upToDateWhen { false }
include 'eqsheet_fantasy_std.htm'
include 'psheet_fantasy_std.htm'
from 'outputsheets/d20/fantasy/htmlxml'
into 'outputsheets/d20/historical/htmlxml'
into ('../../horror/htmlxml') {
from 'outputsheets/d20/fantasy/htmlxml'
}
into ('../../sciencefiction/htmlxml') {
from 'outputsheets/d20/fantasy/htmlxml'
}
into ('../../western/htmlxml') {
from 'outputsheets/d20/fantasy/htmlxml'
}
}
compileJava {
it.dependsOn 'copyMasterSheets'
}
/*
* For information on the exclude group items in this section, and why these are necessary to have Eclipse properly compile PCGen, please see the following items:
* https://bugs.openjdk.java.net/browse/JDK-8215739
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=536928
* https://stackoverflow.com/questions/51094274/eclipse-cant-find-xml-related-classes-after-switching-build-path-to-jdk-10/53824670#53824670
* https://docs.gradle.org/current/userguide/dependency_downgrade_and_exclude.html
*/
dependencies {
implementation group: 'commons-io', name: 'commons-io', version:'2.8.0'
implementation group: 'org.springframework', name: 'spring-web', version:'5.2.9.RELEASE'
implementation group: 'org.springframework', name: 'spring-beans', version:'5.2.9.RELEASE'
implementation group: 'org.springframework', name: 'spring-core', version:'5.2.9.RELEASE'
implementation group: 'org.springframework', name: 'spring-web', version:'5.2.9.RELEASE'
implementation group: 'org.springframework', name: 'spring-beans', version:'5.2.9.RELEASE'
implementation group: 'org.springframework', name: 'spring-core', version:'5.2.9.RELEASE'
implementation group: 'org.apache.commons', name: 'commons-lang3', version:'3.11'
compile('org.apache.xmlgraphics:fop:2.5')
{
exclude group: 'xml-apis', module: 'xml-apis'
}
implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
implementation group: 'org.scijava', name: 'jep', version:'2.4.2'
implementation group: 'org.freemarker', name: 'freemarker', version:'2.3.30'
implementation group: 'org.jdom', name: 'jdom2', version:'2.0.6'
implementation('xalan:xalan:2.7.2')
{
exclude group: 'xml-apis', module: 'xml-apis'
}
implementation group: 'net.sourceforge.argparse4j', name: 'argparse4j', version: '0.8.1'
implementation group: 'org.xmlunit', name: 'xmlunit-core', version:'2.7.0'
implementation group: 'org.controlsfx', name: 'controlsfx', version:'11.0.2'
implementation group: 'net.sourceforge.pcgen', name: 'PCGen-base', version:'1.0.170'
implementation group: 'net.sourceforge.pcgen', name: 'PCGen-Formula', version:'1.0.200'
compileOnly group: 'org.jetbrains', name: 'annotations', version:'20.1.0'
compileOnly group: 'com.yuvimasory', name: 'orange-extensions', version: '1.3.0'
compileOnly group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: '3.1.12'
testImplementation group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.7.0'
testImplementation group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.7.0'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.7.0'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.7.0'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.7.0'
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2'
testImplementation group: 'org.testfx', name: 'testfx-junit5', version: '4.0.16-alpha'
testImplementation group: 'org.testfx', name: 'openjfx-monocle', version: 'jdk-12.0.1+2'
testImplementation group: 'org.xmlunit', name: 'xmlunit-matchers', version:'2.7.0'
}
ant.importBuild 'build-gradle.xml'
ant.properties['src.java.dir']="code/src/java"
ant.properties['build.classes.dir']="build/classes/java/main"
configure('jar-all-plugins') {
group = BasePlugin.BUILD_GROUP // Or use 'build'
description = 'Create the plugin jars'
}
ext {
classpath = ""
configurations.runtimeClasspath.each { lib -> classpath += " libs/${lib.name} "}
}
jar {
it.dependsOn 'jar-all-plugins'
manifest {
attributes 'Implementation-Title': 'PCGen', 'Implementation-Version': archiveVersion,
'Main-Class': 'pcgen.system.Main', 'Class-Path': classpath
}
from {
configurations.runtimeClasspath.collect { it.directory ? it : zipTree(it) }
}
}
runtime {
options = ['--compress', '2']
modules = [
'jdk.httpserver',
'java.rmi',
'java.desktop',
'java.xml',
'java.sql',
'jdk.unsupported',
'java.prefs',
'java.logging',
'java.naming',
'jdk.xml.dom',
'jdk.unsupported.desktop',
'java.datatransfer',
'java.scripting',
'jdk.jfr',
'jdk.jsobject',
'javafx.controls',
'javafx.web',
'javafx.swing',
'javafx.fxml',
'javafx.graphics'
]
targetPlatform('linux-x64', "$projectDir/jre/linux/jre_x64")
targetPlatform('windows-x64', "$projectDir/jre/windows/jre_x64")
targetPlatform('windows-x32', "$projectDir/jre/windows/jre_x32")
targetPlatform('mac-x64', "$projectDir/jre/mac/jre_x64/Contents/Home")
jpackage{
installerOptions = ["--app-version", "${version.replaceAll('-SNAPSHOT', '')}","--license-file", "${projectDir}/code/LICENSE"]
if (Os.isFamily(Os.FAMILY_MAC))
{
targetPlatformName = 'mac-x64'
installerOptions += ["--mac-package-identifier", "PcGen", "--mac-package-name", "PcGen"]
resourceDir = file("${projectDir}/installers/mac-installer")
}
else {
targetPlatformName = 'linux-x64'
installerOptions += ['--linux-shortcut']
}
imageName = "PcGen"
}
}
tasks.jpackageImage.doLast {
copy {
includeEmptyDirs = false
from "${buildDir}/install/pcgen/"
exclude "**/*.exe"
exclude "**/*.bat"
exclude "pcgen"
exclude "**/lib/**"
if (Os.isFamily(Os.FAMILY_MAC)){
into "build/jpackage/PcGen.app/Contents/MacOS"
}
else {
into "build/jpackage/PcGen/bin"
}
}
if (Os.isFamily(Os.FAMILY_MAC)){
copy {
from "${projectDir}/installers/mac-installer"
include "MacDirLauncher"
fileMode 0755
into "${buildDir}/jpackage/PcGen.app/Contents/MacOS"
}
ant.replace(file: "${buildDir}/jpackage/PcGen.app/Contents/Info.plist", token: "<key>CFBundleExecutable</key>\n <string>PcGen</string>", value: "<key>CFBundleExecutable</key>\n <string>MacDirLauncher</string>")
}
}
task converterJar(type: Jar, dependsOn: jar) {
manifest {
attributes 'Implementation-Title': 'PCGen Data Converter', 'Implementation-Version': archiveVersion,
'Main-Class': 'pcgen.gui2.converter.PCGenDataConvert', 'Class-Path': 'pcgen.jar' + classpath
}
archiveClassifier.set('batch-convert')
from {
configurations.runtimeClasspath.collect { it.directory ? it : zipTree(it) }
}
from sourceSets.main.output
include 'none'
}
artifacts {
archives converterJar
}
task copyToLibs(type: Copy) {
into "$buildDir/libs"
from configurations.runtime
}
task copyToOutput(type: Copy, dependsOn: [createExe, copyToLibs, jar,
converterJar]) {
from "$buildDir/libs/pcgen-${version}.jar"
from "$buildDir/libs/pcgen-${version}-batch-convert.jar"
from "$buildDir/launch4j/pcgen.exe"
from "$projectDir/code/pcgen.bat"
from("$projectDir/code/pcgen.sh") {
filter(FixCrLfFilter, eol:FixCrLfFilter.CrLf.newInstance("lf"))
fileMode 0755
}
into outputDir
rename "(.+)-$version(.+)", '$1$2'
}
task qbuild(type: Copy, dependsOn: [copyToOutput, jar]) {
description="Copy the executable file into 'output' to create a working environment"
from "$buildDir/libs/pcgen-${version}.jar"
into outputDir
rename "(.+)-$version(.+)", '$1$2'
mustRunAfter clean
}
task cleanOutput(type: Delete) {
description="Clean up things copied to the output folder by the build"
delete outputDir
}
// Alias tasks
tasks.register("buildonly") {
dependsOn 'copyToOutput'
}
tasks.register("quickbuild") {
dependsOn 'copyToOutput', 'test'
}
build {
it.dependsOn 'copyToOutput'
}
clean {
it.dependsOn 'clean-plugins'
it.dependsOn 'cleanOutput'
}
//Ensures that clean is never run after build and when clean is called it is run before build so it doesn't delete the new build folder.
build.mustRunAfter clean
task downloadJRE {
def major = 14
def archs = ['x64','x32']
def osList = ['windows', 'mac','linux']
def extension = 'zip'
osList.each{
def os = "${it}"
if(os != "windows") {
extension = 'tar.gz'
}
archs.each {
def arch = "${it}"
if (arch == "x32" && os != "windows") return
def url = "https://api.adoptopenjdk.net/v3/binary/latest/${major}/ga/${os}/${arch}/jdk/hotspot/normal/adoptopenjdk"
def jreDir = new File("${projectDir}/jre/${os}/jre_${arch}")
if(!jreDir.exists()){
//Only download Windows libraries. Need to add more OS if we go multi OS at any time.
println("Downloading Java ${major} ${arch} for ${os} from ${url}")
download {
src url
dest new File("${projectDir}/jre/${os}/", "jre_${arch}.${extension}")
overwrite false
}
//Now untar them
if(extension == "zip"){
fileTree(dir: "${projectDir}/jre/${os}/").include("*.${extension}").each { simLib ->
copy {
println "Unzip $simLib.name"
def zipFile = file("${projectDir}/jre/${os}/${simLib.name}")
def outputDir = "${projectDir}/jre/${os}/jre_${arch}/"
from zipTree(zipFile)
into outputDir
eachFile { fcd ->
def relPath = fcd.relativePath
if(relPath.lastName.startsWith("jdk-") && fcd.isDirectory()) {
fcd.exclude()
} else {
def segments = relPath.segments
fcd.relativePath = new RelativePath( !fcd.isDirectory() ,(segments[1..-1]) as String[] )
}
}
}
new File("${projectDir}/jre/${os}/${simLib.name}").delete()
}
} else {
fileTree(dir: "${projectDir}/jre/${os}/").include("*.${extension}").each { simLib ->
copy {
println "Unzip $simLib.name"
def name = simLib.name - '.$extension'
def zipFile = file("${projectDir}/jre/${os}/${simLib.name}")
def outputDir = "${projectDir}/jre/${os}/jre_${arch}/"
from tarTree(zipFile)
into outputDir
eachFile { fcd ->
def relPath = fcd.relativePath
if(relPath.lastName.startsWith("jdk-") && fcd.isDirectory()) {
fcd.exclude()
} else {
def segments = relPath.segments
fcd.relativePath = new RelativePath( !fcd.isDirectory() ,(segments[1..-1]) as String[] )
}
}
}
new File("${projectDir}/jre/${os}/${simLib.name}").delete()
}
}
file("${projectDir}/jre/${os}/jre_${arch}").list().each { f->
if(f.startsWith("jdk")) {
file("${projectDir}/jre/${os}/jre_${arch}/"+f).deleteDir()
}
}
}
}
}
}
task downloadJavaFXModules(dependsOn: downloadJRE) {
def major = "14-0-1"
def archs = ['x64', 'x86']
def osList = ["windows", "mac", "linux"]
//Downloads javafx .mods for custom runtime image. All platforms downloaded
osList.each {
def os = "${it}"
archs.each {
def arch = "$it"
def archAppend = ""
if ((arch == "x86")) {
if (os == "windows") {
archAppend = "-x86"
} else {
return
}
}
def url = "https://gluonhq.com/download/javafx-${major}-jmods-${os}${archAppend}/"
def jmodsDir = new File("${projectDir}/jre/${os}/jre_${arch}/jmods")
def jmodsZip = new File("${projectDir}/jre/${os}/jmods${arch}.zip")
if (!jmodsZip.exists()) {
println("Downloading Javafx mods ${major} ${arch} for ${os} from ${url}")
download {
src url
dest new File("${projectDir}/jre/${os}/", "jmods${arch}.zip")
overwrite false
}
//fileTree(dir: "${projectDir}/jre/${os}/").include("*.zip").each { simLib ->
copy {
println "Unzip jmods${arch}.zip"
def zipFile = file("${projectDir}/jre/${os}/jmods${arch}.zip")
def outputDir = "${projectDir}/jre/${os}/jre_${arch}/jmods"
if (os=="mac")
{
outputDir = "${projectDir}/jre/${os}/jre_${arch}/Contents/Home/jmods"
}
else if(os=="windows" && arch=="x86")
{
outputDir = "${projectDir}/jre/${os}/jre_x32/jmods"
}
from zipTree(zipFile)
into outputDir
eachFile { fcd ->
def relPath = fcd.relativePath
def segments = relPath.segments
fcd.relativePath = new RelativePath(!fcd.isDirectory(), (segments[1..-1]) as String[])
}
}
//new File("${projectDir}/jre/${os}/${simLib.name}").delete()
//}
}
}
}
//Downloads javafx sdk for local platform. Used for running tests.
def sdkDir = new File("${projectDir}/mods")
if (!sdkDir.exists()) {
def os=""
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
os = "windows"
} else if (Os.isFamily(Os.FAMILY_MAC)) {
os = "mac"
} else {
os = "linux"
}
def url = "https://gluonhq.com/download/javafx-${major}-sdk-${os}/"
println("Downloading JavaFX sdk for ${os} from ${url}")
download {
src url
dest new File("${projectDir}/mods", "javaFXSdk-${os}.zip")
overwrite false
}
copy {
println "Unzip javaFXSdk-${os}.zip"
def zipFile = file("${projectDir}/mods/javaFXSdk-${os}.zip")
def outputDir = "${projectDir}/mods"
from zipTree(zipFile)
into outputDir
eachFile { fcd ->
def relPath = fcd.relativePath
def segments = relPath.segments
fcd.relativePath = new RelativePath(!fcd.isDirectory(), (segments[1..-1]) as String[])
}
}
}
}
compileJava.dependsOn(downloadJavaFXModules)
tasks.runtime.dependsOn(downloadJavaFXModules)
test {
exclude 'pcgen/testsupport/**'
useJUnitPlatform()
}
task itest(type: Test, dependsOn: [jar]) {
useJUnitPlatform()
testClassesDirs = sourceSets.itest.output.classesDirs
classpath = sourceSets.itest.runtimeClasspath
systemProperties['jar.path'] = jar.getArchiveFile().get().getAsFile()
}
task slowtest(type: Test, dependsOn: ['jar', 'itest']) {
useJUnitPlatform()
testClassesDirs = sourceSets.slowtest.output.classesDirs
classpath = sourceSets.slowtest.runtimeClasspath
systemProperties['jar.path'] = jar.getArchiveFile().get().getAsFile()
forkEvery = 1
// Exclude the two suites to avoid duplicate test runs.
exclude 'AllJUnitTests.class'
exclude 'pcgen/core/AllJUnitTests.class'
}
task datatest(type: Test, dependsOn: 'jar') {
testClassesDirs = sourceSets.slowtest.output.classesDirs
classpath = sourceSets.slowtest.runtimeClasspath
include 'pcgen/persistence/lst/DataTest.class'
include 'pcgen/persistence/lst/DataLoadTest.class'
}
task inttest(type: Test, dependsOn: 'jar') {
testClassesDirs = sourceSets.slowtest.output.classesDirs
classpath = sourceSets.slowtest.runtimeClasspath
forkEvery = 1
include 'pcgen/inttest/**/*Test.class'
}
task sfinttest(type: Test, dependsOn: 'jar') {
testClassesDirs = sourceSets.slowtest.output.classesDirs
classpath = sourceSets.slowtest.runtimeClasspath
forkEvery = 1
include 'pcgen/inttest/game_starfinder/*Test.class'
}
task pfinttest(type: Test, dependsOn: 'jar') {
testClassesDirs = sourceSets.slowtest.output.classesDirs
classpath = sourceSets.slowtest.runtimeClasspath
forkEvery = 1
include 'pcgen/inttest/game_pathfinder/*Test.class'
}
task rsrdinttest(type: Test, dependsOn: 'jar') {
testClassesDirs = sourceSets.slowtest.output.classesDirs
classpath = sourceSets.slowtest.runtimeClasspath
forkEvery = 1
include 'pcgen/inttest/game_35e/*Test.class'
}
task srdinttest(type: Test, dependsOn: 'jar') {
testClassesDirs = sourceSets.slowtest.output.classesDirs
classpath = sourceSets.slowtest.runtimeClasspath
forkEvery = 1
include 'pcgen/inttest/game_3e/*Test.class'
}
task msrdinttest(type: Test, dependsOn: 'jar') {
testClassesDirs = sourceSets.slowtest.output.classesDirs
classpath = sourceSets.slowtest.runtimeClasspath
forkEvery = 1
include 'pcgen/inttest/game_modern/*Test.class'
}
// Do the lot!
task all(dependsOn: ['build', 'slowtest', 'javadoc', 'buildNsis', 'allReports']) {
}
allprojects {
tasks.withType(Javadoc) {
options.addBooleanOption('Xdoclint:none', true)
}
tasks.withType(Test) {
maxHeapSize = "512m"
maxParallelForks = 1
enableAssertions = true
testLogging {
exceptionFormat = 'full'
events 'failed', 'skipped'
}
jvmArgs += [
'-Djava.awt.headless=true',
'-Dtestfx.robot=glass',
'-Dtestfx.headless=true',
'-Dprism.order=sw',
'-Dprism.verbose=true',
'-Djavafx.macosx.embedded=true',
"--module-path", "${projectDir}/mods/lib/",
"--add-modules", "javafx.controls,javafx.web,javafx.swing,javafx.fxml",
//Needed to fix issue with testfx test crashing due to issue with modularity of whole program. Slightly related issue. https://github.com/TestFX/TestFX/issues/638
'--add-exports','javafx.graphics/com.sun.javafx.application=ALL-UNNAMED',
'--add-opens','javafx.graphics/com.sun.glass.ui=ALL-UNNAMED',
]
}
tasks.withType(JavaCompile) {
doFirst {
if (name.toLowerCase().contains("test")) {
options.compilerArgs << "--module-path" << "${projectDir}/mods/lib/"
options.compilerArgs << "--add-modules" << "javafx.controls,javafx.web,javafx.swing,javafx.fxml"
}
println "Args for for $name are $options.allCompilerArgs"
}
}
}
dependencyUpdates {
revision='release'
}
dependencyUpdates.resolutionStrategy {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
if (['atlassian'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
}) {
selection.reject('unofficial release')
}
boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm', 'preview', 'b', 'ea'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]$qualifier[.\d-+]*/
}
if (rejected) {
selection.reject('Release candidate')
}
if (selection.candidate.version == '2.0.2' && selection.candidate.name == 'xml-apis') {
selection.reject('older than current')
}
if (selection.candidate.version == '2.24' && selection.candidate.name == 'jep') {
selection.reject('older than current')
}
if (selection.candidate.version == '1.8.0_20' && selection.candidate.name == 'openjfx-monocle') {
selection.reject('older than current')
}
}
}
}
idea {
module {
testSourceDirs += project.sourceSets.itest.java.srcDirs
testSourceDirs += project.sourceSets.slowtest.java.srcDirs
testSourceDirs += project.sourceSets.test.java.srcDirs
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
apply from: 'code/gradle/autobuild.gradle'
apply from: 'code/gradle/distribution.gradle'
apply from: 'code/gradle/reporting.gradle'
apply from: 'code/gradle/release.gradle'