build.gradle 3.7 KB

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