Changed gradle files to be like in test project, wasmJsBrowser run appeared. Also added wasmJs to crypto-api gradle

This commit is contained in:
Maria Chernova 2024-12-26 01:03:48 +03:00 committed by kildishevps
parent 9f7fc6e379
commit bd83e9aee0
4 changed files with 51 additions and 12 deletions

View File

@ -26,3 +26,5 @@ org.gradle.jvmargs=-Xmx4g
android.useAndroidX=true
kotlin.js.webpack.major.version=4
kotlin.mpp.applyDefaultHierarchyTemplate=false

View File

@ -17,6 +17,7 @@
@file:Suppress("UnstableApiUsage")
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest
plugins {
@ -39,6 +40,19 @@ kotlin {
val hostOsName = getHostOsName()
runningOnLinuxx86_64 {
jvm()
// TODO: wasm тут копирует не апишный, если поменялся тот, то поменять и тут
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser {
testTask {
useKarma {
useChromeHeadless()
}
}
}
}
js(IR) {
browser {
testTask {
@ -142,6 +156,22 @@ kotlin {
}
}
// TODO: может сунуть обратно в ранинг онг линукс, как и то, что выше
val wasmJsMain by getting {
dependencies {
// implementation(kotlin(Deps.wasmJs.stdLib))
implementation(npm(Deps.wasmJs.Npm.libsodiumWrappers.first, Deps.wasmJs.Npm.libsodiumWrappers.second))
}
}
val wasmJsTest by getting {
dependencies {
implementation(npm(Deps.wasmJs.Npm.libsodiumWrappers.first, Deps.wasmJs.Npm.libsodiumWrappers.second))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
implementation(kotlin("test"))
}
}
runningOnMacos {
val tvosX64Main by getting {
dependsOn(commonMain)

View File

@ -17,10 +17,12 @@
@file:Suppress("UnstableApiUsage")
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest
plugins {
kotlin(PluginsDeps.multiplatform)
@ -702,16 +704,15 @@ tasks {
}
val jvmTest by getting(Test::class) {
testLogging {
events("PASSED", "FAILED", "SKIPPED")
exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = true
showStackTraces = true
}
}
if (getHostOsName() == "linux" && getHostArchitecture() == "x86-64") {
val jvmTest by getting(Test::class) {
testLogging {
events("PASSED", "FAILED", "SKIPPED")
exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = true
showStackTraces = true
}
}
val linuxX64Test by getting(KotlinNativeTest::class) {

View File

@ -19,6 +19,7 @@ pluginManagement {
repositories {
mavenCentral()
maven("https://plugins.gradle.org/m2/")
gradlePluginPortal()
}
resolutionStrategy {
@ -28,6 +29,11 @@ pluginManagement {
}
}
}
plugins {
kotlin("multiplatform") version "2.0.21"
kotlin("plugin.serialization") version "2.0.0"
}
}
rootProject.name = "KotlinMultiplatformLibsodium"
include("multiplatform-crypto-api")