build.gradle 4.3 KB

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