forked from asciidoctor/asciidoctorj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
257 lines (221 loc) · 7.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
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import java.time.Duration
/*
adding the plugin jars to the classpath to apply them later.
currently the new plugins DSL does apply them directly.
there are other limitations too. See https://docs.gradle.org/current/userguide/plugins.html#sec:plugins_block
we don't need to apply the jruby plugin on the rootProject.
*/
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
maven { url "https//oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:5.3.0"
classpath("com.github.jruby-gradle:jruby-gradle-plugin:2.0.1") {
exclude module: 'grolifant'
exclude module: 'okhttp-digest'
}
classpath 'org.ysb33r.gradle:grolifant:0.17.0'
}
}
// modern plugins config
plugins {
id "io.sdkman.vendors" version "3.0.0"
id "signing"
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
// Moved to dependency in buildscript. See https://github.com/asciidoctor/asciidoctorj/issues/1275
// id 'com.github.jruby-gradle.base' version '2.0.1'
id 'codenarc'
}
// TIP use -PpublishRelease=true to active release behavior regardless of the version
status = project.hasProperty('publishRelease') && project.publishRelease.toBoolean() ?
'release' : ((version == 'unspecified' || version.endsWith('-SNAPSHOT')) ? 'snapshot' : 'release')
// using ExpandoMetaClass to add isDistribution() Method to Project instances...
Project.metaClass.isDistribution = { delegate.getName().endsWith("-distribution") }
nexusPublishing {
repositories {
sonatype {
if (project.hasProperty("sonatypeUsername")) {
username = project.sonatypeUsername
}
if (project.hasProperty("sonatypePassword")) {
password = project.sonatypePassword
}
repositoryDescription = "Release ${project.group} ${project.version}"
}
}
clientTimeout = Duration.ofMinutes(5)
}
ext {
buildDateTime = new Date()
(buildDateOnly, buildTimeOnly) = new java.text.SimpleDateFormat('yyyy-MM-dd HH:mm:ss.SSSZ').format(buildDateTime).split(' ')
statusIsRelease = (status == 'release')
// jar versions
arquillianVersion = '1.6.0.Final'
arquillianSpockVersion = '1.0.0.CR1'
asciidoctorjPdfVersion = '2.3.18'
asciidoctorjEpub3Version = '2.1.3'
asciidoctorjDiagramVersion = '2.3.1'
asciidoctorjDiagramDitaaMiniVersion = '1.0.3'
asciidoctorjDiagramJsyntraxVersion = '1.38.2'
asciidoctorjDiagramBatikVersion = '1.17'
asciidoctorjDiagramPlantumlVersion = '1.2024.5'
asciidoctorjRevealJsVersion = '5.1.0'
commonsioVersion = '2.15.1'
guavaVersion = '18.0'
hamcrestVersion = '1.3'
jcommanderVersion = '1.82'
jrubyVersion = '9.4.8.0'
jsoupVersion = '1.17.1'
junit4Version = '4.13.2'
junit5Version = '5.10.1'
junitPioneerVersion = '2.2.0'
assertjVersion = '3.24.2'
nettyVersion = '4.1.58.Final'
saxonVersion = '9.9.0-2'
xmlMatchersVersion = '1.0-RC1'
pdfboxVersion = '3.0.0'
// gem versions
asciidoctorGemVersion = project.hasProperty('asciidoctorGemVersion') ? project.asciidoctorGemVersion : '2.0.23'
asciimathGemVersion = '2.0.4'
coderayGemVersion = '1.1.3'
rougeGemVersion = '3.30.0'
codenarcVersion = '3.2.0'
groovyVersion = '3.0.17'
erubisGemVersion = '2.7.0'
hamlGemVersion = '5.2.2'
openUriCachedGemVersion = '0.0.5'
slimGemVersion = '4.1.0'
concurrentRubyGemVersion = '1.1.7'
spockVersion = '2.3-groovy-3.0'
threadSafeGemVersion = '0.3.6'
tiltGemVersion = '2.0.11'
osgiVersion = '7.0.0'
}
allprojects {
group = 'org.asciidoctor'
defaultTasks 'check'
}
subprojects {
// NOTE applying Java plugin changes the status; take steps to preserve value
def _status = status
apply plugin: 'java-library'
apply plugin: 'groovy'
status = _status
plugins.withType(JavaPlugin) {
project.tasks.withType(JavaCompile) { task ->
if (project.hasProperty("showDeprecation")) {
options.compilerArgs << "-Xlint:deprecation"
}
if (project.hasProperty("showUnchecked")) {
options.compilerArgs << "-Xlint:unchecked"
}
}
}
repositories {
if (project.hasProperty('useMavenLocal') && project.useMavenLocal.toBoolean()) {
mavenLocal()
}
mavenCentral()
}
dependencies {
testImplementation "org.assertj:assertj-core:$assertjVersion"
testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion"
}
if (usesJUnit5(it.project)) {
dependencies {
testImplementation(platform("org.junit:junit-bom:$junit5Version"))
testImplementation "org.junit.jupiter:junit-jupiter-api"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
testImplementation "org.junit.jupiter:junit-jupiter-params"
testImplementation "org.junit-pioneer:junit-pioneer:$junitPioneerVersion"
}
}
if (usesSpock(it)) {
apply plugin: 'codenarc'
codenarc {
configFile = rootProject.file('config/codenarc/codenarc.groovy')
}
dependencies {
testImplementation("org.spockframework:spock-core:$spockVersion") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
testImplementation "org.codehaus.groovy:groovy-all:$groovyVersion"
codenarc("org.codenarc:CodeNarc:$codenarcVersion")
constraints {
["groovy",
"groovy-ant",
"groovy-groovydoc",
"groovy-json",
"groovy-xml",
].each {
codenarc ("org.codehaus.groovy:$it") {
version {
strictly "$groovyVersion"
because "Use same groovy version as project"
}
}
}
}
}
}
test {
useJUnitPlatform()
forkEvery = 10
minHeapSize = '128m'
maxHeapSize = '1024m'
testLogging {
// events 'passed', 'failed', 'skipped', 'standard_out', 'standard_error'
// events 'standard_out', 'standard_error'
afterSuite { desc, result ->
if (!desc.parent && logger.infoEnabled) {
logger.info "Test results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
}
}
}
if (DefaultNativePlatform.getCurrentOperatingSystem().isWindows()) {
// Allow junit-pioneer environment manipulation on Windows + Java17+
jvmArgs = ['--add-opens', 'java.base/java.lang=ALL-UNNAMED']
}
systemProperty 'org.asciidoctor.asciidoctorj-test.version.asciidoctorj', asciidoctorGemVersion
}
}
boolean usesJUnit5(def project) {
!(project.name in ['asciidoctorj-arquillian-extension'])
}
boolean usesSpock(def project) {
project.name in ['asciidoctorj']
}
// apply JRuby and sources/javadocs packaging stuff for all subprojects except the distribution
configure(subprojects.findAll { !it.isDistribution() }) {
apply from: rootProject.file('gradle/eclipse.gradle')
apply plugin: 'idea'
javadoc {
// Oracle JDK11+ likes to fail the build over spoiled HTML
options.addStringOption('Xdoclint:none', '-quiet')
}
}
configure(subprojects.findAll { !it.name.endsWith('-distribution') && ! it.name.endsWith('-documentation')}) {
java {
withJavadocJar()
withSourcesJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of(getToolchainVersion()))
}
}
}
// Windows workaround to fix invalid toolchain detection
def getToolchainVersion() {
if (DefaultNativePlatform.getCurrentOperatingSystem().isWindows()) {
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21))
return 21
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17))
return 17
}
return 11
}