Update kotlin monorepo (#1614)

* Update kotlin monorepo

* Update ksp to v1.8.0-1.0.9

* Lower metadata to 0.5.0

* Update KCT

* Update to compilerOptions

* Suppress deprecation

* Add missing java target too

* Raise it again because it's broken on all

* Kotlin 1.8.20 + updated kotlinpoet

* Update kotlinpoet

* Update kotlin

* Fix KSP equality check for KotlinPoet 1.13.x

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Wharton <github@jakewharton.com>
Co-authored-by: Zac Sweers <pandanomic@gmail.com>
This commit is contained in:
renovate[bot]
2023-05-05 18:04:57 -04:00
committed by GitHub
parent bf4b83d1dc
commit c11f0e168c
9 changed files with 48 additions and 41 deletions

View File

@@ -13,15 +13,20 @@ plugins {
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
@Suppress("SuspiciousCollectionReassignment")
freeCompilerArgs += listOf(
compilerOptions {
freeCompilerArgs.addAll(
"-opt-in=com.squareup.kotlinpoet.metadata.KotlinPoetMetadataPreview",
"-opt-in=com.squareup.moshi.kotlin.codegen.api.InternalMoshiCodegenApi",
)
}
}
tasks.compileTestKotlin {
compilerOptions {
freeCompilerArgs.add("-opt-in=org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi")
}
}
// --add-opens for kapt to work. KGP covers this for us but local JVMs in tests do not
tasks.withType<Test>().configureEach {
jvmArgs(

View File

@@ -262,8 +262,12 @@ public class AdapterGenerator(
val typeRenderer: TypeRenderer = object : TypeRenderer() {
override fun renderTypeVariable(typeVariable: TypeVariableName): CodeBlock {
val index = typeVariables.indexOfFirst { it == typeVariable }
check(index != -1) { "Unexpected type variable $typeVariable" }
// Match only by name because equality checks for more things than just the name. For example, a base class
// may declare "T" but the subclass declares "T : Number", which is legal but will fail an equals() test.
val index = typeVariables.indexOfFirst { it.name == typeVariable.name }
check(index != -1) {
"Unexpected type variable $typeVariable"
}
return CodeBlock.of("%N[%L]", typesParam, index)
}
}
@@ -618,7 +622,10 @@ public class AdapterGenerator(
if (useDefaultsConstructor) {
// Add the masks and a null instance for the trailing default marker instance
result.addCode(",\n%L,\n/*·DefaultConstructorMarker·*/·null", maskNames.map { CodeBlock.of("%L", it) }.joinToCode(", "))
result.addCode(
",\n%L,\n/*·DefaultConstructorMarker·*/·null",
maskNames.map { CodeBlock.of("%L", it) }.joinToCode(", "),
)
}
result.addCode("\n»)\n")