use mp bintools and added more macos apple targets

This commit is contained in:
Sergey Chernov 2024-03-16 20:33:22 +01:00
parent 745eb9ccdf
commit c0ca802a30
4 changed files with 35 additions and 25 deletions

2
.idea/gradle.xml generated
View File

@ -5,7 +5,7 @@
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="17 (5)" />
<option name="gradleJvm" value="corretto-17" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />

View File

@ -34,18 +34,26 @@ kotlin {
// }
}
}
val hostOs = System.getProperty("os.name")
val isArm64 = System.getProperty("os.arch") == "aarch64"
val isMingwX64 = hostOs.startsWith("Windows")
@Suppress("UNUSED_VARIABLE")
val nativeTarget = when {
hostOs == "Mac OS X" && isArm64 -> macosArm64("native")
hostOs == "Mac OS X" && !isArm64 -> macosX64("native")
hostOs == "Linux" && isArm64 -> linuxArm64("native")
hostOs == "Linux" && !isArm64 -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
// val hostOs = System.getProperty("os.name")
// val isArm64 = System.getProperty("os.arch") == "aarch64"
// val isMingwX64 = hostOs.startsWith("Windows")
// @Suppress("UNUSED_VARIABLE")
// val nativeTarget = when {
// hostOs == "Mac OS X" && isArm64 -> macosArm64("native")
// hostOs == "Mac OS X" && !isArm64 -> macosX64("native")
// hostOs == "Linux" && isArm64 -> linuxArm64("native")
// hostOs == "Linux" && !isArm64 -> linuxX64("native")
// isMingwX64 -> mingwX64("native")
// else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
// }
macosArm64()
iosX64()
iosArm64()
iosSimulatorArm64()
linuxX64()
macosX64()
val ktor_version = "2.3.6"
@ -65,8 +73,8 @@ kotlin {
api("com.ionspin.kotlin:bignum:0.3.9")
api("io.ktor:ktor-client-core:$ktor_version")
api("net.sergeych:mp_bintools:0.0.6-SNAPSHOT")
api("net.sergeych:mp_stools:1.4.1")
api("net.sergeych:mp_bintools:0.1.1")
api("net.sergeych:mp_stools:1.4.7")
api("net.sergeych:crypto2:0.1.1-SNAPSHOT")
}
}
@ -93,12 +101,12 @@ kotlin {
}
}
val jsTest by getting
val nativeMain by getting {
dependencies {
implementation("io.ktor:ktor-client-cio:$ktor_version")
}
}
val nativeTest by getting
// val nativeMain by getting {
// dependencies {
// implementation("io.ktor:ktor-client-cio:$ktor_version")
// }
// }
// val nativeTest by getting
}
publishing {

View File

@ -13,7 +13,8 @@ import net.sergeych.crypto2.DecryptionFailedException
import net.sergeych.crypto2.SigningKey
import net.sergeych.crypto2.randomBytes
import net.sergeych.crypto2.randomUInt
import net.sergeych.tools.ProtectedOp
import net.sergeych.synctools.ProtectedOp
import net.sergeych.synctools.invoke
import net.sergeych.utools.pack
import net.sergeych.utools.unpack
import org.komputing.khash.keccak.Keccak
@ -111,7 +112,7 @@ data class KiloParams<S>(
val withFill = BipackEncoder.encode(FilledData(message, fill)).toUByteArray()
val n = proptectedOp { nonce++ }
val n = proptectedOp.invoke { nonce++ }
return pack(
Package(n, SecretBox.easy(withFill, encodeSendNonce(n), sessionKeyPair.sendKey))

View File

@ -9,7 +9,8 @@ import net.sergeych.kiloparsec.adapter.acceptTcpDevice
import net.sergeych.kiloparsec.adapter.connectTcpDevice
import net.sergeych.kiloparsec.adapter.toNetworkAddress
import net.sergeych.mp_logger.Log
import net.sergeych.tools.ProtectedOp
import net.sergeych.synctools.ProtectedOp
import net.sergeych.synctools.invoke
import org.junit.jupiter.api.Assertions.assertEquals
import kotlin.test.Test
import kotlin.test.assertContains
@ -47,7 +48,7 @@ class NetworkTest {
while (true) {
val x = device.input.receive()?.decodeFromUByteArray() ?: break
if (x.startsWith("die")) {
op {
op.invoke {
pills += x
}
cancel()