forked from unclebob/fitnesse
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
329 lines (287 loc) · 7.93 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
/* 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.6.0'
}
}
plugins {
id 'java'
id "maven-publish"
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
id 'signing'
id "com.github.ben-manes.versions" version "0.44.0"
id "groovy"
}
apply plugin: "info.solidsoft.pitest"
group = 'org.fitnesse'
version = new Date().format('yyyyMMdd')
println "Building FitNesse v${project.version}..."
repositories {
mavenCentral()
}
configurations {
lesscss
compile {
transitive = false
}
runtime {
transitive = false
}
}
sourceSets {
main {
java.srcDir 'src'
resources.srcDir 'src'
output.resourcesDir java.outputDir
}
test {
java.srcDir 'test'
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
dependencies {
implementation "org.htmlparser:htmlparser:2.1"
implementation "org.htmlparser:htmllexer:2.1"
implementation ("org.apache.velocity:velocity-engine-core:2.3") {
exclude group:"org.apache.commons", module: "commons-lang3"
exclude group: 'org.slf4j', module: 'slf4j-api'
}
implementation "org.apache.commons:commons-lang3:3.12.0"
implementation "org.slf4j:slf4j-api:2.0.7"
implementation "org.slf4j:slf4j-jdk14:2.0.7"
implementation "org.json:json:20230618"
implementation "com.googlecode.java-diff-utils:diffutils:1.3.0"
implementation "org.apache.commons:commons-text:1.10.0"
compileOnly gradleApi()
compileOnly "org.apache.ant:ant:1.10.13"
compileOnly "junit:junit:4.13.2"
testImplementation gradleApi()
testImplementation "junit:junit:4.13.2"
testImplementation "org.mockito:mockito-core:3.12.4"
testImplementation "org.hamcrest:hamcrest-all:1.3"
testImplementation "net.javacrumbs.json-unit:json-unit:2.38.0"
lesscss "org.mozilla:rhino:1.7.14"
}
task fitNesseVersion {
def versionFile = new File("${sourceSets.main.output.resourcesDir}/META-INF/FitNesseVersion.txt")
outputs.file(versionFile)
doLast {
versionFile.parentFile.mkdirs()
versionFile.text = "v${version}"
println "fitNesseVersion: ${outputs.files.singleFile.text}"
}
}
task compileBootstrap(type: LessCompiler) {
mainClass.set('org.mozilla.javascript.tools.shell.Main')
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.runtimeClasspath
}
test {
dependsOn copyRuntimeLibs
maxParallelForks 1
}
pitest {
targetClasses = ['fit.*', 'fitnesse.*']
pitestVersion = "1.6.4"
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": archiveVersion)
}
}
task standaloneJar(type: Jar) {
dependsOn jar
archiveBaseName = 'fitnesse'
archiveClassifier = 'standalone'
from {
configurations.runtimeClasspath.collect { zipTree(it) }
} {
exclude 'META-INF/**'
}
from jar.outputs.files.collect {
zipTree(it)
}
manifest {
attributes("Main-Class": "fitnesseMain.FitNesseMain",
"Implementation-Version": archiveVersion)
}
}
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": archiveVersion)
}
}
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'
duplicatesStrategy = 'include'
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 release {
dependsOn 'releaseTag', 'signFitNesseReleasePublication', 'publish', 'publishToSonatype', 'closeAndReleaseSonatypeStagingRepository', '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())
}
}
}
}
signing {
sign publishing.publications
}
nexusPublishing {
repositories {
sonatype {
stagingProfileId = "1b9278c71ece6"
}
}
}
wrapper {
gradleVersion = '6.9.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:git@github.com:unclebob/fitnesse.git'
url 'scm:git:http://github.com/unclebob/fitnesse'
}
}
def pomDevelopers() {
new NodeBuilder().developers {
developer {
id 'unclebob'
name 'Robert C. Martin'
email 'unclebob@cleancoder.com'
}
}
}