diff --git a/.space/CODEOWNERS b/.space/CODEOWNERS index d83a85bd362..c8c015c7529 100644 --- a/.space/CODEOWNERS +++ b/.space/CODEOWNERS @@ -221,6 +221,7 @@ /core/compiler.common.js/ "Kotlin Compiler Core" /core/compiler.common.native/ "Kotlin Compiler Core" /core/compiler.common.wasm/ "Kotlin Compiler Core" +/core/compiler.common.web/ "Kotlin Compiler Core" /core/descriptors/ "Kotlin Compiler Core" /core/descriptors.jvm/ "Kotlin Compiler Core" /core/descriptors.runtime/ "Kotlin Libraries" diff --git a/build.gradle.kts b/build.gradle.kts index ae204f0deea..07af946b3a9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -152,6 +152,7 @@ val commonCompilerModules = arrayOf( ":core:compiler.common.js", ":core:compiler.common.native", ":core:compiler.common.wasm", + ":core:compiler.common.web", ":core:util.runtime", ":compiler:frontend.common.jvm", ":compiler:frontend.java", // TODO this is fe10 module but some utils used in fir ide now @@ -358,6 +359,7 @@ extra["kotlinJpsPluginEmbeddedDependencies"] = listOf( ":core:compiler.common.js", ":core:compiler.common.native", ":core:compiler.common.wasm", + ":core:compiler.common.web", ":core:descriptors", ":core:descriptors.jvm", ":compiler:backend.common.jvm", diff --git a/core/compiler.common.js/build.gradle.kts b/core/compiler.common.js/build.gradle.kts index 636b5c3c31b..eb20354a845 100644 --- a/core/compiler.common.js/build.gradle.kts +++ b/core/compiler.common.js/build.gradle.kts @@ -7,6 +7,7 @@ project.configureJvmToolchain(JdkMajorVersion.JDK_1_8) dependencies { api(project(":core:compiler.common")) + api(project(":core:compiler.common.web")) } sourceSets { diff --git a/core/compiler.common.wasm/build.gradle.kts b/core/compiler.common.wasm/build.gradle.kts index 636b5c3c31b..eb20354a845 100644 --- a/core/compiler.common.wasm/build.gradle.kts +++ b/core/compiler.common.wasm/build.gradle.kts @@ -7,6 +7,7 @@ project.configureJvmToolchain(JdkMajorVersion.JDK_1_8) dependencies { api(project(":core:compiler.common")) + api(project(":core:compiler.common.web")) } sourceSets { diff --git a/core/compiler.common.web/build.gradle.kts b/core/compiler.common.web/build.gradle.kts new file mode 100644 index 00000000000..636b5c3c31b --- /dev/null +++ b/core/compiler.common.web/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + kotlin("jvm") + id("jps-compatible") +} + +project.configureJvmToolchain(JdkMajorVersion.JDK_1_8) + +dependencies { + api(project(":core:compiler.common")) +} + +sourceSets { + "main" { projectDefault() } + "test" {} +} diff --git a/core/compiler.common.web/src/org/jetbrains/kotlin/name/WebCommonStandardClassIds.kt b/core/compiler.common.web/src/org/jetbrains/kotlin/name/WebCommonStandardClassIds.kt new file mode 100644 index 00000000000..9b8e68dcce0 --- /dev/null +++ b/core/compiler.common.web/src/org/jetbrains/kotlin/name/WebCommonStandardClassIds.kt @@ -0,0 +1,38 @@ +/* + * 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.kotlin.name + +import org.jetbrains.kotlin.name.StandardClassIds.BASE_KOTLIN_PACKAGE + +object WebCommonStandardClassIds { + val BASE_JS_PACKAGE = BASE_KOTLIN_PACKAGE.child(Name.identifier("js")) + + object Annotations { + @JvmField + val JsQualifier = "JsQualifier".jsId() + + @JvmField + val JsModule = "JsModule".jsId() + + @JvmField + val JsName = "JsName".jsId() + + @JvmField + val JsExport = "JsExport".jsId() + } + + object Callables { + @JvmField + val JsDefinedExternally = "definedExternally".callableId(BASE_JS_PACKAGE) + + @JvmField + val Js = "js".callableId(BASE_JS_PACKAGE) + } +} + +private fun String.jsId() = ClassId(WebCommonStandardClassIds.BASE_JS_PACKAGE, Name.identifier(this)) + +private fun String.callableId(packageName: FqName) = CallableId(packageName, Name.identifier(this)) diff --git a/settings.gradle b/settings.gradle index d813b9f5091..9989808cd75 100644 --- a/settings.gradle +++ b/settings.gradle @@ -115,6 +115,7 @@ include ":benchmarks", ":core:compiler.common.js", ":core:compiler.common.native", ":core:compiler.common.wasm", + ":core:compiler.common.web", ":compiler:backend.common.jvm", ":core:descriptors", ":core:descriptors.jvm",