Skip to content

Commit ad14616

Browse files
committed
Update template to Kotlin 2.3.0
1 parent 8c8bbe9 commit ad14616

File tree

14 files changed

+36
-35
lines changed

14 files changed

+36
-35
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
2-
kotlin("multiplatform") version "2.2.20" apply false
3-
kotlin("jvm") version "2.2.20" apply false
2+
kotlin("multiplatform") version "2.3.0-Beta1" apply false
3+
kotlin("jvm") version "2.3.0-Beta1" apply false
44
id("com.github.gmazzo.buildconfig") version "5.6.5"
55
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.16.3" apply false
66
}

compiler-plugin/build.gradle.kts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ idea {
2424
}
2525

2626
val annotationsRuntimeClasspath: Configuration by configurations.creating { isTransitive = false }
27+
val testArtifacts: Configuration by configurations.creating
2728

2829
dependencies {
2930
compileOnly(kotlin("compiler"))
@@ -35,11 +36,12 @@ dependencies {
3536
annotationsRuntimeClasspath(project(":plugin-annotations"))
3637

3738
// Dependencies required to run the internal test framework.
38-
testRuntimeOnly("junit:junit:4.13.2")
39-
testRuntimeOnly(kotlin("reflect"))
40-
testRuntimeOnly(kotlin("test"))
41-
testRuntimeOnly(kotlin("script-runtime"))
42-
testRuntimeOnly(kotlin("annotations-jvm"))
39+
testArtifacts(kotlin("stdlib"))
40+
testArtifacts(kotlin("stdlib-jdk8"))
41+
testArtifacts(kotlin("reflect"))
42+
testArtifacts(kotlin("test"))
43+
testArtifacts(kotlin("script-runtime"))
44+
testArtifacts(kotlin("annotations-jvm"))
4345
}
4446

4547
buildConfig {
@@ -95,10 +97,8 @@ tasks.compileTestKotlin {
9597
}
9698

9799
fun Test.setLibraryProperty(propName: String, jarName: String) {
98-
val path = project.configurations
99-
.testRuntimeClasspath.get()
100-
.files
101-
.find { """$jarName-\d.*jar""".toRegex().matches(it.name) }
100+
val path = testArtifacts.files
101+
.find { """$jarName-\d.*""".toRegex().matches(it.name) }
102102
?.absolutePath
103103
?: return
104104
systemProperty(propName, path)

compiler-plugin/src/org/jetbrains/kotlin/compiler/plugin/template/SimpleCommandLineProcessor.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import org.jetbrains.kotlin.config.CompilerConfiguration
77

88
@Suppress("unused") // Used via reflection.
99
class SimpleCommandLineProcessor : CommandLineProcessor {
10-
override val pluginId: String = BuildConfig.KOTLIN_PLUGIN_ID
11-
12-
override val pluginOptions: Collection<CliOption> = emptyList()
10+
override val pluginId: String
11+
get() = BuildConfig.KOTLIN_PLUGIN_ID
12+
override val pluginOptions: Collection<CliOption>
13+
get() = emptyList()
1314

1415
override fun processOption(option: AbstractCliOption, value: String, configuration: CompilerConfiguration) {
1516
error("Unexpected config option: '${option.optionName}'")

compiler-plugin/src/org/jetbrains/kotlin/compiler/plugin/template/SimplePluginComponentRegistrar.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import org.jetbrains.kotlin.compiler.plugin.template.ir.SimpleIrGenerationExtens
66
import org.jetbrains.kotlin.config.CompilerConfiguration
77
import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrarAdapter
88

9-
class SimplePluginComponentRegistrar: CompilerPluginRegistrar() {
9+
class SimplePluginComponentRegistrar : CompilerPluginRegistrar() {
10+
override val pluginId: String
11+
get() = BuildConfig.KOTLIN_PLUGIN_ID
1012
override val supportsK2: Boolean
1113
get() = true
1214

compiler-plugin/test-fixtures/org/jetbrains/kotlin/compiler/plugin/template/GenerateTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package org.jetbrains.kotlin.compiler.plugin.template
22

33
import org.jetbrains.kotlin.compiler.plugin.template.runners.AbstractJvmBoxTest
44
import org.jetbrains.kotlin.compiler.plugin.template.runners.AbstractJvmDiagnosticTest
5-
import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5
5+
import org.jetbrains.kotlin.generators.dsl.junit5.generateTestGroupSuiteWithJUnit5
66

77
fun main() {
88
generateTestGroupSuiteWithJUnit5 {

compiler-plugin/test-gen/org/jetbrains/kotlin/compiler/plugin/template/runners/JvmBoxTestGenerated.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import com.intellij.testFramework.TestDataPath;
66
import org.jetbrains.kotlin.test.util.KtTestUtil;
7-
import org.jetbrains.kotlin.test.TargetBackend;
87
import org.jetbrains.kotlin.test.TestMetadata;
98
import org.junit.jupiter.api.Test;
109

@@ -18,7 +17,7 @@
1817
public class JvmBoxTestGenerated extends AbstractJvmBoxTest {
1918
@Test
2019
public void testAllFilesPresentInBox() {
21-
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler-plugin/testData/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
20+
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler-plugin/testData/box"), Pattern.compile("^(.+)\\.kt$"), null, true);
2221
}
2322

2423
@Test

compiler-plugin/test-gen/org/jetbrains/kotlin/compiler/plugin/template/runners/JvmDiagnosticTestGenerated.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import com.intellij.testFramework.TestDataPath;
66
import org.jetbrains.kotlin.test.util.KtTestUtil;
7-
import org.jetbrains.kotlin.test.TargetBackend;
87
import org.jetbrains.kotlin.test.TestMetadata;
98
import org.junit.jupiter.api.Test;
109

@@ -18,7 +17,7 @@
1817
public class JvmDiagnosticTestGenerated extends AbstractJvmDiagnosticTest {
1918
@Test
2019
public void testAllFilesPresentInDiagnostics() {
21-
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler-plugin/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
20+
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler-plugin/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), null, true);
2221
}
2322

2423
@Test

compiler-plugin/testData/box/anotherBoxTest.fir.ir.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ FILE fqName:<root> fileName:/anotherBoxTest.kt
3333
then: STRING_CONCATENATION type=kotlin.String
3434
CONST String type=kotlin.String value="Fail: "
3535
GET_VAR 'val result: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
36-
FILE fqName:foo.bar fileName:__GENERATED DECLARATIONS__.kt
36+
FILE fqName:foo.bar fileName:foo/bar/MyClass.kt
3737
CLASS GENERATED[org.jetbrains.kotlin.compiler.plugin.template.fir.SimpleClassGenerator.Key] CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]
3838
thisReceiver: VALUE_PARAMETER INSTANCE_RECEIVER kind:DispatchReceiver name:<this> type:foo.bar.MyClass
3939
CONSTRUCTOR GENERATED[org.jetbrains.kotlin.compiler.plugin.template.fir.SimpleClassGenerator.Key] visibility:public returnType:foo.bar.MyClass

compiler-plugin/testData/box/anotherBoxTest.fir.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ FILE: anotherBoxTest.kt
1515
}
1616

1717
}
18-
FILE: __GENERATED DECLARATIONS__.kt
18+
FILE: foo/bar/MyClass.kt
1919
package foo.bar
2020

2121
public final class MyClass : R|kotlin/Any| {

compiler-plugin/testData/box/simple.fir.ir.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ FILE fqName:foo.bar fileName:/simple.kt
1818
STRING_CONCATENATION type=kotlin.String
1919
CONST String type=kotlin.String value="Fail: "
2020
GET_VAR 'val result: kotlin.String declared in foo.bar.box' type=kotlin.String origin=null
21-
FILE fqName:foo.bar fileName:__GENERATED DECLARATIONS__.kt
21+
FILE fqName:foo.bar fileName:foo/bar/MyClass.kt
2222
CLASS GENERATED[org.jetbrains.kotlin.compiler.plugin.template.fir.SimpleClassGenerator.Key] CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]
2323
thisReceiver: VALUE_PARAMETER INSTANCE_RECEIVER kind:DispatchReceiver name:<this> type:foo.bar.MyClass
2424
CONSTRUCTOR GENERATED[org.jetbrains.kotlin.compiler.plugin.template.fir.SimpleClassGenerator.Key] visibility:public returnType:foo.bar.MyClass

0 commit comments

Comments
 (0)