-
-
Notifications
You must be signed in to change notification settings - Fork 468
ci: Fix Spring Boot matrix version updates #5372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1042675
917ebad
52df6e9
b8a9c0b
87b8bc3
16dd557
1137d60
1fa2c8c
81e6e98
37d04c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,25 +15,37 @@ group = "io.sentry.sample.spring-boot" | |
|
|
||
| version = "0.0.1-SNAPSHOT" | ||
|
|
||
| java.sourceCompatibility = JavaVersion.VERSION_17 | ||
| java.sourceCompatibility = JavaVersion.VERSION_11 | ||
|
|
||
| java.targetCompatibility = JavaVersion.VERSION_17 | ||
| java.targetCompatibility = JavaVersion.VERSION_11 | ||
|
|
||
| repositories { mavenCentral() } | ||
|
|
||
| fun springBoot2SupportsOptionalIntegrations(): Boolean { | ||
| val version = libs.versions.springboot2.get().removeSuffix(".RELEASE") | ||
| val parts = version.split(".").map { it.toIntOrNull() ?: 0 } | ||
| val major = parts.getOrElse(0) { 0 } | ||
| val minor = parts.getOrElse(1) { 0 } | ||
| return major > 2 || (major == 2 && minor >= 7) | ||
| } | ||
|
|
||
| val includeGraphql = | ||
| !project.hasProperty("excludeGraphql") && springBoot2SupportsOptionalIntegrations() | ||
| val includeKafka = !project.hasProperty("excludeKafka") && springBoot2SupportsOptionalIntegrations() | ||
|
|
||
| configure<JavaPluginExtension> { | ||
| sourceCompatibility = JavaVersion.VERSION_17 | ||
| targetCompatibility = JavaVersion.VERSION_17 | ||
| sourceCompatibility = JavaVersion.VERSION_11 | ||
| targetCompatibility = JavaVersion.VERSION_11 | ||
| } | ||
|
|
||
| tasks.withType<KotlinCompile>().configureEach { | ||
| compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 | ||
| compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 | ||
| } | ||
|
|
||
| tasks.withType<KotlinCompile>().configureEach { | ||
| kotlin { | ||
| compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict") | ||
| compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 | ||
| compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -43,7 +55,9 @@ dependencies { | |
| implementation(libs.springboot.starter) | ||
| implementation(libs.springboot.starter.actuator) | ||
| implementation(libs.springboot.starter.aop) | ||
| implementation(libs.springboot.starter.graphql) | ||
| if (includeGraphql) { | ||
| implementation(libs.springboot.starter.graphql) | ||
| } | ||
| implementation(libs.springboot.starter.jdbc) | ||
| implementation(libs.springboot.starter.quartz) | ||
| implementation(libs.springboot.starter.security) | ||
|
|
@@ -55,14 +69,17 @@ dependencies { | |
| implementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION)) | ||
| implementation(projects.sentrySpringBootStarter) | ||
| implementation(projects.sentryLogback) | ||
| implementation(projects.sentryGraphql) | ||
| if (includeGraphql) { | ||
| implementation(projects.sentryGraphql) | ||
| } | ||
| implementation(projects.sentryQuartz) | ||
| implementation(projects.sentryOpentelemetry.sentryOpentelemetryAgentlessSpring) | ||
| implementation(projects.sentryAsyncProfiler) | ||
|
|
||
| // kafka | ||
| implementation(libs.spring.kafka2) | ||
| implementation(projects.sentryKafka) | ||
| if (includeKafka) { | ||
| implementation(libs.spring.kafka2) | ||
| implementation(projects.sentryKafka) | ||
| } | ||
|
|
||
| // database query tracing | ||
| implementation(projects.sentryJdbc) | ||
|
|
@@ -103,7 +120,19 @@ tasks.jar { | |
|
|
||
| tasks.startScripts { dependsOn(tasks.shadowJar) } | ||
|
|
||
| configure<SourceSetContainer> { test { java.srcDir("src/test/java") } } | ||
| configure<SourceSetContainer> { | ||
| main { | ||
| if (!includeGraphql) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the best gradle caching it would be best to make these 3 separate source sets. EDIT: after scrolling further down and seeing that they also have different imports maybe I need to understand better why we need this. could you explain it?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since older versions of Spring Boot 2 don't have GraphQL support, we're excluding it from the sample in the matrix build. |
||
| java.exclude("**/graphql/**") | ||
| resources.exclude("graphql/**") | ||
| } | ||
| if (!includeKafka) { | ||
| java.exclude("**/queues/kafka/**") | ||
| resources.exclude("application-kafka.properties") | ||
| } | ||
| } | ||
| test { java.srcDir("src/test/java") } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: if this is the implicit default, why do we need this?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably redundant, can try to remove |
||
| } | ||
|
|
||
| tasks.register<Test>("systemTest").configure { | ||
| group = "verification" | ||
|
|
@@ -121,7 +150,15 @@ tasks.register<Test>("systemTest").configure { | |
| minHeapSize = "128m" | ||
| maxHeapSize = "1g" | ||
|
|
||
| filter { includeTestsMatching("io.sentry.systemtest*") } | ||
| filter { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, if we use 3 separate test source sets/tasks we can compile and execute/cache them independently. |
||
| includeTestsMatching("io.sentry.systemtest*") | ||
| if (!includeGraphql) { | ||
| excludeTestsMatching("io.sentry.systemtest.Graphql*") | ||
| } | ||
| if (!includeKafka) { | ||
| excludeTestsMatching("io.sentry.systemtest.Kafka*") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| tasks.named("test").configure { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,22 +15,34 @@ group = "io.sentry.sample.spring-boot" | |
|
|
||
| version = "0.0.1-SNAPSHOT" | ||
|
|
||
| java.sourceCompatibility = JavaVersion.VERSION_17 | ||
| java.sourceCompatibility = JavaVersion.VERSION_11 | ||
|
|
||
| java.targetCompatibility = JavaVersion.VERSION_17 | ||
| java.targetCompatibility = JavaVersion.VERSION_11 | ||
|
|
||
| repositories { mavenCentral() } | ||
|
|
||
| fun springBoot2SupportsOptionalIntegrations(): Boolean { | ||
| val version = libs.versions.springboot2.get().removeSuffix(".RELEASE") | ||
| val parts = version.split(".").map { it.toIntOrNull() ?: 0 } | ||
| val major = parts.getOrElse(0) { 0 } | ||
| val minor = parts.getOrElse(1) { 0 } | ||
| return major > 2 || (major == 2 && minor >= 7) | ||
| } | ||
|
|
||
| val includeGraphql = | ||
| !project.hasProperty("excludeGraphql") && springBoot2SupportsOptionalIntegrations() | ||
| val includeKafka = !project.hasProperty("excludeKafka") && springBoot2SupportsOptionalIntegrations() | ||
|
|
||
| configure<JavaPluginExtension> { | ||
| sourceCompatibility = JavaVersion.VERSION_17 | ||
| targetCompatibility = JavaVersion.VERSION_17 | ||
| sourceCompatibility = JavaVersion.VERSION_11 | ||
| targetCompatibility = JavaVersion.VERSION_11 | ||
| } | ||
|
|
||
| tasks.withType<KotlinCompile>().configureEach { | ||
| compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 | ||
| compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: should we import this?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure |
||
| kotlin { | ||
| compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict") | ||
| compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 | ||
| compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -39,7 +51,9 @@ dependencies { | |
| implementation(libs.springboot.starter) | ||
| implementation(libs.springboot.starter.actuator) | ||
| implementation(libs.springboot.starter.aop) | ||
| implementation(libs.springboot.starter.graphql) | ||
| if (includeGraphql) { | ||
| implementation(libs.springboot.starter.graphql) | ||
| } | ||
| implementation(libs.springboot.starter.jdbc) | ||
| implementation(libs.springboot.starter.quartz) | ||
| implementation(libs.springboot.starter.security) | ||
|
|
@@ -51,14 +65,17 @@ dependencies { | |
| implementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION)) | ||
| implementation(projects.sentrySpringBootStarter) | ||
| implementation(projects.sentryLogback) | ||
| implementation(projects.sentryGraphql) | ||
| if (includeGraphql) { | ||
| implementation(projects.sentryGraphql) | ||
| } | ||
| implementation(projects.sentryQuartz) | ||
| implementation(projects.sentryAsyncProfiler) | ||
| implementation(libs.otel) | ||
|
|
||
| // kafka | ||
| implementation(libs.spring.kafka2) | ||
| implementation(projects.sentryKafka) | ||
| if (includeKafka) { | ||
| implementation(libs.spring.kafka2) | ||
| implementation(projects.sentryKafka) | ||
| } | ||
|
|
||
| // database query tracing | ||
| implementation(projects.sentryJdbc) | ||
|
|
@@ -99,7 +116,19 @@ tasks.jar { | |
|
|
||
| tasks.startScripts { dependsOn(tasks.shadowJar) } | ||
|
|
||
| configure<SourceSetContainer> { test { java.srcDir("src/test/java") } } | ||
| configure<SourceSetContainer> { | ||
| main { | ||
| if (!includeGraphql) { | ||
| java.exclude("**/graphql/**") | ||
| resources.exclude("graphql/**") | ||
| } | ||
| if (!includeKafka) { | ||
| java.exclude("**/queues/kafka/**") | ||
| resources.exclude("application-kafka.properties") | ||
| } | ||
| } | ||
| test { java.srcDir("src/test/java") } | ||
| } | ||
|
|
||
| tasks.register<JavaExec>("bootRunWithAgent").configure { | ||
| group = "application" | ||
|
|
@@ -141,7 +170,15 @@ tasks.register<Test>("systemTest").configure { | |
| minHeapSize = "128m" | ||
| maxHeapSize = "1g" | ||
|
|
||
| filter { includeTestsMatching("io.sentry.systemtest*") } | ||
| filter { | ||
| includeTestsMatching("io.sentry.systemtest*") | ||
| if (!includeGraphql) { | ||
| excludeTestsMatching("io.sentry.systemtest.Graphql*") | ||
| } | ||
| if (!includeKafka) { | ||
| excludeTestsMatching("io.sentry.systemtest.Kafka*") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| tasks.named("test").configure { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this PR is about fixing the fact that this
sedwasn't replacing versions correctly, how do we prevent changes or refactoring oflibs.versions.tomlfile from breaking this? Can we make this fail if no replacement is found?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we should