forked from PCGen/pcgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
440 lines (376 loc) · 13.3 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
/*
* 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 'com.gradle.build-scan' version '2.1'
id 'eclipse'
id 'application'
id 'build-dashboard'
id 'checkstyle'
id "com.github.spotbugs" version '1.6.9'
id 'java'
id 'maven'
id 'pmd'
id 'idea'
id "de.undercouch.download" version '3.4.3'
id 'edu.sc.seis.launch4j' version '2.4.4'
id 'com.github.ben-manes.versions' version '0.20.0'
id "com.dorongold.task-tree" version '1.3.1'
}
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"
}
if (Os.isFamily(Os.FAMILY_MAC)) {
applicationDefaultJvmArgs = ['-Xdock:name=PCGen',
'-Xdock:icon=installers/win-installer/Local/PCGen2.ico',
]
}
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/java', 'code/resources']
include '**/*.properties'
include '**/*.xml'
include '**/*.gif'
include '**/*.png'
include '**/*.jpg'
}
}
test {
java {
srcDirs = ['code/src/utest', 'code/src/testcommon']
}
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
itest {
java {
srcDirs = ['code/src/itest', 'code/src/testcommon']
}
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']
}
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: 'cobra', name: 'cobra', version:'0.98.4-pcgen'
compile group: 'commons-io', name: 'commons-io', version:'2.6'
compile group: 'org.springframework', name: 'spring-core', version:'5.1.4.RELEASE'
compile group: 'org.springframework', name: 'spring-beans', version:'5.1.4.RELEASE'
compile group: 'org.springframework', name: 'spring-web', version:'5.1.4.RELEASE'
compile group: 'skinlf', name: 'skinlf', version: '1.2.3'
compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.8.1'
compile group: 'org.apache.xmlgraphics', name: 'fop', version:'2.3'
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.2'
compile group: 'jep', name: 'jep', version:'2.4.1'
compile group: 'org.freemarker', name: 'freemarker', version:'2.3.28'
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: 'org.mozilla', name: 'rhino', version:'1.7.10'
compile group: 'org.xmlunit', name: 'xmlunit-core', version:'2.6.2'
implementation group: 'net.sourceforge.pcgen', name: 'PCGen-base', version:'1.0.170'
implementation group: 'net.sourceforge.pcgen', name: 'PCGen-Formula', version:'1.0.195'
compile group: 'xml-apis', name: 'xml-apis', version:'1.3.04'
compileOnly group: 'org.jetbrains', name: 'annotations', version:'16.0.3'
compileOnly group: 'com.yuvimasory', name: 'orange-extensions', version: '1.3.0'
testCompile group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.3.2'
testCompile group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.3.2'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.3.2'
testRuntime group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.3.2'
testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.3.2'
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.1'
testCompile group: 'org.xmlunit', name: 'xmlunit-matchers', version:'2.6.2'
}
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
}
}
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
}
classifier = 'batch-convert'
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 syncLibsToRoot(type: Sync, dependsOn: [copyToLibs, jar, converterJar]) {
outputs.dir("$projectDir/libs")
inputs.files(fileTree("$buildDir/libs"))
from "$buildDir/libs"
into "$projectDir/libs"
exclude "pcgen-*.jar"
}
task installToRoot(type: Copy, dependsOn: [syncLibsToRoot, createExe, jar,
converterJar]) {
description="Copy the executable file into the root to create a working environment"
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'
mustRunAfter clean
}
task qbuild(type: Copy, dependsOn: [syncLibsToRoot, jar]) {
description="Copy the executable file into the root 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
}
task cleanRoot(type: Delete) {
description="Clean up things copied to the root folder by the build"
delete "$projectDir/libs"
delete "$projectDir/jre"
}
// Alias tasks
tasks.register("buildonly") {
dependsOn 'installToRoot'
}
tasks.register("quickbuild") {
dependsOn 'installToRoot', 'test'
}
build {
it.dependsOn 'copyToOutput', 'syncLibsToRoot'
mustRunAfter clean
}
clean {
it.dependsOn 'clean-plugins'
it.dependsOn 'cleanOutput'
it.dependsOn 'cleanRoot'
}
test {
exclude 'pcgen/testsupport/**'
useJUnitPlatform()
}
task itest(type: Test, dependsOn: [jar]) {
testClassesDirs = sourceSets.itest.output.classesDirs
classpath = sourceSets.itest.runtimeClasspath
systemProperties['jar.path'] = jar.archivePath
}
task slowtest(type: Test, dependsOn: ['jar', 'itest']) {
testClassesDirs = sourceSets.slowtest.output.classesDirs
classpath = sourceSets.slowtest.runtimeClasspath
systemProperties['jar.path'] = jar.archivePath
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 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
testLogging {
exceptionFormat = 'full'
events 'failed', 'skipped'
}
}
}
dependencyUpdates.resolutionStrategy = {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
if (['atlassian'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
}) {
selection.reject('unofficial release')
}
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')
}
}
}
}
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'