build.gradle 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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:5.3.3.3"
  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. 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/site/docs/{version}/reference/html5/"
  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("updateDependencies") {
  43. // we aren't Gradle 7 compatible yet
  44. checkForGradleUpdate = false
  45. }
  46. updateDependenciesSettings {
  47. gitHub {
  48. organization = "spring-projects"
  49. repository = "spring-security"
  50. }
  51. addFiles({
  52. return [
  53. project.file("buildSrc/src/main/java/io/spring/gradle/convention/AsciidoctorConventionPlugin.java"),
  54. project.file("buildSrc/src/main/groovy/io/spring/gradle/convention/CheckstylePlugin.groovy")
  55. ]
  56. })
  57. dependencyExcludes {
  58. majorVersionBump()
  59. alphaBetaVersions()
  60. releaseCandidatesVersions()
  61. milestoneVersions()
  62. snapshotVersions()
  63. addRule { components ->
  64. components.withModule("commons-codec:commons-codec") { selection ->
  65. ModuleComponentIdentifier candidate = selection.getCandidate();
  66. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  67. selection.reject("commons-codec updates break saml tests");
  68. }
  69. }
  70. components.withModule("org.python:jython") { selection ->
  71. ModuleComponentIdentifier candidate = selection.getCandidate();
  72. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  73. selection.reject("jython updates break integration tests");
  74. }
  75. }
  76. components.withModule("com.nimbusds:nimbus-jose-jwt") { selection ->
  77. ModuleComponentIdentifier candidate = selection.getCandidate();
  78. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  79. selection.reject("nimbus-jose-jwt gets updated when oauth2-oidc-sdk is updated to ensure consistency");
  80. }
  81. }
  82. components.all { selection ->
  83. ModuleComponentIdentifier candidate = selection.getCandidate();
  84. // Do not compare version due to multiple versions existing
  85. // will cause opensaml 3.x to be updated to 4.x
  86. if (candidate.getGroup().equals("org.opensaml")) {
  87. selection.reject("org.opensaml maintains two different versions, so it must be updated manually");
  88. }
  89. }
  90. }
  91. }
  92. }
  93. subprojects {
  94. plugins.withType(JavaPlugin) {
  95. project.sourceCompatibility='1.8'
  96. }
  97. tasks.withType(JavaCompile) {
  98. options.encoding = "UTF-8"
  99. options.compilerArgs.add("-parameters")
  100. }
  101. }
  102. allprojects {
  103. if (!['spring-security-bom', 'spring-security-docs'].contains(project.name)) {
  104. apply plugin: 'io.spring.javaformat'
  105. apply plugin: 'checkstyle'
  106. pluginManager.withPlugin("io.spring.convention.checkstyle", { plugin ->
  107. configure(plugin) {
  108. dependencies {
  109. checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:$springJavaformatVersion"
  110. }
  111. checkstyle {
  112. toolVersion = '8.34'
  113. }
  114. }
  115. })
  116. if (project.name.contains('sample')) {
  117. tasks.whenTaskAdded { task ->
  118. if (task.name.contains('format') || task.name.contains('checkFormat') || task.name.contains("checkstyle")) {
  119. task.enabled = false
  120. }
  121. }
  122. }
  123. }
  124. }
  125. if (hasProperty('buildScan')) {
  126. buildScan {
  127. termsOfServiceUrl = 'https://gradle.com/terms-of-service'
  128. termsOfServiceAgree = 'yes'
  129. }
  130. }
  131. nohttp {
  132. allowlistFile = project.file("etc/nohttp/allowlist.lines")
  133. source.exclude "buildSrc/build/**"
  134. }
  135. tasks.register('checkSamples') {
  136. includeCheckRemote {
  137. repository = 'spring-projects/spring-security-samples'
  138. ref = samplesBranch
  139. }
  140. dependsOn checkRemote
  141. }
  142. s101 {
  143. configurationDirectory = project.file("etc/s101")
  144. }