dist.gradle 2.4 KB

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