build.gradle 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. import io.spring.gradle.IncludeRepoTask
  2. import trang.RncToXsd
  3. buildscript {
  4. dependencies {
  5. classpath libs.io.spring.javaformat.spring.javaformat.gradle.plugin
  6. classpath libs.io.spring.nohttp.nohttp.gradle
  7. classpath libs.io.freefair.gradle.aspectj.plugin
  8. classpath libs.org.jetbrains.kotlin.kotlin.gradle.plugin
  9. classpath libs.com.netflix.nebula.nebula.project.plugin
  10. }
  11. repositories {
  12. maven { url 'https://plugins.gradle.org/m2/' }
  13. }
  14. }
  15. plugins {
  16. alias(libs.plugins.org.gradle.wrapper.upgrade)
  17. }
  18. apply plugin: 'io.spring.nohttp'
  19. apply plugin: 'locks'
  20. apply plugin: 's101'
  21. apply plugin: 'io.spring.convention.root'
  22. apply plugin: 'org.jetbrains.kotlin.jvm'
  23. apply plugin: 'org.springframework.security.update-version'
  24. apply plugin: 'org.springframework.security.sagan'
  25. apply plugin: 'org.springframework.github.milestone'
  26. apply plugin: 'org.springframework.github.changelog'
  27. apply plugin: 'org.springframework.github.release'
  28. apply plugin: 'org.springframework.security.versions.verify-dependencies-versions'
  29. group = 'org.springframework.security'
  30. description = 'Spring Security'
  31. ext.snapshotBuild = version.contains("SNAPSHOT")
  32. ext.releaseBuild = version.contains("SNAPSHOT")
  33. ext.milestoneBuild = !(snapshotBuild || releaseBuild)
  34. repositories {
  35. mavenCentral()
  36. maven { url "https://repo.spring.io/milestone" }
  37. }
  38. tasks.named("saganCreateRelease") {
  39. referenceDocUrl = "https://docs.spring.io/spring-security/reference/{version}/index.html"
  40. apiDocUrl = "https://docs.spring.io/spring-security/site/docs/{version}/api/"
  41. }
  42. tasks.named("gitHubCheckMilestoneHasNoOpenIssues") {
  43. repository {
  44. owner = "spring-projects"
  45. name = "spring-security"
  46. }
  47. }
  48. tasks.named("gitHubNextReleaseMilestone") {
  49. repository {
  50. owner = "spring-projects"
  51. name = "spring-security"
  52. }
  53. }
  54. tasks.named("gitHubCheckNextVersionDueToday") {
  55. repository {
  56. owner = "spring-projects"
  57. name = "spring-security"
  58. }
  59. }
  60. tasks.named("scheduleNextRelease") {
  61. repository {
  62. owner = "spring-projects"
  63. name = "spring-security"
  64. }
  65. weekOfMonth = 3
  66. dayOfWeek = 1
  67. }
  68. tasks.named("createGitHubRelease") {
  69. repository {
  70. owner = "spring-projects"
  71. name = "spring-security"
  72. }
  73. }
  74. tasks.named("dispatchGitHubWorkflow") {
  75. repository {
  76. owner = "spring-projects"
  77. name = "spring-security"
  78. }
  79. }
  80. def toolchainVersion() {
  81. if (project.hasProperty('testToolchain')) {
  82. return project.property('testToolchain').toString().toInteger()
  83. }
  84. return 17
  85. }
  86. subprojects {
  87. java {
  88. toolchain {
  89. languageVersion = JavaLanguageVersion.of(toolchainVersion())
  90. }
  91. }
  92. kotlin {
  93. jvmToolchain {
  94. languageVersion = JavaLanguageVersion.of(17)
  95. }
  96. }
  97. tasks.withType(JavaCompile).configureEach {
  98. options.encoding = "UTF-8"
  99. options.compilerArgs.add("-parameters")
  100. options.release.set(17)
  101. }
  102. }
  103. allprojects {
  104. if (!['spring-security-bom', 'spring-security-docs'].contains(project.name)) {
  105. apply plugin: 'io.spring.javaformat'
  106. apply plugin: 'checkstyle'
  107. pluginManager.withPlugin("io.spring.convention.checkstyle", { plugin ->
  108. configure(plugin) {
  109. dependencies {
  110. checkstyle libs.io.spring.javaformat.spring.javaformat.checkstyle
  111. }
  112. checkstyle {
  113. toolVersion = '8.34'
  114. }
  115. }
  116. })
  117. if (project.name.contains('sample')) {
  118. tasks.whenTaskAdded { task ->
  119. if (task.name.contains('format') || task.name.contains('checkFormat') || task.name.contains("checkstyle")) {
  120. task.enabled = false
  121. }
  122. }
  123. }
  124. }
  125. }
  126. if (hasProperty('buildScan')) {
  127. buildScan {
  128. termsOfServiceUrl = 'https://gradle.com/terms-of-service'
  129. termsOfServiceAgree = 'yes'
  130. }
  131. }
  132. nohttp {
  133. source.exclude "buildSrc/build/**"
  134. source.builtBy(project(':spring-security-config').tasks.withType(RncToXsd))
  135. }
  136. tasks.register('cloneRepository', IncludeRepoTask) {
  137. repository = project.getProperties().get("repositoryName")
  138. ref = project.getProperties().get("ref")
  139. var defaultDirectory = project.file("build/tmp/clone")
  140. outputDirectory = project.hasProperty("cloneOutputDirectory") ? project.file("$cloneOutputDirectory") : defaultDirectory
  141. }
  142. s101 {
  143. configurationDirectory = project.file("etc/s101")
  144. }
  145. wrapperUpgrade {
  146. gradle {
  147. 'spring-security' {
  148. repo = 'spring-projects/spring-security'
  149. baseBranch = '6.1.x' // runs only on 6.1.x and the update is merged forward to main
  150. }
  151. }
  152. }