forked from PCGen/pcgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
396 lines (337 loc) · 10.9 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
/*
* 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
*
* Author: James Dempsey
*/
plugins {
id 'application'
id 'build-dashboard'
id 'checkstyle'
id 'findbugs'
id 'java'
id 'maven'
id 'pmd'
id "de.undercouch.download" version "3.2.0"
id 'edu.sc.seis.launch4j' version '2.1.0'
id 'com.github.ben-manes.versions' version '0.14.0'
}
group = 'net.sourceforge.pcgen'
description = """PCGen"""
defaultTasks 'clean', 'build'
sourceCompatibility = 1.8
targetCompatibility = 1.8
ext {
binDir = "code/bin"
// Default ignoreTestFailures to false if it is not provided
if (!hasProperty('ignoreTestFailures')) {
ignoreTestFailures = false;
}
}
mainClassName = '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"
layout "pattern", {
artifact "[organisation]/jars/[artifact]-[revision].[ext]"
}
}
ivy {
name "fileRepo"
url 'http://librepo.pcgen.org'
}
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']
}
}
itest {
java {
srcDirs = ['code/src/itest', 'code/src/testcommon']
}
}
slowtest {
java {
srcDirs = ['code/src/test', 'code/src/testcommon']
}
}
}
/* 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.5'
compile group: 'rhino', name: 'js', version:'1.7R2'
compile group: 'commons-logging', name: 'commons-logging', version:'1.2'
compile group: 'org.springframework', name: 'spring-core', version:'4.3.6.RELEASE'
compile group: 'org.springframework', name: 'spring-beans', version:'4.3.6.RELEASE'
compile group: 'skinlf', name: 'skinlf', version: '1.2.3'
compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.5'
compile group: 'org.apache.xmlgraphics', name: 'fop', version:'2.1'
compile group: 'org.apache.pdfbox', name: 'fontbox', version:'2.0.4'
compile group: 'jep', name: 'jep', version:'2.4.1'
compile group: 'org.freemarker', name: 'freemarker', version:'2.3.25-incubating'
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.7.0'
compile group: 'net.sourceforge.pcgen', name: 'PCGen-base', version:'1.0.83'
compile group: 'net.sourceforge.pcgen', name: 'PCGen-Formula', version:'1.0.101'
compileOnly group: 'org.jetbrains', name: 'annotations', version:'15.0'
compileOnly group: 'com.yuvimasory', name: 'orange-extensions', version: '1.3.0'
compileOnly group: 'com.google.code.findbugs', name: 'annotations', version: '3.0.1'
testCompile group: 'junit', name: 'junit', version:'4.12'
testCompile group: 'xmlunit', name: 'xmlunit', version:'1.6'
testCompile group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'
testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
itestCompile sourceSets.main.output
itestCompile configurations.testCompile
itestCompile sourceSets.test.output
itestRuntime configurations.testRuntime
slowtestCompile sourceSets.main.output
slowtestCompile configurations.testCompile
slowtestCompile sourceSets.test.output
slowtestRuntime configurations.testRuntime
findbugs 'com.google.code.findbugs:findbugs:3.0.1'
findbugs configurations.findbugsPlugins.dependencies
findbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:6.8.2'
}
ant.importBuild 'build-gradle.xml'
ant.properties['src.java.dir']="code/src/java"
ant.properties['build.classes.dir']="build/classes/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 copyToRoot(type: Copy, dependsOn: [copyToLibs, jar, converterJar]) {
from "$buildDir/libs/pcgen-${version}.jar"
from "$buildDir/libs/pcgen-${version}-batch-convert.jar"
from "$buildDir/release/pcgen.exe"
from "$projectDir/code/pcgen.sh"
into "$projectDir"
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 cleanRoot(type: Delete) {
description="Clean up things copied to the root folder by the build"
delete "$projectDir/pcgen.jar"
delete "$projectDir/pcgen-batch-convert.jar"
delete "$projectDir/batch-convert.jar"
delete "$projectDir/pcgen.sh"
delete "$projectDir/pcgen.exe"
delete "$projectDir/libs"
delete "$projectDir/autobuild.properties"
}
build {
it.dependsOn 'copyToRoot', 'syncLibsToRoot'
}
clean {
it.dependsOn 'clean-plugins'
it.dependsOn 'cleanRoot'
}
test {
exclude 'pcgen/testsupport/**'
// maxParallelForks 4
testLogging {
exceptionFormat = 'full'
}
}
task itest(type: Test, dependsOn: jar) {
testClassesDir = sourceSets.itest.output.classesDir
classpath = sourceSets.itest.runtimeClasspath
systemProperties['jar.path'] = jar.archivePath
ignoreFailures=ignoreTestFailures
testLogging {
exceptionFormat = 'full'
}
}
task slowtest(type: Test, dependsOn: ['jar', 'itest']) {
testClassesDir = sourceSets.slowtest.output.classesDir
classpath = sourceSets.slowtest.runtimeClasspath
systemProperties['jar.path'] = jar.archivePath
forkEvery = 1
maxHeapSize = "512m"
// Exclude the two suites to avoid duplicate test runs.
exclude 'AllJUnitTests.class'
exclude 'pcgen/core/AllJUnitTests.class'
ignoreFailures=ignoreTestFailures
testLogging {
exceptionFormat = 'full'
}
}
task datatest(type: Test, dependsOn: 'jar') {
testClassesDir = sourceSets.slowtest.output.classesDir
classpath = sourceSets.slowtest.runtimeClasspath
include 'pcgen/persistence/lst/DataTest.class'
include 'pcgen/persistence/lst/DataLoadTest.class'
ignoreFailures=ignoreTestFailures
maxHeapSize = "512m"
testLogging {
exceptionFormat = 'full'
}
}
task inttest(type: Test, dependsOn: 'jar') {
testClassesDir = sourceSets.slowtest.output.classesDir
classpath = sourceSets.slowtest.runtimeClasspath
forkEvery = 1
maxHeapSize = "512m"
include 'pcgen/inttest/**/*Test.class'
testLogging {
exceptionFormat = 'full'
}
// Report each test as it is started.
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
}
task pfinttest(type: Test, dependsOn: 'jar') {
testClassesDir = sourceSets.slowtest.output.classesDir
classpath = sourceSets.slowtest.runtimeClasspath
forkEvery = 1
maxHeapSize = "512m"
include 'pcgen/inttest/game_pathfinder/*Test.class'
testLogging {
exceptionFormat = 'full'
}
// Report each test as it is started.
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
}
task rsrdinttest(type: Test, dependsOn: 'jar') {
testClassesDir = sourceSets.slowtest.output.classesDir
classpath = sourceSets.slowtest.runtimeClasspath
forkEvery = 1
maxHeapSize = "512m"
include 'pcgen/inttest/game_35e/*Test.class'
testLogging {
exceptionFormat = 'full'
}
// Report each test as it is started.
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
}
task msrdinttest(type: Test, dependsOn: 'jar') {
testClassesDir = sourceSets.slowtest.output.classesDir
classpath = sourceSets.slowtest.runtimeClasspath
forkEvery = 1
maxHeapSize = "512m"
include 'pcgen/inttest/game_modern/*Test.class'
testLogging {
exceptionFormat = 'full'
}
// Report each test as it is started.
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
}
// Do the lot!
task all(dependsOn: ['clean', 'build', 'slowtest', 'javadoc', 'allReports']) {
}
task wrapper(type: Wrapper) {
gradleVersion = '3.3'
}
//Disable failing on javadoc warning
allprojects {
tasks.withType(Javadoc) {
options.addBooleanOption('Xdoclint:none', 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'