build.gradle 1.6 KB

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