From 873fa630beef0f45cbfe6f01f732c6bf69f0c557 Mon Sep 17 00:00:00 2001 From: IUADE0FY Date: Mon, 17 Jun 2024 01:51:35 +0300 Subject: [PATCH] Bump Kotlin version to 1.9.24 --- build.gradle.kts | 17 ----------------- buildSrc/build.gradle.kts | 4 ++-- buildSrc/src/main/java/Dependencies.kt | 14 ++++++++------ common-utils/build.gradle.kts | 4 ++++ compiler-processing/build.gradle.kts | 4 ++++ gradle/wrapper/gradle-wrapper.properties | 2 +- hilt-binder-compiler/build.gradle.kts | 18 ++---------------- .../hiltbinder/processor/HiltBinderTest.kt | 2 ++ hilt-binder/build.gradle.kts | 4 ++++ sample-deps-javac/build.gradle.kts | 5 +++++ sample-deps-kapt/build.gradle.kts | 9 +++++++++ sample-deps-ksp/build.gradle.kts | 9 +++++++++ sample/build.gradle.kts | 6 +++--- 13 files changed, 53 insertions(+), 45 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index b48547f..9a075ed 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,9 +14,7 @@ * limitations under the License. */ -import com.android.build.gradle.LibraryExtension import io.gitlab.arturbosch.detekt.Detekt -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jlleitschuh.gradle.ktlint.KtlintExtension import org.jlleitschuh.gradle.ktlint.reporter.ReporterType @@ -76,21 +74,6 @@ allprojects { google() } - tasks.withType(KotlinCompile::class.java) { - kotlinOptions { - jvmTarget = appConfig.kotlinCompatibilityVersion.toString() - } - } - - plugins.withId(PLUGIN_ANDROID_LIBRARY) { - extensions.findByType()?.run { - compileOptions { - sourceCompatibility = appConfig.javaCompatibilityVersion - targetCompatibility = appConfig.javaCompatibilityVersion - } - } - } - configure { android.set(true) outputToConsole.set(true) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 78fa246..e4ddd62 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -24,8 +24,8 @@ repositories { } dependencies { - implementation("com.android.tools.build:gradle:7.4.0") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0") + implementation("com.android.tools.build:gradle:8.1.0") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24") // 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 52fb90c..00329f1 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -27,8 +27,10 @@ object appConfig { const val versionCode = 1 const val versionName = "1.0.0" - val javaCompatibilityVersion = JavaVersion.VERSION_1_8 - val kotlinCompatibilityVersion = JavaVersion.VERSION_1_8 + const val exportableLibJavaCompatVersion = 8 + + val androidModuleJavaCompatVersion = JavaVersion.VERSION_17 + val androidModuleKotlinCompatVersion = JavaVersion.VERSION_17 } object publishingConfig { @@ -64,8 +66,8 @@ object publishingConfig { object versions { - const val kotlin = "1.9.0" // also in buildSrc build.gradle.kts file - const val gradlePlugin = "7.4.0" // also in buildSrc build.gradle.kts file + const val kotlin = "1.9.24" // also in buildSrc build.gradle.kts file + const val gradlePlugin = "8.1.0" // also in buildSrc build.gradle.kts file const val detektPlugin = "1.20.0" const val ktlintPlugin = "10.3.0" const val gradleVersionsPlugin = "0.42.0" @@ -82,11 +84,11 @@ object versions { const val kotlinPoet = "1.12.0" const val incap = "0.3" const val autoService = "1.0" - const val ksp = "1.9.0-1.0.13" + const val ksp = "1.9.24-1.0.20" const val jUnit = "4.13.2" const val jUnitExt = "1.1.2" const val truth = "1.1.3" - const val ktCompileTesting = "1.5.0" + const val ktCompileTesting = "1.6.0" const val testParamInjector = "1.0" } diff --git a/common-utils/build.gradle.kts b/common-utils/build.gradle.kts index 92a2186..847f3b8 100644 --- a/common-utils/build.gradle.kts +++ b/common-utils/build.gradle.kts @@ -17,3 +17,7 @@ plugins { kotlin() } + +kotlin { + jvmToolchain(appConfig.exportableLibJavaCompatVersion) +} diff --git a/compiler-processing/build.gradle.kts b/compiler-processing/build.gradle.kts index 63ac179..91afc18 100644 --- a/compiler-processing/build.gradle.kts +++ b/compiler-processing/build.gradle.kts @@ -18,6 +18,10 @@ plugins { kotlin() } +kotlin { + jvmToolchain(appConfig.exportableLibJavaCompatVersion) +} + dependencies { implementation(project(deps.local.commonUtils)) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fa8fbda..d7b551f 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-7.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip diff --git a/hilt-binder-compiler/build.gradle.kts b/hilt-binder-compiler/build.gradle.kts index 6d4f927..5e3dfc5 100644 --- a/hilt-binder-compiler/build.gradle.kts +++ b/hilt-binder-compiler/build.gradle.kts @@ -22,22 +22,8 @@ plugins { shadow() } -// See this https://github.com/tschuchortdev/kotlin-compile-testing?tab=readme-ov-file#java-16-compatibility -if (JavaVersion.current() >= JavaVersion.VERSION_16) { - tasks.withType().all { - 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", - ) - } +kotlin { + jvmToolchain(appConfig.exportableLibJavaCompatVersion) } // Custom configuration used for dependencies that are copied 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 a6196a2..21ed69f 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 @@ -34,12 +34,14 @@ import com.tschuchort.compiletesting.SourceFile.Companion.java import com.tschuchort.compiletesting.SourceFile.Companion.kotlin import com.tschuchort.compiletesting.kspSourcesDir import com.tschuchort.compiletesting.symbolProcessorProviders +import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import java.io.File import org.junit.Test import org.junit.runner.RunWith @Suppress("LargeClass", "LongMethod", "MaxLineLength") @RunWith(TestParameterInjector::class) +@OptIn(ExperimentalCompilerApi::class) internal class HiltBinderTest { internal companion object { diff --git a/hilt-binder/build.gradle.kts b/hilt-binder/build.gradle.kts index d2c9781..8b99777 100644 --- a/hilt-binder/build.gradle.kts +++ b/hilt-binder/build.gradle.kts @@ -18,6 +18,10 @@ plugins { kotlin() } +kotlin { + jvmToolchain(appConfig.exportableLibJavaCompatVersion) +} + dependencies { implementation(deps.vanillaDagger) } diff --git a/sample-deps-javac/build.gradle.kts b/sample-deps-javac/build.gradle.kts index 645ff57..65e966f 100644 --- a/sample-deps-javac/build.gradle.kts +++ b/sample-deps-javac/build.gradle.kts @@ -36,6 +36,11 @@ android { proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") } } + + compileOptions { + sourceCompatibility = appConfig.androidModuleJavaCompatVersion + targetCompatibility = appConfig.androidModuleJavaCompatVersion + } } dependencies { diff --git a/sample-deps-kapt/build.gradle.kts b/sample-deps-kapt/build.gradle.kts index d792738..2ce25c9 100644 --- a/sample-deps-kapt/build.gradle.kts +++ b/sample-deps-kapt/build.gradle.kts @@ -38,6 +38,15 @@ android { proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") } } + + compileOptions { + sourceCompatibility = appConfig.androidModuleJavaCompatVersion + targetCompatibility = appConfig.androidModuleJavaCompatVersion + } + + kotlinOptions { + jvmTarget = appConfig.androidModuleKotlinCompatVersion.toString() + } } dependencies { diff --git a/sample-deps-ksp/build.gradle.kts b/sample-deps-ksp/build.gradle.kts index e29ba2d..6e0ee4d 100644 --- a/sample-deps-ksp/build.gradle.kts +++ b/sample-deps-ksp/build.gradle.kts @@ -55,6 +55,15 @@ android { proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") } } + + compileOptions { + sourceCompatibility = appConfig.androidModuleJavaCompatVersion + targetCompatibility = appConfig.androidModuleJavaCompatVersion + } + + kotlinOptions { + jvmTarget = appConfig.androidModuleKotlinCompatVersion.toString() + } } dependencies { diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index dddfcff..ac63dce 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -43,12 +43,12 @@ android { } compileOptions { - sourceCompatibility = appConfig.javaCompatibilityVersion - targetCompatibility = appConfig.javaCompatibilityVersion + sourceCompatibility = appConfig.androidModuleJavaCompatVersion + targetCompatibility = appConfig.androidModuleJavaCompatVersion } kotlinOptions { - jvmTarget = appConfig.kotlinCompatibilityVersion.toString() + jvmTarget = appConfig.androidModuleKotlinCompatVersion.toString() } }