build.gradle 5.3 KB

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