aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle.kts6
-rw-r--r--example/build.gradle.kts2
-rw-r--r--example/src/main/kotlin/test.kt1
-rw-r--r--kotlin-plugin/build.gradle.kts4
-rw-r--r--kotlin-plugin/src/main/kotlin/moe/nea/mcautotranslations/kotlin/MCAutoTranslationsCallTransformerAndCollector.kt20
5 files changed, 17 insertions, 16 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index 6f0311e..52b20d1 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -3,15 +3,15 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
- kotlin("jvm") version "2.1.20" apply false
- id("com.google.devtools.ksp") version "2.1.20-2.0.0" apply false
+ kotlin("jvm") version "2.2.21" apply false
+ id("com.google.devtools.ksp") version "2.2.21-2.0.4" apply false
id("com.gradle.plugin-publish") version "1.1.0" apply false
id("com.github.gmazzo.buildconfig") version "5.5.0" apply false
}
allprojects {
group = "moe.nea.mcautotranslations"
- version = "0.3.0"
+ version = "0.4.0"
repositories {
mavenCentral()
diff --git a/example/build.gradle.kts b/example/build.gradle.kts
index 888e996..4ede94a 100644
--- a/example/build.gradle.kts
+++ b/example/build.gradle.kts
@@ -1,5 +1,5 @@
plugins {
- kotlin("jvm") version "2.0.20"
+ kotlin("jvm") version "2.2.21"
id("moe.nea.mc-auto-translations")
application
}
diff --git a/example/src/main/kotlin/test.kt b/example/src/main/kotlin/test.kt
index c5132d4..b4831f9 100644
--- a/example/src/main/kotlin/test.kt
+++ b/example/src/main/kotlin/test.kt
@@ -24,4 +24,5 @@ fun main() {
println(tr("test3", "Goodbye ${Math.random()} ${Math.E}"))
println(OtherTest().testFunc(10, tr("lol", "Lolnea")))
println(Test2.x())
+ println("non tr test: ${Math.random()}")
}
diff --git a/kotlin-plugin/build.gradle.kts b/kotlin-plugin/build.gradle.kts
index 2f5f825..995dea9 100644
--- a/kotlin-plugin/build.gradle.kts
+++ b/kotlin-plugin/build.gradle.kts
@@ -14,8 +14,8 @@ dependencies {
testImplementation(kotlin("test-junit5"))
testImplementation("org.jetbrains.kotlin:kotlin-compiler-embeddable")
- testImplementation("dev.zacsweers.kctfork:core:0.7.0")
- testImplementation("dev.zacsweers.kctfork:ksp:0.7.0")
+ testImplementation("dev.zacsweers.kctfork:core:0.11.0")
+ testImplementation("dev.zacsweers.kctfork:ksp:0.11.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 822be0f..30d893a 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
@@ -40,7 +40,7 @@ class MCAutoTranslationsCallTransformerAndCollector(
val fqFunctionName = function.kotlinFqName
val translatedFunctionName = translationNames[fqFunctionName]
?: return super.visitCall(expression)
- if (expression.valueArgumentsCount != 2) {
+ if (expression.arguments.size != 2) {
messageCollector.report(
CompilerMessageSeverity.ERROR,
"Translation calls need to have exactly two arguments. Use $fqFunctionName(\"translation.key\", \"some \$template string\")",
@@ -48,21 +48,21 @@ class MCAutoTranslationsCallTransformerAndCollector(
)
return super.visitCall(expression)
}
- val translationKey = expression.getValueArgument(0).asStringConst()
+ val translationKey = expression.arguments[0].asStringConst()
if (translationKey == null) {
messageCollector.report(
CompilerMessageSeverity.ERROR,
"The key of a translation call needs to be a constant string. Use $fqFunctionName(\"translation.key\", \"some \$template string\")",
- (expression.getValueArgument(0) ?: expression).getCompilerMessageLocation(file)
+ (expression.arguments[0] ?: expression).getCompilerMessageLocation(file)
)
return super.visitCall(expression)
}
- val translationDefault = expression.getValueArgument(1).asStringDyn()
+ val translationDefault = expression.arguments[1].asStringDyn()
if (translationDefault == null) {
messageCollector.report(
CompilerMessageSeverity.ERROR,
"The default of a translation call needs to be a string template or constant. Use $fqFunctionName(\"translation.key\", \"some \$template string\")",
- (expression.getValueArgument(1) ?: expression).getCompilerMessageLocation(file)
+ (expression.arguments[1] ?: expression).getCompilerMessageLocation(file)
)
return super.visitCall(expression)
@@ -71,7 +71,7 @@ class MCAutoTranslationsCallTransformerAndCollector(
val builder = DeclarationIrBuilder(irPluginContext, symbol, expression.startOffset, expression.endOffset)
return builder.generateTemplate(
translatedFunctionName, translationKey,
- expression.getValueArgument(0)!!, translationDefault)
+ expression.arguments.get(0)!!, translationDefault)
}
fun DeclarationIrBuilder.generateTemplate(
@@ -89,9 +89,9 @@ class MCAutoTranslationsCallTransformerAndCollector(
replacementFunction,
replacementFunction.owner.returnType,
).apply {
- putValueArgument(0,
+ this.arguments.set(0,
constString(key, keySource.startOffset, keySource.endOffset))
- putValueArgument(1, varArgs)
+ this.arguments.set(1, varArgs)
}
}
@@ -125,8 +125,8 @@ class MCAutoTranslationsCallTransformerAndCollector(
.referenceConstructors(GatheredTranslation::class.java.toClassId()).single()
val annotations = templates.map {
builder.irCallConstructor(annotationCons, listOf()).apply {
- putValueArgument(0, constString(it.key))
- putValueArgument(1, constString(it.value))
+ arguments.set(0, constString(it.key))
+ arguments.set(1, constString(it.value))
}
}
val annotationContainer = file.declarations.singleOrNull()?.takeIf { it is IrClass } ?: file