Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .kotlin/errors/errors-1745213070779.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kotlin version: 2.0.21
error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output:
1. Kotlin compile daemon is ready

4 changes: 4 additions & 0 deletions .kotlin/errors/errors-1746001177744.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kotlin version: 2.0.21
error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output:
1. Kotlin compile daemon is ready

4 changes: 4 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ dependencies {
implementation("de.thetaphi:forbiddenapis:3.9")
implementation("com.github.spotbugs.snom:spotbugs-gradle-plugin:6.1.7")
implementation("org.gradle:test-retry-gradle-plugin:1.6.2")
val kotlinVersion = "2.0.21"
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion")
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.6")
}
117 changes: 117 additions & 0 deletions buildSrc/src/main/kotlin/sb-ot-demo.java-compile.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* Copyright (c) 2020-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/spring-boot-open-telemetry-demo
*
* Licensed under the Apache License 2.0
*/

import gradle.kotlin.dsl.accessors._82e33fab8c067a1df5c2e280e32692b4.check
import gradle.kotlin.dsl.accessors._82e33fab8c067a1df5c2e280e32692b4.jacocoTestCoverageVerification
import gradle.kotlin.dsl.accessors._82e33fab8c067a1df5c2e280e32692b4.jacocoTestReport
import gradle.kotlin.dsl.accessors._82e33fab8c067a1df5c2e280e32692b4.java
import gradle.kotlin.dsl.accessors._82e33fab8c067a1df5c2e280e32692b4.osdetector
import gradle.kotlin.dsl.accessors._82e33fab8c067a1df5c2e280e32692b4.test
import gradle.kotlin.dsl.accessors._82e33fab8c067a1df5c2e280e32692b4.testImplementation
import gradle.kotlin.dsl.accessors._82e33fab8c067a1df5c2e280e32692b4.testRuntimeOnly

