forked from ratpack/ratpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ratpack.gradle
224 lines (188 loc) · 6.12 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
/*
* 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.
*/
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.locks.ReentrantLock
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:2.2.3"
// Artifactory plugin pulls in very old Guava, which conflicts with child projects.
// Force to newer version here.
classpath 'com.google.guava:guava:18.0'
classpath 'org.apache.commons:commons-lang3:3.6'
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.3.1"
classpath "com.github.ben-manes:gradle-versions-plugin:0.17.0"
}
}
allprojects {
version = "1.8.0-SNAPSHOT"
}
ext {
isSnapshot = version.endsWith("SNAPSHOT")
isTravis = System.getenv("TRAVIS") != null
isDrone = System.getenv("DRONE") != null
isCodeship = System.getenv("CI_NAME") == "codeship"
isSnapCi = System.getenv("SNAP_CI") != null
isAppveyor = System.getenv("APPVEYOR") != null
isHeroku = System.getenv("HEROKU") != null
isSemaphore = System.getenv("SEMAPHORE") != null
isCircleCI = System.getenv("CIRCLECI") != null
isCloudCi = isTravis || isDrone || isCodeship || isSnapCi || isAppveyor || isSemaphore || isCircleCI
isCi = isCloudCi
publishedModules = [
"ratpack-base",
"ratpack-consul",
"ratpack-core",
"ratpack-dropwizard-metrics",
"ratpack-exec",
"ratpack-gradle",
"ratpack-groovy",
"ratpack-groovy-test",
"ratpack-gson",
"ratpack-guice",
"ratpack-h2",
"ratpack-handlebars",
"ratpack-hikari",
"ratpack-hystrix",
"ratpack-jdbc-tx",
"ratpack-manual",
"ratpack-newrelic",
"ratpack-pac4j",
"ratpack-reactor",
"ratpack-remote",
"ratpack-remote-test",
"ratpack-retrofit2",
"ratpack-rocker",
"ratpack-rx", "ratpack-rx2",
"ratpack-session",
"ratpack-session-redis",
"ratpack-spring-boot",
"ratpack-spring-boot-starter",
"ratpack-test",
"ratpack-thymeleaf", "ratpack-thymeleaf3",
].collect { project(it) }
noCodeModules = [
"ratpack-spring-boot-starter"
]
apiModules = publishedModules.findAll { !(it.name in ["ratpack-manual", "ratpack-gradle", "ratpack-spring-boot-starter", "ratpack-thymeleaf3"]) }
}
apply from: 'gradle/buildScan.gradle'
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().java8Compatible) {
throw new IllegalStateException("Must be built with Java 8 or higher")
}
apply plugin: "artifactory"
apply plugin: "com.github.kt3k.coveralls"
apply plugin: "com.github.ben-manes.versions"
artifactory {
contextUrl = 'http://oss.jfrog.org'
}
artifactoryPublish { task ->
gradle.taskGraph.whenReady { taskGraph ->
def startParameter = project.gradle.startParameter
if (taskGraph.hasTask(task) && startParameter.parallelProjectExecutionEnabled && startParameter.maxWorkerCount > 1) {
throw new IllegalStateException("cannot run " + task + " with --parallel and --max-workers > 1")
}
}
skip true
}
task bintrayPublish() {
doLast {
if (!project.hasProperty("ratpackBintrayUser")) {
throw new InvalidUserDataException("You must provide ratpackBintrayUser")
}
if (!project.hasProperty("ratpackBintrayApiKey")) {
throw new InvalidUserDataException("You must provide ratpackBintrayApiKey")
}
if (!project.hasProperty('buildNumber')) {
throw new GradleException("Must provide buildNumber of a release binary from oss.jfrog.org")
}
def curl = ['curl',
'-X', 'POST',
"-u", "${ratpackBintrayUser}:${ratpackBintrayApiKey}",
"https://oss.jfrog.org/api/plugins/build/promote/releaseToBintray/ratpack/$buildNumber?params=org=ratpack;repo=maven;package=ratpack"
].execute()
println "Received response: ${curl.text}"
}
}
allprojects {
group = "io.ratpack"
apply plugin: "base"
apply plugin: "idea"
apply plugin: "eclipse"
apply from: "$rootDir/gradle/dependencyRules.gradle"
apply plugin: "com.github.ben-manes.versions"
repositories {
jcenter()
maven { url 'https://oss.jfrog.org/artifactory/repo' }
}
configurations {
published
}
if (isCi) {
tasks.withType(JavaExec) {
maxHeapSize = "1g"
}
}
}
apply from: "gradle/idea/idea.gradle"
apply from: "gradle/dependencies.gradle"
subprojects {
apply from: "$rootDir/gradle/ratpackLocal.gradle"
if (project in publishedModules) {
apply from: "$rootDir/gradle/publish.gradle"
}
}
evaluationDependsOnChildren()
apply plugin: "jacoco"
task jacocoReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
def projects = subprojects.findAll { it.plugins.hasPlugin(JacocoPlugin) && it.file("src/test").exists() }
dependsOn projects*.test
sourceDirectories = files(projects*.sourceSets*.main*.allSource)
classDirectories = files(projects*.sourceSets*.main*.output)
executionData = files(projects*.jacocoTestReport*.executionData)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
}
}
task downloadDependencies() {
doLast {
allprojects { p ->
configurations.each { c ->
if (c.canBeResolved) {
println "Downloading dependencies for $p.path - $c.name"
c.files
}
}
}
}
}
task sanityCheck { t ->
allprojects {
dependsOn it.tasks.withType(CodeNarc)
dependsOn it.tasks.withType(Checkstyle)
}
}