build.gradle 4.0 KB

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