[K/JS] Prepare JS Plain Objects plugin to publication

This commit is contained in:
Artem Kobzar
2024-01-17 10:52:58 +00:00
committed by Space Team
parent 561be747c1
commit dfe2d8651e
53 changed files with 479 additions and 393 deletions
@@ -0,0 +1,31 @@
description = "Kotlin JavaScript Plain Objects Compiler Plugin (CLI)"
plugins {
kotlin("jvm")
id("jps-compatible")
}
dependencies {
compileOnly(project(":compiler:util"))
compileOnly(project(":compiler:cli"))
compileOnly(project(":compiler:plugin-api"))
compileOnly(project(":compiler:fir:entrypoint"))
compileOnly(project(":compiler:ir.backend.common"))
implementation(project(":plugins:js-plain-objects:compiler-plugin:js-plain-objects.common"))
implementation(project(":plugins:js-plain-objects:compiler-plugin:js-plain-objects.backend"))
implementation(project(":plugins:js-plain-objects:compiler-plugin:js-plain-objects.k2"))
compileOnly(intellijCore())
}
optInToExperimentalCompilerApi()
sourceSets {
"main" { projectDefault() }
"test" { none() }
}
runtimeJar()
sourcesJar()
javadocJar()
@@ -0,0 +1,17 @@
#
# Copyright 2010-2023 JetBrains s.r.o.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
org.jetbrains.kotlinx.jspo.compiler.cli.JsPlainObjectsComponentRegistrar
@@ -0,0 +1,28 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlinx.jspo.compiler.cli
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrarAdapter
import org.jetbrains.kotlinx.jspo.compiler.backend.JsPlainObjectsLoweringExtension
import org.jetbrains.kotlinx.jspo.compiler.fir.JsPlainObjectsExtensionRegistrar
class JsPlainObjectsComponentRegistrar : CompilerPluginRegistrar() {
override val supportsK2: Boolean get() = true
override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) {
Companion.registerExtensions(this)
}
companion object {
fun registerExtensions(extensionStorage: ExtensionStorage) = with(extensionStorage) {
FirExtensionRegistrarAdapter.registerExtension(JsPlainObjectsExtensionRegistrar())
IrGenerationExtension.registerExtension(JsPlainObjectsLoweringExtension())
}
}
}