Skip to content

Commit

Permalink
Downgrade okhttp to 4.11.0 upgrade Kotlin to 1.9 (#4597)
Browse files Browse the repository at this point in the history
OkHttp 4.12.0 depends on a version of okio that ends up requiring Kotlin 1.9. We only have an optional dependency on OkHttp so we could upgrade to 4.12.0, but I would rather not compile against a newer version of OkHttp than our users can use if they are on our minimum supported version of Kotlin (1.7). For that reason, compiles against the latest version of OkHttp that is compatible with Kotlin 1.7 - OkHttp 4.11.0.
Uses Kotlin 1.9 to compile but remains compatible with Kotlin 1.7.
  • Loading branch information
shakuzen authored Jan 23, 2024
1 parent cedcf86 commit d062901
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 = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_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 = JavaVersion.VERSION_11
}
}

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

compileJava11TestJava {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_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 = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_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 = JavaVersion.VERSION_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 d062901

Please sign in to comment.