Migrate servlet smoke build to kotlin
DELETE
smoke-tests/images/servlet/build.gradle
-import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
-import com.bmuschko.gradle.docker.tasks.image.DockerPushImage
-
-plugins {
- id "com.bmuschko.docker-remote-api" version "6.7.0"
-}
-
-def buildLinuxTestImagesTask = tasks.create("buildLinuxTestImages") {
- group = "build"
- description = "Builds all Linux Docker images for the test matrix"
-
-}
-
-def buildWindowsTestImagesTask = tasks.create("buildWindowsTestImages") {
- group = "build"
- description = "Builds all Windows Docker images for the test matrix"
-}
-
-ext {
- matrix = []
-}
-
-tasks.create("pushMatrix", DockerPushImage) {
- group = "publishing"
- description = "Push all Docker images for the test matrix"
- images.set(project.ext.matrix)
-}
-
-// Each line under appserver describes one matrix of (version x vm x jdk), dockerfile key overrides
-// Dockerfile name, args key passes raw arguments to docker build
-def targets = [
- "jetty" : [
- [version: ["9.4.39"], vm: ["hotspot"], jdk: ["8", "11", "17", "18"], args: [sourceVersion: "9.4.39.v20210325"]],
- [version: ["9.4.39"], vm: ["openj9"], jdk: ["8", "11", "16"], args: [sourceVersion: "9.4.39.v20210325"]],
- [version: ["10.0.7"], vm: ["hotspot"], jdk: ["11", "17", "18"], args: [sourceVersion: "10.0.7"]],
- [version: ["10.0.7"], vm: ["openj9"], jdk: ["11", "16"], args: [sourceVersion: "10.0.7"]],
- [version: ["11.0.7"], vm: ["hotspot"], jdk: ["11", "17", "18"], args: [sourceVersion: "11.0.7"], war: "servlet-5.0"],
- [version: ["11.0.7"], vm: ["openj9"], jdk: ["11", "16"], args: [sourceVersion: "11.0.7"], war: "servlet-5.0"]
- ],
- "liberty" : [
- // running configure.sh is failing while building the image with Java 17
- [version: ["20.0.0.12"], vm: ["hotspot", "openj9"], jdk: ["8", "11", "16"], args: [release: "2020-11-11_0736"]],
- // running configure.sh is failing while building the image with Java 18
- [version: ["21.0.0.10"], vm: ["hotspot"], jdk: ["8", "11", "17"], args: [release: "2021-09-20_1900"]],
- [version: ["21.0.0.10"], vm: ["openj9"], jdk: ["8", "11", "16"], args: [release: "2021-09-20_1900"]]
- ],
- "payara" : [
- [version: ["5.2020.6"], vm: ["hotspot", "openj9"], jdk: ["8", "11"]],
- [version: ["5.2021.8"], vm: ["hotspot", "openj9"], jdk: ["8", "11"]]
- ],
- "tomcat" : [
- [version: ["7.0.109"], vm: ["hotspot", "openj9"], jdk: ["8"], args: [majorVersion: "7"]],
- [version: ["8.5.72"], vm: ["hotspot"], jdk: ["8", "11", "17", "18"], args: [majorVersion: "8"]],
- [version: ["8.5.72"], vm: ["openj9"], jdk: ["8", "11"], args: [majorVersion: "8"]],
- [version: ["9.0.54"], vm: ["hotspot"], jdk: ["8", "11", "17", "18"], args: [majorVersion: "9"]],
- [version: ["9.0.54"], vm: ["openj9"], jdk: ["8", "11"], args: [majorVersion: "9"]],
- [version: ["10.0.12"], vm: ["hotspot"], jdk: ["8", "11", "17", "18"], args: [majorVersion: "10"], war: "servlet-5.0"],
- [version: ["10.0.12"], vm: ["openj9"], jdk: ["8", "11"], args: [majorVersion: "10"], war: "servlet-5.0"]
- ],
- "tomee" : [
- [version: ["7.0.9"], vm: ["hotspot", "openj9"], jdk: ["8"]],
- [version: ["7.1.4"], vm: ["hotspot", "openj9"], jdk: ["8"]],
- [version: ["8.0.8"], vm: ["hotspot"], jdk: ["8", "11", "17", "18"]],
- [version: ["8.0.8"], vm: ["openj9"], jdk: ["8", "11", "16"]],
- [version: ["9.0.0-M7"], vm: ["hotspot"], jdk: ["8", "11", "17", "18"], war: "servlet-5.0"],
- [version: ["9.0.0-M7"], vm: ["openj9"], jdk: ["8", "11", "16"], war: "servlet-5.0"]
- ],
- "websphere": [
- // TODO (trask) this is a recent change, check back in a while and see if it's been fixed
- // 8.5.5.20 only has linux/ppc64le image
- [version: ["8.5.5.19", "9.0.5.9"], vm: ["openj9"], jdk: ["8"], windows: false]
- ],
- "wildfly" : [
- [version: ["13.0.0.Final"], vm: ["hotspot", "openj9"], jdk: ["8"]],
- [version: ["17.0.1.Final", "21.0.0.Final", "25.0.1.Final"], vm: ["hotspot"], jdk: ["8", "11", "17", "18"]],
- [version: ["17.0.1.Final", "21.0.0.Final", "25.0.1.Final"], vm: ["openj9"], jdk: ["8", "11", "16"]]
- ]
-]
-
-tasks.register("printSmokeTestsConfigurations") {
- targets.each { server, matrices ->
- def smokeTestServer = findProperty('smokeTestServer')
- if (smokeTestServer != null && server != smokeTestServer) {
- return
- }
- println server
- def serverName = String.valueOf(Character.toUpperCase(server.charAt(0))) + server.substring(1)
- matrices.forEach { entry ->
- entry.version.forEach { version ->
- def dotIndex = version.indexOf('.')
- def majorVersion = dotIndex != -1 ? version.substring(0, dotIndex) : version
- entry.jdk.forEach { jdk ->
- entry.vm.forEach { vm ->
- println "@AppServer(version = \"$version\", jdk = \"$jdk${vm == 'hotspot' ? '' : '-openj9'}\")"
- println "class ${serverName}${majorVersion}Jdk${jdk}${vm == 'hotspot' ? '' : 'Openj9'} extends ${serverName}SmokeTest {"
- println "}"
- }
- }
- }
- }
- }
-}
-
-createDockerTasks(buildLinuxTestImagesTask, targets, false)
-createDockerTasks(buildWindowsTestImagesTask, targets, true)
-
-def configureImage(Task parentTask, server, dockerfile, version, vm, jdk, warProject, Map<String, String> extraArgs, boolean isWindows, String extraTag) {
- // Using separate build directory for different images
- def dockerWorkingDir = new File(project.buildDir, "docker-$server-$version-jdk$jdk-$vm-$warProject")
- def dockerFileName = isWindows ? "${dockerfile}.windows.dockerfile" : "${dockerfile}.dockerfile"
- def platformSuffix = isWindows ? "-windows" : ""
-
- def prepareTask = tasks.register("${server}ImagePrepare-$version-jdk$jdk-$vm$platformSuffix", Copy) {
- def warTask = warProject != null ? project(":$warProject").tasks["war"] : project.tasks.war
- it.dependsOn(warTask)
- it.into(dockerWorkingDir)
- it.from("src/$dockerFileName")
- it.from("src/main/docker/$server")
- it.from(warTask.archiveFile) {
- rename { _ -> "app.war" }
- }
- }
-
- def vmSuffix = vm == "hotspot" ? "" : "-$vm"
- def image = "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-servlet-$server:$version-jdk$jdk$vmSuffix$platformSuffix-$extraTag"
-
- def jdkImage
- if (vm == "hotspot") {
- if (jdk == "18") {
- jdkImage = "openjdk:${jdk}"
- } else {
- jdkImage = "eclipse-temurin:${jdk}"
- }
- } else if (vm == "openj9") {
- jdkImage = "adoptopenjdk:${jdk}-openj9"
- } else {
- throw new GradleException("Unexpected vm: $vm")
- }
-
- if (server == "wildfly") {
- // wildfly url without .zip or .tar.gz suffix
- def serverBaseUrl
- int majorVersion = version.substring(0, version.indexOf(".")) as int
- if (majorVersion >= 25) {
- serverBaseUrl = "https://github.com/wildfly/wildfly/releases/download/${version}/wildfly-${version}"
- } else {
- serverBaseUrl = "https://download.jboss.org/wildfly/${version}/wildfly-${version}"
- }
- extraArgs = extraArgs + [baseDownloadUrl: serverBaseUrl]
- } else if (server == "payara") {
- if (version == "5.2020.6") {
- extraArgs = extraArgs + [domainName: "production"]
- } else {
- extraArgs = extraArgs + [domainName: "domain1"]
- }
- }
-
- def buildTask = tasks.register("${server}Image-$version-jdk$jdk$vmSuffix$platformSuffix", DockerBuildImage) {
- it.dependsOn(prepareTask)
- group = "build"
- description = "Builds Docker image with $server $version on JDK $jdk-$vm${isWindows ? ' on Windows' : ''}"
-
- it.inputDir.set(dockerWorkingDir)
- it.images.add(image)
- it.dockerFile.set(new File(dockerWorkingDir, dockerFileName))
- it.buildArgs.set(extraArgs + [jdk: jdk, vm: vm, version: version, jdkImage: jdkImage])
- it.doLast {
- project.ext.matrix.add(image)
- }
- }
-
- parentTask.dependsOn(buildTask)
- return image
-}
-
-def createDockerTasks(Task parentTask, targets, isWindows) {
- String extraTag = findProperty("extraTag") ?: new Date().format("yyyyMMdd.HHmmSS")
- Set<String> resultImages = []
- targets.each { server, matrices ->
- def smokeTestServer = findProperty('smokeTestServer')
- if (smokeTestServer != null && server != smokeTestServer) {
- return
- }
- matrices.forEach { entry ->
- def dockerfile = entry["dockerfile"]?.toString() ?: server
- def extraArgs = (entry["args"] ?: [:]) as Map<String, String>
- def warProject = entry["war"] ?: "servlet-3.0"
- def supportsWindows = entry["windows"] != null ? entry["windows"] : true
-
- entry.version.forEach { version ->
- entry.vm.forEach { vm ->
- entry.jdk.forEach { jdk ->
- if (supportsWindows || !isWindows) {
- resultImages.add(configureImage(parentTask, server, dockerfile, version, vm, jdk, warProject, extraArgs, isWindows, extraTag))
- }
- }
- }
- }
- }
- }
- return resultImages
-}
\ No newline at end of file

