build.gradle 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. buildscript {
  2. dependencies {
  3. classpath "io.spring.javaformat:spring-javaformat-gradle-plugin:$springJavaformatVersion"
  4. classpath 'io.spring.nohttp:nohttp-gradle:0.0.10'
  5. classpath "io.freefair.gradle:aspectj-plugin:6.4.3"
  6. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
  7. classpath "com.netflix.nebula:nebula-project-plugin:8.2.0"
  8. }
  9. repositories {
  10. gradlePluginPortal()
  11. }
  12. }
  13. apply plugin: 'io.spring.nohttp'
  14. apply plugin: 'locks'
  15. apply plugin: 's101'
  16. apply plugin: 'io.spring.convention.root'
  17. apply plugin: 'io.spring.convention.include-check-remote'
  18. apply plugin: 'org.jetbrains.kotlin.jvm'
  19. apply plugin: 'org.springframework.security.update-dependencies'
  20. apply plugin: 'org.springframework.security.sagan'
  21. apply plugin: 'org.springframework.github.milestone'
  22. apply plugin: 'org.springframework.github.changelog'
  23. apply plugin: 'org.springframework.github.release'
  24. group = 'org.springframework.security'
  25. description = 'Spring Security'
  26. ext.snapshotBuild = version.contains("SNAPSHOT")
  27. ext.releaseBuild = version.contains("SNAPSHOT")
  28. ext.milestoneBuild = !(snapshotBuild || releaseBuild)
  29. repositories {
  30. mavenCentral()
  31. }
  32. tasks.named("saganCreateRelease") {
  33. referenceDocUrl = "https://docs.spring.io/spring-security/reference/{version}/index.html"
  34. apiDocUrl = "https://docs.spring.io/spring-security/site/docs/{version}/api/"
  35. }
  36. tasks.named("gitHubCheckMilestoneHasNoOpenIssues") {
  37. repository {
  38. owner = "spring-projects"
  39. name = "spring-security"
  40. }
  41. }
  42. tasks.named("createGitHubRelease") {
  43. repository {
  44. owner = "spring-projects"
  45. name = "spring-security"
  46. }
  47. }
  48. tasks.named("updateDependencies") {
  49. // we aren't Gradle 7 compatible yet
  50. checkForGradleUpdate = false
  51. }
  52. updateDependenciesSettings {
  53. gitHub {
  54. organization = "spring-projects"
  55. repository = "spring-security"
  56. }
  57. addFiles({
  58. return [
  59. project.file("buildSrc/src/main/groovy/io/spring/gradle/convention/CheckstylePlugin.groovy")
  60. ]
  61. })
  62. dependencyExcludes {
  63. majorVersionBump()
  64. alphaBetaVersions()
  65. snapshotVersions()
  66. addRule { components ->
  67. components.withModule("commons-codec:commons-codec") { selection ->
  68. ModuleComponentIdentifier candidate = selection.getCandidate();
  69. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  70. selection.reject("commons-codec updates break saml tests");
  71. }
  72. }
  73. components.withModule("org.python:jython") { selection ->
  74. ModuleComponentIdentifier candidate = selection.getCandidate();
  75. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  76. selection.reject("jython updates break integration tests");
  77. }
  78. }
  79. components.withModule("com.nimbusds:nimbus-jose-jwt") { selection ->
  80. ModuleComponentIdentifier candidate = selection.getCandidate();
  81. if (!candidate.getVersion().equals(selection.getCurrentVersion())) {
  82. selection.reject("nimbus-jose-jwt gets updated when oauth2-oidc-sdk is updated to ensure consistency");
  83. }
  84. }
  85. components.all { selection ->
  86. ModuleComponentIdentifier candidate = selection.getCandidate();
  87. // Do not compare version due to multiple versions existing
  88. // will cause opensaml 3.x to be updated to 4.x
  89. if (candidate.getGroup().equals("org.opensaml")) {
  90. selection.reject("org.opensaml maintains two different versions, so it must be updated manually");
  91. }
  92. }
  93. }
  94. }
  95. }
  96. subprojects {
  97. plugins.withType(JavaPlugin) {
  98. project.sourceCompatibility='1.8'
  99. }
  100. tasks.withType(JavaCompile) {
  101. options.encoding = "UTF-8"
  102. options.compilerArgs.add("-parameters")
  103. options.release = 8
  104. }
  105. }
  106. allprojects {
  107. if (!['spring-security-bom', 'spring-security-docs'].contains(project.name)) {
  108. apply plugin: 'io.spring.javaformat'
  109. apply plugin: 'checkstyle'
  110. pluginManager.withPlugin("io.spring.convention.checkstyle", { plugin ->
  111. configure(plugin) {
  112. dependencies {
  113. checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:$springJavaformatVersion"
  114. }
  115. checkstyle {
  116. toolVersion = '8.34'
  117. }
  118. }
  119. })
  120. if (project.name.contains('sample')) {
  121. tasks.whenTaskAdded { task ->
  122. if (task.name.contains('format') || task.name.contains('checkFormat') || task.name.contains("checkstyle")) {
  123. task.enabled = false
  124. }
  125. }
  126. }
  127. }
  128. }
  129. if (hasProperty('buildScan')) {
  130. buildScan {
  131. termsOfServiceUrl = 'https://gradle.com/terms-of-service'
  132. termsOfServiceAgree = 'yes'
  133. }
  134. }
  135. nohttp {
  136. allowlistFile = project.file("etc/nohttp/allowlist.lines")
  137. source.exclude "buildSrc/build/**"
  138. }
  139. tasks.register('checkSamples') {
  140. includeCheckRemote {
  141. repository = 'spring-projects/spring-security-samples'
  142. ref = samplesBranch
  143. if (project.hasProperty("samplesInitScript")) {
  144. initScripts = [samplesInitScript]
  145. projectProperties = ["localRepositoryPath": localRepositoryPath, "springSecurityVersion": project.version]
  146. }
  147. }
  148. dependsOn checkRemote
  149. }
  150. s101 {
  151. configurationDirectory = project.file("etc/s101")
  152. }