Skip to content

Commit

Permalink
Avoid robolectric added add-opens on JDK 1.8 (#8644)
Browse files Browse the repository at this point in the history
* Avoid robolectric on JDK 1.8

Add add-opens and also fails to run.

* ... and release

* ... and release
  • Loading branch information
yschimke authored Dec 31, 2024
1 parent dd5a002 commit fed29a2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions okhttp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,19 @@ configure<CheckstyleExtension> {
sourceSets = listOf(project.sourceSets["main"])
}

afterEvaluate {
tasks.withType<Test> {
if (javaLauncher.get().metadata.languageVersion.asInt() < 9) {
// Work around robolectric requirements and limitations
// https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/factory/AndroidUnitTest.java;l=339
allJvmArgs = allJvmArgs.filter { !it.startsWith("--add-opens") }
filter {
excludeTest("okhttp3.internal.publicsuffix.PublicSuffixDatabaseTest", null)
}
}
}
}

apply(plugin = "io.github.usefulness.maven-sympathy")

mavenPublishing {
Expand Down

0 comments on commit fed29a2

Please sign in to comment.