-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.gradle
201 lines (171 loc) · 5.87 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
/*
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("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.8.0'
pdfboxVersion = '3.0.0'
junitVersion = '5.10.0'
assertjVersion = '3.24.2'
// gem versions
asciidoctorJVersion = project.hasProperty('asciidoctorJVersion') ? project.asciidoctorJVersion : '2.5.7'
asciidoctorPdfGemVersion = project.hasProperty('asciidoctorPdfGemVersion') ? project.asciidoctorPdfGemVersion : '2.3.19'
addressableVersion = '2.8.0'
concurrentRubyVersion = '1.1.7'
public_suffixVersion = '1.4.6'
prawnGemVersion=project.hasProperty('prawnGemVersion') ? project.prawnGemVersion : '2.4.0'
prawnSvgGemVersion = "0.34.1"
rghostGemVersion = '0.9.7'
threadSafeGemVersion = '0.3.6'
ttfunkGemVersion = '1.7.0'
cssParserGemVersion = '1.12.0'
textHyphenVersion='1.4.1'
}
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'
apply from: "$rootDir/gradle/providedConfiguration.gradle"
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).configureEach {
project.tasks.withType(JavaCompile).configureEach { task ->
if (JavaVersion.current().isJava11Compatible()) {
task.options.release = 8
}
if (project.hasProperty("showDeprecation")) {
options.compilerArgs << "-Xlint:deprecation"
}
if (project.hasProperty("showUnchecked")) {
options.compilerArgs << "-Xlint:unchecked"
}
}
project.tasks.withType(GroovyCompile).configureEach { task ->
if (JavaVersion.current().isJava11Compatible()) {
task.options.release = 8
}
}
}
repositories {
if (project.hasProperty('useMavenLocal') && project.useMavenLocal.toBoolean()) {
mavenLocal()
}
mavenCentral()
}
dependencies {
testImplementation(platform("org.junit:junit-bom:$junitVersion"))
testImplementation "org.junit.jupiter:junit-jupiter-api"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
testImplementation "org.assertj:assertj-core:$assertjVersion"
}
test {
useJUnitPlatform()
forkEvery = 10
minHeapSize = '128m'
maxHeapSize = '1024m'
if (JavaVersion.current().isJava8Compatible()) {
jvmArgs '-XX:-UseGCOverheadLimit'
} else {
jvmArgs '-XX:MaxPermSize=256m', '-XX:-UseGCOverheadLimit'
}
testLogging {
exceptionFormat = 'full'
// 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()
}
if (JavaVersion.current().isJava8Compatible()) {
javadoc {
// Oracle JDK8 likes to fail the build over spoiled HTML
options.addStringOption('Xdoclint:none', '-quiet')
}
}
java {
withJavadocJar()
withSourcesJar()
}
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
}
}
}
configure(subprojects.findAll { it.name != 'itest'}) {
jruby {
jrubyVersion = jrubyVersion
}
compileJava {
options.release = 8
}
// 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)
}