-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
195 lines (165 loc) · 5.57 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
/*
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 and bintray 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("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 "signing"
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
}
// 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')
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
jrubyVersion = '9.4.7.0'
junitVersion = '5.8.2'
assertjVersion = '3.22.0'
jsoupVersion = '1.17.2'
// gem versions
asciidoctorJVersion = project.hasProperty('asciidoctorJVersion') ? project.asciidoctorJVersion : '2.5.10'
asciidoctorDiagramGemVersion = project.hasProperty('asciidoctorDiagramGemVersion') ? project.asciidoctorDiagramGemVersion : project(':asciidoctorj-diagram').version.replace('-', '.')
asciidoctorDiagramBatikGemVersion = "1.17"
barbyGemVersion = "0.6.9"
rqrcodeGemVersion = "2.2.0"
rexmlGemVersion = '3.2.6'
}
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 from: "$rootDir/gradle/providedConfiguration.gradle"
status = _status
def _javaVersion = 8
if (project.name == "itest"
|| project.name == "asciidoctorj-diagram-jsyntrax") {
_javaVersion = 11
}
project.tasks.withType(JavaCompile).configureEach { task ->
task.options.release = _javaVersion
}
project.tasks.withType(GroovyCompile).configureEach {task ->
task.options.release = _javaVersion
}
repositories {
if (project.hasProperty('useMavenLocal') && project.useMavenLocal.toBoolean()) {
mavenLocal()
}
mavenCentral()
}
dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
testImplementation "org.assertj:assertj-core:$assertjVersion"
}
apply plugin: 'codenarc'
codenarc {
configFile = rootProject.file('config/codenarc/codenarc.groovy')
}
test {
useJUnitPlatform()
forkEvery = 10
minHeapSize = '128m'
maxHeapSize = '1024m'
if (JavaVersion.current().isJava8Compatible()) {
jvmArgs '-XX:-UseGCOverheadLimit'
} else {
jvmArgs '-XX:MaxPermSize=256m', '-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.name != 'itest'}) {
apply from: rootProject.file('gradle/versioncheck.gradle')
apply plugin: 'com.github.jruby-gradle.base'
repositories {
ruby.gems()
}
ext {
// path to use for the prepared jruby gems
preparedGems = new File("$buildDir/preparedGems")
}
if (JavaVersion.current().isJava8Compatible()) {
javadoc {
// Oracle JDK8 likes to fail the build over spoiled HTML
options.addStringOption('Xdoclint:none', '-quiet')
}
}
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
}
}
}
configure(subprojects.findAll { it.name != 'itest'}) {
java {
withJavadocJar()
withSourcesJar()
}
jruby {
jrubyVersion = rootProject.jrubyVersion
}
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
}
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)
}