build.gradle 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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.6.3"
  8. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinBuildDependencyVersion"
  9. classpath "com.netflix.nebula:nebula-project-plugin:8.2.0"
  10. }
  11. repositories {
  12. maven { url 'https://plugins.gradle.org/m2/' }
  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. maven { url "https://repo.spring.io/milestone" }
  34. }
  35. tasks.named("saganCreateRelease") {
  36. referenceDocUrl = "https://docs.spring.io/spring-security/reference/{version}/index.html"
  37. apiDocUrl = "https://docs.spring.io/spring-security/site/docs/{version}/api/"
  38. }
  39. tasks.named("gitHubCheckMilestoneHasNoOpenIssues") {
  40. repository {
  41. owner = "spring-projects"
  42. name = "spring-security"
  43. }
  44. }
  45. tasks.named("gitHubNextReleaseMilestone") {
  46. repository {
  47. owner = "spring-projects"
  48. name = "spring-security"
  49. }
  50. }
  51. tasks.named("gitHubCheckNextVersionDueToday") {
  52. repository {
  53. owner = "spring-projects"
  54. name = "spring-security"
  55. }
  56. }
  57. tasks.named("scheduleNextRelease") {
  58. repository {
  59. owner = "spring-projects"
  60. name = "spring-security"
  61. }
  62. weekOfMonth = 3
  63. dayOfWeek = 1
  64. }
  65. tasks.named("createGitHubRelease") {
  66. repository {
  67. owner = "spring-projects"
  68. name = "spring-security"
  69. }
  70. }
  71. tasks.named("dispatchGitHubWorkflow") {
  72. repository {
  73. owner = "spring-projects"
  74. name = "spring-security"
  75. }
  76. }
  77. tasks.named("updateDependencies") {
  78. // we aren't Gradle 7 compatible yet
  79. checkForGradleUpdate = false
  80. }
  81. updateDependenciesSettings {
  82. gitHub {
  83. organization = "spring-projects"
  84. repository = "spring-security"
  85. }
  86. addFiles({
  87. return [
  88. project.file("buildSrc/src/main/groovy/io/spring/gradle/convention/CheckstylePlugin.groovy")
  89. ]
  90. })
  91. dependencyExcludes {
  92. majorVersionBump()
  93. alphaBetaVersions()
  94. snapshotVersions()
  95. addRule { components ->
  96. components.withModule("org.python:jython") { selection ->
  97. ModuleComponentIdentifier candidate = selection.getCandidate();
  98. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  99. selection.reject("jython updates break integration tests");
  100. }
  101. }
  102. components.withModule("com.nimbusds:nimbus-jose-jwt") { selection ->
  103. ModuleComponentIdentifier candidate = selection.getCandidate();
  104. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  105. selection.reject("nimbus-jose-jwt gets updated when oauth2-oidc-sdk is updated to ensure consistency");
  106. }
  107. }
  108. }
  109. }
  110. }
  111. def toolchainVersion() {
  112. if (project.hasProperty('testToolchain')) {
  113. return project.property('testToolchain').toString().toInteger()
  114. }
  115. return 17
  116. }
  117. subprojects {
  118. java {
  119. toolchain {
  120. languageVersion = JavaLanguageVersion.of(toolchainVersion())
  121. }
  122. }
  123. tasks.withType(JavaCompile).configureEach {
  124. options.encoding = "UTF-8"
  125. options.compilerArgs.add("-parameters")
  126. }
  127. }
  128. allprojects {
  129. if (!['spring-security-bom', 'spring-security-docs'].contains(project.name)) {
  130. apply plugin: 'io.spring.javaformat'
  131. apply plugin: 'checkstyle'
  132. pluginManager.withPlugin("io.spring.convention.checkstyle", { plugin ->
  133. configure(plugin) {
  134. dependencies {
  135. checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:$springJavaformatVersion"
  136. }
  137. checkstyle {
  138. toolVersion = '8.34'
  139. }
  140. }
  141. })
  142. if (project.name.contains('sample')) {
  143. tasks.whenTaskAdded { task ->
  144. if (task.name.contains('format') || task.name.contains('checkFormat') || task.name.contains("checkstyle")) {
  145. task.enabled = false
  146. }
  147. }
  148. }
  149. }
  150. }
  151. if (hasProperty('buildScan')) {
  152. buildScan {
  153. termsOfServiceUrl = 'https://gradle.com/terms-of-service'
  154. termsOfServiceAgree = 'yes'
  155. }
  156. }
  157. nohttp {
  158. source.exclude "buildSrc/build/**"
  159. source.builtBy(project(':spring-security-config').tasks.withType(RncToXsd))
  160. }
  161. tasks.register('cloneSamples', IncludeRepoTask) {
  162. repository = 'spring-projects/spring-security-samples'
  163. ref = samplesBranch
  164. outputDirectory = project.hasProperty("cloneOutputDirectory") ? project.file("$cloneOutputDirectory") : project.file("build/samples")
  165. }
  166. s101 {
  167. configurationDirectory = project.file("etc/s101")
  168. }