forked from unclebob/fitnesse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
357 lines (311 loc) · 8.66 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
/* Plan:
- Create multi-module repo:
- fit (deps: common)
- slim (deps: common, networking)
- common
- networking
- ant
- fitnesse, the wiki server
- Move file creation to plugin
*/
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.3.0'
}
}
plugins {
id 'java'
id "maven-publish"
id "com.jfrog.bintray" version "1.8.4"
id "com.github.ben-manes.versions" version "0.27.0"
id "groovy"
}
apply plugin: "info.solidsoft.pitest"
version = new Date().format('yyyyMMdd')
println "Building FitNesse v${project.version}..."
repositories {
mavenCentral()
}
configurations {
lesscss
optional
compile {
transitive = false
extendsFrom optional
}
runtime {
transitive = false
}
}
sourceSets {
main {
java.srcDir 'src'
resources.srcDir 'src'
output.resourcesDir java.outputDir
}
test {
java.srcDir 'test'
}
}
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
dependencies {
compile "org.htmlparser:htmlparser:2.1"
compile "org.htmlparser:htmllexer:2.1"
compile ("org.apache.velocity:velocity-engine-core:2.2") {
exclude group:"org.apache.commons", module: "commons-lang3"
exclude group: 'org.slf4j', module: 'slf4j-api'
}
compile "org.apache.commons:commons-lang3:3.11"
compile "org.slf4j:slf4j-api:1.7.25"
compile "org.slf4j:slf4j-jdk14:1.7.25"
compile "org.json:json:20190722"
compile "com.googlecode.java-diff-utils:diffutils:1.3.0"
compile "org.apache.commons:commons-text:1.9"
optional gradleApi()
optional "org.apache.ant:ant:1.10.7"
optional "junit:junit:4.13"
testCompile "junit:junit:4.13"
testCompile "org.mockito:mockito-core:3.2.4"
testCompile "org.hamcrest:hamcrest-all:1.3"
testCompile "net.javacrumbs.json-unit:json-unit:2.2.0"
lesscss "org.mozilla:rhino:1.7.12"
}
task fitNesseVersion {
def versionFile = new File("${sourceSets.main.output.resourcesDir}/META-INF/FitNesseVersion.txt")
versionFile.parentFile.mkdirs()
versionFile.text="v${version}"
}
task compileBootstrap(type: LessCompiler) {
inputDir file('src/fitnesse/resources/bootstrap/less')
mainLessFile = 'fitnesse-bootstrap.less'
cssFile file("${sourceSets.main.output.resourcesDir}/fitnesse/resources/bootstrap/css/fitnesse-bootstrap.css")
classpath configurations.lesscss
}
task createUpdateLists(type: WikiFileListBuilderTask) {
outputDirectory = "${sourceSets.main.output.resourcesDir}/Resources"
files = {
// Make sure only files in version control are added to the default wiki contents
"git ls-files FitNesseRoot".execute().text.readLines()
}
doNotReplaceFiles = [
"FitNesseRoot/content.txt",
"FitNesseRoot/properties.xml",
"FitNesseRoot/FrontPage/content.txt",
"FitNesseRoot/FrontPage/properties.xml",
"FitNesseRoot/PageHeader/content.txt",
"FitNesseRoot/PageHeader/properties.xml",
"FitNesseRoot/PlugIns/content.txt",
"FitNesseRoot/PlugIns/properties.xml",
"FitNesseRoot/PageFooter/content.txt",
"FitNesseRoot/PageFooter/properties.xml",
"FitNesseRoot/TemplateLibrary/content.txt",
"FitNesseRoot/TemplateLibrary/properties.xml",
"FitNesseRoot/TemplateLibrary/StaticPage/content.txt",
"FitNesseRoot/TemplateLibrary/StaticPage/properties.xml",
"FitNesseRoot/TemplateLibrary/SuitePage/content.txt",
"FitNesseRoot/TemplateLibrary/SuitePage/properties.xml",
"FitNesseRoot/TemplateLibrary/TestPage/content.txt",
"FitNesseRoot/TemplateLibrary/TestPage/properties.xml" ]
}
processResources.dependsOn "fitNesseVersion", "compileBootstrap", "createUpdateLists"
task copyRuntimeLibs(type: Copy) {
into "lib"
from configurations.runtime
}
test {
dependsOn copyRuntimeLibs
maxParallelForks 1
}
pitest {
targetClasses = ['fit.*', 'fitnesse.*']
pitestVersion = "1.4.3"
threads = 1 // We can not deal with parallel execution yet
outputFormats = ['XML', 'HTML']
}
task run(type: JavaExec) {
dependsOn classes, copyRuntimeLibs
classpath = sourceSets.main.runtimeClasspath
main "fitnesseMain.FitNesseMain"
args "-p", "8001", "-e", "0"
}
jar {
dependsOn createUpdateLists
into('Resources') {
from('.') {
include createUpdateLists.wikiFiles as String[]
}
}
duplicatesStrategy = 'exclude'
manifest {
attributes("Main-Class": "fitnesseMain.FitNesseMain",
"Implementation-Version": version)
}
}
task standaloneJar(type: Jar) {
dependsOn jar
archiveBaseName = 'fitnesse'
archiveClassifier = 'standalone'
from {
(configurations.compile - configurations.optional).collect { zipTree(it) }
} {
exclude 'META-INF/**'
}
from jar.outputs.files.collect {
zipTree(it)
}
manifest {
attributes("Main-Class": "fitnesseMain.FitNesseMain",
"Implementation-Version": version)
}
}
task slimJar(type: Jar) {
dependsOn jar
archiveBaseName = 'fitnesse'
archiveClassifier = 'slim'
from { jar.outputs.files.collect { zipTree(it) } }
{
include 'fitnesse/html/*.class'
include 'fitnesse/slim/**/*.class'
include 'fitnesse/socketservice/*.class'
include 'util/*.class'
include 'fitnesse/util/StringUtils.class'
}
manifest {
attributes("Implementation-Version": version)
}
}
task acceptanceTest(type: JavaExec) {
mustRunAfter test
onlyIf { test.didWork }
classpath = standaloneJar.outputs.files
main "fitnesseMain.FitNesseMain"
args "-o", "-c", "FitNesse.SuiteAcceptanceTests?suite&format=text"
}
check.dependsOn acceptanceTest
task javadocJar(type: Jar) {
mustRunAfter check
archiveClassifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
mustRunAfter check
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task releaseTag(type: Exec) {
commandLine 'git', 'tag', project.version
doLast {
println "Tagged release ${project.version}"
}
}
task publishTag(type: Exec) {
commandLine 'git', 'push', '--tags'
shouldRunAfter releaseTag
}
task prepareSnapshotRepo {
bintray.pkg.repo = 'edge'
}
task prepareReleaseRepo {
bintray.pkg.repo = 'release'
}
bintrayUpload.mustRunAfter prepareSnapshotRepo, prepareReleaseRepo
task snapshotRelease {
dependsOn prepareSnapshotRepo, bintrayUpload
}
task release {
dependsOn releaseTag, prepareReleaseRepo, bintrayUpload, publishTag
}
clean {
delete "lib"
}
publishing {
publications {
FitNesseRelease(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
artifact standaloneJar
artifact slimJar
groupId 'org.fitnesse'
artifactId 'fitnesse'
pom.withXml {
asNode().get('version') + {
resolveStrategy = Closure.DELEGATE_FIRST
name('FitNesse')
description('The fully integrated standalone wiki, and acceptance testing framework.')
url('http://fitnesse.org')
packaging('jar')
}
asNode().append(pomLicenses())
asNode().append(pomScm())
asNode().append(pomDevelopers())
// Clean up scope entries added by the pom generator:
asNode().dependencies.'*'.findAll() {
if (project.configurations.optional.allDependencies
.find { dep -> dep.name == it.artifactId.text()}) {
def xmlOptional = it.optional[0]
if ( !xmlOptional ) {
xmlOptional = it.appendNode('optional')
}
xmlOptional.value = 'true'
}
}
}
}
}
}
bintray {
user = System.getenv("BINTRAY_USER") ?: 'Define your Bintray user name in BINTRAY_USER'
key = System.getenv("BINTRAY_API_KEY") ?: 'Define your Bintray BINTRAY_API_KEY'
publications = ['FitNesseRelease']
publish = true
pkg {
name = 'fitnesse'
userOrg = 'fitnesse'
licenses = ['CPL-1.0']
websiteUrl = 'http://fitnesse.org'
vcsUrl = 'https://github.com/unclebob/fitnesse.git'
publicDownloadNumbers = true
githubRepo = 'unclebob/fitnesse'
version {
name = project.version
desc = "FitNesse release ${project.version}"
vcsTag = project.version
gpg {
sign = true
}
}
}
}
wrapper {
gradleVersion = '5.3.1'
}
def pomLicenses() {
new NodeBuilder().licenses {
license {
name 'Common Public License version 1.0'
url 'http://www.opensource.org/licenses/cpl1.0'
distribution 'repo'
}
}
}
def pomScm() {
new NodeBuilder().scm {
connection 'scm:git:git://github.com/unclebob/fitnesse.git'
developerConnection 'scm:git:[email protected]:unclebob/fitnesse.git'
url 'scm:git:http://github.com/unclebob/fitnesse'
}
}
def pomDevelopers() {
new NodeBuilder().developers {
developer {
id 'unclebob'
name 'Robert C. Martin'
email '[email protected]'
}
}
}