build.gradle 4.7 KB

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