aboutsummaryrefslogtreecommitdiff
path: root/kotlin-plugin
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-04-09 14:30:07 +0200
committerLinnea Gräf <nea@nea.moe>2025-04-09 14:30:07 +0200
commitd0b62df0460daa444805a5177a4955f782196d0c (patch)
treebbe768eaff3428c9a04aaf71e54323c00b2d77c9 /kotlin-plugin
parent5e0940a9691f373a6fda16b19e4d15724324829b (diff)
downloadmcautotranslations-d0b62df0460daa444805a5177a4955f782196d0c.tar.gz
mcautotranslations-d0b62df0460daa444805a5177a4955f782196d0c.tar.bz2
mcautotranslations-d0b62df0460daa444805a5177a4955f782196d0c.zip
feat: Port to K2 / Kotlin 2.1.20 / KSP 2.0.0
Diffstat (limited to 'kotlin-plugin')
-rw-r--r--kotlin-plugin/build.gradle.kts6
-rw-r--r--kotlin-plugin/src/main/kotlin/moe/nea/mcautotranslations/kotlin/MCAutoTranslationsCallTransformerAndCollector.kt12
-rw-r--r--kotlin-plugin/src/test/kotlin/moe/nea/mcautotranslations/TestTemplateReplacement.kt4
3 files changed, 11 insertions, 11 deletions
diff --git a/kotlin-plugin/build.gradle.kts b/kotlin-plugin/build.gradle.kts
index 0db911d..2f5f825 100644
--- a/kotlin-plugin/build.gradle.kts
+++ b/kotlin-plugin/build.gradle.kts
@@ -6,7 +6,7 @@ plugins {
dependencies {
compileOnly("org.jetbrains.kotlin:kotlin-compiler-embeddable")
- implementation("com.google.devtools.ksp:symbol-processing-api:1.9.23-1.0.20")
+ implementation("com.google.devtools.ksp:symbol-processing-api:2.1.20-2.0.0")
implementation(project(":annotations"))
ksp("dev.zacsweers.autoservice:auto-service-ksp:1.2.0")
@@ -14,8 +14,8 @@ dependencies {
testImplementation(kotlin("test-junit5"))
testImplementation("org.jetbrains.kotlin:kotlin-compiler-embeddable")
- testImplementation("dev.zacsweers.kctfork:core:0.5.1")
- testImplementation("dev.zacsweers.kctfork:ksp:0.5.1")
+ testImplementation("dev.zacsweers.kctfork:core:0.7.0")
+ testImplementation("dev.zacsweers.kctfork:ksp:0.7.0")
}
diff --git a/kotlin-plugin/src/main/kotlin/moe/nea/mcautotranslations/kotlin/MCAutoTranslationsCallTransformerAndCollector.kt b/kotlin-plugin/src/main/kotlin/moe/nea/mcautotranslations/kotlin/MCAutoTranslationsCallTransformerAndCollector.kt
index d87648d..822be0f 100644
--- a/kotlin-plugin/src/main/kotlin/moe/nea/mcautotranslations/kotlin/MCAutoTranslationsCallTransformerAndCollector.kt
+++ b/kotlin-plugin/src/main/kotlin/moe/nea/mcautotranslations/kotlin/MCAutoTranslationsCallTransformerAndCollector.kt
@@ -86,8 +86,8 @@ class MCAutoTranslationsCallTransformerAndCollector(
val varArgs = irVararg(context.irBuiltIns.anyType.makeNullable(), arguments)
return irCall(
- replacementFunction, replacementFunction.owner.returnType,
- valueArgumentsCount = 2,
+ replacementFunction,
+ replacementFunction.owner.returnType,
).apply {
putValueArgument(0,
constString(key, keySource.startOffset, keySource.endOffset))
@@ -139,8 +139,8 @@ class MCAutoTranslationsCallTransformerAndCollector(
text: String,
startOffset: Int = SYNTHETIC_OFFSET,
endOffset: Int = SYNTHETIC_OFFSET
- ): IrConst<String> =
- text.toIrConst(irPluginContext.irBuiltIns.stringType, startOffset, endOffset) as IrConst<String>
+ ): IrConst =
+ text.toIrConst(irPluginContext.irBuiltIns.stringType, startOffset, endOffset)
}
data class StringTemplate(
@@ -150,13 +150,13 @@ data class StringTemplate(
}
fun IrExpression?.asStringDyn(): StringTemplate? = when (this) {
- is IrConst<*> -> if (kind == IrConstKind.String) StringTemplate(this) else null
+ is IrConst -> if (kind == IrConstKind.String) StringTemplate(this) else null
is IrStringConcatenation -> StringTemplate(this.arguments)
else -> null
}
fun IrExpression?.asStringConst(): String? = when (this) {
- is IrConst<*> -> if (kind == IrConstKind.String) value as String else null
+ is IrConst -> if (kind == IrConstKind.String) value as String else null
is IrStringConcatenation -> this.arguments.singleOrNull().asStringConst()
else -> null
}
diff --git a/kotlin-plugin/src/test/kotlin/moe/nea/mcautotranslations/TestTemplateReplacement.kt b/kotlin-plugin/src/test/kotlin/moe/nea/mcautotranslations/TestTemplateReplacement.kt
index b4a7f18..a62ac30 100644
--- a/kotlin-plugin/src/test/kotlin/moe/nea/mcautotranslations/TestTemplateReplacement.kt
+++ b/kotlin-plugin/src/test/kotlin/moe/nea/mcautotranslations/TestTemplateReplacement.kt
@@ -10,7 +10,7 @@ class TestTemplateReplacement {
@Test
fun testX() {
val dollar = '$'
- compile(listOf(
+ val result = compile(listOf(
SourceFile.kotlin(
"test.kt",
"""
@@ -37,4 +37,4 @@ class TestTemplateReplacement {
)
))
}
-} \ No newline at end of file
+}