build.gradle 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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.3.0"
  6. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
  7. classpath "com.netflix.nebula:nebula-project-plugin:8.2.0"
  8. }
  9. repositories {
  10. maven { url 'https://repo.spring.io/plugins-snapshot' }
  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: 'io.spring.convention.include-check-remote'
  19. apply plugin: 'org.jetbrains.kotlin.jvm'
  20. apply plugin: 'org.springframework.security.update-dependencies'
  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/site/docs/{version}/reference/html5/"
  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("createGitHubRelease") {
  44. repository {
  45. owner = "spring-projects"
  46. name = "spring-security"
  47. }
  48. }
  49. tasks.named("updateDependencies") {
  50. // we aren't Gradle 7 compatible yet
  51. checkForGradleUpdate = false
  52. }
  53. updateDependenciesSettings {
  54. gitHub {
  55. organization = "spring-projects"
  56. repository = "spring-security"
  57. }
  58. addFiles({
  59. return [
  60. project.file("buildSrc/src/main/groovy/io/spring/gradle/convention/CheckstylePlugin.groovy")
  61. ]
  62. })
  63. dependencyExcludes {
  64. majorVersionBump()
  65. alphaBetaVersions()
  66. releaseCandidatesVersions()
  67. milestoneVersions()
  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. }
  97. }
  98. }
  99. subprojects {
  100. plugins.withType(JavaPlugin) {
  101. project.sourceCompatibility=JavaVersion.VERSION_17
  102. }
  103. tasks.withType(JavaCompile) {
  104. options.encoding = "UTF-8"
  105. options.compilerArgs.add("-parameters")
  106. }
  107. }
  108. allprojects {
  109. if (!['spring-security-bom', 'spring-security-docs'].contains(project.name)) {
  110. apply plugin: 'io.spring.javaformat'
  111. apply plugin: 'checkstyle'
  112. pluginManager.withPlugin("io.spring.convention.checkstyle", { plugin ->
  113. configure(plugin) {
  114. dependencies {
  115. checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:$springJavaformatVersion"
  116. }
  117. checkstyle {
  118. toolVersion = '8.34'
  119. }
  120. }
  121. })
  122. if (project.name.contains('sample')) {
  123. tasks.whenTaskAdded { task ->
  124. if (task.name.contains('format') || task.name.contains('checkFormat') || task.name.contains("checkstyle")) {
  125. task.enabled = false
  126. }
  127. }
  128. }
  129. }
  130. }
  131. if (hasProperty('buildScan')) {
  132. buildScan {
  133. termsOfServiceUrl = 'https://gradle.com/terms-of-service'
  134. termsOfServiceAgree = 'yes'
  135. }
  136. }
  137. nohttp {
  138. allowlistFile = project.file("etc/nohttp/allowlist.lines")
  139. source.exclude "buildSrc/build/**"
  140. }
  141. tasks.register('checkSamples') {
  142. includeCheckRemote {
  143. repository = 'spring-projects/spring-security-samples'
  144. ref = samplesBranch
  145. }
  146. dependsOn checkRemote
  147. }
  148. s101 {
  149. configurationDirectory = project.file("etc/s101")
  150. }