dist.gradle 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Task for creating the distro zip
  2. configurations {
  3. antaws
  4. }
  5. dependencies {
  6. antaws "org.springframework.build:org.springframework.build.aws.ant:3.0.3.RELEASE",
  7. "net.java.dev.jets3t:jets3t:0.6.1"
  8. }
  9. task dist(type: Zip) {
  10. dependsOn subprojects*.tasks*.matching { task -> task.name == 'assemble' }
  11. evaluationDependsOn(':docs')
  12. def zipRootDir = "${project.name}-$version"
  13. into(zipRootDir) {
  14. from(rootDir) {
  15. include '*.txt'
  16. }
  17. into('docs') {
  18. with(project(':docs').apiSpec)
  19. with(project(':docs:manual').spec)
  20. }
  21. into('dist') {
  22. from coreModuleProjects.collect {project -> project.libsDir }
  23. from project(':spring-security-samples-tutorial').libsDir
  24. from project(':spring-security-samples-contacts').libsDir
  25. }
  26. }
  27. doLast {
  28. ant.checksum(file: archivePath, algorithm: 'SHA1', fileext: '.sha1')
  29. }
  30. }
  31. task uploadDist(type: UploadDist) {
  32. archiveFile = dist.archivePath
  33. shaFile = "${dist.archivePath}.sha1" as File
  34. archiveName = dist.archiveName
  35. }
  36. class UploadDist extends DefaultTask {
  37. @InputFile
  38. File shaFile
  39. @InputFile
  40. File archiveFile
  41. @Input
  42. String archiveName
  43. @TaskAction
  44. def upload() {
  45. def accessKey = project.s3AccessKey
  46. def secretKey = project.s3SecretAccessKey
  47. def version = project.version
  48. def classpath = project.configurations.antaws
  49. project.ant {
  50. taskdef(resource: 'org/springframework/build/aws/ant/antlib.xml', classpath: classpath.asPath)
  51. s3(accessKey: accessKey, secretKey: secretKey) {
  52. upload(bucketName: 'dist.springframework.org', file: archiveFile,
  53. toFile: releaseType() + "/SEC/${archiveName}", publicRead: 'true') {
  54. metadata(name: 'project.name', value: 'Spring Security')
  55. metadata(name: 'release.type', value: releaseType())
  56. metadata(name: 'bundle.version', value: version)
  57. metadata(name: 'package.file.name', value: archiveName)
  58. }
  59. upload(bucketName: 'dist.springframework.org', file: shaFile,
  60. toFile: releaseType() + "/SEC/${archiveName}.sha1", publicRead: 'true')
  61. }
  62. }
  63. }
  64. def releaseType() {
  65. if (project.releaseBuild) {
  66. 'release'
  67. } else if (project.snapshotBuild) {
  68. 'snapshot'
  69. } else {
  70. 'milestone'
  71. }
  72. }
  73. }