forked from asciidoctor/asciidoctorj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
172 lines (149 loc) · 5.52 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
// legacy plugins config; necessary to accomodate Java 6
buildscript {
repositories {
jcenter()
}
dependencies {
if (JavaVersion.current().isJava7Compatible()) {
classpath 'com.netflix.nebula:nebula-publishing-plugin:2.0.0'
}
}
}
// modern plugins config
plugins {
id 'com.github.jruby-gradle.base' version '0.1.11'
// Adding the nebula-publishing plugin when using JDK6 causes the build to abort
//id 'nebula.nebula-publishing' version '2.0.0'
id 'com.jfrog.bintray' version '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
guavaVersion = '18.0'
hamcrestVersion = '1.3'
jcommanderVersion = '1.35'
jrubyVersion = '1.7.18'
jsoupVersion = '1.8.1'
junitVersion = '4.12'
saxonVersion = '9.5.1-6'
xmlMatchersVersion = '1.0-RC1'
// gem versions
asciidoctorGemVersion = project.hasProperty('asciidoctorGemVersion') ? project.asciidoctorGemVersion : '1.5.2'
asciidoctorEpub3GemVersion = project(':asciidoctorj-epub3').version.replace('-', '.')
asciidoctorPdfGemVersion = project(':asciidoctorj-pdf').version.replace('-', '.')
asciidoctorDiagramGemVersion = project(':asciidoctorj-diagram').version.replace('-', '.')
coderayGemVersion = '1.1.0'
erubisGemVersion = '2.7.0'
hamlGemVersion = '4.0.5'
openUriCachedGemVersion = '0.0.5'
prawnGemVersion = '1.2.1'
slimGemVersion = '2.0.3'
threadSafeGemVersion = '0.3.4'
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'
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
repositories {
if (project.hasProperty('useMavenLocal') && project.useMavenLocal.toBoolean()) {
mavenLocal()
}
// QUESTION can we switch to jcenter() only?
mavenCentral()
maven {
name 'rubygems-release'
url 'http://rubygems-proxy.torquebox.org/releases'
}
maven {
name 'rubygems-prerelease'
url 'http://rubygems-proxy.torquebox.org/prereleases'
}
}
}
// apply Java and JRuby stuff for all subprojects except the distribution
configure(subprojects.findAll { !it.name.endsWith('-distribution') }) {
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)"
}
}
}
}
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
}
apply plugin: 'com.github.jruby-gradle.base'
jruby {
defaultRepositories = false
defaultVersion = 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
apply from: rootProject.file('gradle/eclipse.gradle')
if (JavaVersion.current().isJava7Compatible()) {
apply from: rootProject.file('gradle/publish.gradle')
}
}
subprojects {
if (JavaVersion.current().isJava7Compatible()) {
apply from: rootProject.file('gradle/sign.gradle')
apply from: rootProject.file('gradle/deploy.gradle')
}
}
apply from: 'gradle/idea.gradle'
// disable bintrayUpload on root project to prevent build from failing
// NOTE seems to only get added when we use the modern plugin syntax
if (tasks.findByName(':bintrayUpload')) {
bintrayUpload.enabled = false
}