2010-01-11 19:35:20 -05:00
|
|
|
import java.util.jar.Manifest
|
|
|
|
import org.gradle.api.tasks.bundling.GradleManifest
|
2009-12-21 12:32:38 -05:00
|
|
|
|
2010-01-19 23:14:48 -05:00
|
|
|
apply id: 'base'
|
|
|
|
|
2009-12-04 16:33:17 -05:00
|
|
|
allprojects {
|
2010-01-15 13:15:19 -05:00
|
|
|
version = '3.0.2.CI-SNAPSHOT'
|
2010-01-17 21:02:28 -05:00
|
|
|
releaseBuild = version.endsWith('RELEASE')
|
2010-01-21 00:28:17 -05:00
|
|
|
snapshotBuild = version.endsWith('SNAPSHOT')
|
|
|
|
|
2010-01-12 19:44:05 -05:00
|
|
|
group = 'org.springframework.security'
|
|
|
|
|
2009-12-04 16:33:17 -05:00
|
|
|
repositories {
|
2010-01-11 19:35:20 -05:00
|
|
|
mavenRepo name:'Local', urls:'file:///Users/luke/.m2/repository'
|
2009-12-04 16:33:17 -05:00
|
|
|
mavenCentral()
|
2010-01-21 00:28:17 -05:00
|
|
|
// mavenRepo name:'SpringSource Milestone Repo', urls:'http://repository.springsource.com/maven/bundles/milestone'
|
2009-12-04 16:33:17 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-19 23:14:48 -05:00
|
|
|
configure(javaProjects()) {
|
2010-01-10 18:31:23 -05:00
|
|
|
apply id: 'java'
|
|
|
|
|
2009-12-21 12:32:38 -05:00
|
|
|
springVersion = '3.0.0.RELEASE'
|
|
|
|
springLdapVersion = '1.3.0.RELEASE'
|
2009-12-07 20:54:15 -05:00
|
|
|
ehcacheVersion = '1.6.2'
|
2009-12-21 12:32:38 -05:00
|
|
|
aspectjVersion = '1.6.5'
|
2010-01-10 18:31:23 -05:00
|
|
|
apacheDsVersion = '1.5.5'
|
|
|
|
jstlVersion = '1.1.2'
|
2009-12-21 12:32:38 -05:00
|
|
|
|
2010-01-10 18:31:23 -05:00
|
|
|
configurations {
|
2010-01-11 19:35:20 -05:00
|
|
|
bundlor
|
2010-01-10 18:31:23 -05:00
|
|
|
provided
|
|
|
|
}
|
|
|
|
|
2009-12-04 16:33:17 -05:00
|
|
|
dependencies {
|
|
|
|
compile 'commons-logging:commons-logging:1.1.1'
|
|
|
|
|
2009-12-21 12:32:38 -05:00
|
|
|
testCompile 'junit:junit:4.7',
|
2009-12-04 16:33:17 -05:00
|
|
|
'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"
|
2010-01-11 19:35:20 -05:00
|
|
|
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'
|
2009-12-04 16:33:17 -05:00
|
|
|
}
|
2010-01-10 18:31:23 -05:00
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
compileClasspath = compileClasspath + configurations.provided
|
|
|
|
}
|
|
|
|
test {
|
|
|
|
compileClasspath = compileClasspath + configurations.provided
|
2010-01-17 21:02:28 -05:00
|
|
|
runtimeClasspath = runtimeClasspath + configurations.provided
|
2010-01-10 18:31:23 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-04 16:33:17 -05:00
|
|
|
test {
|
2010-01-17 21:02:28 -05:00
|
|
|
options.fork(forkMode: ForkMode.ONCE, jvmArgs: ["-ea", '-Xms128m', '-Xmx500m', '-XX:MaxPermSize=128m', '-XX:+HeapDumpOnOutOfMemoryError'])
|
2009-12-04 16:33:17 -05:00
|
|
|
}
|
2010-01-11 19:35:20 -05:00
|
|
|
|
2010-01-17 21:02:28 -05:00
|
|
|
task bundlor (dependsOn: compileJava) << {
|
|
|
|
if (!dependsOnTaskDidWork()) {
|
|
|
|
return
|
|
|
|
}
|
2010-01-11 19:35:20 -05:00
|
|
|
ant.taskdef(resource: 'com/springsource/bundlor/ant/antlib.xml', classpath: configurations.bundlor.asPath)
|
|
|
|
File template = new File(projectDir, 'template.mf')
|
2010-01-17 21:02:28 -05:00
|
|
|
mkdir(buildDir, 'bundlor')
|
2010-01-11 19:35:20 -05:00
|
|
|
if (template.exists()) {
|
2010-01-17 21:02:28 -05:00
|
|
|
ant.bundlor(inputPath: "$buildDir/classes/main", outputPath: "$buildDir/bundlor", manifestTemplatePath: template) {
|
2010-01-12 19:44:05 -05:00
|
|
|
property(name: 'version', value: "$version")
|
|
|
|
property(name: 'spring.version', value: "$springVersion")
|
2010-01-11 19:35:20 -05:00
|
|
|
}
|
|
|
|
// See GRADLE-395 for support for using an existing manifest
|
2010-01-17 21:02:28 -05:00
|
|
|
jar.manifest = new GradleManifest(new Manifest(new File("$buildDir/bundlor/META-INF/MANIFEST.MF").newInputStream()))
|
2010-01-11 19:35:20 -05:00
|
|
|
}
|
|
|
|
}
|
2010-01-17 21:02:28 -05:00
|
|
|
|
|
|
|
jar.dependsOn bundlor
|
2009-12-04 16:33:17 -05:00
|
|
|
}
|
|
|
|
|
2010-01-19 23:14:48 -05:00
|
|
|
configure(javaProjects()) {
|
2010-01-12 19:44:05 -05:00
|
|
|
apply id: 'maven'
|
|
|
|
|
|
|
|
// Create a source jar for uploading
|
|
|
|
task sourceJar(type: Jar) {
|
|
|
|
classifier = 'sources'
|
|
|
|
from sourceSets.main.java
|
|
|
|
}
|
|
|
|
|
2010-01-17 21:02:28 -05:00
|
|
|
configurations {
|
|
|
|
deployerJars
|
|
|
|
}
|
|
|
|
|
2010-01-12 19:44:05 -05:00
|
|
|
artifacts {
|
|
|
|
archives sourceJar
|
|
|
|
}
|
|
|
|
|
2010-01-17 21:02:28 -05:00
|
|
|
dependencies {
|
|
|
|
deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:2.0.1.BUILD-SNAPSHOT"
|
|
|
|
}
|
|
|
|
|
2010-01-12 19:44:05 -05:00
|
|
|
uploadArchives {
|
2010-01-17 21:02:28 -05:00
|
|
|
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)
|
|
|
|
}
|
2010-01-12 19:44:05 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
conf2ScopeMappings.addMapping(1, configurations.provided, "provided")
|
|
|
|
}
|
2010-01-19 23:14:48 -05:00
|
|
|
|
2010-01-21 00:28:17 -05:00
|
|
|
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"
|
|
|
|
}
|
|
|
|
|
2010-01-22 21:07:10 -05:00
|
|
|
def docsDir = new File(project(':manual').buildDir, 'docs')
|
|
|
|
|
2010-01-19 23:14:48 -05:00
|
|
|
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 })
|
|
|
|
}
|
|
|
|
|
2010-01-21 00:28:17 -05:00
|
|
|
task apitar(type: Tar, dependsOn: apidocs) {
|
|
|
|
compression = Compression.BZIP2
|
|
|
|
classifier = 'apidocs'
|
|
|
|
into('apidocs') {
|
2010-01-19 23:14:48 -05:00
|
|
|
from apidocs.destinationDir
|
|
|
|
}
|
2010-01-21 00:28:17 -05:00
|
|
|
}
|
|
|
|
|
2010-01-22 21:07:10 -05:00
|
|
|
task doctar(type: Tar, dependsOn: ':manual:doc') {
|
|
|
|
compression = Compression.BZIP2
|
|
|
|
classifier = 'doc'
|
|
|
|
into('reference') {
|
|
|
|
from docsDir
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def username;
|
|
|
|
def password;
|
|
|
|
|
2010-01-21 00:28:17 -05:00
|
|
|
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")
|
2010-01-22 21:07:10 -05:00
|
|
|
username = ant.properties['ssh.username']
|
|
|
|
password = ant.properties['ssh.password']
|
2010-01-21 00:28:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
task uploadApidocs (dependsOn: login) << {
|
2010-01-22 21:07:10 -05:00
|
|
|
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}")
|
2010-01-21 00:28:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
2010-01-19 23:14:48 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-21 00:28:17 -05:00
|
|
|
dist.dependsOn apidocs, ':manual:doc'
|
|
|
|
dist.dependsOn subprojects.collect { "$it.path:assemble" }
|
|
|
|
|
2010-01-19 23:33:21 -05:00
|
|
|
dist.doLast {
|
|
|
|
ant.checksum(file: archivePath, algorithm: 'SHA1', fileext: '.sha1')
|
|
|
|
}
|
|
|
|
|
2010-01-21 00:28:17 -05:00
|
|
|
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')
|
|
|
|
}
|
|
|
|
}
|
2010-01-19 23:14:48 -05:00
|
|
|
|
|
|
|
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()
|
|
|
|
}
|
2010-01-21 00:28:17 -05:00
|
|
|
|
|
|
|
def releaseType() {
|
|
|
|
if (releaseBuild) {
|
|
|
|
'release'
|
|
|
|
} else if (snapshotBuild) {
|
|
|
|
'snapshot'
|
|
|
|
} else {
|
|
|
|
'milestone'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|