build.gradle 4.5 KB

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