From 0b278cac8a732e0c0356f25f310f5e66d7089174 Mon Sep 17 00:00:00 2001 From: serge shustoff Date: Sat, 29 Apr 2023 16:56:42 +0200 Subject: [PATCH] build 1.1.0 for kotlin 1.7.21 --- .../DiktStorageComponentContainerContributor.kt | 1 - .../dikt/compiler/DiktComponentRegistrar.kt | 14 ++++++-------- ...ains.kotlin.compiler.plugin.ComponentRegistrar} | 0 .../dev/shustoff/dikt/compiler/CompileExt.kt | 4 ++-- .../dev/shustoff/dikt/gradle/DiktGradlePlugin.kt | 2 +- gradle.properties | 4 ++-- 6 files changed, 11 insertions(+), 14 deletions(-) rename dikt-compiler-plugin/src/main/resources/META-INF/services/{org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar => org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar} (100%) diff --git a/dikt-compiler-plugin-analysis/src/main/kotlin/dev/shustoff/dikt/compiler/DiktStorageComponentContainerContributor.kt b/dikt-compiler-plugin-analysis/src/main/kotlin/dev/shustoff/dikt/compiler/DiktStorageComponentContainerContributor.kt index 968816a..9de0cec 100644 --- a/dikt-compiler-plugin-analysis/src/main/kotlin/dev/shustoff/dikt/compiler/DiktStorageComponentContainerContributor.kt +++ b/dikt-compiler-plugin-analysis/src/main/kotlin/dev/shustoff/dikt/compiler/DiktStorageComponentContainerContributor.kt @@ -14,7 +14,6 @@ class DiktStorageComponentContainerContributor : StorageComponentContainerContri platform: TargetPlatform, moduleDescriptor: ModuleDescriptor ) { - super.registerModuleComponents(container, platform, moduleDescriptor) container.useInstance(DiktPlatformDiagnosticSuppressor()) container.useClashResolver(PlatformDiagnosticSuppressorClashesResolver()) } diff --git a/dikt-compiler-plugin/src/main/kotlin/dev/shustoff/dikt/compiler/DiktComponentRegistrar.kt b/dikt-compiler-plugin/src/main/kotlin/dev/shustoff/dikt/compiler/DiktComponentRegistrar.kt index 592e519..ef4981d 100644 --- a/dikt-compiler-plugin/src/main/kotlin/dev/shustoff/dikt/compiler/DiktComponentRegistrar.kt +++ b/dikt-compiler-plugin/src/main/kotlin/dev/shustoff/dikt/compiler/DiktComponentRegistrar.kt @@ -3,19 +3,17 @@ package dev.shustoff.dikt.compiler import dev.shustoff.dikt.incremental.incrementalHelper import dev.shustoff.dikt.message_collector.errorCollector import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension -import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar -import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi +import org.jetbrains.kotlin.com.intellij.mock.MockProject +import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor -@OptIn(ExperimentalCompilerApi::class) -class DiktComponentRegistrar : CompilerPluginRegistrar() { - override val supportsK2: Boolean get() = true +class DiktComponentRegistrar : ComponentRegistrar { - override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) { + override fun registerProjectComponents(project: MockProject, configuration: CompilerConfiguration) { val errorCollector = errorCollector(configuration) val incrementalCache = incrementalHelper(configuration) - StorageComponentContainerContributor.registerExtension(DiktStorageComponentContainerContributor()) - IrGenerationExtension.registerExtension(DiktIrGenerationExtension(errorCollector, incrementalCache)) + StorageComponentContainerContributor.registerExtension(project, DiktStorageComponentContainerContributor()) + IrGenerationExtension.registerExtension(project, DiktIrGenerationExtension(errorCollector, incrementalCache)) } } \ No newline at end of file diff --git a/dikt-compiler-plugin/src/main/resources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar b/dikt-compiler-plugin/src/main/resources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar similarity index 100% rename from dikt-compiler-plugin/src/main/resources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar rename to dikt-compiler-plugin/src/main/resources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar diff --git a/dikt-compiler-plugin/src/test/kotlin/dev/shustoff/dikt/compiler/CompileExt.kt b/dikt-compiler-plugin/src/test/kotlin/dev/shustoff/dikt/compiler/CompileExt.kt index decacfa..e5642fb 100644 --- a/dikt-compiler-plugin/src/test/kotlin/dev/shustoff/dikt/compiler/CompileExt.kt +++ b/dikt-compiler-plugin/src/test/kotlin/dev/shustoff/dikt/compiler/CompileExt.kt @@ -20,12 +20,12 @@ fun compile(root: File, vararg sourceFiles: SourceFile): KotlinCompilation.Resul workingDir = root //TODO: uncomment when fixed // compilerPluginRegistrars = listOf(DiktComponentRegistrar()) - componentRegistrars = listOf(DiktComponentRegistrarLegacy()) + componentRegistrars = listOf(DiktComponentRegistrar()) inheritClassPath = true sources = sourceFiles.asList() verbose = false useIR = true -// jvmTarget = JvmTarget.JVM_1_8.description + jvmTarget = JvmTarget.JVM_1_8.description }.compile() } diff --git a/dikt-gradle-plugin/src/main/kotlin/dev/shustoff/dikt/gradle/DiktGradlePlugin.kt b/dikt-gradle-plugin/src/main/kotlin/dev/shustoff/dikt/gradle/DiktGradlePlugin.kt index 71341e6..19ccc57 100644 --- a/dikt-gradle-plugin/src/main/kotlin/dev/shustoff/dikt/gradle/DiktGradlePlugin.kt +++ b/dikt-gradle-plugin/src/main/kotlin/dev/shustoff/dikt/gradle/DiktGradlePlugin.kt @@ -38,7 +38,7 @@ class DiktGradlePlugin : KotlinCompilerPluginSupportPlugin { } companion object { - private const val version = "1.1.0-kotlin-1.8.10" + private const val version = "1.1.0-kotlin-1.7.21" } } diff --git a/gradle.properties b/gradle.properties index 10c46f0..15633ee 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,10 +5,10 @@ kotlin.js.webpack.major.version=5 kotlin.compiler.execution.strategy=in-process org.gradle.jvmargs=-Xmx3g -kotlin_version=1.8.10 +kotlin_version=1.7.21 # don't forget to update DiktGradlePlugin -VERSION_NAME=1.1.0-kotlin-1.8.10 +VERSION_NAME=1.1.0-kotlin-1.7.21 dikt_sample_version=1.1.0-alpha6 GROUP=io.github.sergeshustoff.dikt