build.gradle 4.1 KB

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