Migrate play smoke test to kotlin build
DELETE
smoke-tests/images/play/build.gradle
-plugins {
- id "org.gradle.playframework" version "0.12"
- id "com.google.cloud.tools.jib" version "3.1.4"
- id "com.diffplug.spotless" version "6.1.2"
-}
-
-ext {
- playVersion = "2.6.20"
- scalaVersion = System.getProperty("scala.binary.version", /* default = */ "2.12")
-}
-
-play {
- platform {
- playVersion = project.ext.playVersion
- scalaVersion = project.ext.scalaVersion
- javaVersion = JavaVersion.VERSION_1_8
- }
- injectedRoutesGenerator = true
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- maven {
- name "lightbend-maven-releases"
- url "https://repo.lightbend.com/lightbend/maven-release"
- }
-}
-
-description = "Play Integration Tests."
-
-spotless {
- scala {
- scalafmt()
- licenseHeaderFile(rootProject.file("../../../buildscripts/spotless.license.java"), "(package|import|public)")
- target("src/**/*.scala")
- }
-}
-
-dependencies {
- implementation "com.typesafe.play:play-guice_$scalaVersion:$playVersion"
- implementation "com.typesafe.play:play-logback_$scalaVersion:$playVersion"
- implementation "com.typesafe.play:filters-helpers_$scalaVersion:$playVersion"
-}
-
-def targetJDK = project.hasProperty("targetJDK") ? project.targetJDK : 11
-
-def tag = findProperty("tag") ?: new Date().format("yyyyMMdd.HHmmSS")
-
-jib {
- from.image = "openjdk:$targetJDK"
- to.image = "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-play:jdk$targetJDK-$tag"
- container.mainClass = "play.core.server.ProdServerStart"
-}
\ No newline at end of file

ADD
smoke-tests/images/play/build.gradle.kts
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+plugins {
+ id("org.gradle.playframework") version "0.12"
+ id("com.google.cloud.tools.jib") version "3.2.1"
+ id("com.diffplug.spotless") version "6.4.2"
+}
+
+val playVer = "2.6.20"
+val scalaVer = "2.12"
+
+play {
+ platform {
+ playVersion.set(playVer)
+ scalaVersion.set(scalaVer)
+ javaVersion.set(JavaVersion.VERSION_1_8)
+ }
+ injectedRoutesGenerator.set(true)
+}
+
+repositories {
+ mavenCentral()
+ maven {
+ setName("lightbend-maven-releases")
+ setUrl("https://repo.lightbend.com/lightbend/maven-release")
+ }
+}
+
+description = "Play Integration Tests."
+
+spotless {
+ scala {
+ scalafmt()
+ licenseHeaderFile(rootProject.file("../../../buildscripts/spotless.license.java"), "(package|import|public)")
+ target("src/**/*.scala")
+ }
+ kotlinGradle {
+ ktlint().userData(mapOf("indent_size" to "2", "continuation_indent_size" to "2", "disabled_rules" to "no-wildcard-imports"))
+ target("**/*.gradle.kts")
+ }
+}
+
+dependencies {
+ implementation("com.typesafe.play:play-guice_$scalaVer:$playVer")
+ implementation("com.typesafe.play:play-logback_$scalaVer:$playVer")
+ implementation("com.typesafe.play:filters-helpers_$scalaVer:$playVer")
+}
+
+val targetJDK = project.findProperty("targetJDK") ?: "11"
+
+val tag = findProperty("tag") ?: DateTimeFormatter.ofPattern("yyyyMMdd.HHmmSS").format(LocalDateTime.now())
+
+jib {
+ from.image = "openjdk:$targetJDK"
+ to.image = "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-play:jdk$targetJDK-$tag"
+ container.mainClass = "play.core.server.ProdServerStart"
+}

ADD
smoke-tests/images/play/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/play/settings.gradle
-rootProject.name = 'smoke-test-play-images'

ADD
smoke-tests/images/play/settings.gradle.kts
+rootProject.name = "smoke-test-play-images"

Migrate play smoke test to kotlin build (#5813)