build.gradle 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. buildscript {
  2. repositories {
  3. maven {
  4. url = 'https://repo.spring.io/plugins-snapshot'
  5. if (project.hasProperty('artifactoryUsername')) {
  6. credentials {
  7. username "$artifactoryUsername"
  8. password "$artifactoryPassword"
  9. }
  10. }
  11. }
  12. }
  13. dependencies {
  14. classpath "com.github.ben-manes:gradle-versions-plugin:0.17.0"
  15. classpath("org.springframework.build.gradle:propdeps-plugin:0.0.7")
  16. classpath("io.spring.gradle:spring-io-plugin:0.0.8.RELEASE")
  17. classpath("com.bmuschko:gradle-tomcat-plugin:2.2.4")
  18. classpath('me.champeau.gradle:gradle-javadoc-hotfix-plugin:0.1')
  19. classpath('org.asciidoctor:asciidoctor-gradle-plugin:1.5.7')
  20. classpath("io.spring.gradle:docbook-reference-plugin:0.3.1")
  21. classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.22.RELEASE")
  22. classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.12.0"
  23. classpath 'org.hidetake:gradle-ssh-plugin:2.10.1'
  24. classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.10.0'
  25. }
  26. }
  27. plugins {
  28. id "org.sonarqube" version "2.1-rc1"
  29. }
  30. apply plugin: 'base'
  31. apply from: "$rootDir/gradle/finalize-deploy.gradle"
  32. description = 'Spring Security'
  33. allprojects {
  34. apply plugin: 'idea'
  35. apply plugin: 'eclipse'
  36. apply plugin: "com.github.ben-manes.versions"
  37. ext.releaseBuild = version.endsWith('RELEASE')
  38. ext.snapshotBuild = version.endsWith('SNAPSHOT')
  39. ext.springVersion = '4.3.30.RELEASE'
  40. ext.springLdapVersion = '2.3.3.RELEASE'
  41. group = 'org.springframework.security'
  42. repositories {
  43. mavenCentral()
  44. maven { url "https://repo.spring.io/libs-snapshot" }
  45. maven { url "https://repo.spring.io/plugins-release" }
  46. maven { url "https://repo.terracotta.org/maven2/" }
  47. }
  48. }
  49. sonarqube {
  50. properties {
  51. property "sonar.java.coveragePlugin", "jacoco"
  52. property "sonar.projectName", "Spring Security"
  53. property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec"
  54. property "sonar.links.homepage", 'https://www.springsource.org/spring-security'
  55. property "sonar.links.ci", 'https://build.springsource.org/browse/SEC-B32X'
  56. property "sonar.links.issue", 'https://jira.springsource.org/browse/SEC'
  57. property "sonar.links.scm", 'https://github.com/SpringSource/spring-security'
  58. property "sonar.links.scm_dev", 'https://github.com/SpringSource/spring-security.git'
  59. property "sonar.java.coveragePlugin", "jacoco"
  60. }
  61. }
  62. // Set up different subproject lists for individual configuration
  63. ext.javaProjects = subprojects.findAll { project -> project.name != 'docs' && project.name != 'manual' && project.name != 'guides' && project.name != 'spring-security-bom' }
  64. ext.sampleProjects = subprojects.findAll { project -> project.name.startsWith('spring-security-samples') }
  65. ext.sampleBootProjects = subprojects.findAll { project -> project.name.startsWith('spring-security-samples-boot') }
  66. ext.itestProjects = subprojects.findAll { project -> project.name.startsWith('itest') }
  67. ext.coreModuleProjects = javaProjects - sampleProjects - itestProjects
  68. ext.aspectjProjects = [project(':spring-security-aspects'), project(':spring-security-samples-xml-aspectj'), project(':spring-security-samples-javaconfig-aspectj')]
  69. configure(allprojects - javaProjects) {
  70. task afterEclipseImport {
  71. ext.srcFile = file('.classpath')
  72. inputs.file srcFile
  73. outputs.dir srcFile
  74. onlyIf { !srcFile.exists() }
  75. doLast {
  76. srcFile << """<?xml version="1.0" encoding="UTF-8"?>
  77. <classpath>
  78. <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  79. <classpathentry kind="output" path="bin"/>
  80. </classpath>
  81. """
  82. }
  83. }
  84. }
  85. configure(subprojects - coreModuleProjects - project(':spring-security-samples-javaconfig-messages') - project(':spring-security-bom')) {
  86. sonarqube {
  87. skipProject = true
  88. }
  89. }
  90. configure(javaProjects) {
  91. ext.TOMCAT_GRADLE = "$rootDir/gradle/tomcat.gradle"
  92. ext.WAR_SAMPLE_GRADLE = "$rootDir/gradle/war-sample.gradle"
  93. ext.BOOT_SAMPLE_GRADLE = "$rootDir/gradle/boot-sample.gradle"
  94. apply from: "$rootDir/gradle/javaprojects.gradle"
  95. if(!project.name.contains('gae')) {
  96. apply from: "$rootDir/gradle/checkstyle.gradle"
  97. }
  98. apply from: "$rootDir/gradle/ide.gradle"
  99. apply from: "$rootDir/gradle/release-checks.gradle"
  100. }
  101. configure(coreModuleProjects) {
  102. apply from: "$rootDir/gradle/maven-deployment.gradle"
  103. apply from: "$rootDir/gradle/artifactory.gradle"
  104. apply from: "$rootDir/gradle/ossrh.gradle"
  105. apply from: "$rootDir/gradle/deploy-artifacts.gradle"
  106. apply plugin: 'emma'
  107. apply plugin: 'spring-io'
  108. ext.springIoVersion = project.hasProperty('platformVersion') ? platformVersion : 'Brussels-SR9'
  109. configurations {
  110. jacoco //Configuration Group used by Sonar to provide Code Coverage using JaCoCo
  111. }
  112. dependencyManagement {
  113. imports {
  114. mavenBom("org.springframework:spring-framework-bom:${springVersion}")
  115. }
  116. springIoTestRuntime {
  117. imports {
  118. mavenBom("io.spring.platform:platform-bom:${springIoVersion}") {
  119. bomProperties([
  120. 'assertj.version': '2.6.0',
  121. 'mockito.version': '1.10.19'
  122. ])
  123. }
  124. }
  125. }
  126. }
  127. dependencies {
  128. jacoco "org.jacoco:org.jacoco.agent:0.7.9:runtime"
  129. }
  130. test {
  131. jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=${project.group}.*"
  132. }
  133. integrationTest {
  134. jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=${project.group}.*"
  135. }
  136. }
  137. configure (aspectjProjects) {
  138. apply plugin: 'java'
  139. apply plugin: 'aspectj'
  140. }
  141. task coreBuild {
  142. dependsOn coreModuleProjects*.tasks*.matching { task -> task.name == 'build' }
  143. }
  144. task coreInstall {
  145. dependsOn coreModuleProjects*.tasks*.matching { task -> task.name == 'install' }
  146. }
  147. // Task for creating the distro zip
  148. task dist(type: Zip) {
  149. dependsOn { subprojects*.tasks*.matching { task -> task.name.endsWith('generatePom') } }
  150. classifier = 'dist'
  151. evaluationDependsOn(':docs')
  152. evaluationDependsOn(':docs:manual')
  153. def zipRootDir = "${project.name}-$version"
  154. into(zipRootDir) {
  155. from(rootDir) {
  156. include '*.adoc'
  157. include '*.txt'
  158. }
  159. into('docs') {
  160. with(project(':docs').apiSpec)
  161. with(project(':docs:manual').spec)
  162. with(project(':docs:guides').spec)
  163. }
  164. project.coreModuleProjects*.tasks*.withType(AbstractArchiveTask).flatten().each{ archiveTask ->
  165. if(archiveTask!=dist){
  166. into("$zipRootDir/dist") {
  167. from archiveTask.outputs.files
  168. }
  169. }
  170. }
  171. sampleProjects.each { project->
  172. into("$zipRootDir/samples/$project.name") {
  173. from(project.projectDir) {
  174. include "src/main/**"
  175. include "pom.xml"
  176. }
  177. }
  178. }
  179. }
  180. }
  181. artifacts {
  182. archives dist
  183. archives project(':docs').docsZip
  184. archives project(':docs').schemaZip
  185. }
  186. if (project.hasProperty('artifactoryUsername')) {
  187. allprojects { project ->
  188. project.repositories { repos ->
  189. all { repo ->
  190. if (!repo.url.toString().startsWith("https://repo.spring.io/")) {
  191. return;
  192. }
  193. repo.credentials {
  194. username = artifactoryUsername
  195. password = artifactoryPassword
  196. }
  197. }
  198. }
  199. }
  200. }