build.gradle 2.7 KB

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