build.gradle 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. buildscript {
  2. dependencies {
  3. classpath "io.spring.javaformat:spring-javaformat-gradle-plugin:$springJavaformatVersion"
  4. classpath 'io.spring.nohttp:nohttp-gradle:0.0.10'
  5. classpath "io.freefair.gradle:aspectj-plugin:6.4.3.1"
  6. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
  7. classpath "com.netflix.nebula:nebula-project-plugin:8.2.0"
  8. }
  9. repositories {
  10. gradlePluginPortal()
  11. }
  12. }
  13. apply plugin: 'io.spring.nohttp'
  14. apply plugin: 'locks'
  15. apply plugin: 's101'
  16. apply plugin: 'io.spring.convention.root'
  17. apply plugin: 'io.spring.convention.include-check-remote'
  18. apply plugin: 'org.jetbrains.kotlin.jvm'
  19. apply plugin: 'org.springframework.security.update-dependencies'
  20. apply plugin: 'org.springframework.security.sagan'
  21. apply plugin: 'org.springframework.github.milestone'
  22. apply plugin: 'org.springframework.github.changelog'
  23. apply plugin: 'org.springframework.github.release'
  24. group = 'org.springframework.security'
  25. description = 'Spring Security'
  26. ext.snapshotBuild = version.contains("SNAPSHOT")
  27. ext.releaseBuild = version.contains("SNAPSHOT")
  28. ext.milestoneBuild = !(snapshotBuild || releaseBuild)
  29. repositories {
  30. mavenCentral()
  31. }
  32. tasks.named("saganCreateRelease") {
  33. referenceDocUrl = "https://docs.spring.io/spring-security/reference/{version}/index.html"
  34. apiDocUrl = "https://docs.spring.io/spring-security/site/docs/{version}/api/"
  35. }
  36. tasks.named("gitHubCheckMilestoneHasNoOpenIssues") {
  37. repository {
  38. owner = "spring-projects"
  39. name = "spring-security"
  40. }
  41. }
  42. tasks.named("createGitHubRelease") {
  43. repository {
  44. owner = "spring-projects"
  45. name = "spring-security"
  46. }
  47. }
  48. tasks.named("updateDependencies") {
  49. // we aren't Gradle 7 compatible yet
  50. checkForGradleUpdate = false
  51. }
  52. updateDependenciesSettings {
  53. gitHub {
  54. organization = "spring-projects"
  55. repository = "spring-security"
  56. }
  57. addFiles({
  58. return [
  59. project.file("buildSrc/src/main/groovy/io/spring/gradle/convention/CheckstylePlugin.groovy")
  60. ]
  61. })
  62. dependencyExcludes {
  63. majorVersionBump()
  64. minorVersionBump()
  65. releaseCandidatesVersions()
  66. milestoneVersions()
  67. alphaBetaVersions()
  68. snapshotVersions()
  69. addRule { components ->
  70. components.withModule("commons-codec:commons-codec") { selection ->
  71. ModuleComponentIdentifier candidate = selection.getCandidate();
  72. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  73. selection.reject("commons-codec updates break saml tests");
  74. }
  75. }
  76. components.withModule("org.python:jython") { selection ->
  77. ModuleComponentIdentifier candidate = selection.getCandidate();
  78. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  79. selection.reject("jython updates break integration tests");
  80. }
  81. }
  82. components.withModule("com.nimbusds:nimbus-jose-jwt") { selection ->
  83. ModuleComponentIdentifier candidate = selection.getCandidate();
  84. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  85. selection.reject("nimbus-jose-jwt gets updated when oauth2-oidc-sdk is updated to ensure consistency");
  86. }
  87. }
  88. components.all { selection ->
  89. ModuleComponentIdentifier candidate = selection.getCandidate();
  90. // Do not compare version due to multiple versions existing
  91. // will cause opensaml 3.x to be updated to 4.x
  92. if (candidate.getGroup().equals("org.opensaml")) {
  93. selection.reject("org.opensaml maintains two different versions, so it must be updated manually");
  94. }
  95. }
  96. components.withModule("io.spring.javaformat:spring-javaformat-gradle-plugin") { selection ->
  97. ModuleComponentIdentifier candidate = selection.getCandidate();
  98. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  99. selection.reject("spring-javaformat-gradle-plugin updates break checkstyle");
  100. }
  101. }
  102. components.withModule("io.spring.javaformat:spring-javaformat-checkstyle") { selection ->
  103. ModuleComponentIdentifier candidate = selection.getCandidate();
  104. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  105. selection.reject("spring-javaformat-checkstyle updates break checkstyle");
  106. }
  107. }
  108. }
  109. }
  110. }
  111. subprojects {
  112. plugins.withType(JavaPlugin) {
  113. project.sourceCompatibility='1.8'
  114. }
  115. tasks.withType(JavaCompile) {
  116. options.encoding = "UTF-8"
  117. options.compilerArgs.add("-parameters")
  118. options.release = 8
  119. }
  120. }
  121. allprojects {
  122. if (!['spring-security-bom', 'spring-security-docs'].contains(project.name)) {
  123. apply plugin: 'io.spring.javaformat'
  124. apply plugin: 'checkstyle'
  125. pluginManager.withPlugin("io.spring.convention.checkstyle", { plugin ->
  126. configure(plugin) {
  127. dependencies {
  128. checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:$springJavaformatVersion"
  129. }
  130. checkstyle {
  131. toolVersion = '8.34'
  132. }
  133. }
  134. })
  135. if (project.name.contains('sample')) {
  136. tasks.whenTaskAdded { task ->
  137. if (task.name.contains('format') || task.name.contains('checkFormat') || task.name.contains("checkstyle")) {
  138. task.enabled = false
  139. }
  140. }
  141. }
  142. }
  143. }
  144. if (hasProperty('buildScan')) {
  145. buildScan {
  146. termsOfServiceUrl = 'https://gradle.com/terms-of-service'
  147. termsOfServiceAgree = 'yes'
  148. }
  149. }
  150. nohttp {
  151. allowlistFile = project.file("etc/nohttp/allowlist.lines")
  152. source.exclude "buildSrc/build/**"
  153. }
  154. tasks.register('checkSamples') {
  155. includeCheckRemote {
  156. repository = 'spring-projects/spring-security-samples'
  157. ref = samplesBranch
  158. if (project.hasProperty("samplesInitScript")) {
  159. initScripts = [samplesInitScript]
  160. projectProperties = ["localRepositoryPath": localRepositoryPath, "springSecurityVersion": project.version]
  161. }
  162. }
  163. dependsOn checkRemote
  164. }
  165. s101 {
  166. configurationDirectory = project.file("etc/s101")
  167. }