forked from jbake-org/jbake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
222 lines (186 loc) · 7.03 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
plugins {
id "eclipse"
id "idea"
id "io.sdkman.vendors" version "1.1.1" apply false
id "com.jfrog.bintray" version "1.8.4" apply false
id "com.github.kt3k.coveralls" version "2.8.2" apply false
id "org.sonarqube" version "2.7" apply false
id 'com.github.ben-manes.versions' version '0.20.0'
id "nebula.optional-base" version "5.0.0" apply false
}
// common variables
ext {
asciidoctorjVersion = '1.5.8.1'
asciidoctorjDiagramVersion = '1.5.11'
commonsIoVersion = '2.6'
commonsConfigurationVersion = '1.10'
commonsLangVersion = '3.8.1'
commonsVfs2Version = '2.2'
args4jVersion = '2.33'
freemarkerVersion = '2.3.28'
junit4Version = '4.12'
junit5Version = '5.3.1'
junitPioneer = '0.2.2'
flexmarkVersion = '0.40.8'
jettyServerVersion = '9.4.12.v20180830'
orientDbVersion = '3.0.14'
groovyVersion = '2.5.5'
slf4jVersion = '1.7.25'
logbackVersion = '1.2.3'
assertjCoreVersion = '2.9.1'
thymeleafVersion = '3.0.11.RELEASE'
jsonSimpleVersion = '1.1.1'
jade4jVersion = '1.2.7'
mockitoVersion = '2.23.4'
jsoupVersion = '1.11.3'
pebbleVersion = '3.0.7'
isTravis = (System.getenv("TRAVIS") == "true")
isTravisPullRequest = (System.getenv("TRAVIS_PULL_REQUEST")) != "false"
pullRequestId = System.getenv("TRAVIS_PULL_REQUEST")
hasGithub = System.getenv("GITHUBTOKEN") && System.getenv("GITHUBREPO")
hasSonar = System.getenv("SONARORG") && System.getenv("SONARLOGIN")
sonarDefaultURL = "https://sonarcloud.io"
sonarDefaultProjectKey = "org.jbake:jbake-base:jbake-core"
sonarURL = System.getenv("SONARHOST") ?: sonarDefaultURL
sonarProjectKey = System.getenv("SONARPROJECTKEY") ?: sonarDefaultProjectKey
}
/**
* Apply coveralls to the root project as we just need it here to send the
* aggregated coverage execution data from the jacocoRootReport task
*/
apply plugin: 'com.github.kt3k.coveralls'
/**
* Apply jacoco plugin to all projects and add jcenter as default repository
*/
allprojects {
apply plugin: 'jacoco'
if ( JavaVersion.current().isJava8Compatible() ) {
apply plugin: 'checkstyle'
tasks.withType(Checkstyle) {
reports {
xml.enabled false
html.enabled true
}
}
}
repositories {
jcenter()
}
jacoco {
toolVersion = jacocoVersion
}
}
/**
* Common setup for all subprojects
*/
subprojects {
apply plugin: 'java'
apply plugin: 'nebula.optional-base'
apply from: "$rootDir/gradle/signing.gradle"
// We do not publish any jars from the jbake-dist project
if ( project.name != "jbake-dist" ) {
apply from: "$rootDir/gradle/maven-publishing.gradle"
}
// add source and target compatibility for all JavaCompile tasks
tasks.withType(JavaCompile) {
sourceCompatibility = 1.8
targetCompatibility = 1.8
/**
* Fix for warning: [options] bootstrap class path not set in conjunction with -source
* See https://stackoverflow.com/questions/42599422/warning-options-bootstrap-class-path-not-set-in-conjunction-with-source-1-7
*/
File file = file("${System.properties.getProperty("java.home")}/lib/rt.jar")
if ( file.exists() ) {
options.setBootstrapClasspath(files(file))
}
}
test {
useJUnitPlatform()
}
dependencies {
compile "org.slf4j:slf4j-api:$slf4jVersion"
compile "org.slf4j:jul-to-slf4j:$slf4jVersion"
compile "org.slf4j:jcl-over-slf4j:$slf4jVersion"
compile "ch.qos.logback:logback-classic:$logbackVersion", optional
compile "ch.qos.logback:logback-core:$logbackVersion", optional
testCompile("org.junit.jupiter:junit-jupiter-api:$junit5Version")
testRuntime("org.junit.jupiter:junit-jupiter-engine:$junit5Version")
testCompile("org.junit-pioneer:junit-pioneer:$junitPioneer")
// compatibility for Junit 4 test
testCompile "junit:junit:$junit4Version"
testRuntime("org.junit.vintage:junit-vintage-engine:$junit5Version")
testCompile "org.assertj:assertj-core:$assertjCoreVersion"
testCompile "org.mockito:mockito-core:$mockitoVersion"
testCompile "org.mockito:mockito-junit-jupiter:$mockitoVersion"
}
dependencyUpdates.resolutionStrategy = {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]?${qualifier}[.\d-]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}
//set jvm for all Test tasks (like test and smokeTest)
tasks.withType(Test) {
def args = ['-Xms512m', '-Xmx3g', '-Dorientdb.installCustomFormatter=false=false','-Djna.nosys=true']
/**
* AppVeyor breaks with mockito throwing a java.lang.OutOfMemoryError: PermGen space
*/
if ( JavaVersion.current().java7 ) {
args << '-XX:MaxPermSize=2g'
}
/**
* jdk9 build is unable to determine the amount of MaxDirectMemorySize
* See https://pastebin.com/ECvQeHx0
*/
if ( JavaVersion.current().java9Compatible ) {
args << '-XX:MaxDirectMemorySize=2g'
}
jvmArgs args
}
jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}
jacocoTestReport.dependsOn test
}
task jacocoMerge(type: JacocoMerge) {
description 'Merge all testreport execution data from subprojects excluding jbake-dist'
dependsOn subprojects.test
executionData subprojects.findAll{it.name!="jbake-dist"}.jacocoTestReport.executionData
}
task jacocoRootReport(type: JacocoReport, group: 'Coverage reports') {
description = 'Generates an aggregate report from all subprojects'
dependsOn jacocoMerge
sourceDirectories.from files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories.from files(subprojects.sourceSets.main.output)
executionData.from jacocoMerge.executionData
reports {
html.enabled = true
xml.enabled = true
}
}
task testReport(type: TestReport) {
description "Generate an aggregated Testreport for all projects"
destinationDir = file("$buildDir/reports/allTests")
// Include the results from the `test` task in all subprojects
reportOn subprojects*.test
}
coveralls {
sourceDirs = subprojects.sourceSets.main.allSource.srcDirs.flatten()
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
}
tasks.coveralls {
group = 'Coverage reports'
description = 'Uploads the aggregated coverage report to Coveralls'
dependsOn jacocoRootReport
// Skip Task if not run on CI Server
onlyIf { System.env.'CI' }
}