Skip to content

Commit

Permalink
Update to Kotlin 2.0.20 (#621)
Browse files Browse the repository at this point in the history
* Prep for Kotlin 2.0.20

* beta2

* 2.0.20-RC2 + lint update

* Few more ir calls

* 2.0.20 final
  • Loading branch information
ZacSweers authored Aug 23, 2024
1 parent 183093a commit 746d762
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ subprojects {
configure<Lint> {
fatal += "KotlincFE10"
disable += "UnknownIssueId"
lintConfig = rootProject.layout.projectDirectory.file("config/lint/lint.xml").asFile
baseline = project.layout.projectDirectory.file("lint-baseline.xml").asFile
}
}
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ gjf = "1.17.0"
incap = "1.0.0"
jdk = "21"
jvmTarget = "11"
kotlin = "2.0.10"
kotlin = "2.0.20"
kotlinCompileTesting = "0.5.1"
kotlinpoet = "1.18.1"
ksp = "2.0.10-1.0.24"
ksp = "2.0.20-1.0.24"
ktfmt = "0.51"
moshi = "1.15.1"
okhttp = "4.12.0"
Expand All @@ -33,7 +33,7 @@ dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
kotlinBinaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.16.3" }
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
lint = { id = "com.android.lint", version = "8.6.0-rc01" }
lint = { id = "com.android.lint", version = "8.7.0-alpha06" }
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.29.0" }
mavenShadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" }
moshix = { id = "dev.zacsweers.moshix", version = "0.27.2" } # Always replaced by the local plugin
Expand Down
14 changes: 7 additions & 7 deletions moshi-ir/moshi-compiler-plugin/lint-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 8.6.0-alpha02" type="baseline" client="gradle" dependencies="false" name="AGP (8.6.0-alpha02)" variant="all" version="8.6.0-alpha02">
<issues format="6" by="lint 8.7.0-alpha06" type="baseline" client="gradle" dependencies="false" name="AGP (8.7.0-alpha06)" variant="all" version="8.7.0-alpha06">

<issue
id="IgnoreWithoutReason"
Expand Down Expand Up @@ -701,7 +701,7 @@
errorLine2=" ~~~~~~~~~~">
<location
file="src/main/kotlin/dev/zacsweers/moshix/ir/compiler/sealed/SealedAdapterGenerator.kt"
line="145"
line="148"
column="19"/>
</issue>

Expand All @@ -712,7 +712,7 @@
errorLine2=" ~~~~">
<location
file="src/main/kotlin/dev/zacsweers/moshix/ir/compiler/sealed/SealedAdapterGenerator.kt"
line="187"
line="194"
column="34"/>
</issue>

Expand All @@ -723,7 +723,7 @@
errorLine2=" ~~~~~~~~~">
<location
file="src/main/kotlin/dev/zacsweers/moshix/ir/compiler/sealed/SealedAdapterGenerator.kt"
line="375"
line="384"
column="14"/>
</issue>

Expand All @@ -734,7 +734,7 @@
errorLine2=" ~~~~~~~~~~">
<location
file="src/main/kotlin/dev/zacsweers/moshix/ir/compiler/sealed/SealedAdapterGenerator.kt"
line="376"
line="385"
column="31"/>
</issue>

Expand All @@ -745,7 +745,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/kotlin/dev/zacsweers/moshix/ir/compiler/sealed/SealedAdapterGenerator.kt"
line="409"
line="418"
column="24"/>
</issue>

Expand All @@ -756,7 +756,7 @@
errorLine2=" ~~~~">
<location
file="src/main/kotlin/dev/zacsweers/moshix/ir/compiler/sealed/SealedAdapterGenerator.kt"
line="622"
line="631"
column="18"/>
</issue>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ package dev.zacsweers.moshix.ir.compiler

import com.google.auto.service.AutoService
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.name.ClassId

Expand All @@ -34,7 +34,7 @@ public class MoshiComponentRegistrar : CompilerPluginRegistrar() {
val enableSealed = configuration[KEY_ENABLE_SEALED] ?: false

val messageCollector =
configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE)
configuration.get(CommonConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE)
val fqGeneratedAnnotation = configuration[KEY_GENERATED_ANNOTATION]?.let(ClassId::fromString)

IrGenerationExtension.registerExtension(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ import org.jetbrains.kotlin.ir.builders.IrGeneratorContext
import org.jetbrains.kotlin.ir.builders.declarations.addFunction
import org.jetbrains.kotlin.ir.builders.irBlockBody
import org.jetbrains.kotlin.ir.builders.irBoolean
import org.jetbrains.kotlin.ir.builders.irByte
import org.jetbrains.kotlin.ir.builders.irCall
import org.jetbrains.kotlin.ir.builders.irChar
import org.jetbrains.kotlin.ir.builders.irConcat
import org.jetbrains.kotlin.ir.builders.irInt
import org.jetbrains.kotlin.ir.builders.irLong
import org.jetbrains.kotlin.ir.builders.irNull
import org.jetbrains.kotlin.ir.builders.irReturn
import org.jetbrains.kotlin.ir.builders.irShort
import org.jetbrains.kotlin.ir.builders.irString
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrConstructor
Expand Down Expand Up @@ -183,8 +185,8 @@ internal fun IrBuilderWithScope.defaultPrimitiveValue(
when (type.getPrimitiveType()) {
PrimitiveType.BOOLEAN -> irBoolean(false)
PrimitiveType.CHAR -> irChar(0.toChar())
PrimitiveType.BYTE -> IrConstImpl.byte(startOffset, endOffset, type, 0)
PrimitiveType.SHORT -> IrConstImpl.short(startOffset, endOffset, type, 0)
PrimitiveType.BYTE -> irByte(0)
PrimitiveType.SHORT -> irShort(0)
PrimitiveType.INT -> irInt(0)
PrimitiveType.FLOAT -> IrConstImpl.float(startOffset, endOffset, type, 0.0f)
PrimitiveType.LONG -> irLong(0L)
Expand Down

0 comments on commit 746d762

Please sign in to comment.