123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- apply id: 'base'
- allprojects {
- version = '3.1.0.CI-SNAPSHOT'
- releaseBuild = version.endsWith('RELEASE')
- snapshotBuild = version.endsWith('SNAPSHOT')
- group = 'org.springframework.security'
- repositories {
- mavenRepo name:'Local', urls: "file://" + System.properties['user.home'] + "/.m2/repository"
- mavenCentral()
- mavenRepo name: 'SpringSource Milestone Repo', urls: 'http://repository.springsource.com/maven/bundles/milestone'
- mavenRepo name: 'SpringSource Maven Snapshot Repo', urls: 'http://maven.springframework.org/snapshot/'
- mavenRepo name: 'SpringSource Enterprise Release', urls: 'http://repository.springsource.com/maven/bundles/release'
- mavenRepo name: 'SpringSource Enterprise External', urls: 'http://repository.springsource.com/maven/bundles/external'
- }
- }
- configure(javaProjects) {
- apply url: "$rootDir/gradle/javaprojects.gradle"
- apply url: "$rootDir/gradle/maven.gradle"
- }
- configure(coreModuleProjects) {
- // Gives better names in structure101 jar diagram
- sourceSets.main.classesDir = new File(buildDir, "classes/" + project.name.substring("spring-security".length() + 1))
- }
- 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')
- title = "Spring Security $version API"
- 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
- }
- }
- task login {
- // add dynamic properties to login task
- username = null
- password = null
- doFirst {
- ant {
- input("Please enter the ssh username for host '$sshHost'", addproperty: "ssh.username")
- 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: "$login.username@$sshHost:$remoteDocsDir", password: login.password)
- sshexec(host: sshHost, username: login.username, password: login.password, command: "cd $remoteDocsDir && tar -xjf ${apitar.archiveName}")
- sshexec(host: sshHost, username: login.username, password: login.password, command: "rm $remoteDocsDir/${apitar.archiveName}")
- }
- }
- task uploadManual(dependsOn: login) << {
- ant {
- scp(file: doctar.archivePath, todir: "$login.username@$sshHost:$remoteDocsDir", password: login.password)
- sshexec(host: sshHost, username: login.username, password: login.password, command: "cd $remoteDocsDir && tar -xjf ${doctar.archiveName}")
- sshexec(host: sshHost, username: login.username, password: login.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', subprojects.collect { "$it.path:assemble" }
- doLast {
- ant.checksum(file: archivePath, algorithm: 'SHA1', fileext: '.sha1')
- }
- }
- task uploadDist(type: UploadDist) {
- archiveFile = dist.archivePath
- shaFile = "${dist.archivePath}.sha1" as File
- archiveName = dist.archiveName
- }
- def getJavaProjects() {
- subprojects.findAll {project -> project.name != 'faq' && project.name != 'manual' }
- }
- def getSampleProjects() {
- subprojects.findAll {project -> project.name.startsWith('spring-security-samples') }
- }
- def getItestProjects() {
- subprojects.findAll {project -> project.name.startsWith('itest') }
- }
- def getCoreModuleProjects() {
- javaProjects - sampleProjects - itestProjects
- }
- class UploadDist extends DefaultTask {
- @InputFile
- File shaFile
- @InputFile
- File archiveFile
- @Input
- String archiveName
- @InputFiles
- def classpath
- @TaskAction
- def upload() {
- project.ant {
- taskdef(resource: 'org/springframework/build/aws/ant/antlib.xml', classpath: classpath.asPath)
- s3(accessKey: project.s3AccessKey, secretKey: project.s3SecretAccessKey) {
- upload(bucketName: 'dist.springframework.org', file: archiveFile,
- toFile: releaseType() + "/SEC/${archiveName}", publicRead: 'true') {
- metadata(name: 'project.name', value: 'Spring Security')
- metadata(name: 'release.type', value: releaseType())
- metadata(name: 'bundle.version', value: project.version)
- metadata(name: 'package.file.name', value: archiveName)
- }
- upload(bucketName: 'dist.springframework.org', file: shaFile,
- toFile: releaseType() + "/SEC/${archiveName}.sha1", publicRead: 'true')
- }
- }
- }
- def releaseType() {
- if (project.releaseBuild) {
- 'release'
- } else if (project.snapshotBuild) {
- 'snapshot'
- } else {
- 'milestone'
- }
- }
- }
|