|
| 1 | +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
| 2 | + |
1 | 3 | plugins { |
2 | 4 | java |
3 | 5 | application |
| 6 | + kotlin("jvm") |
4 | 7 | alias(libs.plugins.gradle.versions) |
| 8 | + id("com.github.johnrengelman.shadow") version "8.1.1" |
5 | 9 | } |
6 | 10 |
|
7 | 11 | application { mainClass.set("io.sentry.samples.jul.Main") } |
8 | 12 |
|
| 13 | +java.sourceCompatibility = JavaVersion.VERSION_17 |
| 14 | + |
| 15 | +java.targetCompatibility = JavaVersion.VERSION_17 |
| 16 | + |
| 17 | +repositories { mavenCentral() } |
| 18 | + |
9 | 19 | configure<JavaPluginExtension> { |
10 | | - sourceCompatibility = JavaVersion.VERSION_1_8 |
11 | | - targetCompatibility = JavaVersion.VERSION_1_8 |
| 20 | + sourceCompatibility = JavaVersion.VERSION_17 |
| 21 | + targetCompatibility = JavaVersion.VERSION_17 |
| 22 | +} |
| 23 | + |
| 24 | +tasks.withType<KotlinCompile>().configureEach { |
| 25 | + kotlinOptions { |
| 26 | + freeCompilerArgs = listOf("-Xjsr305=strict") |
| 27 | + jvmTarget = JavaVersion.VERSION_17.toString() |
| 28 | + } |
12 | 29 | } |
13 | 30 |
|
14 | 31 | dependencies { |
15 | 32 | implementation(projects.sentryJul) |
16 | 33 | implementation(libs.slf4j.jdk14) |
| 34 | + |
| 35 | + testImplementation(kotlin(Config.kotlinStdLib)) |
| 36 | + testImplementation(projects.sentry) |
| 37 | + testImplementation(projects.sentrySystemTestSupport) |
| 38 | + testImplementation(libs.kotlin.test.junit) |
| 39 | + testImplementation(libs.slf4j.api) |
| 40 | + testImplementation(libs.slf4j.jdk14) |
| 41 | +} |
| 42 | + |
| 43 | +// Configure the Shadow JAR (executable JAR with all dependencies) |
| 44 | +tasks.shadowJar { |
| 45 | + manifest { attributes["Main-Class"] = "io.sentry.samples.jul.Main" } |
| 46 | + archiveClassifier.set("") // Remove the classifier so it replaces the regular JAR |
| 47 | + mergeServiceFiles() |
| 48 | +} |
| 49 | + |
| 50 | +// Make the regular jar task depend on shadowJar |
| 51 | +tasks.jar { |
| 52 | + enabled = false |
| 53 | + dependsOn(tasks.shadowJar) |
| 54 | +} |
| 55 | + |
| 56 | +// Fix the startScripts task dependency |
| 57 | +tasks.startScripts { dependsOn(tasks.shadowJar) } |
| 58 | + |
| 59 | +configure<SourceSetContainer> { test { java.srcDir("src/test/java") } } |
| 60 | + |
| 61 | +tasks.register<Test>("systemTest").configure { |
| 62 | + group = "verification" |
| 63 | + description = "Runs the System tests" |
| 64 | + |
| 65 | + outputs.upToDateWhen { false } |
| 66 | + |
| 67 | + maxParallelForks = 1 |
| 68 | + |
| 69 | + // Cap JVM args per test |
| 70 | + minHeapSize = "128m" |
| 71 | + maxHeapSize = "1g" |
| 72 | + |
| 73 | + filter { includeTestsMatching("io.sentry.systemtest*") } |
| 74 | +} |
| 75 | + |
| 76 | +tasks.named("test").configure { |
| 77 | + require(this is Test) |
| 78 | + |
| 79 | + filter { excludeTestsMatching("io.sentry.systemtest.*") } |
17 | 80 | } |
0 commit comments