Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/gradle/gradle-6a8ccde0a1
Browse files Browse the repository at this point in the history
  • Loading branch information
rhernandez35 authored Feb 26, 2025
2 parents 90db86f + b072ed5 commit 9adc7e7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
21 changes: 17 additions & 4 deletions buildSrc/src/main/kotlin/smithy-java.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import com.diffplug.spotless.FormatterFunc
import com.github.spotbugs.snom.Effort
import java.util.regex.Pattern
import org.gradle.api.Project
import org.gradle.kotlin.dsl.the
import java.io.Serializable

plugins {
`java-library`
Expand Down Expand Up @@ -38,6 +40,7 @@ dependencies {
testImplementation(libs.junit.jupiter.api)
testRuntimeOnly(libs.junit.jupiter.engine)
testImplementation(libs.junit.jupiter.params)
testImplementation(libs.junit.platform.launcher)
testImplementation(libs.hamcrest)
testImplementation(libs.assertj.core)
compileOnly("com.github.spotbugs:spotbugs-annotations:${spotbugs.toolVersion.get()}")
Expand Down Expand Up @@ -75,15 +78,25 @@ spotless {
// Enforce a common license header on all files
licenseHeaderFile("${project.rootDir}/config/spotless/license-header.txt")
.onlyIfContentMatches("^((?!SKIPLICENSECHECK)[\\s\\S])*\$")
indentWithSpaces()
leadingTabsToSpaces()
endWithNewline()

eclipse().configFile("${project.rootDir}/config/spotless/formatting.xml")

// Fixes for some strange formatting applied by eclipse:
// see: https://github.com/kamkie/demo-spring-jsf/blob/bcacb9dc90273a5f8d2569470c5bf67b171c7d62/build.gradle.kts#L159
custom("Lambda fix") { it.replace("} )", "})").replace("} ,", "},") }
custom("Long literal fix") { Pattern.compile("([0-9_]+) [Ll]").matcher(it).replaceAll("\$1L") }
// These have to be implemented with anonymous classes this way instead of lambdas because of:
// https://github.com/diffplug/spotless/issues/2387
custom("Lambda fix", object : Serializable, FormatterFunc {
override fun apply(input: String) : String {
return input.replace("} )", "})").replace("} ,", "},")
}
})
custom("Long literal fix", object : Serializable, FormatterFunc {
override fun apply(input: String) : String {
return Pattern.compile("([0-9_]+) [Ll]").matcher(input).replaceAll("\$1L")
}
})

// Static first, then everything else alphabetically
removeUnusedImports()
Expand All @@ -96,7 +109,7 @@ spotless {
// Formatting for build.gradle.kts files
kotlinGradle {
ktlint()
indentWithSpaces()
leadingTabsToSpaces()
trimTrailingWhitespace()
endWithNewline()
}
Expand Down
9 changes: 5 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ smithy = "1.54.0"
jmh = "0.7.3"
test-logger-plugin = "4.0.0"
spotbugs = "6.0.22"
spotless = "6.25.0"
spotless = "7.0.2"
smithy-gradle-plugins = "1.2.0"
assertj = "3.27.3"
jackson = "2.18.2"
Expand Down Expand Up @@ -39,9 +39,10 @@ netty-all = {module = "io.netty:netty-all", version.ref = "netty"}

# Test dependencies
junit-bom = { module = "org.junit:junit-bom", version.ref = "junit5" }
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit5" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit5" }
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit5" }
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine" }
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params" }
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" }
hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" }
assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj"}

Expand Down
3 changes: 3 additions & 0 deletions protocol-test-harness/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


plugins {
id("smithy-java.module-conventions")
}
Expand All @@ -21,6 +23,7 @@ dependencies {
implementation(project(":codecs:json-codec"))
implementation(libs.assertj.core)

api(platform(libs.junit.bom))
api(libs.junit.jupiter.api)
api(libs.junit.jupiter.engine)
api(libs.junit.jupiter.params)
Expand Down

0 comments on commit 9adc7e7

Please sign in to comment.