build.gradle 3.9 KB

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