mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Kotlin] Use wasm.js and wasm.wasi as statistics
GitOrigin-RevId: 2e737fcf9cb12d3a2aa9508e3c8a2523126b4a52
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3566ea8042
commit
ffef0db30a
-2
@@ -1,2 +0,0 @@
|
||||
kotlin.code.style=official
|
||||
kotlin.js.compiler=ir
|
||||
+1
-1
@@ -10,7 +10,7 @@ repositories {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
wasm {
|
||||
wasmJs {
|
||||
binaries.executable()
|
||||
browser {}
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
kotlin.code.style=official
|
||||
kotlin.js.compiler=ir
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
plugins {
|
||||
kotlin("multiplatform") version "{{kotlin_plugin_version}}"
|
||||
}
|
||||
|
||||
group = "me.user"
|
||||
version = "1.0-SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
{ { kts_kotlin_plugin_repositories } }
|
||||
}
|
||||
|
||||
kotlin {
|
||||
wasmWasi {
|
||||
binaries.executable()
|
||||
nodejs {}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
val commonTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test-common"))
|
||||
implementation(kotlin("test-annotations-common"))
|
||||
}
|
||||
}
|
||||
|
||||
val wasmWasiTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test-wasm-wasi"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
rootProject.name = "wasm20221114"
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
{ { kts_kotlin_plugin_repositories } }
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
{ { kts_kotlin_plugin_repositories } }
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fun main() {
|
||||
println()
|
||||
}
|
||||
|
||||
fun greet() = "world"
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class TestClient {
|
||||
@Test
|
||||
fun testGreet() {
|
||||
assertEquals("world", greet())
|
||||
}
|
||||
}
|
||||
+1
-4
@@ -1,9 +1,6 @@
|
||||
package foo
|
||||
|
||||
@kotlin.js.JsExport
|
||||
fun jsMain() {
|
||||
Foo()
|
||||
fun wasmMain() {
|
||||
println()
|
||||
}
|
||||
|
||||
class Foo
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class JsTestClient {
|
||||
class WasmTestClient {
|
||||
@Test
|
||||
fun testGreet() {
|
||||
assertEquals("world", greet())
|
||||
+19
-1
@@ -388,7 +388,15 @@ fun getPlatform(module: Module): String {
|
||||
if (module.name.contains("android")) "jvm.android"
|
||||
else "jvm"
|
||||
}
|
||||
module.platform.isWasm() && hasKotlinWasmRuntimeInScope(module) -> "wasm"
|
||||
|
||||
module.platform.isWasm() -> {
|
||||
when {
|
||||
hasKotlinWasmJsRuntimeInScope(module) -> "wasm.js"
|
||||
hasKotlinWasmWasiRuntimeInScope(module) -> "wasm.wasi"
|
||||
else -> "wasm.unknown"
|
||||
}
|
||||
}
|
||||
|
||||
module.platform.isJs() && hasKotlinJsRuntimeInScope(module) -> "js"
|
||||
module.platform.isCommon() -> "common"
|
||||
module.platform.isNative() -> "native." + (module.platform?.componentPlatforms?.first()?.targetName ?: "unknown")
|
||||
@@ -436,6 +444,14 @@ fun hasKotlinWasmRuntimeInScope(module: Module): Boolean {
|
||||
return hasKotlinPlatformRuntimeInScope(module, KOTLIN_WASM_FQ_NAME, KotlinWasmLibraryKind)
|
||||
}
|
||||
|
||||
fun hasKotlinWasmJsRuntimeInScope(module: Module): Boolean {
|
||||
return hasKotlinPlatformRuntimeInScope(module, KOTLIN_WASM_JS_FQ_NAME, KotlinWasmLibraryKind)
|
||||
}
|
||||
|
||||
fun hasKotlinWasmWasiRuntimeInScope(module: Module): Boolean {
|
||||
return hasKotlinPlatformRuntimeInScope(module, KOTLIN_WASM_WASI_FQ_NAME, KotlinWasmLibraryKind)
|
||||
}
|
||||
|
||||
fun hasKotlinNativeRuntimeInScope(module: Module): Boolean {
|
||||
return hasKotlinPlatformRuntimeInScope(module, KOTLIN_NATIVE_FQ_NAME, KotlinNativeLibraryKind)
|
||||
}
|
||||
@@ -570,6 +586,8 @@ private fun getJvmTargetFromSdkOrDefault(
|
||||
|
||||
private val KOTLIN_JS_FQ_NAME = FqName("kotlin.js")
|
||||
private val KOTLIN_WASM_FQ_NAME = FqName("kotlin.wasm")
|
||||
private val KOTLIN_WASM_JS_FQ_NAME = FqName("kotlin.wasm.js")
|
||||
private val KOTLIN_WASM_WASI_FQ_NAME = FqName("kotlin.wasm.wasi")
|
||||
|
||||
private val KOTLIN_NATIVE_FQ_NAME = FqName("kotlin.native")
|
||||
|
||||
|
||||
+13
-2
@@ -57,7 +57,7 @@ internal class ProjectConfigurationCollector : ProjectUsagesCollector() {
|
||||
}
|
||||
}
|
||||
|
||||
private val GROUP = EventLogGroup("kotlin.project.configuration", 10)
|
||||
private val GROUP = EventLogGroup("kotlin.project.configuration", 11)
|
||||
|
||||
private val systemField = EventFields.String("system", listOf("JPS", "Maven", "Gradle", "unknown"))
|
||||
private val platformField = EventFields.String("platform", composePlatformFields())
|
||||
@@ -69,7 +69,18 @@ internal class ProjectConfigurationCollector : ProjectUsagesCollector() {
|
||||
|
||||
private fun composePlatformFields(): List<String> {
|
||||
return listOf(
|
||||
listOf("jvm", "jvm.android", "js", "wasm", "common", "native.unknown", "unknown"),
|
||||
listOf(
|
||||
"jvm",
|
||||
"jvm.android",
|
||||
"js",
|
||||
"wasm",
|
||||
"wasm.js",
|
||||
"wasm.wasi",
|
||||
"wasm.unknown",
|
||||
"common",
|
||||
"native.unknown",
|
||||
"unknown"
|
||||
),
|
||||
KonanTarget.predefinedTargets.keys.map { "native.$it" }
|
||||
).flatten()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user