mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-08 13:12:12 +00:00
Porting gradle changes from master
This commit is contained in:
parent
46611872db
commit
1872d94aa1
73
build.gradle
73
build.gradle
@ -41,8 +41,6 @@ dependencies {
|
|||||||
"net.java.dev.jets3t:jets3t:0.6.1"
|
"net.java.dev.jets3t:jets3t:0.6.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
def docsDir = new File(project(':manual').buildDir, 'docs')
|
|
||||||
|
|
||||||
task apidocs(type: Javadoc) {
|
task apidocs(type: Javadoc) {
|
||||||
destinationDir = new File(buildDir, 'apidocs')
|
destinationDir = new File(buildDir, 'apidocs')
|
||||||
title = "Spring Security $version API"
|
title = "Spring Security $version API"
|
||||||
@ -57,49 +55,55 @@ task apidocs(type: Javadoc) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
task apitar(type: Tar, dependsOn: apidocs) {
|
task docSiteLogin(type: Login) {
|
||||||
compression = Compression.BZIP2
|
if (project.hasProperty('sshHost')) {
|
||||||
|
host = project.property('sshHost')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define remoteSiteDir and sshHost in gradle.properties
|
||||||
|
def remoteDocsDir = null
|
||||||
|
|
||||||
|
if (hasProperty('remoteSiteDir')) {
|
||||||
|
remoteDocsDir="$remoteSiteDir/docs/3.0.x"
|
||||||
|
}
|
||||||
|
|
||||||
|
task uploadApidocs(type: TarUpload) {
|
||||||
|
dependsOn apidocs
|
||||||
classifier = 'apidocs'
|
classifier = 'apidocs'
|
||||||
|
remoteDir = remoteDocsDir
|
||||||
|
login = docSiteLogin
|
||||||
|
|
||||||
into('apidocs') {
|
into('apidocs') {
|
||||||
from apidocs.destinationDir
|
from apidocs.destinationDir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task doctar(type: Tar, dependsOn: ':manual:doc') {
|
def docsDir = new File(project(':manual').buildDir, 'docs')
|
||||||
compression = Compression.BZIP2
|
|
||||||
|
task uploadDoc(type: TarUpload) {
|
||||||
|
dependsOn ':manual:doc'
|
||||||
classifier = 'doc'
|
classifier = 'doc'
|
||||||
|
remoteDir = remoteDocsDir
|
||||||
|
login = docSiteLogin
|
||||||
|
|
||||||
into('reference') {
|
into('reference') {
|
||||||
from docsDir
|
from docsDir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task login {
|
task uploadFaq(type: TarUpload) {
|
||||||
// add dynamic properties to login task
|
dependsOn ':faq:docbookHtmlSingle'
|
||||||
username = null
|
classifier = 'faq'
|
||||||
password = null
|
if (project.hasProperty('remoteSiteDir')) {
|
||||||
doFirst {
|
remoteDir = project.property('remoteSiteDir')
|
||||||
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']
|
|
||||||
}
|
}
|
||||||
}
|
login = docSiteLogin
|
||||||
|
|
||||||
task uploadApidocs(dependsOn: login) << {
|
def faqDir = new File(project(':faq').buildDir, 'docs')
|
||||||
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) << {
|
into('faq') {
|
||||||
ant {
|
from faqDir
|
||||||
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}")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,6 +135,7 @@ task uploadDist(type: UploadDist) {
|
|||||||
archiveFile = dist.archivePath
|
archiveFile = dist.archivePath
|
||||||
shaFile = "${dist.archivePath}.sha1" as File
|
shaFile = "${dist.archivePath}.sha1" as File
|
||||||
archiveName = dist.archiveName
|
archiveName = dist.archiveName
|
||||||
|
classpath = configurations.antlibs
|
||||||
}
|
}
|
||||||
|
|
||||||
def getJavaProjects() {
|
def getJavaProjects() {
|
||||||
@ -168,14 +173,18 @@ class UploadDist extends DefaultTask {
|
|||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
def upload() {
|
def upload() {
|
||||||
|
def accessKey = project.s3AccessKey
|
||||||
|
def secretKey = project.s3SecretAccessKey
|
||||||
|
def version = project.version
|
||||||
|
|
||||||
project.ant {
|
project.ant {
|
||||||
taskdef(resource: 'org/springframework/build/aws/ant/antlib.xml', classpath: classpath.asPath)
|
taskdef(resource: 'org/springframework/build/aws/ant/antlib.xml', classpath: classpath.asPath)
|
||||||
s3(accessKey: project.s3AccessKey, secretKey: project.s3SecretAccessKey) {
|
s3(accessKey: accessKey, secretKey: secretKey) {
|
||||||
upload(bucketName: 'dist.springframework.org', file: archiveFile,
|
upload(bucketName: 'dist.springframework.org', file: archiveFile,
|
||||||
toFile: releaseType() + "/SEC/${archiveName}", publicRead: 'true') {
|
toFile: releaseType() + "/SEC/${archiveName}", publicRead: 'true') {
|
||||||
metadata(name: 'project.name', value: 'Spring Security')
|
metadata(name: 'project.name', value: 'Spring Security')
|
||||||
metadata(name: 'release.type', value: releaseType())
|
metadata(name: 'release.type', value: releaseType())
|
||||||
metadata(name: 'bundle.version', value: project.version)
|
metadata(name: 'bundle.version', value: version)
|
||||||
metadata(name: 'package.file.name', value: archiveName)
|
metadata(name: 'package.file.name', value: archiveName)
|
||||||
}
|
}
|
||||||
upload(bucketName: 'dist.springframework.org', file: shaFile,
|
upload(bucketName: 'dist.springframework.org', file: shaFile,
|
||||||
|
62
buildSrc/src/main/groovy/TarUpload.groovy
Normal file
62
buildSrc/src/main/groovy/TarUpload.groovy
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import org.gradle.api.DefaultTask;
|
||||||
|
import org.gradle.api.tasks.*;
|
||||||
|
import org.gradle.api.tasks.bundling.Tar;
|
||||||
|
import org.gradle.api.tasks.bundling.Compression;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extends the Tar task, uploading the created archive to a remote directory, unpacking and deleting it.
|
||||||
|
* Requires Ant ssh (jsch) support.
|
||||||
|
*/
|
||||||
|
class TarUpload extends Tar {
|
||||||
|
@Input
|
||||||
|
String remoteDir
|
||||||
|
|
||||||
|
@Input
|
||||||
|
Login login
|
||||||
|
|
||||||
|
TarUpload() {
|
||||||
|
compression = Compression.BZIP2
|
||||||
|
}
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
void copy() {
|
||||||
|
super.copy();
|
||||||
|
upload();
|
||||||
|
}
|
||||||
|
|
||||||
|
def upload() {
|
||||||
|
String username = login.username
|
||||||
|
String password = login.password
|
||||||
|
String host = login.host
|
||||||
|
project.ant {
|
||||||
|
scp(file: archivePath, todir: "$username@$host:$remoteDir", password: password)
|
||||||
|
sshexec(host: host, username: username, password: password, command: "cd $remoteDir && tar -xjf $archiveName")
|
||||||
|
sshexec(host: host, username: username, password: password, command: "rm $remoteDir/$archiveName")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setLogin(Login login) {
|
||||||
|
dependsOn(login)
|
||||||
|
this.login = login
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores login information for a remote host.
|
||||||
|
*/
|
||||||
|
class Login extends DefaultTask {
|
||||||
|
@Input
|
||||||
|
String host
|
||||||
|
String username
|
||||||
|
String password
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
login() {
|
||||||
|
project.ant {
|
||||||
|
input("Please enter the ssh username for host '$host'", addproperty: "user.$host")
|
||||||
|
input("Please enter the ssh password '$host'", addproperty: "pass.$host")
|
||||||
|
}
|
||||||
|
username = ant.properties["user.$host"]
|
||||||
|
password = ant.properties["pass.$host"]
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,7 @@ defaultTasks 'docbookHtmlSingle'
|
|||||||
[docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceFileName = 'faq.xml'
|
[docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceFileName = 'faq.xml'
|
||||||
|
|
||||||
docbookHtmlSingle.stylesheet = new File(projectDir, 'src/xsl/html-single-custom.xsl')
|
docbookHtmlSingle.stylesheet = new File(projectDir, 'src/xsl/html-single-custom.xsl')
|
||||||
|
docbookHtmlSingle.suffix = ''
|
||||||
|
|
||||||
docbookHtmlSingle.doLast {
|
docbookHtmlSingle.doLast {
|
||||||
resourcesDir = new File(projectDir, 'src/resources')
|
resourcesDir = new File(projectDir, 'src/resources')
|
||||||
|
@ -16,4 +16,5 @@ dependencies {
|
|||||||
provided 'javax.servlet:servlet-api:2.5'
|
provided 'javax.servlet:servlet-api:2.5'
|
||||||
|
|
||||||
testCompile 'commons-codec:commons-codec:1.3'
|
testCompile 'commons-codec:commons-codec:1.3'
|
||||||
|
testRuntime "hsqldb:hsqldb:$hsqlVersion"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user