ADD
smoke-tests/images/servlet/build.gradle.kts
+import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
+import com.bmuschko.gradle.docker.tasks.image.DockerPushImage
+import org.gradle.configurationcache.extensions.capitalized
+
+plugins {
+ id("com.bmuschko.docker-remote-api")
+ id("com.diffplug.spotless")
+}
+
+data class ImageTarget(val version: List<String>, val vm: List<String>, val jdk: List<String>, val args: Map<String, String> = emptyMap(), val war: String = "servlet-3.0", val windows: Boolean = true)
+
+val extraTag = findProperty("extraTag") ?: java.time.format.DateTimeFormatter.ofPattern("yyyyMMdd.HHmmSS").format(java.time.LocalDateTime.now())
+
+// Each line under appserver describes one matrix of (version x vm x jdk), dockerfile key overrides
+// Dockerfile name, args key passes raw arguments to docker build
+val targets = mapOf(
+ "jetty" to listOf(
+ ImageTarget(listOf("9.4.39"), listOf("hotspot"), listOf("8", "11", "17", "18"), mapOf("sourceVersion" to "9.4.39.v20210325")),
+ ImageTarget(listOf("9.4.39"), listOf("openj9"), listOf("8", "11", "16"), mapOf("sourceVersion" to "9.4.39.v20210325")),
+ ImageTarget(listOf("10.0.7"), listOf("hotspot"), listOf("11", "17", "18"), mapOf("sourceVersion" to "10.0.7")),
+ ImageTarget(listOf("10.0.7"), listOf("openj9"), listOf("11", "16"), mapOf("sourceVersion" to "10.0.7")),
+ ImageTarget(listOf("11.0.7"), listOf("hotspot"), listOf("11", "17", "18"), mapOf("sourceVersion" to "11.0.7"), "servlet-5.0"),
+ ImageTarget(listOf("11.0.7"), listOf("openj9"), listOf("11", "16"), mapOf("sourceVersion" to "11.0.7"), "servlet-5.0"),
+ ),
+ "liberty" to listOf(
+ // running configure.sh is failing while building the image with Java 17
+ ImageTarget(listOf("20.0.0.12"), listOf("hotspot", "openj9"), listOf("8", "11", "16"), mapOf("release" to "2020-11-11_0736")),
+ // running configure.sh is failing while building the image with Java 18
+ ImageTarget(listOf("21.0.0.10"), listOf("hotspot"), listOf("8", "11", "17"), mapOf("release" to "2021-09-20_1900")),
+ ImageTarget(listOf("21.0.0.10"), listOf("openj9"), listOf("8", "11", "16"), mapOf("release" to "2021-09-20_1900")),
+ ),
+ "payara" to listOf(
+ ImageTarget(listOf("5.2020.6"), listOf("hotspot", "openj9"), listOf("8", "11")),
+ ImageTarget(listOf("5.2021.8"), listOf("hotspot", "openj9"), listOf("8", "11")),
+ ),
+ "tomcat" to listOf(
+ ImageTarget(listOf("7.0.109"), listOf("hotspot", "openj9"), listOf("8"), mapOf("majorVersion" to "7")),
+ ImageTarget(listOf("8.5.72"), listOf("hotspot"), listOf("8", "11", "17", "18"), mapOf("majorVersion" to "8")),
+ ImageTarget(listOf("8.5.72"), listOf("openj9"), listOf("8", "11"), mapOf("majorVersion" to "8")),
+ ImageTarget(listOf("9.0.54"), listOf("hotspot"), listOf("8", "11", "17", "18"), mapOf("majorVersion" to "9")),
+ ImageTarget(listOf("9.0.54"), listOf("openj9"), listOf("8", "11"), mapOf("majorVersion" to "9")),
+ ImageTarget(listOf("10.0.12"), listOf("hotspot"), listOf("8", "11", "17", "18"), mapOf("majorVersion" to "10"), "servlet-5.0"),
+ ImageTarget(listOf("10.0.12"), listOf("openj9"), listOf("8", "11"), mapOf("majorVersion" to "10"), "servlet-5.0"),
+ ),
+ "tomee" to listOf(
+ ImageTarget(listOf("7.0.9"), listOf("hotspot", "openj9"), listOf("8")),
+ ImageTarget(listOf("7.1.4"), listOf("hotspot", "openj9"), listOf("8")),
+ ImageTarget(listOf("8.0.8"), listOf("hotspot"), listOf("8", "11", "17", "18")),
+ ImageTarget(listOf("8.0.8"), listOf("openj9"), listOf("8", "11", "16")),
+ ImageTarget(listOf("9.0.0-M7"), listOf("hotspot"), listOf("8", "11", "17", "18"), war = "servlet-5.0"),
+ ImageTarget(listOf("9.0.0-M7"), listOf("openj9"), listOf("8", "11", "16"), war = "servlet-5.0"),
+ ),
+ "websphere" to listOf(
+ // TODO (trask) this is a recent change, check back in a while and see if it's been fixed
+ // 8.5.5.20 only has linux/ppc64le image
+ ImageTarget(listOf("8.5.5.19", "9.0.5.9"), listOf("openj9"), listOf("8"), windows = false),
+ ),
+ "wildfly" to listOf(
+ ImageTarget(listOf("13.0.0.Final"), listOf("hotspot", "openj9"), listOf("8")),
+ ImageTarget(listOf("17.0.1.Final", "21.0.0.Final", "25.0.1.Final"), listOf("hotspot"), listOf("8", "11", "17", "18")),
+ ImageTarget(listOf("17.0.1.Final", "21.0.0.Final", "25.0.1.Final"), listOf("openj9"), listOf("8", "11", "16")),
+ ),
+)
+
+val matrix = mutableListOf<String>()
+
+tasks {
+ val buildLinuxTestImages by registering {
+ group = "build"
+ description = "Builds all Linux Docker images for the test matrix"
+ }
+
+ val buildWindowsTestImages by registering {
+ group = "build"
+ description = "Builds all Windows Docker images for the test matrix"
+ }
+
+ val pushMatrix by registering(DockerPushImage::class) {
+ group = "publishing"
+ description = "Push all Docker images for the test matrix"
+ images.set(matrix)
+ }
+
+ createDockerTasks(buildLinuxTestImages, false)
+ createDockerTasks(buildWindowsTestImages, true)
+
+ val printSmokeTestsConfigurations by registering {
+ for ((server, matrices) in targets) {
+ val smokeTestServer = findProperty("smokeTestServer")
+ if (smokeTestServer != null && server != smokeTestServer) {
+ continue
+ }
+ println(server)
+ val serverName = server.capitalized()
+ for (entry in matrices) {
+ for (version in entry.version) {
+ val dotIndex = version.indexOf('.')
+ val majorVersion = if (dotIndex != -1) version.substring(0, dotIndex) else version
+ for (jdk in entry.jdk) {
+ for (vm in entry.vm) {
+ println("@AppServer(version = \"$version\", jdk = \"$jdk${if (vm == "hotspot") "" else "-openj9"}\")")
+ println("class ${serverName}${majorVersion}Jdk${jdk}${if (vm == "hotspot") "" else "Openj9"} extends ${serverName}SmokeTest {")
+ println("}")
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+fun configureImage(parentTask: TaskProvider<out Task>, server: String, dockerfile: String, version: String, vm: String, jdk: String, warProject: String, args: Map<String, String>, isWindows: Boolean): String {
+ // Using separate build directory for different image
+ val dockerWorkingDir = file("$buildDir/docker-$server-$version-jdk$jdk-$vm-$warProject")
+ val dockerFileName = "$dockerfile.${if (isWindows) "windows." else ""}dockerfile"
+ val platformSuffix = if (isWindows) "-windows" else ""
+
+ val prepareTask = tasks.register<Copy>("${server}ImagePrepare-$version-jdk$jdk-$vm$platformSuffix") {
+ val warTask = project(":$warProject").tasks.named<War>("war")
+ dependsOn(warTask)
+ into(dockerWorkingDir)
+ from("src/$dockerFileName")
+ from("src/main/docker/$server")
+ from(warTask.get().archiveFile) {
+ rename { "app.war" }
+ }
+ }
+
+ val vmSuffix = if (vm == "hotspot") "" else "-$vm"
+ val image = "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-servlet-$server:$version-jdk$jdk$vmSuffix$platformSuffix-$extraTag"
+
+ val jdkImage = if (vm == "hotspot") {
+ if (jdk == "18") {
+ "openjdk:$jdk"
+ } else {
+ "eclipse-temurin:$jdk"
+ }
+ } else if (vm == "openj9") {
+ "adoptopenjdk:$jdk-openj9"
+ } else {
+ throw GradleException("Unexpected vm: $vm")
+ }
+
+ val extraArgs = args.toMutableMap()
+ if (server == "wildfly") {
+ // wildfly url without .zip or .tar.gz suffix
+ val majorVersion = version.substring(0, version.indexOf(".")).toInt()
+ val serverBaseUrl = if (majorVersion >= 25) {
+ "https://github.com/wildfly/wildfly/releases/download/$version/wildfly-$version"
+ } else {
+ "https://download.jboss.org/wildfly/$version/wildfly-$version"
+ }
+ extraArgs["baseDownloadUrl"] = serverBaseUrl
+ } else if (server == "payara") {
+ if (version == "5.2020.6") {
+ extraArgs["domainName"] = "production"
+ } else {
+ extraArgs["domainName"] = "domain1"
+ }
+ }
+
+ val buildTask = tasks.register<DockerBuildImage>("${server}Image-$version-jdk$jdk$vmSuffix$platformSuffix") {
+ dependsOn(prepareTask)
+ group = "build"
+ description = "Builds Docker image with $server $version on JDK $jdk-$vm${if (isWindows) " on Windows" else ""}"
+
+ inputDir.set(dockerWorkingDir)
+ images.add(image)
+ dockerFile.set(File(dockerWorkingDir, dockerFileName))
+ buildArgs.set(extraArgs + mapOf("jdk" to jdk, "vm" to vm, "version" to version, "jdkImage" to jdkImage))
+ doLast {
+ matrix.add(image)
+ }
+ }
+
+ parentTask.configure {
+ dependsOn(buildTask)
+ }
+ return image
+}
+
+fun createDockerTasks(parentTask: TaskProvider<out Task>, isWindows: Boolean) {
+ val resultImages = mutableSetOf<String>()
+ for ((server, matrices) in targets) {
+ val smokeTestServer = findProperty("smokeTestServer")
+ if (smokeTestServer != null && server != smokeTestServer) {
+ continue
+ }
+
+ for (entry in matrices) {
+ val dockerfile = server
+ val extraArgs = entry.args
+ val warProject = entry.war
+ val supportsWindows = entry.windows
+
+ for (version in entry.version) {
+ for (vm in entry.vm) {
+ for (jdk in entry.jdk) {
+ if (supportsWindows || !isWindows) {
+ resultImages.add(configureImage(parentTask, server, dockerfile, version, vm, jdk, warProject, extraArgs, isWindows))
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+spotless {
+ kotlinGradle {
+ ktlint().userData(mapOf("indent_size" to "2", "continuation_indent_size" to "2", "disabled_rules" to "no-wildcard-imports"))
+ target("**/*.gradle.kts")
+ }
+}

ADD
smoke-tests/images/servlet/gradle.properties
+org.gradle.parallel=true
+org.gradle.caching=true
+
+org.gradle.priority=low
+
+# Gradle default is 256m which causes issues with our build - https://docs.gradle.org/current/userguide/build_environment.html#sec:configuring_jvm_memory
+# Also workaround https://github.com/diffplug/spotless/issues/834
+org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m \
+ --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
+ --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
+ --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED \
+ --add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED \
+ --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
+ --add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED \
+ --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
+ --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
+ --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
+ --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
+
+# Currently causes failure when importing project in IntelliJ
+# org.gradle.warning.mode=fail
+
+# To allow caching more tasks in buildSrc project
+# This property is not mentioned in Gradle documentation
+# See https://github.com/gradle/gradle/issues/15214 for background info
+systemProp.org.gradle.kotlin.dsl.precompiled.accessors.strict=true
+
+# Workaround https://youtrack.jetbrains.com/issue/KT-34862
+kotlin.incremental=false

DELETE
smoke-tests/images/servlet/servlet-3.0/build.gradle
-plugins {
- id "war"
- id "com.diffplug.spotless" version "6.1.2"
-}
-
-compileJava {
- options.release.set(8)
-}
-
-repositories {
- mavenCentral()
-}
-
-spotless {
- java {
- googleJavaFormat()
- licenseHeaderFile(rootProject.file("../../../buildscripts/spotless.license.java"), "(package|import|public)")
- target("src/**/*.java")
- }
-}
-
-dependencies {
- implementation("javax.servlet:javax.servlet-api:3.0.1")
-}

ADD
smoke-tests/images/servlet/servlet-3.0/build.gradle.kts
+plugins {
+ war
+
+ id("com.diffplug.spotless")
+}
+
+spotless {
+ java {
+ googleJavaFormat()
+ licenseHeaderFile(rootProject.file("../../../buildscripts/spotless.license.java"), "(package|import|public)")
+ }
+ kotlinGradle {
+ ktlint().userData(mapOf("indent_size" to "2", "continuation_indent_size" to "2", "disabled_rules" to "no-wildcard-imports"))
+ target("**/*.gradle.kts")
+ }
+}
+
+dependencies {
+ implementation("javax.servlet:javax.servlet-api:3.0.1")
+}
+
+tasks {
+ withType<JavaCompile>().configureEach {
+ with(options) {
+ release.set(8)
+ }
+ }
+}

DELETE
smoke-tests/images/servlet/servlet-5.0/build.gradle
-plugins {
- id "war"
- id "com.diffplug.spotless" version "6.1.2"
-}
-
-compileJava {
- options.release.set(8)
-}
-
-repositories {
- mavenCentral()
-}
-
-spotless {
- java {
- googleJavaFormat()
- licenseHeaderFile(rootProject.file("../../../buildscripts/spotless.license.java"), "(package|import|public)")
- target("src/**/*.java")
- }
-}
-
-dependencies {
- compileOnly("jakarta.servlet:jakarta.servlet-api:5.0.0")
-}

ADD
smoke-tests/images/servlet/servlet-5.0/build.gradle.kts
+plugins {
+ war
+
+ id("com.diffplug.spotless")
+}
+
+spotless {
+ java {
+ googleJavaFormat()
+ licenseHeaderFile(rootProject.file("../../../buildscripts/spotless.license.java"), "(package|import|public)")
+ }
+ kotlinGradle {
+ ktlint().userData(mapOf("indent_size" to "2", "continuation_indent_size" to "2", "disabled_rules" to "no-wildcard-imports"))
+ target("**/*.gradle.kts")
+ }
+}
+
+dependencies {
+ compileOnly("jakarta.servlet:jakarta.servlet-api:5.0.0")
+}
+
+tasks {
+ withType<JavaCompile>().configureEach {
+ with(options) {
+ release.set(8)
+ }
+ }
+}

DELETE
smoke-tests/images/servlet/settings.gradle
-rootProject.name = 'matrix'
-
-include ':servlet-3.0'
-include ':servlet-5.0'

ADD
smoke-tests/images/servlet/settings.gradle.kts
+pluginManagement {
+ plugins {
+ id("com.bmuschko.docker-remote-api") version "7.3.0"
+ id("com.diffplug.spotless") version "6.4.2"
+ }
+}
+
+dependencyResolutionManagement {
+ repositories {
+ mavenCentral()
+ mavenLocal()
+ }
+}
+
+rootProject.name = "matrix"
+
+include(":servlet-3.0")
+include(":servlet-5.0")

Migrate servlet smoke build to kotlin (#5816)