forked from asciidoctor/asciidoctorj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
187 lines (160 loc) · 6.13 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
/*
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 {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.github.jruby-gradle:jruby-gradle-plugin:0.1.17"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7"
classpath "gradle.plugin.io.sdkman:gradle-sdkvendor-plugin: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')
// using ExpandoMetaClass to add isDistribution() Method to Project instances...
Project.metaClass.isDistribution = { delegate.getName().endsWith("-distribution") }
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
guavaVersion = '18.0'
hamcrestVersion = '1.3'
jcommanderVersion = '1.35'
jrubyVersion = '1.7.26'
jsoupVersion = '1.8.3'
junitVersion = '4.12'
saxonVersion = '9.5.1-6'
xmlMatchersVersion = '1.0-RC1'
// gem versions
asciidoctorGemVersion = project.hasProperty('asciidoctorGemVersion') ? project.asciidoctorGemVersion : '1.5.5'
asciidoctorEpub3GemVersion = project(':asciidoctorj-epub3').version.replace('-', '.')
asciidoctorPdfGemVersion = project(':asciidoctorj-pdf').version.replace('-', '.')
asciidoctorDiagramGemVersion = project(':asciidoctorj-diagram').version.replace('-', '.')
addressableVersion = '2.4.0'
public_suffixVersion = '1.4.6'
coderayGemVersion = '1.1.0'
erubisGemVersion = '2.7.0'
hamlGemVersion = '4.0.5'
openUriCachedGemVersion = '0.0.5'
prawnGemVersion = '1.3.0'
rougeGemVersion = '1.10.1'
slimGemVersion = '3.0.6'
threadSafeGemVersion = '0.3.5'
tiltGemVersion = '2.0.1'
ttfunkGemVersion = '1.2.2'
}
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'
if (JavaVersion.current().isJava7Compatible()) {
apply from: rootProject.file('gradle/signing.gradle')
if (!it.isDistribution()) {
apply from: rootProject.file('gradle/publish.gradle')
}
apply from: rootProject.file('gradle/deploy.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_6
plugins.withType(JavaPlugin) {
project.tasks.withType(JavaCompile) { task ->
task.sourceCompatibility = project.sourceCompatibility
task.targetCompatibility = project.targetCompatibility
}
project.tasks.withType(GroovyCompile) { task ->
task.sourceCompatibility = project.sourceCompatibility
task.targetCompatibility = project.targetCompatibility
}
}
repositories {
if (project.hasProperty('useMavenLocal') && project.useMavenLocal.toBoolean()) {
mavenLocal()
}
jcenter()
}
dependencies {
testCompile "junit:junit:$junitVersion"
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
}
test {
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)"
}
}
}
}
}
// 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 from: rootProject.file('gradle/versioncheck.gradle')
repositories {
maven {
name 'rubygems-release'
url 'http://rubygems-proxy.torquebox.org/releases'
}
maven {
name 'rubygems-prerelease'
url 'http://rubygems-proxy.torquebox.org/prereleases'
}
}
if (JavaVersion.current().isJava8Compatible()) {
javadoc {
// Oracle JDK8 likes to fail the build over spoiled HTML
options.addStringOption('Xdoclint:none', '-quiet')
}
}
task sourcesJar(type: Jar, dependsOn: classes, group: 'Release') {
description 'Assembles a jar archive containing the main source code.'
from sourceSets.main.allSource
classifier 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc, group: 'Release') {
description 'Assembles a jar archive containing the Javadoc API documentation for the main source code.'
from javadoc.destinationDir
classifier 'javadoc'
}
// jcenter & Maven Central requires sources & javadoc jars (even if empty), so give 'em what they want
artifacts {
archives sourcesJar, javadocJar
}
jruby {
defaultRepositories = false
defaultVersion = jrubyVersion
execVersion = jrubyVersion
// TODO I'd like to be able to customize the name of the gemInstallDir
}
// 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 jrubyPrepareGems
}