build.gradle 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import io.spring.javaformat.gradle.tasks.Format
  2. plugins {
  3. id "checkstyle"
  4. id "io.spring.javaformat" version "0.0.42"
  5. id 'io.spring.nohttp' version '0.0.11'
  6. }
  7. allprojects {
  8. apply plugin: 'checkstyle'
  9. apply plugin: 'io.spring.javaformat'
  10. dependencies {
  11. checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:0.0.42"
  12. }
  13. // Ensure every test task has at least a single test
  14. tasks.withType(Test).configureEach {
  15. afterSuite { desc, result ->
  16. if (result.testCount == 0) {
  17. throw new IllegalStateException("No tests were found. Ensure that useJUnitPlatform was used.")
  18. }
  19. }
  20. }
  21. // Spring Framework 6.1 requires -parameters to be able to introspect method parameter names
  22. tasks.withType(JavaCompile) {
  23. options.compilerArgs.add("-parameters")
  24. }
  25. tasks.matching { it.name == 'formatAot' }.all { task ->
  26. task.enabled = false
  27. }
  28. tasks.matching { it.name == 'formatAotTest' }.all { task ->
  29. task.enabled = false
  30. }
  31. tasks.matching { it.name == 'checkFormatAot' }.all { task ->
  32. task.enabled = false
  33. }
  34. tasks.matching { it.name == 'checkFormatAotTest' }.all { task ->
  35. task.enabled = false
  36. }
  37. tasks.matching { it.name == "checkstyleAot" }.all { task ->
  38. task.enabled = false
  39. }
  40. tasks.matching { it.name == "checkstyleAotTest" }.all { task ->
  41. task.enabled = false
  42. }
  43. tasks.withType(Format).tap {
  44. configureEach {
  45. it.enabled = !it.identityPath.toString().contains("saml2")
  46. }
  47. }
  48. }
  49. if (hasProperty('buildScan')) {
  50. buildScan {
  51. termsOfServiceUrl = 'https://gradle.com/terms-of-service'
  52. termsOfServiceAgree = 'yes'
  53. }
  54. }
  55. repositories {
  56. mavenCentral()
  57. }
  58. tasks.register('runAllTests') {
  59. var allTasks = rootProject.getAllTasks(true)
  60. var allTestsTasks = allTasks.values().collect { t ->
  61. t.findAll { it.name == 'test' || it.name == 'integrationTest' }
  62. }.flatten()
  63. it.dependsOn {
  64. allTestsTasks
  65. }
  66. }