Skip to content

Commit

Permalink
Downgrade okhttp to 4.11.0 upgrade Kotlin to 1.9
Browse files Browse the repository at this point in the history
Uses Kotlin 1.9 to compile but remains compatible with Kotlin 1.7. For this, we need to be on OkHttp 4.11.0. Upgrading to 4.12.0 makes Kotlin 1.7 not work in the sample.
  • Loading branch information
shakuzen committed Jan 19, 2024
1 parent b7b40f8 commit 23e1c3d
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 6 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ subprojects {

toolchain {
languageVersion = javaLanguageVersion
sourceCompatibility = javaTargetVersion
targetCompatibility = javaTargetVersion
}
}

Expand Down Expand Up @@ -117,6 +119,9 @@ subprojects {
compileTestJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'

sourceCompatibility = 11
targetCompatibility = 11
}


Expand Down
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ mockito = "5.8.0"
mongo = "4.11.1"
netty = "4.1.104.Final"
newrelic-api = "5.14.0"
okhttp = "5.0.0-alpha.11" # TODO is compiling against an alpha version intentional?
# Kotlin 1.7 sample will fail from OkHttp 4.12.0 due to okio dependency being a Kotlin 1.9 module
okhttp = "4.11.0"
postgre = "42.7.1"
prometheus = "0.16.0"
reactor = "2022.0.13"
Expand Down
13 changes: 10 additions & 3 deletions micrometer-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
alias(libs.plugins.kotlin17)
alias(libs.plugins.kotlin19)
id 'me.champeau.mrjar' version "0.1.1"
}

Expand All @@ -12,12 +12,14 @@ multiRelease {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = javaTargetVersion
apiVersion = "1.7"
languageVersion = "1.7"
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinTest).all {
compileTestKotlin {
kotlinOptions {
jvmTarget = JavaVersion.toVersion(javaLanguageVersion)
jvmTarget = 11
}
}

Expand Down Expand Up @@ -273,3 +275,8 @@ java11Test {
maxRetries = 3
}
}

compileJava11TestJava {
sourceCompatibility = 11
targetCompatibility = 11
}
4 changes: 4 additions & 0 deletions micrometer-jetty11/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ dependencies {
testImplementation 'org.assertj:assertj-core'
}

java {
targetCompatibility = 11
}

compileJava {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
Expand Down
5 changes: 5 additions & 0 deletions micrometer-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,8 @@ java11Test {
maxRetries = 3
}
}

compileJava11TestJava {
sourceCompatibility = 11
targetCompatibility = 11
}
4 changes: 4 additions & 0 deletions samples/micrometer-samples-javalin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ dependencies {
implementation 'ch.qos.logback:logback-classic'
}

java {
targetCompatibility = 11
}

compileJava {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
Expand Down
12 changes: 10 additions & 2 deletions samples/micrometer-samples-kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
plugins {
// test with the highest version of Kotlin supported because we compile with oldest version supported
alias(libs.plugins.kotlin19)
// test with the lowest version of Kotlin supported because we compile with highest version supported
alias(libs.plugins.kotlin17)
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = javaTargetVersion
apiVersion = "1.7"
languageVersion = "1.7"
}
}

dependencies {
Expand Down

0 comments on commit 23e1c3d

Please sign in to comment.