-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
256 lines (214 loc) · 8.24 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
import java.util.jar.Manifest
import org.gradle.api.tasks.bundling.GradleManifest
apply id: 'base'
allprojects {
version = '3.0.2.CI-SNAPSHOT'
releaseBuild = version.endsWith('RELEASE')
snapshotBuild = version.endsWith('SNAPSHOT')
group = 'org.springframework.security'
repositories {
mavenRepo name:'Local', urls:'file:///Users/luke/.m2/repository'
mavenCentral()
// mavenRepo name:'SpringSource Milestone Repo', urls:'http://repository.springsource.com/maven/bundles/milestone'
}
}
configure(javaProjects()) {
apply id: 'java'
springVersion = '3.0.0.RELEASE'
springLdapVersion = '1.3.0.RELEASE'
ehcacheVersion = '1.6.2'
aspectjVersion = '1.6.5'
apacheDsVersion = '1.5.5'
jstlVersion = '1.1.2'
jettyVersion = '6.1.22'
configurations {
bundlor
provided
}
dependencies {
compile 'commons-logging:commons-logging:1.1.1'
testCompile 'junit:junit:4.7',
'org.mockito:mockito-core:1.7',
'org.jmock:jmock:2.5.1',
'org.jmock:jmock-junit4:2.5.1',
'org.hamcrest:hamcrest-core:1.1',
'org.hamcrest:hamcrest-library:1.1',
"org.springframework:spring-test:$springVersion"
bundlor 'com.springsource.bundlor:com.springsource.bundlor.ant:1.0.0.RC1',
'com.springsource.bundlor:com.springsource.bundlor:1.0.0.RC1',
'com.springsource.bundlor:com.springsource.bundlor.blint:1.0.0.RC1'
}
sourceSets {
main {
compileClasspath = compileClasspath + configurations.provided
}
test {
compileClasspath = compileClasspath + configurations.provided
runtimeClasspath = runtimeClasspath + configurations.provided
}
}
test {
options.fork(forkMode: ForkMode.ONCE, jvmArgs: ["-ea", '-Xms128m', '-Xmx500m', '-XX:MaxPermSize=128m', '-XX:+HeapDumpOnOutOfMemoryError'])
}
task bundlor (dependsOn: compileJava) << {
if (!dependsOnTaskDidWork()) {
return
}
ant.taskdef(resource: 'com/springsource/bundlor/ant/antlib.xml', classpath: configurations.bundlor.asPath)
File template = new File(projectDir, 'template.mf')
mkdir(buildDir, 'bundlor')
if (template.exists()) {
ant.bundlor(inputPath: "$buildDir/classes/main", outputPath: "$buildDir/bundlor", manifestTemplatePath: template) {
property(name: 'version', value: "$version")
property(name: 'spring.version', value: "$springVersion")
}
// See GRADLE-395 for support for using an existing manifest
jar.manifest = new GradleManifest(new Manifest(new File("$buildDir/bundlor/META-INF/MANIFEST.MF").newInputStream()))
}
}
jar.dependsOn bundlor
}
configure(javaProjects()) {
apply id: 'maven'
// Create a source jar for uploading
task sourceJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.java
}
configurations {
deployerJars
}
artifacts {
archives sourceJar
}
dependencies {
deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:2.0.1.BUILD-SNAPSHOT"
}
uploadArchives {
repositories.mavenDeployer {
configuration = configurations.deployerJars
if (releaseBuild) {
// "mavenSyncRepoDir" should be set in properties
repository(url: mavenSyncRepoDir)
} else {
s3credentials = [userName: s3AccessKey, passphrase: s3SecretAccessKey]
repository(url: "s3://maven.springframework.org/milestone") {
authentication(s3credentials)
}
snapshotRepository(url: "s3://maven.springframework.org/snapshot") {
authentication(s3credentials)
}
}
}
}
conf2ScopeMappings.addMapping(1, configurations.provided, "provided")
}
repositories {
// Required for ant s3 task
mavenRepo name: "s2.com release", urls: "http://repository.springsource.com/maven/bundles/release"
}
configurations {
antlibs
}
dependencies {
antlibs "org.springframework.build:org.springframework.build.aws.ant:3.0.3.RELEASE",
"net.java.dev.jets3t:jets3t:0.6.1"
}
def docsDir = new File(project(':manual').buildDir, 'docs')
task apidocs(type: Javadoc) {
destinationDir = new File(buildDir, 'apidocs')
optionsFile = file("$buildDir/tmp/javadoc.options")
source coreModuleProjects().collect { project ->
project.sourceSets.main.allJava
}
classpath = files(coreModuleProjects().collect { project ->
project.sourceSets.main.compileClasspath })
}
task apitar(type: Tar, dependsOn: apidocs) {
compression = Compression.BZIP2
classifier = 'apidocs'
into('apidocs') {
from apidocs.destinationDir
}
}
task doctar(type: Tar, dependsOn: ':manual:doc') {
compression = Compression.BZIP2
classifier = 'doc'
into('reference') {
from docsDir
}
}
def username;
def password;
task login << {
ant.input("Please enter the ssh username for host '$sshHost'", addproperty: "ssh.username")
ant.input("Please enter the ssh password '$sshHost'", addproperty: "ssh.password")
username = ant.properties['ssh.username']
password = ant.properties['ssh.password']
}
task uploadApidocs (dependsOn: login) << {
ant.scp(file: apitar.archivePath, todir: "$username@$sshHost:$remoteDocsDir", password: password)
ant.sshexec(host: sshHost, username: username, password: password, command: "cd $remoteDocsDir && tar -xjf ${apitar.archiveName}")
ant.sshexec(host: sshHost, username: username, password: password, command: "rm $remoteDocsDir/${apitar.archiveName}")
}
task uploadManual (dependsOn: login) << {
ant.scp(file: doctar.archivePath, todir: "$username@$sshHost:$remoteDocsDir", password: password)
ant.sshexec(host: sshHost, username: username, password: password, command: "cd $remoteDocsDir && tar -xjf ${doctar.archiveName}")
ant.sshexec(host: sshHost, username: username, password: password, command: "rm $remoteDocsDir/${doctar.archiveName}")
}
task dist (type: Zip) {
def zipRootDir = "${project.name}-$version"
into (zipRootDir) {
into('docs/apidocs') {
from apidocs.destinationDir
}
into('docs/reference') {
from docsDir
}
into('dist') {
from coreModuleProjects().collect { project -> project.libsDir }
from project(':spring-security-samples-tutorial').libsDir
from project(':spring-security-samples-contacts').libsDir
}
}
}
dist.dependsOn apidocs, ':manual:doc'
dist.dependsOn subprojects.collect { "$it.path:assemble" }
dist.doLast {
ant.checksum(file: archivePath, algorithm: 'SHA1', fileext: '.sha1')
}
task uploadDist << {
def shaFile = file("${dist.archivePath}.sha1")
assert dist.archivePath.isFile()
assert shaFile.isFile()
ant.taskdef(resource: 'org/springframework/build/aws/ant/antlib.xml', classpath: configurations.antlibs.asPath)
ant.s3(accessKey: s3AccessKey, secretKey: s3SecretAccessKey) {
upload(bucketName: 'dist.springframework.org', file: dist.archivePath,
toFile: releaseType() + "/SEC/${dist.archiveName}", publicRead: 'true') {
metadata(name: 'project.name', value: 'Spring Security')
metadata(name: 'release.type', value: releaseType())
metadata(name: 'bundle.version', value: version)
metadata(name: 'package.file.name', value: dist.archiveName)
}
upload(bucketName: 'dist.springframework.org', file: shaFile,
toFile: releaseType() + "/SEC/${dist.archiveName}.sha1", publicRead: 'true')
}
}
def javaProjects() {
subprojects.findAll { project -> project.name != 'faq' && project.name != 'manual' }
}
def sampleProjects() {
subprojects.findAll { project -> project.name.startsWith('spring-security-samples') }
}
def coreModuleProjects() {
javaProjects() - sampleProjects()
}
def releaseType() {
if (releaseBuild) {
'release'
} else if (snapshotBuild) {
'snapshot'
} else {
'milestone'
}
}