Skip to content

Commit

Permalink
Fix the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mars885 committed Sep 24, 2024
1 parent 54f01b9 commit 2b2e1c7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ object appConfig {

const val exportableLibJavaCompatVersion = 8

val androidModuleJavaCompatVersion = JavaVersion.VERSION_17
val androidModuleKotlinCompatVersion = JavaVersion.VERSION_17
val androidModuleJavaCompatVersion = JavaVersion.VERSION_1_8
val androidModuleKotlinCompatVersion = JavaVersion.VERSION_1_8
}

object publishingConfig {
Expand Down
25 changes: 25 additions & 0 deletions hilt-binder-compiler/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,31 @@ configurations {
}
}

// https://github.com/ZacSweers/kotlin-compile-testing?tab=readme-ov-file#java-16-compatibility
if (JavaVersion.current() >= JavaVersion.VERSION_16) {
tasks.withType<Test>().configureEach {
// Kotlin Compile Testing lib does not run the Javac tests with the JDK 1.8 as of the
// 0.5.1 version. This is a workaround to run the tests using the JDK 17.
// See https://github.com/ZacSweers/kotlin-compile-testing/issues/277
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
}

jvmArgs(
"--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
)
}
}

dependencies {
implementation(project(deps.local.hiltBinder))
shadowed(project(deps.local.compilerProcessing))
Expand Down

0 comments on commit 2b2e1c7

Please sign in to comment.