Skip to content

Commit

Permalink
Bump Kotlin version to 1.9.24
Browse files Browse the repository at this point in the history
  • Loading branch information
IUADE0FY committed Jun 16, 2024
1 parent 6c8b91b commit 873fa63
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 45 deletions.
17 changes: 0 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -76,21 +74,6 @@ allprojects {
google()
}

tasks.withType(KotlinCompile::class.java) {
kotlinOptions {
jvmTarget = appConfig.kotlinCompatibilityVersion.toString()
}
}

plugins.withId(PLUGIN_ANDROID_LIBRARY) {
extensions.findByType<LibraryExtension>()?.run {
compileOptions {
sourceCompatibility = appConfig.javaCompatibilityVersion
targetCompatibility = appConfig.javaCompatibilityVersion
}
}
}

configure<KtlintExtension> {
android.set(true)
outputToConsole.set(true)
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
14 changes: 8 additions & 6 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"
Expand All @@ -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"
}

Expand Down
4 changes: 4 additions & 0 deletions common-utils/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@
plugins {
kotlin()
}

kotlin {
jvmToolchain(appConfig.exportableLibJavaCompatVersion)
}
4 changes: 4 additions & 0 deletions compiler-processing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ plugins {
kotlin()
}

kotlin {
jvmToolchain(appConfig.exportableLibJavaCompatVersion)
}

dependencies {
implementation(project(deps.local.commonUtils))

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 2 additions & 16 deletions hilt-binder-compiler/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Test>().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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions hilt-binder/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ plugins {
kotlin()
}

kotlin {
jvmToolchain(appConfig.exportableLibJavaCompatVersion)
}

dependencies {
implementation(deps.vanillaDagger)
}
Expand Down
5 changes: 5 additions & 0 deletions sample-deps-javac/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ android {
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}

compileOptions {
sourceCompatibility = appConfig.androidModuleJavaCompatVersion
targetCompatibility = appConfig.androidModuleJavaCompatVersion
}
}

dependencies {
Expand Down
9 changes: 9 additions & 0 deletions sample-deps-kapt/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 9 additions & 0 deletions sample-deps-ksp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down

0 comments on commit 873fa63

Please sign in to comment.