build.gradle 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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.0.1"
  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 = "rwinch"
  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. }
  63. }
  64. }
  65. subprojects {
  66. plugins.withType(JavaPlugin) {
  67. project.sourceCompatibility='1.8'
  68. }
  69. tasks.withType(JavaCompile) {
  70. options.encoding = "UTF-8"
  71. }
  72. }
  73. allprojects {
  74. if (!['spring-security-bom', 'spring-security-docs'].contains(project.name)) {
  75. apply plugin: 'io.spring.javaformat'
  76. apply plugin: 'checkstyle'
  77. pluginManager.withPlugin("io.spring.convention.checkstyle", { plugin ->
  78. configure(plugin) {
  79. dependencies {
  80. checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:$springJavaformatVersion"
  81. }
  82. checkstyle {
  83. toolVersion = '8.34'
  84. }
  85. }
  86. })
  87. if (project.name.contains('sample')) {
  88. tasks.whenTaskAdded { task ->
  89. if (task.name.contains('format') || task.name.contains('checkFormat') || task.name.contains("checkstyle")) {
  90. task.enabled = false
  91. }
  92. }
  93. }
  94. }
  95. }
  96. if (hasProperty('buildScan')) {
  97. buildScan {
  98. termsOfServiceUrl = 'https://gradle.com/terms-of-service'
  99. termsOfServiceAgree = 'yes'
  100. }
  101. }
  102. nohttp {
  103. allowlistFile = project.file("etc/nohttp/allowlist.lines")
  104. source.exclude "buildSrc/build/**"
  105. }