build.gradle 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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.6-rc1"
  7. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
  8. classpath "com.netflix.nebula:nebula-project-plugin:8.2.0"
  9. }
  10. repositories {
  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: '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. alphaBetaVersions()
  93. snapshotVersions()
  94. addRule { components ->
  95. components.withModule("org.python:jython") { selection ->
  96. ModuleComponentIdentifier candidate = selection.getCandidate();
  97. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  98. selection.reject("jython updates break integration tests");
  99. }
  100. }
  101. components.withModule("com.nimbusds:nimbus-jose-jwt") { selection ->
  102. ModuleComponentIdentifier candidate = selection.getCandidate();
  103. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  104. selection.reject("nimbus-jose-jwt gets updated when oauth2-oidc-sdk is updated to ensure consistency");
  105. }
  106. }
  107. }
  108. }
  109. }
  110. subprojects {
  111. plugins.withType(JavaPlugin) {
  112. project.sourceCompatibility=JavaVersion.VERSION_17
  113. }
  114. tasks.withType(JavaCompile) {
  115. options.encoding = "UTF-8"
  116. options.compilerArgs.add("-parameters")
  117. }
  118. }
  119. allprojects {
  120. if (!['spring-security-bom', 'spring-security-docs'].contains(project.name)) {
  121. apply plugin: 'io.spring.javaformat'
  122. apply plugin: 'checkstyle'
  123. pluginManager.withPlugin("io.spring.convention.checkstyle", { plugin ->
  124. configure(plugin) {
  125. dependencies {
  126. checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:$springJavaformatVersion"
  127. }
  128. checkstyle {
  129. toolVersion = '8.34'
  130. }
  131. }
  132. })
  133. if (project.name.contains('sample')) {
  134. tasks.whenTaskAdded { task ->
  135. if (task.name.contains('format') || task.name.contains('checkFormat') || task.name.contains("checkstyle")) {
  136. task.enabled = false
  137. }
  138. }
  139. }
  140. }
  141. tasks.withType(JavaCompile).configureEach {
  142. javaCompiler = javaToolchains.compilerFor {
  143. languageVersion = JavaLanguageVersion.of(17)
  144. }
  145. }
  146. }
  147. if (hasProperty('buildScan')) {
  148. buildScan {
  149. termsOfServiceUrl = 'https://gradle.com/terms-of-service'
  150. termsOfServiceAgree = 'yes'
  151. }
  152. }
  153. nohttp {
  154. source.exclude "buildSrc/build/**"
  155. }
  156. tasks.register('cloneSamples', IncludeRepoTask) {
  157. repository = 'spring-projects/spring-security-samples'
  158. ref = samplesBranch
  159. outputDirectory = project.hasProperty("cloneOutputDirectory") ? project.file("$cloneOutputDirectory") : project.file("build/samples")
  160. }
  161. s101 {
  162. configurationDirectory = project.file("etc/s101")
  163. }