diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index ee77285..5c7b384 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -24,8 +24,8 @@ repositories { } dependencies { - implementation("com.android.tools.build:gradle:8.1.0") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.25") + implementation("com.android.tools.build:gradle:8.3.1") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0") // See https://github.com/google/dagger/issues/3068#issuecomment-999118496 // for why it should be here. implementation("com.squareup:javapoet:1.13.0") diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index 0ca5059..ef2d933 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -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 { @@ -66,14 +66,14 @@ object publishingConfig { object versions { - const val kotlin = "1.9.25" // also in buildSrc build.gradle.kts file - const val gradlePlugin = "8.1.0" // also in buildSrc build.gradle.kts file + const val kotlin = "2.0.0" // also in buildSrc build.gradle.kts file + const val androidPlugin = "8.3.1" // also in buildSrc build.gradle.kts file const val detektPlugin = "1.23.6" const val ktlintPlugin = "12.1.1" const val gradleVersionsPlugin = "0.51.0" const val dokkaPlugin = "1.9.20" const val shadowPlugin = "8.0.0" - const val ksp = "1.9.25-1.0.20" + const val ksp = "2.0.0-1.0.24" const val dagger = "2.51.1" const val appCompat = "1.7.0" const val navigation = "2.7.7" @@ -88,7 +88,7 @@ object versions { const val ktlint = "1.3.1" const val jUnit = "4.13.2" const val truth = "1.4.4" - const val ktCompileTesting = "1.6.0" + const val ktCompileTesting = "0.5.1" const val testParamInjector = "1.16" } @@ -97,7 +97,7 @@ object deps { object plugins { const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" - const val android = "com.android.tools.build:gradle:${versions.gradlePlugin}" + const val android = "com.android.tools.build:gradle:${versions.androidPlugin}" const val ksp = "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:${versions.ksp}" const val daggerHilt = "com.google.dagger:hilt-android-gradle-plugin:${versions.dagger}" const val gradleVersions = "com.github.ben-manes:gradle-versions-plugin:${versions.gradleVersionsPlugin}" @@ -140,6 +140,6 @@ object deps { const val kspApi = "com.google.devtools.ksp:symbol-processing-api:${versions.ksp}" const val jUnit = "junit:junit:${versions.jUnit}" const val truth = "com.google.truth:truth:${versions.truth}" - const val kspCompileTesting = "com.github.tschuchortdev:kotlin-compile-testing-ksp:${versions.ktCompileTesting}" + const val kspCompileTesting = "dev.zacsweers.kctfork:ksp:${versions.ktCompileTesting}" const val testParamInjector = "com.google.testparameterinjector:test-parameter-injector:${versions.testParamInjector}" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d7b551f..ce13d51 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip diff --git a/hilt-binder-compiler/build.gradle.kts b/hilt-binder-compiler/build.gradle.kts index 5e3dfc5..82df898 100644 --- a/hilt-binder-compiler/build.gradle.kts +++ b/hilt-binder-compiler/build.gradle.kts @@ -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().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)) diff --git a/hilt-binder-compiler/src/test/java/com/paulrybitskyi/hiltbinder/processor/HiltBinderTest.kt b/hilt-binder-compiler/src/test/java/com/paulrybitskyi/hiltbinder/processor/HiltBinderTest.kt index f84c16f..16d828c 100644 --- a/hilt-binder-compiler/src/test/java/com/paulrybitskyi/hiltbinder/processor/HiltBinderTest.kt +++ b/hilt-binder-compiler/src/test/java/com/paulrybitskyi/hiltbinder/processor/HiltBinderTest.kt @@ -32,8 +32,8 @@ import com.tschuchort.compiletesting.KotlinCompilation.ExitCode import com.tschuchort.compiletesting.SourceFile import com.tschuchort.compiletesting.SourceFile.Companion.java import com.tschuchort.compiletesting.SourceFile.Companion.kotlin +import com.tschuchort.compiletesting.configureKsp import com.tschuchort.compiletesting.kspSourcesDir -import com.tschuchort.compiletesting.symbolProcessorProviders import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import org.junit.Test import org.junit.runner.RunWith @@ -5746,10 +5746,13 @@ internal class HiltBinderTest { sources = sourceFiles verbose = false inheritClassPath = true + languageVersion = "1.9" when (processorType) { ProcessorType.JAVAC -> annotationProcessors = listOf(HiltBinderJavacProcessor()) - ProcessorType.KSP -> symbolProcessorProviders = listOf(HiltBinderKspProcessor.Provider()) + ProcessorType.KSP -> configureKsp { + symbolProcessorProviders.add(HiltBinderKspProcessor.Provider()) + } } }