build.gradle 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. import io.spring.gradle.IncludeRepoTask
  2. import trang.RncToXsd
  3. buildscript {
  4. dependencies {
  5. classpath "io.spring.javaformat:spring-javaformat-gradle-plugin:$springJavaformatVersion"
  6. classpath 'io.spring.nohttp:nohttp-gradle:0.0.11'
  7. classpath "io.freefair.gradle:aspectj-plugin:6.5.1"
  8. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
  9. classpath "com.netflix.nebula:nebula-project-plugin:8.2.0"
  10. }
  11. repositories {
  12. gradlePluginPortal()
  13. }
  14. }
  15. apply plugin: 'io.spring.nohttp'
  16. apply plugin: 'locks'
  17. apply plugin: 's101'
  18. apply plugin: 'io.spring.convention.root'
  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("scheduleNextRelease") {
  57. repository {
  58. owner = "spring-projects"
  59. name = "spring-security"
  60. }
  61. weekOfMonth = 3
  62. dayOfWeek = 1
  63. }
  64. tasks.named("createGitHubRelease") {
  65. repository {
  66. owner = "spring-projects"
  67. name = "spring-security"
  68. }
  69. }
  70. tasks.named("dispatchGitHubWorkflow") {
  71. repository {
  72. owner = "spring-projects"
  73. name = "spring-security"
  74. }
  75. }
  76. tasks.named("updateDependencies") {
  77. // we aren't Gradle 7 compatible yet
  78. checkForGradleUpdate = false
  79. }
  80. updateDependenciesSettings {
  81. gitHub {
  82. organization = "spring-projects"
  83. repository = "spring-security"
  84. }
  85. addFiles({
  86. return [
  87. project.file("buildSrc/src/main/groovy/io/spring/gradle/convention/CheckstylePlugin.groovy")
  88. ]
  89. })
  90. dependencyExcludes {
  91. majorVersionBump()
  92. minorVersionBump()
  93. releaseCandidatesVersions()
  94. alphaBetaVersions()
  95. snapshotVersions()
  96. addRule { components ->
  97. components.withModule("org.python:jython") { selection ->
  98. ModuleComponentIdentifier candidate = selection.getCandidate();
  99. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  100. selection.reject("jython updates break integration tests");
  101. }
  102. }
  103. components.withModule("com.nimbusds:nimbus-jose-jwt") { selection ->
  104. ModuleComponentIdentifier candidate = selection.getCandidate();
  105. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  106. selection.reject("nimbus-jose-jwt gets updated when oauth2-oidc-sdk is updated to ensure consistency");
  107. }
  108. }
  109. components.withModule("io.mockk:mockk") { selection ->
  110. ModuleComponentIdentifier candidate = selection.getCandidate();
  111. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  112. selection.reject("mockk updates break tests");
  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. }
  124. }
  125. }
  126. subprojects {
  127. plugins.withType(JavaPlugin) {
  128. project.sourceCompatibility='1.8'
  129. }
  130. tasks.withType(JavaCompile) {
  131. options.encoding = "UTF-8"
  132. options.compilerArgs.add("-parameters")
  133. }
  134. }
  135. allprojects {
  136. if (!['spring-security-bom', 'spring-security-docs'].contains(project.name)) {
  137. apply plugin: 'io.spring.javaformat'
  138. apply plugin: 'checkstyle'
  139. pluginManager.withPlugin("io.spring.convention.checkstyle", { plugin ->
  140. configure(plugin) {
  141. dependencies {
  142. checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:$springJavaformatVersion"
  143. }
  144. checkstyle {
  145. toolVersion = '8.34'
  146. }
  147. }
  148. })
  149. if (project.name.contains('sample')) {
  150. tasks.whenTaskAdded { task ->
  151. if (task.name.contains('format') || task.name.contains('checkFormat') || task.name.contains("checkstyle")) {
  152. task.enabled = false
  153. }
  154. }
  155. }
  156. }
  157. tasks.withType(JavaCompile).configureEach {
  158. javaCompiler = javaToolchains.compilerFor {
  159. languageVersion = JavaLanguageVersion.of(8)
  160. }
  161. }
  162. }
  163. if (hasProperty('buildScan')) {
  164. buildScan {
  165. termsOfServiceUrl = 'https://gradle.com/terms-of-service'
  166. termsOfServiceAgree = 'yes'
  167. }
  168. }
  169. nohttp {
  170. source.exclude "buildSrc/build/**"
  171. source.builtBy(project(':spring-security-config').tasks.withType(RncToXsd))
  172. }
  173. tasks.register('cloneSamples', IncludeRepoTask) {
  174. repository = 'spring-projects/spring-security-samples'
  175. ref = samplesBranch
  176. outputDirectory = project.hasProperty("cloneOutputDirectory") ? project.file("$cloneOutputDirectory") : project.file("build/samples")
  177. }
  178. s101 {
  179. configurationDirectory = project.file("etc/s101")
  180. }