forked from ratpack/ratpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ratpack.gradle
262 lines (221 loc) · 6.72 KB
/
ratpack.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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/*
* Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.gradle.api.plugins:gradle-clover-plugin:0.6.1"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:2.2.3"
}
}
def jvmEncoding = java.nio.charset.Charset.defaultCharset().name()
if (jvmEncoding != "UTF-8") {
throw new IllegalStateException("Build environment must be UTF-8 (it is: $jvmEncoding) - add '-Dfile.encoding=UTF-8' to the GRADLE_OPTS environment variable ")
}
if (!JavaVersion.current().java7Compatible) {
throw new IllegalStateException("Must be built with Java 7 or higher")
}
apply plugin: 'artifactory'
artifactory {
contextUrl = 'http://oss.jfrog.org'
}
artifactoryPublish {
skip true
}
allprojects {
group = "io.ratpack"
version = rootProject.file("shared-resources/ratpack/ratpack-version.txt").text.trim()
apply plugin: "base"
apply plugin: "idea"
apply plugin: "eclipse"
apply from: "$rootDir/gradle/dependencyRules.gradle"
repositories {
jcenter()
maven { url 'http://oss.jfrog.org/artifactory/repo' }
}
def noClover = ["ratpack-site", "ratpack-manual", "ratpack-lazybones"]
if (project.hasProperty("enableClover") && !noClover.contains(project.name)) {
project.apply from: rootProject.file("gradle/clover.gradle")
}
clean {
delete fileTree(dir: projectDir, include: "**/Expression\$*.class")
}
}
apply from: "gradle/idea/idea.gradle"
ext {
isSnapshot = version.endsWith("SNAPSHOT")
isTravis = System.getenv("TRAVIS") != null
publishedModules = [
"ratpack-core", "ratpack-groovy", "ratpack-guice", "ratpack-session", "ratpack-test", "ratpack-groovy-test",
"ratpack-manual", "ratpack-gradle", "ratpack-handlebars", "ratpack-remote", "ratpack-remote-test", "ratpack-jackson",
"ratpack-codahale-metrics", "ratpack-h2", "ratpack-thymeleaf", "ratpack-rx", "ratpack-hikari", "ratpack-newrelic",
"ratpack-pac4j"
].collect { project(it) }
apiModules = publishedModules.findAll { !(it.name in ["ratpack-manual", "ratpack-gradle"]) }
}
apply from: "gradle/dependencies.gradle"
subprojects {
tasks.withType(Upload).matching { it.name != "install" }.all {
rootProject.subprojects {
mustRunAfter tasks.matching { it instanceof VerificationTask }
}
}
// CodeNarc appears to hang in drone.io
tasks.withType(CodeNarc) {
onlyIf { !rootProject.hasProperty("ciBuild") }
}
tasks.withType(Test) {
allprojects {
mustRunAfter tasks.withType(Checkstyle)
}
}
tasks.withType(GroovyCompile) {
allprojects {
mustRunAfter tasks.withType(CodeNarc)
}
}
apply from: "$rootDir/gradle/ratpackLocal.gradle"
tasks.withType(Javadoc) {
options.encoding = "utf-8"
options.docEncoding = "utf-8"
options.charSet = "utf-8"
exclude "**/internal/**"
}
apply plugin: "maven"
apply from: "${rootDir}/gradle/pom.gradle"
apply plugin: "signing"
if (rootProject.hasProperty("ciBuild")) {
plugins.withType(ReportingBasePlugin) {
reporting.baseDir = rootProject.file("build/reports/$name")
}
}
plugins.withType(JavaPlugin) {
sourceSets.main {
resources {
srcDir rootProject.file("shared-resources")
}
}
tasks.withType(AbstractCompile) {
options.compilerArgs << "-Werror" << "-Xlint:all" << "-Xlint:-options"
}
test {
testLogging {
exceptionFormat "full"
showStackTraces true
showCauses true
quiet {
events "failed"
}
}
jvmArgs "-Xss320k"
}
sourceCompatibility = "1.7"
targetCompatibility = "1.7"
task sourceJar(type: Jar) {
description "An archive of the source code for Maven Central"
classifier "sources"
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
description "An archive of the JavaDocs for Maven Central"
classifier "javadoc"
from javadoc
}
artifacts {
archives javadocJar, sourceJar
}
signing {
if (!isSnapshot) {
sign configurations.archives
}
}
install {
repositories {
mavenDeployer {
repository(url: "file://${rootProject.buildDir.absolutePath}/localrepo")
}
}
}
install.repositories["mavenInstaller"].beforeDeployment { deployment ->
if (!isSnapshot) {
artifacts {
signatures signing.signPom(deployment)
}
}
}
}
}
// Have to evaluate the children before setting up the publishing stuff so the dependencies are defined.
evaluationDependsOnChildren()
subprojects {
configurations.signatures.artifacts.all {
extension = toSignArtifact.extension + "." + extension
}
if (project in publishedModules) {
apply plugin: "artifactory"
artifactoryPublish { task ->
rootProject.artifactory {
publish {
repository {
repoKey = isSnapshot ? 'oss-snapshot-local' : 'oss-release-local'
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(task)) {
username = ratpackBintrayUser
password = ratpackBintrayApiKey
}
}
}
}
}
}
assert description: "Project $project.path is published, must have a description"
modifyPom {
project {
name project.name
description project.description
url "http://www.ratpack.io"
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
}
scm {
connection "scm:https://[email protected]/ratpack/ratpack"
developerConnection "scm:[email protected]:ratpack/ratpack.git"
url "https://github.com/ratpack/ratpack"
}
developers {
developer {
id "ratpack"
name "Team Ratpack"
}
}
}
}
}
}
task ciZip(type: Zip) {
into "reports", { from "build/reports" }
into "manual", { from { project(":ratpack-manual").packageManual } }
archiveName = "ci.zip"
destinationDir = buildDir
}
task stage {
dependsOn "clean", ":ratpack-site:installApp"
}