Skip to content

Commit b038dc1

Browse files
runningcodeclaude
andcommitted
build(samples): Track launched app archive as systemTest input
Removing outputs.upToDateWhen { false } let Gradle treat systemTest as up-to-date from the test classpath alone, but the tests launch the packaged sample (shadowJar/bootJar/war) from build/libs as a separate process, and that archive was neither a task input nor a dependency. A separate jar build could refresh the artifact while systemTest was skipped, so verification would not run against the rebuilt sample. Declare the packaging task's archive as an input and depend on it, mirroring the task selection in system-test-runner.py (war for the Tomcat samples, shadowJar where the Shadow plugin is applied, bootJar otherwise). Up-to-date checks now account for the real artifact. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 44084fa commit b038dc1

22 files changed

Lines changed: 198 additions & 0 deletions

File tree

sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ tasks.register<Test>("systemTest").configure {
7171
testClassesDirs = test.output.classesDirs
7272
classpath = test.runtimeClasspath
7373

74+
// System tests launch the packaged sample app from build/libs as a separate
75+
// process, so the archive is a real input even though it is not on the test classpath.
76+
val appArchive = tasks.named("shadowJar")
77+
dependsOn(appArchive)
78+
inputs
79+
.files(appArchive)
80+
.withPropertyName("appArchive")
81+
.withNormalizer(ClasspathNormalizer::class.java)
82+
7483
maxParallelForks = 1
7584

7685
// Cap JVM args per test

sentry-samples/sentry-samples-console-otlp/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ tasks.register<Test>("systemTest").configure {
7474
testClassesDirs = test.output.classesDirs
7575
classpath = test.runtimeClasspath
7676

77+
// System tests launch the packaged sample app from build/libs as a separate
78+
// process, so the archive is a real input even though it is not on the test classpath.
79+
val appArchive = tasks.named("shadowJar")
80+
dependsOn(appArchive)
81+
inputs
82+
.files(appArchive)
83+
.withPropertyName("appArchive")
84+
.withNormalizer(ClasspathNormalizer::class.java)
85+
7786
maxParallelForks = 1
7887

7988
// Cap JVM args per test

sentry-samples/sentry-samples-console/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ tasks.register<Test>("systemTest").configure {
7575
testClassesDirs = test.output.classesDirs
7676
classpath = test.runtimeClasspath
7777

78+
// System tests launch the packaged sample app from build/libs as a separate
79+
// process, so the archive is a real input even though it is not on the test classpath.
80+
val appArchive = tasks.named("shadowJar")
81+
dependsOn(appArchive)
82+
inputs
83+
.files(appArchive)
84+
.withPropertyName("appArchive")
85+
.withNormalizer(ClasspathNormalizer::class.java)
86+
7887
maxParallelForks = 1
7988

8089
// Cap JVM args per test

sentry-samples/sentry-samples-jul/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ tasks.register<Test>("systemTest").configure {
6666
testClassesDirs = test.output.classesDirs
6767
classpath = test.runtimeClasspath
6868

69+
// System tests launch the packaged sample app from build/libs as a separate
70+
// process, so the archive is a real input even though it is not on the test classpath.
71+
val appArchive = tasks.named("shadowJar")
72+
dependsOn(appArchive)
73+
inputs
74+
.files(appArchive)
75+
.withPropertyName("appArchive")
76+
.withNormalizer(ClasspathNormalizer::class.java)
77+
6978
maxParallelForks = 1
7079

7180
// Cap JVM args per test

sentry-samples/sentry-samples-log4j2/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ tasks.register<Test>("systemTest").configure {
7272
testClassesDirs = test.output.classesDirs
7373
classpath = test.runtimeClasspath
7474

75+
// System tests launch the packaged sample app from build/libs as a separate
76+
// process, so the archive is a real input even though it is not on the test classpath.
77+
val appArchive = tasks.named("shadowJar")
78+
dependsOn(appArchive)
79+
inputs
80+
.files(appArchive)
81+
.withPropertyName("appArchive")
82+
.withNormalizer(ClasspathNormalizer::class.java)
83+
7584
maxParallelForks = 1
7685

7786
// Cap JVM args per test

sentry-samples/sentry-samples-logback/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ tasks.register<Test>("systemTest").configure {
6666
testClassesDirs = test.output.classesDirs
6767
classpath = test.runtimeClasspath
6868

69+
// System tests launch the packaged sample app from build/libs as a separate
70+
// process, so the archive is a real input even though it is not on the test classpath.
71+
val appArchive = tasks.named("shadowJar")
72+
dependsOn(appArchive)
73+
inputs
74+
.files(appArchive)
75+
.withPropertyName("appArchive")
76+
.withNormalizer(ClasspathNormalizer::class.java)
77+
6978
maxParallelForks = 1
7079

7180
// Cap JVM args per test

sentry-samples/sentry-samples-spring-7/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ tasks.register<Test>("systemTest").configure {
7777
testClassesDirs = test.output.classesDirs
7878
classpath = test.runtimeClasspath
7979

80+
// System tests launch the packaged sample app from build/libs as a separate
81+
// process, so the archive is a real input even though it is not on the test classpath.
82+
val appArchive = tasks.named("war")
83+
dependsOn(appArchive)
84+
inputs
85+
.files(appArchive)
86+
.withPropertyName("appArchive")
87+
.withNormalizer(ClasspathNormalizer::class.java)
88+
8089
maxParallelForks = 1
8190

8291
// Cap JVM args per test

sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ tasks.register<Test>("systemTest").configure {
9090
testClassesDirs = test.output.classesDirs
9191
classpath = test.runtimeClasspath
9292

93+
// System tests launch the packaged sample app from build/libs as a separate
94+
// process, so the archive is a real input even though it is not on the test classpath.
95+
val appArchive = tasks.named("bootJar")
96+
dependsOn(appArchive)
97+
inputs
98+
.files(appArchive)
99+
.withPropertyName("appArchive")
100+
.withNormalizer(ClasspathNormalizer::class.java)
101+
93102
maxParallelForks = 1
94103

95104
// Cap JVM args per test

sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ tasks.register<Test>("systemTest").configure {
118118
testClassesDirs = test.output.classesDirs
119119
classpath = test.runtimeClasspath
120120

121+
// System tests launch the packaged sample app from build/libs as a separate
122+
// process, so the archive is a real input even though it is not on the test classpath.
123+
val appArchive = tasks.named("bootJar")
124+
dependsOn(appArchive)
125+
inputs
126+
.files(appArchive)
127+
.withPropertyName("appArchive")
128+
.withNormalizer(ClasspathNormalizer::class.java)
129+
121130
maxParallelForks = 1
122131

123132
// Cap JVM args per test

sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ tasks.register<Test>("systemTest").configure {
9191
testClassesDirs = test.output.classesDirs
9292
classpath = test.runtimeClasspath
9393

94+
// System tests launch the packaged sample app from build/libs as a separate
95+
// process, so the archive is a real input even though it is not on the test classpath.
96+
val appArchive = tasks.named("bootJar")
97+
dependsOn(appArchive)
98+
inputs
99+
.files(appArchive)
100+
.withPropertyName("appArchive")
101+
.withNormalizer(ClasspathNormalizer::class.java)
102+
94103
maxParallelForks = 1
95104

96105
// Cap JVM args per test

0 commit comments

Comments
 (0)