build.gradle 4.2 KB

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