forked from grails/grails-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
509 lines (431 loc) · 16.9 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
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
buildscript {
repositories {
maven { url "https://repo.grails.org/grails/core" }
jcenter()
maven { url 'http://dl.bintray.com/vermeulen-mp/gradle-plugins' }
}
dependencies {
classpath "commons-io:commons-io:2.2"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2"
classpath "com.netflix.nebula:gradle-extra-configurations-plugin:2.2.0"
classpath "com.github.adrianbk:gradle-travisci-trigger-plugin:1.0.0"
classpath 'com.bmuschko:gradle-nexus-plugin:2.3'
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3"
classpath 'net.gvmtool:gradle-sdkvendor-plugin:0.3.1'
}
}
apply plugin: 'idea'
ext {
bintrayPublish = false
// Sets release version
grailsVersion = '3.2.0.BUILD-SNAPSHOT'
isBuildSnapshot = grailsVersion.endsWith(".BUILD-SNAPSHOT")
isTravisBuild = System.getenv().get("TRAVIS") == 'true'
antTraxVersion = "1.7.1"
antVersion = "1.9.4"
aspectjVersion = "1.8.7" // use same version as org.springframework:spring-aspects uses
commonsCliVersion = "1.2"
commonsCollectionsVersion = "3.2.1"
commonsIOVersion = "2.2"
commonsLangVersion = "2.6"
datastoreVersion = "5.0.4.RELEASE"
gantVersion = "1.9.6"
gdocEngineVersion = "1.0.1"
groovyVersion = System.getenv('CI_GROOVY_VERSION') ?: "2.4.6"
ivyVersion = "2.3.0"
jansiVersion = "1.11"
jlineVersion = "2.12"
jnaVersion = "4.0.0"
slf4jVersion = "1.7.10"
reactorVersion = '2.0.7.RELEASE'
spockVersion = '1.0-groovy-2.4'
springBootVersion = "1.3.3.RELEASE"
springLoadedVersion = "1.2.6.RELEASE"
springLoadedCommonOptions = "-Xverify:none -Dspringloaded.synchronize=true -Djdk.reflect.allowGetCallerClass=true"
springVersion = "4.2.5.RELEASE"
ehcacheVersion = "2.4.6"
junitVersion = "4.12"
concurrentlinkedhashmapVersion = "1.4.2"
cglibVersion = "2.2.2"
objenesisVersion = "1.4"
tomcatVersion = "8.0.33"
servletApiVersion = "3.0.1"
isJava8Compatible = org.gradle.api.JavaVersion.current().isJava8Compatible()
nexusUsername = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
nexusPassword = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
}
version = grailsVersion
group = "org.grails"
apply plugin: 'io.codearte.nexus-staging'
nexusStaging {
delayBetweenRetriesInMillis = 5000
}
// directories created during the build which are related
// to turning the workspace root into a GRAILS_HOME
ext {
distInstallDir = file("$buildDir/dist-tmp")
homeDistDir = file("dist")
homeBinDir = file("bin")
homeConfDir = file("conf")
homeLibDir = file("lib")
homeSrcDir = file("src")
}
// Groovy is added as a dependency to both the 'groovy' and 'compile'
// configurations, so place the dependency in a shared variable. The
// 'compile' is required so that Groovy appears as a dependency in the
// artifacts' POMs.
ext.jointBuildGroovyJarProperty = System.getProperty('groovy.jar')
ext.groovyDependency = null
if (jointBuildGroovyJarProperty) {
def jointBuildGroovyJar = file(jointBuildGroovyJarProperty)
if (jointBuildGroovyJar.exists()) {
groovyDependency = dependencies.create(files(jointBuildGroovyJar))
} else {
throw new GradleException("The groovy.jar system property points to ${jointBuildGroovyJar.absolutePath} which does not exist.")
}
} else {
groovyDependency = dependencies.create("org.codehaus.groovy:groovy:${groovyVersion}") {
exclude module:"commons-cli"
exclude module:"ant"
}
}
allprojects {
repositories {
maven { url "https://repo.grails.org/grails/core" }
mavenLocal()
if(groovyVersion.endsWith('-SNAPSHOT')) {
maven {
name 'JFrog OSS snapshot repo'
url 'https://oss.jfrog.org/oss-snapshot-local/'
}
}
}
configurations {
all {
resolutionStrategy {
def cacheHours = isCiBuild ? 0 : 24
cacheDynamicVersionsFor cacheHours, 'hours'
cacheChangingModulesFor cacheHours, 'hours'
}
}
}
[Javadoc, Groovydoc].each {
tasks.withType(it).all {
// exclude problematic jar file from javadoc classpath
// http://www.adam-bien.com/roller/abien/entry/trouble_with_crippled_java_ee
if (classpath) {
classpath -= classpath.filter { it.name == 'javaee-web-api-6.0.jar' }
}
// this will apply the javadoc fix tool to all generated javadocs
// we use it to make sure that the javadocs are not vulnerable independently of the JDK used to build
doLast {
def javadocFix = new JavadocFixTool()
javadocFix.recursive = true
javadocFix.doPatch = true
javadocFix.searchAndPatch(destinationDir)
}
}
}
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
apply from: "gradle/idea.gradle"
subprojects { project ->
version = grailsVersion
group = "org.grails"
ext.isTestSuite = project.name.startsWith("grails-test-suite")
ext.isCiBuild = project.hasProperty("isCiBuild")
ext.pomInfo = {
delegate.name 'Grails'
delegate.description 'Grails Web Application Framework'
delegate.url 'http://grails.org/'
delegate.licenses {
delegate.license {
delegate.name 'The Apache Software License, Version 2.0'
delegate.url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
delegate.distribution 'repo'
}
}
delegate.scm {
delegate.url 'scm:[email protected]:grails/grails-core.git'
delegate.connection 'scm:[email protected]:grails/grails-core.git'
delegate.developerConnection 'scm:[email protected]:grails/grails-core.git'
}
delegate.developers {
delegate.developer {
delegate.id 'graemerocher'
delegate.name 'Graeme Rocher'
}
delegate.developer {
delegate.id 'jeffscottbrown'
delegate.name 'Jeff Brown'
}
delegate.developer {
delegate.id 'lhotari'
delegate.name 'Lari Hotari'
}
}
}
if(!project.hasProperty("artifactoryPublishPassword") && System.getenv("ARTIFACTORY_PASSWORD")) {
project.ext.artifactoryPublishPassword = System.getenv("ARTIFACTORY_PASSWORD")
}
if(project.name == 'grails-dependencies') return
if(project.name == 'grails-bom') return
apply plugin: 'groovy'
if(!isTestSuite) {
apply plugin: 'com.bmuschko.nexus'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
}
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'project-report'
apply plugin: 'provided-base'
apply plugin: 'optional-base'
sourceCompatibility = "1.7"
targetCompatibility = "1.7"
if(project.name =~ /^(grails-web|grails-plugin-|grails-project-api|grails-test-suite|grails-test|grails-compat)/) {
dependencies {
provided "javax.servlet:javax.servlet-api:$servletApiVersion"
// MockHttpServletRequest/Response/Context used in many classes
provided("org.springframework:spring-test:${springVersion}") {
exclude group: 'commons-logging', module:'commons-logging'
}
}
}
if(project.name =~ /^(grails-plugin-datasource|grails-test-suite)/) {
dependencies {
provided 'hsqldb:hsqldb:1.8.0.10'
provided 'com.h2database:h2:1.3.176'
}
}
jar{
manifest.mainAttributes(
"Built-By": System.properties['user.name'],
"Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
"Implementation-Title": "Grails",
"Implementation-Version": grailsVersion,
"Implementation-Vendor": 'grails.org')
}
configure([compileGroovy, compileTestGroovy]) {
groovyOptions.fork(jvmArgs: ['-XX:MaxPermSize=512m'], memoryInitialSize: '128M', memoryMaximumSize: '1G')
groovyOptions.encoding = "UTF-8"
options.encoding = "UTF-8"
}
configure([compileJava, compileTestJava]) {
options.deprecation = true
options.debug = true
}
configure([javadoc]) {
options.encoding "UTF-8"
options.docEncoding "UTF-8"
options.charSet "UTF-8"
options.jFlags "-Xms64M", "-Xmx512M"
if(!isJava8Compatible) {
options.jFlags "-XX:MaxPermSize=256m"
}
}
idea {
module.iml.whenMerged { module ->
// adding slf4j-simple with scope TEST to .iml
module.dependencies << new org.gradle.plugins.ide.idea.model.ModuleLibrary(
[new org.gradle.plugins.ide.idea.model.Path("jar://\$GRADLE_USER_HOME/cache/org.slf4j/slf4j-simple/jars/slf4j-simple-${slf4jVersion}.jar!/")], [], [], [], "TEST"
)
}
}
dependencies {
compile groovyDependency
testCompile "org.codehaus.groovy:groovy-test:${groovyVersion}", {
exclude group:'junit', module: 'junit'
exclude group:'org.codehaus.groovy', module: 'groovy'
exclude group:'org.hamcrest', module: 'hamcrest-core'
}
if (project.name != "grails-docs") {
// Logging
compile "org.slf4j:slf4j-api:$slf4jVersion"
compile "org.slf4j:jcl-over-slf4j:$slf4jVersion"
// Testing
testCompile "junit:junit:${junitVersion}"
testCompile("org.spockframework:spock-core:${spockVersion}") {
transitive = false
exclude group:'junit', module: 'junit-dep'
exclude group:'org.codehaus.groovy', module: 'groovy-all'
}
// Required by Spock's Mocking
testCompile "cglib:cglib-nodep:${cglibVersion}"
testCompile "org.objenesis:objenesis:${objenesisVersion}"
}
}
def debugArguments = ['-Xmx2g', '-Xdebug', '-Xnoagent', '-Djava.compiler=NONE',
'-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005']
test {
excludes = ["**/*TestCase.class", "**/*\$*.class"]
if (isTravisBuild) {
maxParallelForks = 2
maxHeapSize = '768m'
if(!isJava8Compatible) {
jvmArgs '-XX:MaxPermSize=256m'
}
afterSuite {
System.out.print('.')
System.out.flush()
}
} else {
maxHeapSize = '1024m'
if(!isJava8Compatible) {
jvmArgs '-XX:MaxPermSize=512m'
}
}
if(System.getProperty("debug.tests")) {
jvmArgs debugArguments
}
}
task singleTest(type: Test) {
// task for running a single test with -DsingleTest.single=TestName singleTest
if(System.getProperty("debug.tests")) {
jvmArgs debugArguments
}
}
configurations {
meta
published.extendsFrom archives, meta
all*.exclude group:'commons-logging', module: 'commons-logging'
}
if(!isTestSuite) {
modifyPom {
delegate.project {
def updatePom = pomInfo.clone()
updatePom.delegate = delegate
updatePom()
}
}
task installToHomeDist(type: Upload) {
configuration = configurations.archives
repositories {
flatDir name: 'libs', dirs: distInstallDir
}
}
publishing {
repositories {
maven {
credentials {
def u = System.getenv("ARTIFACTORY_USERNAME") ?: project.hasProperty("artifactoryPublishUsername") ? project.artifactoryPublishUsername : ''
def p = System.getenv("ARTIFACTORY_PASSWORD") ?: project.hasProperty("artifactoryPublishPassword") ? project.artifactoryPublishPassword : ''
username = u
password = p
}
if(isBuildSnapshot) {
url "https://repo.grails.org/grails/libs-snapshots-local"
}
else {
url "https://repo.grails.org/grails/libs-releases-local"
}
}
}
publications {
maven(MavenPublication) {
from components.java
artifact sourcesJar {
classifier "sources"
}
artifact javadocJar {
classifier "javadoc"
}
pom.withXml {
def xml = asNode()
xml.children().last() + pomInfo
}
}
}
}
bintray {
def u = System.getenv("BINTRAY_USER") ?: project.hasProperty("bintrayUser") ? project.bintrayUser : ''
def p = System.getenv("BINTRAY_KEY") ?: project.hasProperty("bintrayKey") ? project.bintrayKey : ''
user = u
key = p
publications = ['maven']
publish = bintrayPublish
pkg {
repo = 'grails-core'
userOrg = 'grails'
name = 'org.grails'
desc = 'Grails Framework'
websiteUrl = 'http://grails.org'
issueTrackerUrl = 'http://jira.grails.org/browse/GRAILS'
vcsUrl = 'http://jira.grails.org/browse/GRAILS'
licenses = ['Apache-2.0']
publicDownloadNumbers = true
version {
name = project.version
gpg {
sign = true
passphrase = System.getenv("SIGNING_PASSPHRASE") ?: project.hasProperty("signingPassphrase") ? project.signingPassphrase : ''
}
mavenCentralSync {
sync = false
def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
user = ossUser
password = ossPass
}
}
}
}
project.tasks.withType(org.gradle.api.publish.maven.tasks.PublishToMavenLocal) { org.gradle.api.publish.maven.tasks.PublishToMavenLocal t ->
t.dependsOn installToHomeDist
t.doLast {
ant.copy(todir: homeDistDir, flatten: true, includeEmptyDirs: false) {
fileset dir: distInstallDir
}
}
}
}
}
task clean(type: Delete) {
delete buildDir,
homeBinDir,
homeConfDir,
homeDistDir,
homeLibDir,
homeSrcDir
}
// From this point on we need the subprojects to be fully configured, so force their full evaluation
subprojects.each { evaluationDependsOn it.path }
apply {
from 'gradle/docs.gradle' // tasks for building the documentation (e.g. user guide, javadocs)
from 'gradle/assemble.gradle' // tasks for creating an installation or distribution
from 'gradle/findbugs.gradle'
}
apply plugin: "com.github.adrianbk.tcitrigger"
tciTrigger {
gitHubRepo 'grails/grails3-functional-tests'
}
task wrapper(type: Wrapper) {
gradleVersion = '2.9'
jarFile = 'gradle/wrapper/gradle-wrapper.jar'
}
task buildscriptDependencies(type: org.gradle.api.tasks.diagnostics.DependencyReportTask) {
configurations = project.buildscript.configurations
}
[Javadoc, Groovydoc].each {
tasks.withType(it).all {
// exclude problematic jar file from javadoc classpath
// http://www.adam-bien.com/roller/abien/entry/trouble_with_crippled_java_ee
if (classpath) {
classpath -= classpath.filter { it.name == 'javaee-web-api-6.0.jar' }
}
}
}
apply plugin: 'net.gvmtool.sdkvendor'
gvm {
api = "https://gvm-vendor.herokuapp.com"
consumerKey = System.getenv("GVM_SDKVENDOR_KEY") ?: project.hasProperty("gvmSdkvendorKey") ? project.gvmSdkvendorKey : ''
consumerToken = System.getenv("GVM_SDKVENDOR_TOKEN") ?: project.hasProperty("gvmSdkvendorToken") ? project.gvmSdkvendorToken : ''
candidate = "grails"
version = project.version
url = "https://github.com/grails/grails-core/releases/download/v${project.version}/grails-${project.version}.zip"
hashtag = "#grailsfw"
}