forked from PCGen/pcgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
477 lines (411 loc) · 14.4 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
/*
* 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
plugins {
id 'eclipse'
id 'application'
id 'build-dashboard'
id 'checkstyle'
id "com.github.spotbugs" version '2.0.1'
id 'java'
id 'maven'
id 'pmd'
id 'idea'
id "de.undercouch.download" version '4.0.1'
id 'edu.sc.seis.launch4j' version '2.4.6'
id 'com.github.ben-manes.versions' version '0.27.0'
id "com.dorongold.task-tree" version '1.4'
id "edu.sc.seis.macAppBundle" version "2.3.0"
id 'org.openjfx.javafxplugin' version '0.0.8'
id 'org.beryx.runtime' version '1.7.1'
}
javafx {
version = "13"
modules = [ 'javafx.controls', 'javafx.web', 'javafx.swing', 'javafx.fxml', 'javafx.graphics' ]
}
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';
applicationDistribution.from('plugins') {
into "plugins"
}
applicationDistribution.from('docs') {
into "docs"
}
applicationDistribution.from('data') {
into "data"
}
applicationDistribution.from('outputsheets') {
into "outputsheets"
}
applicationDistribution.from('system') {
into "system"
}
applicationDistribution.from('preview') {
into "preview"
}
repositories {
mavenCentral()
ivy {
url "http://pcgen.sourceforge.net/mvnrepo"
patternLayout {
artifact "[organisation]/jars/[artifact]-[revision].[ext]"
}
}
ivy {
name "fileRepo"
url 'http://pc-gen.org/librepo/'
}
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.main.output
runtimeClasspath += sourceSets.main.output
compileClasspath += sourceSets.test.compileClasspath
runtimeClasspath += sourceSets.test.runtimeClasspath
}
slowtest {
java {
srcDirs = ['code/src/test', 'code/src/testcommon']
}
resources {
srcDirs = ['code/src/testResources']
}
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
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'
}
dependencies {
compile group: 'commons-io', name: 'commons-io', version:'2.6'
compile group: 'org.springframework', name: 'spring-web', version:'5.2.1.RELEASE'
compile group: 'org.springframework', name: 'spring-core', version:'5.2.1.RELEASE'
compile group: 'org.springframework', name: 'spring-beans', version:'5.2.1.RELEASE'
compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.9'
compile group: 'org.apache.xmlgraphics', name: 'fop', version:'2.3'
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
compile group: 'jep', name: 'jep', version:'2.4.1'
compile group: 'org.freemarker', name: 'freemarker', version:'2.3.29'
compile group: 'org.jdom', name: 'jdom2', version:'2.0.6'
compile group: 'xalan', name: 'xalan', version:'2.7.2'
compile group: 'net.sourceforge.argparse4j', name: 'argparse4j', version: '0.8.1'
compile group: 'xml-apis', name: 'xml-apis', version:'1.4.01'
compile group: 'org.xmlunit', name: 'xmlunit-core', version:'2.6.3'
compile group: 'org.controlsfx', name: 'controlsfx', version:'11.0.0'
compile group: 'net.sourceforge.pcgen', name: 'PCGen-base', version:'1.0.170'
compile group: 'net.sourceforge.pcgen', name: 'PCGen-Formula', version:'1.0.200'
compileOnly group: 'org.jetbrains', name: 'annotations', version:'17.0.0'
compileOnly group: 'com.yuvimasory', name: 'orange-extensions', version: '1.3.0'
compileOnly group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: '3.1.12'
testCompile group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.5.2'
testCompile group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.5.2'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.2'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.5.2'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.5.2'
testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.2'
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2'
testCompile group: 'org.testfx', name: 'testfx-junit5', version: '4.0.16-alpha'
testCompile group: 'org.testfx', name: 'openjfx-monocle', version: 'jdk-12.0.1+2'
testCompile group: 'org.xmlunit', name: 'xmlunit-matchers', version:'2.6.3'
}
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.runtime.each { lib -> classpath += " libs/${lib.name} "}
}
jar {
it.dependsOn 'jar-all-plugins'
manifest {
attributes 'Implementation-Title': 'PCGen', 'Implementation-Version': version,
'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',
]
}
task converterJar(type: Jar, dependsOn: jar) {
manifest {
attributes 'Implementation-Title': 'PCGen Data Converter', 'Implementation-Version': version,
'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
test {
exclude 'pcgen/testsupport/**'
useJUnitPlatform()
}
task itest(type: Test, dependsOn: [jar]) {
testClassesDirs = sourceSets.itest.output.classesDirs
classpath = sourceSets.itest.runtimeClasspath
systemProperties['jar.path'] = jar.getArchiveFile().get().getAsFile()
}
task slowtest(type: Test, dependsOn: ['jar', 'itest']) {
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',
]
}
}
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
}
run {
enableAssertions = true
}
apply from: 'code/gradle/autobuild.gradle'
apply from: 'code/gradle/distribution.gradle'
apply from: 'code/gradle/reporting.gradle'
apply from: 'code/gradle/release.gradle'