forked from grails/grails-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
335 lines (285 loc) · 11.3 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
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
repositories {
maven { url "http://repo.grails.org/grails/core" }
//mavenRepo(urls: 'http://evgeny-goldin.org/artifactory/repo/')
}
dependencies {
classpath "commons-io:commons-io:2.1"
//classpath "com.goldin.plugins:gradle:0.1-RC3" // http://evgeny-goldin.com/wiki/Gradle-duplicates-plugin
}
}
apply plugin: 'idea'
ext {
grailsVersion = '2.3.0.BUILD-SNAPSHOT'
isBuildSnapshot = grailsVersion.endsWith(".BUILD-SNAPSHOT")
antTraxVersion = "1.7.1"
antVersion = "1.8.4"
aspectjVersion = "1.6.10"
commonsBeanUtilsVersion = "1.8.3"
commonsCliVersion = "1.2"
commonsCollectionsVersion = "3.2.1"
commonsIOVersion = "2.1"
commonsLangVersion = "2.6"
datastoreVersion = "1.1.1.RELEASE"
gantVersion = "1.9.6"
gdocEngineVersion = "1.0.1"
groovyVersion = "2.0.5"
gradleGroovyVersion = groovyVersion
gradleGroovyVersion = "1.8.2"
ivyVersion = "2.2.0"
jansiVersion = "1.2.1"
jlineVersion = "1.0"
jnaVersion = "3.2.3"
slf4jVersion = "1.7.2"
spockVersion = '0.7-groovy-2.0'
springLoadedVersion = "1.1.0"
springVersion = "3.1.2.RELEASE"
springWebflowVersion= "2.0.8.RELEASE"
hibernateVersion = "3.6.10.Final"
ehcacheVersion = "2.4.6"
junitVersion = "4.10"
concurrentlinkedhashmapVersion = "1.2_jdk5"
}
version = grailsVersion
// directories created during the build which are related
// to turning the workspace root into a GRAILS_HOME
ext {
homeDistDir = file("dist")
homeBinDir = file("bin")
homeConfDir = file("conf")
homeDslSupportDir = file("dsl-support")
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) {
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-all:${groovyVersion}") {
exclude module:"commons-cli"
exclude module:"ant"
}
}
allprojects {
repositories {
maven { url "http://repo.grails.org/grails/core" }
// TODO configure this as a remote for repo.grails.org so we don't need this here...
maven { url 'http://oss.sonatype.org/content/repositories/snapshots' }
}
configurations {
all {
resolutionStrategy {
def cacheHours = isCiBuild ? 1 : 24
cacheDynamicVersionsFor cacheHours, 'hours'
cacheChangingModulesFor cacheHours, 'hours'
}
}
}
}
apply from: "gradle/idea.gradle"
subprojects { project ->
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'project-report'
apply plugin: 'signing'
//apply plugin: 'duplicates'
sourceCompatibility = "1.5"
targetCompatibility = "1.5"
archivesBaseName = 'grails'
version = grailsVersion
group = "org.grails"
ext.isCiBuild = project.hasProperty("isCiBuild")
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(memoryInitialSize: '128M', memoryMaximumSize: '1G')
groovyOptions.encoding = "UTF-8"
groovyOptions.useAnt = true
options.useAnt = true
}
configure([compileJava, compileTestJava]) {
options.deprecation = true
options.debug = true
}
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 {
groovy groovyDependency
if (project.name != "grails-docs") {
// Logging
compile "org.slf4j:slf4j-api:$slf4jVersion"
compile "org.slf4j:jcl-over-slf4j:$slf4jVersion"
// Specs
compile 'javax.servlet:javax.servlet-api:3.0.1'
compile 'org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final'
// Testing
testCompile "junit:junit:${junitVersion}"
testCompile("org.spockframework:spock-core:${spockVersion}") {
transitive = false
}
}
}
test {
excludes = ["**/*TestCase.class", "**/*\$*.class"]
}
task sourcesJar(type: Jar) {
classifier = 'sources'
appendix = project.name[7..-1]
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = 'javadoc'
appendix = project.name[7..-1]
from javadoc.destinationDir
}
groovydoc.doLast {
delete("${buildDir}/tmp")
}
configurations {
meta
published.extendsFrom archives, meta
all*.exclude group:'commons-logging', module: 'commons-logging'
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
signing {
sign configurations.archives
required { !isBuildSnapshot && gradle.taskGraph.hasTask(uploadPublished) }
}
uploadPublished {
repositories {
final url = project.version.endsWith("SNAPSHOT") ? "http://repo.grails.org/grails/libs-snapshots-local" :
"http://repo.grails.org/grails/libs-releases-local"
repositories {
mavenDeployer {
repository(url: url) {
final username = project.hasProperty("artifactoryPublishUsername") ? project.artifactoryPublishUsername : null
final password = project.hasProperty("artifactoryPublishPassword") ? project.artifactoryPublishPassword : null
if(username && password) {
org.apache.ivy.util.url.CredentialsStore.INSTANCE.addCredentials("Artifactory Realm", "repo.grails.org", username, password);
}
authentication(userName: username, password: password)
}
}
project.ext.deployer = mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: project.hasProperty("sonatypeUsername") ? project.sonatypeUsername : null,
password: project.hasProperty("sonatypePassword") ? project.sonatypePassword : null)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: project.hasProperty("sonatypeUsername") ? project.sonatypeUsername : null,
password: project.hasProperty("sonatypePassword") ? project.sonatypePassword : null)
}
pom.project {
name 'Grails'
packaging 'jar'
description 'Grails Web Application Framework'
delegate.url 'http://grails.org/'
scm {
delegate.url 'scm:[email protected]:grails/grails-core.git'
connection 'scm:[email protected]:grails/grails-core.git'
developerConnection 'scm:[email protected]:grails/grails-core.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
delegate.url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'graemerocher'
name 'Graeme Rocher'
}
developer {
id 'jeffscottbrown'
name 'Jeff Brown'
}
}
}
}
}
}
}
/*
Install a method that can be used to fine tune the poms, e.g…
modifyPom { pom ->
pom.dependencies.removeAll(pom.dependencies.findAll { it.scope == "test" })
}
Mods are run in order they are encountered in the build script.
The pom argument is of the following type:
http://maven.apache.org/ref/2.2.1/maven-model/apidocs/org/apache/maven/model/Model.html
*/
ext {
poms = [project.install.repositories.mavenInstaller.pom, project.deployer.pom]
pomModifications = []
modifyPom = { Closure modification -> project.pomModifications << modification }
poms*.whenConfigured {
pomModifications*.call(it)
}
// Map the groovy gradle configuration to the “compile” scope in our published POMs
def groovyConfiguration = project.configurations.findByName("groovy")
if (groovyConfiguration) {
poms.each {
it.scopeMappings.addMapping(1, groovyConfiguration, "compile")
}
}
}
// Remove any dependencies that shouldn't be included in the POM
modifyPom { pom ->
configurations.runtime.allDependencies.each { dependency ->
if (dependency.hasProperty("notInPom") && dependency.notInPom) {
pom.dependencies.removeAll { it.groupId == dependency.group && it.artifactId == dependency.name }
}
}
}
}
task clean(type: Delete) {
delete buildDir,
homeBinDir,
homeConfDir,
homeDistDir,
homeDslSupportDir,
homeLibDir,
homeSrcDir
}
task allDependencies(dependsOn: { subprojects*.implicitTasks*.dependencies })
// 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'
}
task wrapper(type: Wrapper) {
gradleVersion = '1.1'
jarFile = 'gradle/wrapper/gradle-wrapper.jar'
}