forked from asciidoctor/asciidoctorj
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
244 lines (207 loc) · 7.78 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
/*
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 "gradle.plugin.io.sdkman:gradle-sdkvendor-plugin:1.1.0"
classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:5.3.0"
}
}
// modern plugins config
plugins {
id "signing"
id "io.codearte.nexus-staging" version "0.22.0"
id "de.marcphilipp.nexus-publish" version "0.4.0"
id 'com.github.jruby-gradle.base' version '2.0.0'
}
apply plugin: 'io.codearte.nexus-staging'
// 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") }
nexusStaging {
if (project.hasProperty("sonatypeUsername")) {
username = project.sonatypeUsername
}
if (project.hasProperty("sonatypePassword")) {
password = project.sonatypePassword
}
repositoryDescription = "Release ${project.group} ${project.version}"
}
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.1.10.Final'
arquillianSpockVersion = '1.0.0.Beta3'
asciidoctorjPdfVersion = '1.5.4'
asciidoctorjEpub3Version = '1.5.0-alpha.19'
asciidoctorjDiagramVersion = '2.1.2'
asciidoctorjRevealJsVersion = '4.1.0'
commonsioVersion = '2.4'
guavaVersion = '18.0'
hamcrestVersion = '1.3'
jcommanderVersion = '1.72'
jrubyVersion = '9.2.17.0'
jsoupVersion = '1.12.1'
junitVersion = '4.13.1'
assertjVersion = '3.19.0'
nettyVersion = '4.1.58.Final'
saxonVersion = '9.9.0-2'
xmlMatchersVersion = '1.0-RC1'
pdfboxVersion = '1.8.16'
// gem versions
asciidoctorGemVersion = project.hasProperty('asciidoctorGemVersion') ? project.asciidoctorGemVersion : '2.0.13'
coderayGemVersion = '1.1.3'
rougeGemVersion = '3.26.0'
codenarcVersion = '0.24.1'
groovyVersion = '2.4.13'
erubisGemVersion = '2.7.0'
hamlGemVersion = '5.0.4'
openUriCachedGemVersion = '0.0.5'
slimGemVersion = '4.1.0'
concurrentRubyGemVersion = '1.1.8'
spockVersion = '0.7-groovy-2.0'
threadSafeGemVersion = '0.3.6'
tiltGemVersion = '2.0.10'
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
// NOTE sourceCompatibility & targetCompatibility are set in gradle.properties to meet requirements of Gradle
// Must redefine here to work around a bug in the Eclipse plugin
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
plugins.withType(JavaPlugin) {
project.tasks.withType(JavaCompile) { task ->
task.sourceCompatibility = project.sourceCompatibility
task.targetCompatibility = project.targetCompatibility
if (project.hasProperty("showDeprecation")) {
options.compilerArgs << "-Xlint:deprecation"
}
if (project.hasProperty("showUnchecked")) {
options.compilerArgs << "-Xlint:unchecked"
}
}
project.tasks.withType(GroovyCompile) { task ->
task.sourceCompatibility = project.sourceCompatibility
task.targetCompatibility = project.targetCompatibility
}
}
repositories {
if (project.hasProperty('useMavenLocal') && project.useMavenLocal.toBoolean()) {
mavenLocal()
}
mavenCentral()
}
apply plugin: 'codenarc'
codenarc {
configFile = rootProject.file('config/codenarc/codenarc.groovy')
}
if (!isIntegrationTestProject(it)) {
dependencies {
testImplementation "junit:junit:$junitVersion"
testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion"
testImplementation("org.spockframework:spock-core:$spockVersion") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
testImplementation "org.codehaus.groovy:groovy-all:$groovyVersion"
testImplementation "org.jboss.arquillian.junit:arquillian-junit-container:$arquillianVersion"
testImplementation "org.jboss.arquillian.spock:arquillian-spock-container:$arquillianSpockVersion"
codenarc "org.codehaus.groovy:groovy:$groovyVersion"
codenarc "org.codehaus.groovy:groovy-xml:$groovyVersion"
codenarc "org.codehaus.groovy:groovy-ant:$groovyVersion"
codenarc("org.codenarc:CodeNarc:$codenarcVersion") {
exclude group: 'org.codehaus.groovy'
}
}
}
test {
forkEvery = 10
minHeapSize = '128m'
maxHeapSize = '1024m'
if (JavaVersion.current().isJava8Compatible()) {
jvmArgs '-XX:-UseGCOverheadLimit'
}
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)"
}
}
}
}
}
configure(subprojects.findAll { !it.isDistribution() && it.name != 'asciidoctorj-api' && it.name != 'asciidoctorj-documentation' && it.name != 'asciidoctorj-test-support' && it.name != 'asciidoctorj-arquillian-extension' && !isIntegrationTestProject(it) }) {
apply from: rootProject.file('gradle/versioncheck.gradle')
}
boolean isIntegrationTestProject(def project) {
project.name in ['asciidoctorj-wildfly-integration-test',
'asciidoctorj-springboot-integration-test',
'springboot-app']
}
// apply JRuby and sources/javadocs packaging stuff for all subprojects except the distribution
configure(subprojects.findAll { !it.isDistribution() }) {
apply plugin: 'com.github.jruby-gradle.base'
apply from: rootProject.file('gradle/eclipse.gradle')
apply plugin: 'idea'
jruby {
defaultRepositories false
}
repositories {
ruby.gems()
}
if (JavaVersion.current().isJava8Compatible()) {
javadoc {
// Oracle JDK8 likes to fail the build over spoiled HTML
options.addStringOption('Xdoclint:none', '-quiet')
options.source('8')
}
}
}
configure(subprojects.findAll { !it.name.endsWith('-distribution') && ! it.name.endsWith('-documentation')}) {
java {
withJavadocJar()
withSourcesJar()
}
jruby {
defaultRepositories = false
defaultVersion = jrubyVersion
// TODO I'd like to be able to customize the name of the gemInstallDir
}
ext {
// path to use for the prepared jruby gems
preparedGems = new File("$buildDir/preparedGems")
}
sourceSets {
main {
//let's register an output folder on the main SourceSet:
output.dir(preparedGems, builtBy: 'jrubyPrepare')
//it is now a part of the 'main' classpath and will be a part of the jar
}
}
// QUESTION is this the right place to insert this task dependency in the lifecycle?
// IMPORTANT The TMP or TEMP environment variable must be set for the gem install command to work on Windows
processResources.dependsOn jrubyPrepare
}