forked from apache/grails-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
264 lines (213 loc) · 7.66 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
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
repositories {
mavenRepo(urls: "http://repo.grails.org/grails/core")
}
dependencies {
classpath "commons-io:commons-io:1.4"
}
}
apply plugin: 'idea'
grailsVersion = '1.4.0.BUILD-SNAPSHOT'
antVersion = "1.8.2"
antTraxVersion = "1.7.1"
aspectjVersion = "1.6.10"
springVersion = "3.1.0.M1"
springDatastoreVersion = "1.0.0.M6"
springLoadedVersion = "0.8.0.RELEASE"
springWebflowVersion= "2.0.8.RELEASE"
ivyVersion = "2.2.0"
gantVersion = "1.9.5"
groovyVersion = "1.8.0"
jansiVersion = "1.2.1"
jlineVersion = "1.0"
jnaVersion = "3.2.3"
commonsCliVersion = "1.2"
commonsCollectionsVersion = "3.2.1"
commonsBeanUtilsVersion = "1.8.0"
commonsIOVersion = "1.4"
commonsLangVersion = "2.4"
slf4jVersion = "1.6.1"
archivesBaseName = 'grails'
version = grailsVersion
// 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.
if(System.getProperty('groovy.jar')) {
groovyDependency = files(System.getProperty('groovy.jar'))
} else {
groovyDependency = "org.codehaus.groovy:groovy-all:${groovyVersion}"
}
subprojects { project ->
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'project-report'
sourceCompatibility = "1.5"
targetCompatibility = "1.5"
archivesBaseName = 'grails'
version = grailsVersion
group = "org.grails"
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"
}
configure([compileJava, compileTestJava]) {
options.deprecation = true
options.debug = true
}
repositories {
mavenRepo(urls: "http://repo.grails.org/grails/core") {
if (project.hasProperty('snapshotTimeout')) {
setSnapshotTimeout(Long.parseLong(project.snapshotTimeout))
}
}
}
dependencies {
// Groovy
groovy( groovyDependency ) {
exclude module:"commons-cli"
exclude module:"ant"
}
compile groovyDependency
// Logging
compile "org.slf4j:slf4j-api:$slf4jVersion"
compile "org.slf4j:jcl-over-slf4j:$slf4jVersion"
// Specs
compile 'javax.servlet:servlet-api:2.5'
compile 'org.hibernate.java-persistence:jpa-api:2.0-cr-1'
// Testing
testCompile 'junit:junit:4.8.1'
testCompile('org.spockframework:spock-core:0.5-groovy-1.8') {
transitive = false
}
}
install.doLast {
copy {
from(project.libsDir) {
include "*-${grailsVersion}.jar"
}
into "${rootProject.projectDir}/dist"
}
}
test {
excludes = ["**/*TestCase.class", "**/*\$*.class"]
}
task sourcesJar(type: Jar, dependsOn:classes) {
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
}
artifacts {
meta sourcesJar
meta javadocJar
}
uploadArchives {
repositories {
final url = project.version.endsWith("SNAPSHOT") ? "http://repo.grails.org/grails/libs-snapshots-local" :
"http://repo.grails.org/grails/libs-releases-local"
mavenRepo urls: url
project.deployer = repositories.mavenDeployer {
repository(url: url) {
beforeDeployment { deployment ->
["sources", "javadoc"].each { type ->
deployment.addArtifact configurations.meta.artifacts.find { it.classifier == type }
}
}
final username = project.properties["artifactoryPublishUsername"]
final password = project.properties["artifactoryPublishPassword"]
if(username && password) {
org.apache.ivy.util.url.CredentialsStore.INSTANCE.addCredentials("Artifactory Realm", "repo.grails.org", username, password);
}
authentication(userName: username, password: password)
}
}
}
}
uploadArchives.dependsOn sourcesJar, javadocJar
/*
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
*/
project.poms = [project.install.repositories.mavenInstaller.pom, project.deployer.pom]
project.pomModifications = []
project.modifyPom = { Closure modification -> project.pomModifications << modification }
project.poms*.whenConfigured {
project.pomModifications*.call(it)
}
}
apply {
from 'gradle/docs.gradle'
from 'gradle/assemble.gradle'
}
task clean << {
// add additional dirs
// delete(docs.destinationDir, libs.destinationDir)
delete(libs.destinationDir)
delete(buildDir)
}
task installResources << {
copy {
from('grails-resources/src/grails/home/tests')
into('lib')
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
}
copy {
from("grails-resources/src/grails/home/bash")
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
filter(ReplaceTokens, tokens: ['groovy.version': groovyVersion])
filter(ReplaceTokens, tokens: ['spring.loaded.version': springLoadedVersion])
fileMode = 0755
into "bin"
}
// the fileMode property above should take care of the chmod work, but
// it doesn't per http://jira.codehaus.org/browse/GRADLE-971
ant.chmod(dir: 'bin', perm: '755', includes: '*')
copy {
from("grails-resources/src/grails/home/conf")
into "conf"
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
filter(ReplaceTokens, tokens: ['groovy.version': groovyVersion])
filter(ReplaceTokens, tokens: ['jline.version': jlineVersion])
filter(ReplaceTokens, tokens: ['jansi.version': jansiVersion])
filter(ReplaceTokens, tokens: ['jna.version': jnaVersion])
filter(ReplaceTokens, tokens: ['commons.cli.version': commonsCliVersion])
filter(ReplaceTokens, tokens: ['ant.version': antVersion])
filter(ReplaceTokens, tokens: ['gant.version': gantVersion])
filter(ReplaceTokens, tokens: ['ivy.version': ivyVersion])
}
copy {
from 'grails-resources/src/grails/home/dsl-support'
into 'dsl-support'
}
copy {
from "grails-resources/src/war/WEB-INF"
into 'src/war/WEB-INF'
}
}
task install(dependsOn:[populateDependencies, installResources])
task assemble(dependsOn:zipDist)