Migrate quarkus smoke build to kotlin
DELETE
smoke-tests/images/quarkus/build.gradle
-buildscript {
- dependencies {
- classpath("com.google.cloud.tools:jib-quarkus-extension-gradle:0.1.1")
- }
-}
-
-plugins {
- id "java"
- id "io.quarkus"
- 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()
- mavenLocal()
-}
-
-spotless {
- java {
- googleJavaFormat()
- licenseHeaderFile(rootProject.file("../../../buildscripts/spotless.license.java"), "(package|import|public)")
- target("src/**/*.java")
- }
-}
-
-dependencies {
- implementation enforcedPlatform("io.quarkus.platform:quarkus-bom:2.5.0.Final")
- implementation "io.quarkus:quarkus-resteasy"
-}
-
-compileJava {
- // Quarkus 2.0+ does not support Java 8
- options.release = 11
-}
-
-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-quarkus:jdk$targetJDK-$tag"
- container {
- mainClass = 'bogus' // to suppress Jib warning about missing main class
- }
- pluginExtensions {
- pluginExtension {
- implementation = 'com.google.cloud.tools.jib.gradle.extension.quarkus.JibQuarkusExtension'
- }
- }
-}
-
-tasks.jib.dependsOn quarkusBuild
-tasks.jibDockerBuild.dependsOn quarkusBuild

ADD
smoke-tests/images/quarkus/build.gradle.kts
+import com.google.cloud.tools.jib.gradle.JibTask
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+buildscript {
+ dependencies {
+ classpath("com.google.cloud.tools:jib-quarkus-extension-gradle:0.1.1")
+ }
+}
+
+plugins {
+ java
+
+ id("io.quarkus") version "2.8.0.Final"
+ id("com.google.cloud.tools.jib") version "3.2.1"
+ id("com.diffplug.spotless") version "6.4.2"
+}
+
+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(enforcedPlatform("io.quarkus.platform:quarkus-bom:2.8.0.Final"))
+ implementation("io.quarkus:quarkus-resteasy")
+}
+
+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-quarkus:jdk$targetJDK-$tag"
+ container {
+ mainClass = "bogus" // to suppress Jib warning about missing main class
+ }
+ pluginExtensions {
+ pluginExtension {
+ implementation = "com.google.cloud.tools.jib.gradle.extension.quarkus.JibQuarkusExtension"
+ }
+ }
+}
+
+tasks {
+ withType<JavaCompile>().configureEach {
+ with(options) {
+ // Quarkus 2.0+ does not support Java 8
+ release.set(11)
+ }
+ }
+
+ withType<JibTask>().configureEach {
+ dependsOn(quarkusBuild)
+ }
+}

ADD
smoke-tests/images/quarkus/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/quarkus/settings.gradle
-pluginManagement {
- repositories {
- mavenLocal()
- mavenCentral()
- gradlePluginPortal()
- }
- plugins {
- id "io.quarkus" version "2.5.0.Final"
- }
-}
-
-rootProject.name = 'smoke-test-quarkus-images'

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

Migrate quarkus smoke build to kotlin (#5814)