Migrate spring-boot smoke build to kotlin
DELETE
smoke-tests/images/spring-boot/build.gradle
-plugins {
- id "org.springframework.boot" version "2.3.2.RELEASE"
- id "io.spring.dependency-management" version "1.0.9.RELEASE"
- id "java"
- id "com.google.cloud.tools.jib" version "3.1.4"
- id "com.diffplug.spotless" version "6.1.2"
-}
-
-group = "io.opentelemetry"
-version = "0.0.1-SNAPSHOT"
-
-repositories {
- mavenCentral()
- // this is only needed for the working against unreleased otel-java snapshots
- maven {
- url "https://oss.sonatype.org/content/repositories/snapshots"
- content {
- includeGroup "io.opentelemetry"
- }
- }
-}
-
-spotless {
- java {
- googleJavaFormat()
- licenseHeaderFile(rootProject.file("../../../buildscripts/spotless.license.java"), "(package|import|public)")
- target("src/**/*.java")
- }
-}
-
-dependencies {
- implementation platform("io.opentelemetry:opentelemetry-bom:1.0.0")
-
- implementation "org.springframework.boot:spring-boot-starter-web"
- implementation "io.opentelemetry:opentelemetry-extension-annotations"
- implementation "io.opentelemetry:opentelemetry-api"
-}
-
-compileJava {
- options.release.set(8)
-}
-
-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-spring-boot:jdk$targetJDK-$tag"
- container.ports = ["8080"]
-}
\ No newline at end of file

ADD
smoke-tests/images/spring-boot/build.gradle.kts
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+plugins {
+ java
+
+ id("com.diffplug.spotless") version "6.4.2"
+ id("com.google.cloud.tools.jib") version "3.2.1"
+}
+
+group = "io.opentelemetry"
+version = "0.0.1-SNAPSHOT"
+
+repositories {
+ mavenCentral()
+}
+
+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(platform("io.opentelemetry:opentelemetry-bom:1.0.0"))
+ implementation(platform("org.springframework.boot:spring-boot-dependencies:2.6.6"))
+
+ implementation("io.opentelemetry:opentelemetry-api")
+ implementation("io.opentelemetry:opentelemetry-extension-annotations")
+ implementation("org.springframework.boot:spring-boot-starter-web")
+}
+
+tasks {
+ withType<JavaCompile>().configureEach {
+ with(options) {
+ release.set(8)
+ }
+ }
+}
+
+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-spring-boot:jdk$targetJDK-$tag"
+ container.ports = listOf("8080")
+}

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

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

Migrate spring-boot smoke build to kotlin (#5824)