build.gradle 4.9 KB

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