build.gradle 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. import io.spring.gradle.IncludeRepoTask
  2. buildscript {
  3. dependencies {
  4. classpath "io.spring.javaformat:spring-javaformat-gradle-plugin:$springJavaformatVersion"
  5. classpath 'io.spring.nohttp:nohttp-gradle:0.0.11'
  6. classpath "io.freefair.gradle:aspectj-plugin:6.4.3.1"
  7. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
  8. classpath "com.netflix.nebula:nebula-project-plugin:8.2.0"
  9. }
  10. repositories {
  11. gradlePluginPortal()
  12. }
  13. }
  14. apply plugin: 'io.spring.nohttp'
  15. apply plugin: 'locks'
  16. apply plugin: 's101'
  17. apply plugin: 'io.spring.convention.root'
  18. apply plugin: 'org.jetbrains.kotlin.jvm'
  19. apply plugin: 'org.springframework.security.update-dependencies'
  20. apply plugin: 'org.springframework.security.update-version'
  21. apply plugin: 'org.springframework.security.sagan'
  22. apply plugin: 'org.springframework.github.milestone'
  23. apply plugin: 'org.springframework.github.changelog'
  24. apply plugin: 'org.springframework.github.release'
  25. group = 'org.springframework.security'
  26. description = 'Spring Security'
  27. ext.snapshotBuild = version.contains("SNAPSHOT")
  28. ext.releaseBuild = version.contains("SNAPSHOT")
  29. ext.milestoneBuild = !(snapshotBuild || releaseBuild)
  30. repositories {
  31. mavenCentral()
  32. }
  33. tasks.named("saganCreateRelease") {
  34. referenceDocUrl = "https://docs.spring.io/spring-security/reference/{version}/index.html"
  35. apiDocUrl = "https://docs.spring.io/spring-security/site/docs/{version}/api/"
  36. }
  37. tasks.named("gitHubCheckMilestoneHasNoOpenIssues") {
  38. repository {
  39. owner = "spring-projects"
  40. name = "spring-security"
  41. }
  42. }
  43. tasks.named("gitHubNextReleaseMilestone") {
  44. repository {
  45. owner = "spring-projects"
  46. name = "spring-security"
  47. }
  48. }
  49. tasks.named("gitHubCheckNextVersionDueToday") {
  50. repository {
  51. owner = "spring-projects"
  52. name = "spring-security"
  53. }
  54. }
  55. tasks.named("scheduleNextRelease") {
  56. repository {
  57. owner = "spring-projects"
  58. name = "spring-security"
  59. }
  60. weekOfMonth = 3
  61. dayOfWeek = 1
  62. }
  63. tasks.named("createGitHubRelease") {
  64. repository {
  65. owner = "spring-projects"
  66. name = "spring-security"
  67. }
  68. }
  69. tasks.named("dispatchGitHubWorkflow") {
  70. repository {
  71. owner = "spring-projects"
  72. name = "spring-security"
  73. }
  74. }
  75. tasks.named("updateDependencies") {
  76. // we aren't Gradle 7 compatible yet
  77. checkForGradleUpdate = false
  78. }
  79. updateDependenciesSettings {
  80. gitHub {
  81. organization = "spring-projects"
  82. repository = "spring-security"
  83. }
  84. addFiles({
  85. return [
  86. project.file("buildSrc/src/main/groovy/io/spring/gradle/convention/CheckstylePlugin.groovy")
  87. ]
  88. })
  89. dependencyExcludes {
  90. majorVersionBump()
  91. minorVersionBump()
  92. releaseCandidatesVersions()
  93. milestoneVersions()
  94. alphaBetaVersions()
  95. snapshotVersions()
  96. addRule { components ->
  97. components.withModule("commons-codec:commons-codec") { selection ->
  98. ModuleComponentIdentifier candidate = selection.getCandidate();
  99. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  100. selection.reject("commons-codec updates break saml tests");
  101. }
  102. }
  103. components.withModule("org.python:jython") { selection ->
  104. ModuleComponentIdentifier candidate = selection.getCandidate();
  105. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  106. selection.reject("jython updates break integration tests");
  107. }
  108. }
  109. components.withModule("com.nimbusds:nimbus-jose-jwt") { selection ->
  110. ModuleComponentIdentifier candidate = selection.getCandidate();
  111. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  112. selection.reject("nimbus-jose-jwt gets updated when oauth2-oidc-sdk is updated to ensure consistency");
  113. }
  114. }
  115. components.all { selection ->
  116. ModuleComponentIdentifier candidate = selection.getCandidate();
  117. // Do not compare version due to multiple versions existing
  118. // will cause opensaml 3.x to be updated to 4.x
  119. if (candidate.getGroup().equals("org.opensaml")) {
  120. selection.reject("org.opensaml maintains two different versions, so it must be updated manually");
  121. }
  122. }
  123. components.withModule("io.spring.javaformat:spring-javaformat-gradle-plugin") { selection ->
  124. ModuleComponentIdentifier candidate = selection.getCandidate();
  125. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  126. selection.reject("spring-javaformat-gradle-plugin updates break checkstyle");
  127. }
  128. }
  129. components.withModule("io.spring.javaformat:spring-javaformat-checkstyle") { selection ->
  130. ModuleComponentIdentifier candidate = selection.getCandidate();
  131. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  132. selection.reject("spring-javaformat-checkstyle updates break checkstyle");
  133. }
  134. }
  135. }
  136. }
  137. }
  138. subprojects {
  139. plugins.withType(JavaPlugin) {
  140. project.sourceCompatibility='1.8'
  141. }
  142. tasks.withType(JavaCompile) {
  143. options.encoding = "UTF-8"
  144. options.compilerArgs.add("-parameters")
  145. options.release = 8
  146. }
  147. }
  148. allprojects {
  149. if (!['spring-security-bom', 'spring-security-docs'].contains(project.name)) {
  150. apply plugin: 'io.spring.javaformat'
  151. apply plugin: 'checkstyle'
  152. pluginManager.withPlugin("io.spring.convention.checkstyle", { plugin ->
  153. configure(plugin) {
  154. dependencies {
  155. checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:$springJavaformatVersion"
  156. }
  157. checkstyle {
  158. toolVersion = '8.34'
  159. }
  160. }
  161. })
  162. if (project.name.contains('sample')) {
  163. tasks.whenTaskAdded { task ->
  164. if (task.name.contains('format') || task.name.contains('checkFormat') || task.name.contains("checkstyle")) {
  165. task.enabled = false
  166. }
  167. }
  168. }
  169. }
  170. }
  171. if (hasProperty('buildScan')) {
  172. buildScan {
  173. termsOfServiceUrl = 'https://gradle.com/terms-of-service'
  174. termsOfServiceAgree = 'yes'
  175. }
  176. }
  177. nohttp {
  178. source.exclude "buildSrc/build/**"
  179. }
  180. tasks.register('cloneSamples', IncludeRepoTask) {
  181. repository = 'spring-projects/spring-security-samples'
  182. ref = samplesBranch
  183. outputDirectory = project.hasProperty("cloneOutputDirectory") ? project.file("$cloneOutputDirectory") : project.file("build/samples")
  184. }
  185. s101 {
  186. configurationDirectory = project.file("etc/s101")
  187. }