Skip to content

Commit

Permalink
Bump kotlin from 2.0.21 to 2.1.0 (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored Nov 30, 2024
1 parent ca48fb0 commit fe62676
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 39 deletions.
9 changes: 3 additions & 6 deletions compiler/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ plugins {
kotlin("kapt")
id("library")
id("library.publishing")
id("com.gradleup.shadow")
`java-test-fixtures`
}

Expand All @@ -18,18 +17,15 @@ dependencies {
implementation(libs.dagger)
implementation(libs.dagger.hilt.core)
implementation(libs.ksp.api)
implementation(libs.auto.common)
api(libs.auto.common)
implementation(libs.kotlin.metadata)

implementation(projects.core)
implementation(projects.android.testing)
implementation(projects.thirdParty.androidx.room)
implementation(projects.thirdParty.ktorfit)
implementation(projects.thirdParty.retrofit)

implementation(projects.compiler.common)
compileShaded(libs.kotlinx.metadata) {
exclude("org.jetbrains.kotlin", "kotlin-stdlib")
}

implementation(libs.auto.service.annotations)
kapt(libs.auto.service)
Expand All @@ -41,4 +37,5 @@ dependencies {
testFixturesApi(libs.dagger)
testFixturesApi(libs.dagger.hilt.core)
testFixturesApi(libs.bundles.compileTesting)
testFixturesApi(projects.compiler.common)
}
2 changes: 1 addition & 1 deletion compiler/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

dependencies {
compileOnly(libs.kotlinx.metadata)
compileOnly(libs.kotlin.metadata)
compileOnly(libs.javapoet)
compileOnly(libs.bundles.kotlinpoet)
implementation(libs.dagger)
Expand Down
4 changes: 2 additions & 2 deletions compiler/common/test-utils/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ plugins {
}

dependencies {
api(projects.compiler.common.apply { targetConfiguration = "shadow" })
api(projects.compiler.common)
api(libs.bundles.jvmTesting)
api(libs.dagger.hilt.core)
api(libs.kotlinx.metadata)
api(libs.kotlin.metadata)
api(libs.ksp.api)
api(libs.bundles.compileTesting)
api(libs.okio)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import com.google.auto.common.MoreElements
import com.squareup.javapoet.AnnotationSpec
import com.squareup.javapoet.ClassName
import com.squareup.javapoet.TypeName
import kotlinx.metadata.ClassKind
import kotlinx.metadata.Modality
import kotlinx.metadata.Visibility
import kotlinx.metadata.kind
import kotlinx.metadata.modality
import kotlinx.metadata.visibility
import kotlin.metadata.ClassKind
import kotlin.metadata.Modality
import kotlin.metadata.Visibility
import kotlin.metadata.kind
import kotlin.metadata.modality
import kotlin.metadata.visibility
import se.ansman.dagger.auto.compiler.common.processing.ClassDeclaration
import javax.lang.model.element.Element
import javax.lang.model.element.ElementKind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.google.common.collect.ImmutableSetMultimap
import com.squareup.javapoet.AnnotationSpec
import com.squareup.javapoet.ClassName
import com.squareup.javapoet.TypeName
import kotlinx.metadata.jvm.KotlinClassMetadata
import kotlin.metadata.jvm.KotlinClassMetadata
import se.ansman.dagger.auto.compiler.common.TypeLookup
import se.ansman.dagger.auto.compiler.common.processing.AutoDaggerResolver
import se.ansman.dagger.auto.compiler.common.processing.ClassDeclaration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,17 @@ class KspCompilation(
symbolProcessorProviders.addAll(processorProviders())
}
}
.compileFixed()
.compile()
.let(::Result)

private fun KotlinCompilation.compileFixed(): JvmCompilationResult {
return compile()
// val result = synchronized(mutex) { compile() }
// // This works around a bug where compile-testing-kotlin returns OK even though KSP failed.
// if (
// result.exitCode == KotlinCompilation.ExitCode.OK &&
// "e: Error occurred in KSP, check log for detail" in result.messages
// ) {
// return JvmCompilationResult(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.messages, this, )
// }
// return result
}

private fun File.listSourceFiles(): Sequence<File> =
walkTopDown().filter { it.isFile && (it.extension == "java" || it.extension == "kt") }

override val JvmCompilationResult.filesGeneratedByAnnotationProcessor: Sequence<File>
get() = workingDir.resolve("ksp/sources").listSourceFiles()

class Factory(vararg processorProviders: () -> SymbolProcessorProvider) : Compilation.Factory {
private val processorProviders = { processorProviders.map { it() }}
private val processorProviders = { processorProviders.map { it() } }

override val expectedFilesDirectoryName: String
get() = "ksp"
Expand Down
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[versions]
kotlin = "2.0.21"
kotlin = "2.1.0"
dokka = "1.9.20"
compileTesting = "0.6.0"
compileTesting = "0.7.0"
autoService = "1.1.1"
incap = "1.0.0"
dagger = "2.52"
ksp = "2.0.21-1.0.28"
ksp = "2.1.0-1.0.29"
android-minSdk = "21"
android-compileSdk = "35"
androidx-test = "1.6.1"
Expand All @@ -28,7 +28,7 @@ kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotl
kotlin-jvm-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-compiler-embeddable = { module = "org.jetbrains.kotlin:kotlin-compiler-embeddable", version.ref = "kotlin" }

kotlinx-metadata = "org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.9.0"
kotlin-metadata = { module = "org.jetbrains.kotlin:kotlin-metadata-jvm", version.ref = "kotlin" }

dokka-gradlePlugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
dokka-versioningPlugin = { module = "org.jetbrains.dokka:versioning-plugin", version.ref = "dokka" }
Expand Down
17 changes: 13 additions & 4 deletions tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.android.build.api.variant.HasTestFixturesBuilder
import com.android.build.api.variant.HasUnitTestBuilder
import com.android.build.gradle.internal.lint.AndroidLintAnalysisTask
import com.google.devtools.ksp.gradle.KspTask
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

plugins {
id("com.android.application")
Expand Down Expand Up @@ -32,6 +33,14 @@ android {
}
}

kotlin {
compilerOptions {
// Needed until Hilt supports Kotlin 2.1:
// https://github.com/google/dagger/issues/4451
languageVersion = KotlinVersion.KOTLIN_2_0
}
}

androidComponents {
beforeVariants { variant ->
(variant as? HasAndroidTestBuilder)?.androidTest?.enable = variant.buildType == "debug"
Expand All @@ -47,8 +56,8 @@ ksp {
dependencies {
implementation(libs.retrofit.moshi)
implementation(libs.dagger.hilt.android)
"kaptJava"(projects.compiler) { targetConfiguration = "shadow" }
"kspKotlin"(projects.compiler) { targetConfiguration = "shadow" }
"kaptJava"(projects.compiler)
"kspKotlin"(projects.compiler)
"kaptJava"(libs.dagger.compiler)
"kspKotlin"(libs.dagger.compiler)
"kaptJava"(libs.dagger.hilt.compiler)
Expand All @@ -70,8 +79,8 @@ dependencies {

// Unit test
testImplementation(libs.dagger.hilt.android.testing)
"kaptTestJava"(projects.compiler) { targetConfiguration = "shadow" }
"kspTestKotlin"(projects.compiler) { targetConfiguration = "shadow" }
"kaptTestJava"(projects.compiler)
"kspTestKotlin"(projects.compiler)
// Compile Only is used here to ensure it's included by the android module
testCompileOnly(libs.androidx.startup)
"kaptTestJava"(libs.dagger.compiler)
Expand Down

0 comments on commit fe62676

Please sign in to comment.