From 7fd3f41a450bacbf222c6a5cae408bd5288d1dc4 Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Wed, 4 Jan 2023 20:06:08 +0100 Subject: [PATCH] update Kotlin 1.8.0 --- .idea/codeStyles/Project.xml | 38 ---- .idea/codeStyles/codeStyleConfig.xml | 5 - .idea/encodings.xml | 4 - .idea/markdown-navigator.xml | 85 ------- .../markdown-navigator/profiles_settings.xml | 3 - .idea/misc.xml | 10 - ...inCompilerPluginHelloWorld.app.jvmMain.iml | 104 --------- ...inCompilerPluginHelloWorld.app.jvmTest.iml | 120 ---------- .../de.jensklingenberg.gradle-plugin.main.iml | 193 ---------------- .../de.jensklingenberg.gradle-plugin.test.iml | 209 ------------------ ...lingenberg.kotlin-compiler-plugin.main.iml | 193 ---------------- ...lingenberg.kotlin-compiler-plugin.test.iml | 191 ---------------- .idea/vcs.xml | 6 - Readme.md | 4 +- build.gradle | 2 +- buildSrc/build.gradle | 2 +- .../kotlin-native-plugin/build.gradle | 14 +- .../NativeComponentRegistrar.kt | 12 +- .../common/NativeCommandLineProcessor.kt | 1 - .../kotlin-plugin/build.gradle | 15 +- .../CommonComponentRegistrar.kt | 16 +- buildSrc/gradle-plugin/build.gradle | 2 +- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 24 files changed, 43 insertions(+), 1190 deletions(-) delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/markdown-navigator.xml delete mode 100644 .idea/markdown-navigator/profiles_settings.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules/app/KotlinCompilerPluginHelloWorld.app.jvmMain.iml delete mode 100644 .idea/modules/app/KotlinCompilerPluginHelloWorld.app.jvmTest.iml delete mode 100644 .idea/modules/gradle-plugin/de.jensklingenberg.gradle-plugin.main.iml delete mode 100644 .idea/modules/gradle-plugin/de.jensklingenberg.gradle-plugin.test.iml delete mode 100644 .idea/modules/kotlin-compiler-plugin/de.jensklingenberg.kotlin-compiler-plugin.main.iml delete mode 100644 .idea/modules/kotlin-compiler-plugin/de.jensklingenberg.kotlin-compiler-plugin.test.iml delete mode 100644 .idea/vcs.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index a9ea262..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 79ee123..0000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 15a15b2..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/markdown-navigator.xml b/.idea/markdown-navigator.xml deleted file mode 100644 index d030f38..0000000 --- a/.idea/markdown-navigator.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/markdown-navigator/profiles_settings.xml b/.idea/markdown-navigator/profiles_settings.xml deleted file mode 100644 index 57927c5..0000000 --- a/.idea/markdown-navigator/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 0d997d2..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/app/KotlinCompilerPluginHelloWorld.app.jvmMain.iml b/.idea/modules/app/KotlinCompilerPluginHelloWorld.app.jvmMain.iml deleted file mode 100644 index 2ae5e12..0000000 --- a/.idea/modules/app/KotlinCompilerPluginHelloWorld.app.jvmMain.iml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - KotlinCompilerPluginHelloWorld.app.commonMain - - COMPILATION_AND_SOURCE_SET_HOLDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/app/KotlinCompilerPluginHelloWorld.app.jvmTest.iml b/.idea/modules/app/KotlinCompilerPluginHelloWorld.app.jvmTest.iml deleted file mode 100644 index 4c959a8..0000000 --- a/.idea/modules/app/KotlinCompilerPluginHelloWorld.app.jvmTest.iml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - KotlinCompilerPluginHelloWorld.app.commonMain - KotlinCompilerPluginHelloWorld.app.commonTest - KotlinCompilerPluginHelloWorld.app.jvmMain - - COMPILATION_AND_SOURCE_SET_HOLDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/gradle-plugin/de.jensklingenberg.gradle-plugin.main.iml b/.idea/modules/gradle-plugin/de.jensklingenberg.gradle-plugin.main.iml deleted file mode 100644 index d1ecdad..0000000 --- a/.idea/modules/gradle-plugin/de.jensklingenberg.gradle-plugin.main.iml +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/gradle-plugin/de.jensklingenberg.gradle-plugin.test.iml b/.idea/modules/gradle-plugin/de.jensklingenberg.gradle-plugin.test.iml deleted file mode 100644 index e2aceeb..0000000 --- a/.idea/modules/gradle-plugin/de.jensklingenberg.gradle-plugin.test.iml +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/kotlin-compiler-plugin/de.jensklingenberg.kotlin-compiler-plugin.main.iml b/.idea/modules/kotlin-compiler-plugin/de.jensklingenberg.kotlin-compiler-plugin.main.iml deleted file mode 100644 index 2d4e8fd..0000000 --- a/.idea/modules/kotlin-compiler-plugin/de.jensklingenberg.kotlin-compiler-plugin.main.iml +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/kotlin-compiler-plugin/de.jensklingenberg.kotlin-compiler-plugin.test.iml b/.idea/modules/kotlin-compiler-plugin/de.jensklingenberg.kotlin-compiler-plugin.test.iml deleted file mode 100644 index 324c394..0000000 --- a/.idea/modules/kotlin-compiler-plugin/de.jensklingenberg.kotlin-compiler-plugin.test.iml +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Readme.md b/Readme.md index 0fbd7fd..7986e89 100644 --- a/Readme.md +++ b/Readme.md @@ -4,7 +4,7 @@ [![jCenter](https://img.shields.io/badge/Apache-2.0-green.svg )](https://github.com/Foso/KotlinReactNativeMpp/blob/master/LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) -[![jCenter](https://img.shields.io/badge/Kotlin-1.7.10-green.svg +[![jCenter](https://img.shields.io/badge/Kotlin-1.8.0-green.svg )](https://github.com/Foso/Sheasy/blob/master/LICENSE) @@ -26,7 +26,7 @@ This is an example project that shows how to create a Kotlin Compiler Plugin. At ## Usage > :information_source: Please be aware that the Kotlin Compiler still doesn’t have any stable API and there is no -> backwards compatibility guaranteed. Kotlin versions above 1.7.10 can have a totally different API. +> backwards compatibility guaranteed. Kotlin versions above 1.8.0 can have a totally different API. * Inside the project folder run ` ./gradlew clean build` diff --git a/build.gradle b/build.gradle index bee3f0c..a8167af 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ buildscript { } } plugins { - id 'org.jetbrains.kotlin.multiplatform' version '1.7.10' + id 'org.jetbrains.kotlin.multiplatform' version '1.8.0' } apply plugin: 'compiler.gradleplugin.helloworld' diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index b800ade..de516f1 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'org.jetbrains.kotlin.jvm' version '1.7.10' + id 'org.jetbrains.kotlin.jvm' version '1.8.0' } allprojects { diff --git a/buildSrc/compiler-plugin/kotlin-native-plugin/build.gradle b/buildSrc/compiler-plugin/kotlin-native-plugin/build.gradle index 74c32f3..957fb7a 100644 --- a/buildSrc/compiler-plugin/kotlin-native-plugin/build.gradle +++ b/buildSrc/compiler-plugin/kotlin-native-plugin/build.gradle @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask + plugins { id("maven-publish") @@ -16,9 +18,9 @@ repositories { } dependencies { - compileOnly "org.jetbrains.kotlin:kotlin-compiler" - compileOnly "com.google.auto.service:auto-service:1.0" - kapt "com.google.auto.service:auto-service:1.0" + compileOnly "org.jetbrains.kotlin:kotlin-compiler:1.8.0" + compileOnly "com.google.auto.service:auto-service:1.0.1" + kapt "com.google.auto.service:auto-service:1.0.1" } compileKotlin { @@ -41,4 +43,10 @@ publishing { repositories { } +} + +tasks.withType(KotlinCompilationTask).configureEach { + compilerOptions { + freeCompilerArgs.add("-opt-in=org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi") + } } \ No newline at end of file diff --git a/buildSrc/compiler-plugin/kotlin-native-plugin/src/main/java/de/jensklingenberg/NativeComponentRegistrar.kt b/buildSrc/compiler-plugin/kotlin-native-plugin/src/main/java/de/jensklingenberg/NativeComponentRegistrar.kt index d163fd2..6e8f18e 100644 --- a/buildSrc/compiler-plugin/kotlin-native-plugin/src/main/java/de/jensklingenberg/NativeComponentRegistrar.kt +++ b/buildSrc/compiler-plugin/kotlin-native-plugin/src/main/java/de/jensklingenberg/NativeComponentRegistrar.kt @@ -1,21 +1,22 @@ package de.jensklingenberg import com.google.auto.service.AutoService -import com.intellij.mock.MockProject import de.jensklingenberg.common.KEY_ENABLED import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.cli.common.config.kotlinSourceRoots import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity import org.jetbrains.kotlin.cli.common.messages.MessageCollector -import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar +import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar import org.jetbrains.kotlin.config.CompilerConfiguration -@AutoService(ComponentRegistrar::class) -class NativeComponentRegistrar : ComponentRegistrar { +@AutoService(CompilerPluginRegistrar::class) +class NativeComponentRegistrar : CompilerPluginRegistrar() { - override fun registerProjectComponents(project: MockProject, configuration: CompilerConfiguration) { + override val supportsK2: Boolean + get() = true + override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) { if (configuration[KEY_ENABLED] == false) { return } @@ -29,4 +30,5 @@ class NativeComponentRegistrar : ComponentRegistrar { ) } } + } diff --git a/buildSrc/compiler-plugin/kotlin-native-plugin/src/main/java/de/jensklingenberg/common/NativeCommandLineProcessor.kt b/buildSrc/compiler-plugin/kotlin-native-plugin/src/main/java/de/jensklingenberg/common/NativeCommandLineProcessor.kt index c75f0be..22f2027 100644 --- a/buildSrc/compiler-plugin/kotlin-native-plugin/src/main/java/de/jensklingenberg/common/NativeCommandLineProcessor.kt +++ b/buildSrc/compiler-plugin/kotlin-native-plugin/src/main/java/de/jensklingenberg/common/NativeCommandLineProcessor.kt @@ -7,7 +7,6 @@ import org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.config.CompilerConfigurationKey -@AutoService(CommandLineProcessor::class) // don't forget! class NativeCommandLineProcessor : CommandLineProcessor { override val pluginId: String = "helloWorldPlugin" diff --git a/buildSrc/compiler-plugin/kotlin-plugin/build.gradle b/buildSrc/compiler-plugin/kotlin-plugin/build.gradle index b0bf8dd..65e5f39 100644 --- a/buildSrc/compiler-plugin/kotlin-plugin/build.gradle +++ b/buildSrc/compiler-plugin/kotlin-plugin/build.gradle @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask + plugins { id 'org.jetbrains.kotlin.jvm' @@ -16,10 +18,9 @@ repositories { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib" - compileOnly "org.jetbrains.kotlin:kotlin-compiler-embeddable" - compileOnly "com.google.auto.service:auto-service:1.0" - kapt "com.google.auto.service:auto-service:1.0" + compileOnly "org.jetbrains.kotlin:kotlin-compiler-embeddable:1.8.0" + compileOnly "com.google.auto.service:auto-service:1.0.1" + kapt "com.google.auto.service:auto-service:1.0.1" } compileKotlin { @@ -43,4 +44,10 @@ publishing { repositories { } +} + +tasks.withType(KotlinCompilationTask).configureEach { + compilerOptions { + freeCompilerArgs.add("-opt-in=org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi") + } } \ No newline at end of file diff --git a/buildSrc/compiler-plugin/kotlin-plugin/src/main/java/de/jensklingenberg/CommonComponentRegistrar.kt b/buildSrc/compiler-plugin/kotlin-plugin/src/main/java/de/jensklingenberg/CommonComponentRegistrar.kt index b48d076..eae51a3 100644 --- a/buildSrc/compiler-plugin/kotlin-plugin/src/main/java/de/jensklingenberg/CommonComponentRegistrar.kt +++ b/buildSrc/compiler-plugin/kotlin-plugin/src/main/java/de/jensklingenberg/CommonComponentRegistrar.kt @@ -5,17 +5,16 @@ import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.cli.common.config.kotlinSourceRoots import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity import org.jetbrains.kotlin.cli.common.messages.MessageCollector -import org.jetbrains.kotlin.com.intellij.mock.MockProject -import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar +import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar import org.jetbrains.kotlin.config.CompilerConfiguration -@AutoService(ComponentRegistrar::class) -class CommonComponentRegistrar : ComponentRegistrar { - override fun registerProjectComponents( - project: MockProject, - configuration: CompilerConfiguration - ) { +@AutoService(CompilerPluginRegistrar::class) +class CommonComponentRegistrar : CompilerPluginRegistrar() { + override val supportsK2: Boolean + get() = true + + override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) { if (configuration[KEY_ENABLED] == false) { return } @@ -27,6 +26,5 @@ class CommonComponentRegistrar : ComponentRegistrar { "*** Hello from ***" + it.path ) } - } } diff --git a/buildSrc/gradle-plugin/build.gradle b/buildSrc/gradle-plugin/build.gradle index 19c81f9..04b1b75 100644 --- a/buildSrc/gradle-plugin/build.gradle +++ b/buildSrc/gradle-plugin/build.gradle @@ -23,7 +23,7 @@ gradlePlugin { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.7.10" + implementation "org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.8.0" } diff --git a/gradle.properties b/gradle.properties index 15327af..1d33e3b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,4 +4,4 @@ org.gradle.parallel=false org.gradle.configureondemand=false kotlin.compiler.execution.strategy=in-process kotlin.daemon.debug.log=true - +kotlin.js.compiler=ir diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 86c98ea..648948f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip