-
Notifications
You must be signed in to change notification settings - Fork 925
/
Copy pathbuild.gradle.kts
70 lines (58 loc) · 1.75 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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.2")
}
}
plugins {
id("otel.java-conventions")
id("com.google.cloud.tools.jib")
id("io.quarkus") version "3.10.2"
}
dependencies {
implementation(enforcedPlatform("io.quarkus:quarkus-bom:3.10.2"))
implementation("io.quarkus:quarkus-resteasy")
}
quarkus {
// Expected by jib extension.
// TODO(anuraaga): Switch to quarkus plugin native jib support.
setFinalName("opentelemetry-quarkus-$version")
}
val targetJDK = project.findProperty("targetJDK") ?: "11"
val tag = findProperty("tag")
?: DateTimeFormatter.ofPattern("yyyyMMdd.HHmmSS").format(LocalDateTime.now())
java {
// this is needed to avoid jib failing with
// "Your project is using Java 17 but the base image is for Java 8"
// (it seems the jib plugins does not understand toolchains yet)
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
jib {
from.image = "eclipse-temurin:$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)
}
sourcesJar {
dependsOn(quarkusGenerateCode)
}
}