Problem with 1.9.23 KMP version. It's been fixed in 2.0 so it needs to be updated
This commit is contained in:
parent
bd83e9aee0
commit
59f2d77890
@ -20,7 +20,7 @@ buildscript {
|
|||||||
dependencies {
|
dependencies {
|
||||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
|
||||||
classpath("com.android.tools.build:gradle:7.2.2")
|
classpath("com.android.tools.build:gradle:7.2.2")
|
||||||
classpath ("org.jetbrains.dokka:dokka-gradle-plugin:1.9.20")
|
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.9.20")
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -47,7 +47,7 @@ kotlin {
|
|||||||
browser {
|
browser {
|
||||||
testTask {
|
testTask {
|
||||||
useKarma {
|
useKarma {
|
||||||
useChromeHeadless()
|
useChrome()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ kotlin {
|
|||||||
implementation(Deps.Common.coroutines)
|
implementation(Deps.Common.coroutines)
|
||||||
|
|
||||||
// implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
|
// implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
|
||||||
// implementation(kotlin("test"))
|
implementation(kotlin("test"))
|
||||||
// implementation(kotlin("test-junit"))
|
// implementation(kotlin("test-junit"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -333,6 +333,24 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: это скопипасчено с блока runningOnLinuxx86_64 (примерно 590 строка)
|
||||||
|
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 {
|
||||||
|
dependsOn(commonTest)
|
||||||
|
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"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Set up shared source sets
|
//Set up shared source sets
|
||||||
//linux, linuxArm32Hfp, linuxArm64
|
//linux, linuxArm32Hfp, linuxArm64
|
||||||
val linux64Bit = setOf(
|
val linux64Bit = setOf(
|
||||||
@ -572,25 +590,6 @@ kotlin {
|
|||||||
runningOnLinuxx86_64 {
|
runningOnLinuxx86_64 {
|
||||||
println("Configuring Linux 64 Bit source sets")
|
println("Configuring Linux 64 Bit source sets")
|
||||||
|
|
||||||
val wasmJsMain by getting {
|
|
||||||
// TODO: разобраться (и с test)
|
|
||||||
dependencies {
|
|
||||||
// implementation(kotlin(Deps.wasmJs.stdLib))
|
|
||||||
implementation(npm(Deps.wasmJs.Npm.libsodiumWrappers.first, Deps.wasmJs.Npm.libsodiumWrappers.second))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val wasmJsTest by getting {
|
|
||||||
dependencies {
|
|
||||||
// implementation(kotlin(Deps.wasmJs.test))
|
|
||||||
implementation(npm(Deps.wasmJs.Npm.libsodiumWrappers.first, Deps.wasmJs.Npm.libsodiumWrappers.second))
|
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
|
|
||||||
// implementation("kotlinx-coroutines-test")
|
|
||||||
|
|
||||||
implementation(kotlin("test"))
|
|
||||||
implementation(kotlin("test-junit"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val jsMain by getting {
|
val jsMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin(Deps.Js.stdLib))
|
implementation(kotlin(Deps.Js.stdLib))
|
||||||
@ -742,12 +741,12 @@ tasks {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// TODO: ваще не жс тест, помогите
|
// TODO: ваще не жс тест, помогите
|
||||||
// val wasmJsBrowserTest by getting(KotlinJsTest::class) {
|
val wasmJsBrowserTest by getting(KotlinJsTest::class) {
|
||||||
// testLogging {
|
testLogging {
|
||||||
// events("PASSED", "FAILED", "SKIPPED")
|
events("PASSED", "FAILED", "SKIPPED")
|
||||||
// showStandardStreams = true
|
showStandardStreams = true
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
val jsBrowserTest by getting(KotlinJsTest::class) {
|
val jsBrowserTest by getting(KotlinJsTest::class) {
|
||||||
testLogging {
|
testLogging {
|
||||||
|
@ -17,6 +17,7 @@ class SmokeTest {
|
|||||||
//TODO Browser ignores our testBlocking, node works fine though
|
//TODO Browser ignores our testBlocking, node works fine though
|
||||||
@Test
|
@Test
|
||||||
fun testIfLibraryIsNotOnFire() {
|
fun testIfLibraryIsNotOnFire() {
|
||||||
|
throw Exception("aoaoao")
|
||||||
testBlocking {
|
testBlocking {
|
||||||
LibsodiumInitializer.initialize()
|
LibsodiumInitializer.initialize()
|
||||||
val hashResult = GenericHash.genericHash("Hello".encodeToUByteArray(), 64)
|
val hashResult = GenericHash.genericHash("Hello".encodeToUByteArray(), 64)
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
//package com.ionspin.kotlin.crypto.debug
|
||||||
|
|
||||||
|
import kotlin.test.Test
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
class TestTest {
|
||||||
|
@Test
|
||||||
|
fun wasmSymbolsTest() {
|
||||||
|
assertEquals(42, 42)
|
||||||
|
}
|
||||||
|
}
|
@ -4,8 +4,8 @@ import kotlin.test.Test
|
|||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
class WasmSymbolsTest {
|
class WasmSymbolsTest {
|
||||||
// @Test
|
@Test
|
||||||
// fun wasmSymbolsTest() {
|
fun wasmSymbolsTest() {
|
||||||
// assertEquals(42, 42)
|
assertEquals(42, 42)
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
17
package-lock.json
generated
Normal file
17
package-lock.json
generated
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "kotlin-multiplatform-libsodium",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"dependencies": {
|
||||||
|
"libsodium-sumo": "^0.7.15"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/libsodium-sumo": {
|
||||||
|
"version": "0.7.15",
|
||||||
|
"resolved": "https://registry.npmjs.org/libsodium-sumo/-/libsodium-sumo-0.7.15.tgz",
|
||||||
|
"integrity": "sha512-5tPmqPmq8T8Nikpm1Nqj0hBHvsLFCXvdhBFV7SGOitQPZAA6jso8XoL0r4L7vmfKXr486fiQInvErHtEvizFMw=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
@file:Suppress("UnstableApiUsage")
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
|
||||||
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.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||||||
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
|
||||||
|
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest
|
||||||
import org.jetbrains.kotlin.gradle.tasks.FatFrameworkTask
|
import org.jetbrains.kotlin.gradle.tasks.FatFrameworkTask
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
@ -82,6 +82,36 @@ kotlin {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalWasmDsl::class)
|
||||||
|
wasmJs {
|
||||||
|
browser {
|
||||||
|
webpackTask {
|
||||||
|
|
||||||
|
}
|
||||||
|
testTask {
|
||||||
|
useKarma {
|
||||||
|
useChrome()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binaries.executable()
|
||||||
|
// browser {
|
||||||
|
// val rootDirPath = project.rootDir.path
|
||||||
|
// val projectDirPath = project.projectDir.path
|
||||||
|
// commonWebpackConfig {
|
||||||
|
// outputFileName = "composeApp.js"
|
||||||
|
// devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply {
|
||||||
|
//// static = (static ?: mutableListOf()).apply {
|
||||||
|
//// // Serve sources to debug inside browser
|
||||||
|
//// add(rootDirPath)
|
||||||
|
//// add(projectDirPath)
|
||||||
|
//// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// binaries.executable()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
linuxX64("linux") {
|
linuxX64("linux") {
|
||||||
binaries {
|
binaries {
|
||||||
@ -207,6 +237,22 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
dependsOn(commonTest)
|
||||||
|
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"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// val nativeMain by creating {
|
// val nativeMain by creating {
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.LibsodiumInitializer
|
||||||
|
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
LibsodiumInitializer.initializeWithCallback {
|
||||||
|
// val hash = Hash.sha512("123".encodeToUByteArray())
|
||||||
|
// println("Hash (SHA512) of 123: ${hash.toHexString()}")
|
||||||
|
println("Hello")
|
||||||
|
}
|
||||||
|
}
|
12
sample/src/wasmJsMain/resources/index.html
Normal file
12
sample/src/wasmJsMain/resources/index.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Libsodium bindings sample app!</title>
|
||||||
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script src="sample.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user