-
-
Notifications
You must be signed in to change notification settings - Fork 467
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
85 lines (65 loc) · 2.21 KB
/
build.gradle.kts
File metadata and controls
85 lines (65 loc) · 2.21 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
java
application
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.gradle.versions)
alias(libs.plugins.shadow)
}
application { mainClass.set("io.sentry.samples.log4j2.Main") }
java.sourceCompatibility = JavaVersion.VERSION_17
java.targetCompatibility = JavaVersion.VERSION_17
repositories { mavenCentral() }
configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
tasks.withType<KotlinCompile>().configureEach {
kotlin {
compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict")
compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
dependencies {
implementation(projects.sentryLog4j2)
implementation(libs.log4j.api)
implementation(libs.log4j.core)
testImplementation(kotlin(Config.kotlinStdLib))
testImplementation(projects.sentry)
testImplementation(projects.sentrySystemTestSupport)
testImplementation(libs.kotlin.test.junit)
testImplementation(libs.slf4j.api)
testImplementation(libs.slf4j.jdk14)
}
// Configure the Shadow JAR (executable JAR with all dependencies)
tasks.shadowJar {
manifest { attributes["Main-Class"] = "io.sentry.samples.log4j2.Main" }
archiveClassifier.set("") // Remove the classifier so it replaces the regular JAR
mergeServiceFiles()
// Use Log4j2 cache transformer to properly handle plugin files
transform(
com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer()
)
}
// Make the regular jar task depend on shadowJar
tasks.jar {
enabled = false
dependsOn(tasks.shadowJar)
}
// Fix the startScripts task dependency
tasks.startScripts { dependsOn(tasks.shadowJar) }
configure<SourceSetContainer> { test { java.srcDir("src/test/java") } }
tasks.register<Test>("systemTest").configure {
group = "verification"
description = "Runs the System tests"
outputs.upToDateWhen { false }
maxParallelForks = 1
// Cap JVM args per test
minHeapSize = "128m"
maxHeapSize = "1g"
filter { includeTestsMatching("io.sentry.systemtest*") }
}
tasks.named("test").configure {
require(this is Test)
filter { excludeTestsMatching("io.sentry.systemtest.*") }
}