forked from asciidoctor/asciidoctorj
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
162 lines (134 loc) · 4.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
apply plugin: 'java-library'
apply plugin: 'groovy'
apply plugin: 'biz.aQute.bnd.builder'
apply plugin: 'com.github.jruby-gradle.base'
project.ext.publicationName = "mavenAsciidoctorJ"
apply from: rootProject.file('gradle/publish.gradle')
apply from: rootProject.file('gradle/signing.gradle')
repositories {
ruby.gems()
}
dependencies {
api project(path: ':asciidoctorj-api')
api "org.jruby:jruby:$jrubyVersion"
implementation "com.beust:jcommander:$jcommanderVersion"
gems "rubygems:asciidoctor:$asciidoctorGemVersion"
gems "rubygems:asciimath:$asciimathGemVersion"
gems "rubygems:coderay:$coderayGemVersion"
gems "rubygems:rouge:$rougeGemVersion"
gems "rubygems:erubis:$erubisGemVersion"
gems "rubygems:haml:$hamlGemVersion"
gems "rubygems:open-uri-cached:$openUriCachedGemVersion"
gems "rubygems:slim:$slimGemVersion"
gems "rubygems:thread_safe:$threadSafeGemVersion"
gems "rubygems:tilt:$tiltGemVersion"
gems "rubygems:concurrent-ruby:$concurrentRubyGemVersion"
// TODO could use dependency replacement feature to fix version of Saxon-HE
testImplementation("org.xmlmatchers:xml-matchers:$xmlMatchersVersion") { exclude module: 'Saxon-HE' }
testImplementation "net.sf.saxon:Saxon-HE:$saxonVersion"
testImplementation "com.google.guava:guava:$guavaVersion"
testImplementation "org.jsoup:jsoup:$jsoupVersion"
testImplementation "io.netty:netty-all:$nettyVersion"
testImplementation project(path: ':asciidoctorj-arquillian-extension')
compileOnly "org.osgi:osgi.annotation:$osgiVersion"
}
def gemFiles = fileTree("${project.buildDir}/.gems") {
include 'specifications/*.gemspec'
include 'gems/*/lib/**'
include "gems/asciidoctor-*/data/**"
}
apply from: rootProject.file('gradle/versioncheck.gradle')
jrubyPrepare {
doLast {
copy { // bundles the gems inside this artifact
from gemFiles
into preparedGems
}
}
}
tasks.eclipse.dependsOn jrubyPrepare
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
javadoc {
classpath = sourceSets.main.output + sourceSets.main.compileClasspath + project(':asciidoctorj-test-support').sourceSets.test.output
source(project(':asciidoctorj-api').sourceSets.main.allJava)
}
//jruby {
// execVersion = '1.7.20'
//}
jar {
bnd(
('Bundle-Name'): 'asciidoctorj',
('Bundle-SymbolicName'): 'org.asciidoctor.asciidoctorj',
('Import-Package'): 'com.beust.jcommander;resolution:=optional, *'
)
metaInf { from "$buildDir/version-info/" }
}
test {
useJUnit {
excludeCategories 'org.asciidoctor.categories.Polluted'
}
}
task createVersionFile {
inputs.property('version.asciidoctor', asciidoctorGemVersion)
inputs.property('version.asciidoctorj', project.version)
outputs.dir("$buildDir/version-info")
doLast {
file("$buildDir/version-info/asciidoctorj-version.properties").text = """
version.asciidoctorj: ${project.version}
version.asciidoctor: $asciidoctorGemVersion
"""
}
}
jar.dependsOn createVersionFile
task pollutedTest(type: Test) {
useJUnit {
includeCategories 'org.asciidoctor.categories.Polluted'
}
forkEvery = 10
minHeapSize = '128m'
maxHeapSize = '1024m'
if (JavaVersion.current().isJava8Compatible()) {
jvmArgs '-XX:-UseGCOverheadLimit'
}
else {
jvmArgs '-XX:MaxPermSize=256m', '-XX:-UseGCOverheadLimit'
}
environment 'GEM_PATH', '/some/path'
environment 'GEM_HOME', '/some/other/path'
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)"
}
}
}
reports {
html {
destination file("$buildDir/reports/pollutedTest")
}
junitXml {
destination file("$buildDir/pollutedTest-result")
}
}
}
test.dependsOn pollutedTest