plugins {
id("java")
id("jacoco")
id("com.google.osdetector")
id("org.gradle.test-retry")
}
dependencies {
testImplementation("org.assertj:assertj-core")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// https://github.com/netty/netty/issues/11020
if (osdetector.arch == "aarch_64") {
testImplementation("io.netty:netty-all:4.1.104.Final")
}
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

tasks {
withType<JavaCompile>().configureEach {
options.compilerArgs.add("-parameters")
options.compilerArgs.add("--should-stop=ifError=FLOW")
}

test {
useJUnitPlatform()

finalizedBy(jacocoTestReport, jacocoTestCoverageVerification)
maxParallelForks = 1

retry {
maxRetries.set(2)
maxFailures.set(5)
failOnPassedAfterRetry.set(false)
}
}

jacocoTestCoverageVerification {
dependsOn(jacocoTestReport)
violationRules {
rule {
limit {
counter = "CLASS"
value = "MISSEDCOUNT"
maximum = "0.0".toBigDecimal()
}
}
rule {
limit {
counter = "METHOD"
value = "MISSEDCOUNT"
maximum = "2.0".toBigDecimal()
}
}
rule {
limit {
counter = "LINE"
value = "MISSEDCOUNT"
maximum = "7.0".toBigDecimal()
}
}
rule {
limit {
counter = "INSTRUCTION"
value = "COVEREDRATIO"
minimum = "0.93".toBigDecimal()
}
}
rule {
limit {
counter = "BRANCH"
value = "COVEREDRATIO"
minimum = "0.66".toBigDecimal()
}
}
}
}

jacocoTestReport {
dependsOn(test)
reports {
xml.required.set(true)
html.required.set(true)
}
}

check {
dependsOn(jacocoTestCoverageVerification)
}
}
75 changes: 1 addition & 74 deletions buildSrc/src/main/kotlin/sb-ot-demo.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ plugins {
id("net.ltgt.errorprone")
id("com.google.osdetector")
id("org.gradle.test-retry")
id("sb-ot-demo.java-compile")
}

dependencies {
Expand All @@ -43,16 +44,6 @@ dependencies {
spotbugsPlugins("com.mebigfatguy.sb-contrib:sb-contrib:7.6.9")
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

jacoco {
toolVersion = "0.8.12"
}

checkstyle {
toolVersion = "10.21.1"
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml")
Expand Down Expand Up @@ -84,77 +75,13 @@ tasks.withType<SpotBugsTask>().configureEach {

tasks {
withType<JavaCompile>().configureEach {
options.compilerArgs.add("-parameters")
options.compilerArgs.add("--should-stop=ifError=FLOW")
options.errorprone {
disableWarningsInGeneratedCode.set(true)
disable("Slf4jLoggerShouldBeNonStatic")
}
}

test {
useJUnitPlatform()
dependsOn(checkstyleMain, checkstyleTest, pmdMain, pmdTest, spotbugsMain, spotbugsTest)
finalizedBy(jacocoTestReport, jacocoTestCoverageVerification)
maxParallelForks = 1

retry {
maxRetries.set(2)
maxFailures.set(5)
failOnPassedAfterRetry.set(false)
}
}

jacocoTestCoverageVerification {
dependsOn(jacocoTestReport)
violationRules {
rule {
limit {
counter = "CLASS"
value = "MISSEDCOUNT"
maximum = "0.0".toBigDecimal()
}
}
rule {
limit {
counter = "METHOD"
value = "MISSEDCOUNT"
maximum = "2.0".toBigDecimal()
}
}
rule {
limit {
counter = "LINE"
value = "MISSEDCOUNT"
maximum = "7.0".toBigDecimal()
}
}
rule {
limit {
counter = "INSTRUCTION"
value = "COVEREDRATIO"
minimum = "0.93".toBigDecimal()
}
}
rule {
limit {
counter = "BRANCH"
value = "COVEREDRATIO"
minimum = "0.66".toBigDecimal()
}
}
}
}

jacocoTestReport {
dependsOn(test)
reports {
xml.required.set(true)
html.required.set(true)
}
}

check {
dependsOn(jacocoTestCoverageVerification)
}
}
52 changes: 52 additions & 0 deletions buildSrc/src/main/kotlin/sb-ot-demo.kotlin-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) 2020-2025. Ivan Vakhrushev and others.
* https://github.com/mfvanek/spring-boot-open-telemetry-demo
*
* Licensed under the Apache License 2.0
*/

import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("java")
id("jacoco")
id("org.jetbrains.kotlin.jvm")
id("org.jetbrains.kotlin.plugin.spring")
id("io.gitlab.arturbosch.detekt")
id("sb-ot-demo.forbidden-apis")
id("sb-ot-demo.java-compile")
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect")
//implementation("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6")
implementation("io.gitlab.arturbosch.detekt:detekt-rules-libraries:1.23.6")
}

tasks.withType<KotlinCompile> {
compilerOptions {
freeCompilerArgs.add("-Xjsr305=strict")
jvmTarget = JvmTarget.JVM_17
}
}

detekt {
toolVersion = "1.23.6"
config.setFrom(file("${rootDir}/config/detekt/detekt.yml"))
buildUponDefaultConfig = true
}

tasks {
withType<JavaCompile>().configureEach {
options.compilerArgs.add("-parameters")
options.compilerArgs.add("--should-stop=ifError=FLOW")
}

test {
testLogging.showStandardStreams = false // set to true for debug purposes
}
}



7 changes: 7 additions & 0 deletions config/detekt/detekt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
performance:
SpreadOperator:
active: false

style:
MaxLineLength:
maxLineLength: 200
2 changes: 2 additions & 0 deletions db-migrations/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
plugins {
id("java")
id("sb-ot-demo.java-conventions")
id("sb-ot-demo.kotlin-conventions")
}

5 changes: 5 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}
rootProject.name = "spring-boot-open-telemetry-demo"
include("spring-boot-3-demo-app")
include("common-internal-bom")
include("spring-boot-2-demo-app")
include("db-migrations")
include("spring-boot-3-demo-app-kotlin")

dependencyResolutionManagement {
versionCatalogs {
Expand All @@ -15,3 +19,4 @@ dependencyResolutionManagement {
}
}
}

4 changes: 3 additions & 1 deletion spring-boot-2-demo-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-jdbc")
implementation("org.postgresql:postgresql")
implementation("com.zaxxer:HikariCP")
implementation(project(":db-migrations"))
implementation(project(":db-migrations")){
exclude(group = "io.gitlab.arturbosch.detekt")
}
implementation("org.liquibase:liquibase-core")
implementation("com.github.blagerweij:liquibase-sessionlock")
implementation("net.ttddyy:datasource-proxy:1.9") {
Expand Down
Loading
Loading