build.gradle 6.3 KB

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