Merge pull request #11 from ionspin/kotlin-1.5.21

Kotlin 1.5.21
This commit is contained in:
Ugljesa Jovanovic 2021-07-19 20:15:12 +00:00 committed by GitHub
commit 763471f745
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 81 additions and 209 deletions

View File

@ -2,6 +2,9 @@
(All dates are DD.MM.YYYY)
#### 0.8.4-SNAPSHOT
- Bump to kotlin 1.5.21
- Libsodium.js bump to 0.7.9
- Removed bintray/jcenter repositories
#### 0.8.3 - 28.5.2021
- Built with kotlin 1.5.10

View File

@ -20,11 +20,8 @@ buildscript {
repositories {
mavenCentral()
google()
maven ("https://kotlin.bintray.com/kotlinx")
maven ("https://dl.bintray.com/kotlin/kotlin-eap")
maven ("https://dl.bintray.com/kotlin/kotlin-dev")
gradlePluginPortal()
jcenter()
}
dependencies {
@ -39,10 +36,6 @@ allprojects {
repositories {
mavenCentral()
google()
maven ("https://kotlin.bintray.com/kotlinx")
maven ("https://dl.bintray.com/kotlin/kotlin-eap")
maven ("https://dl.bintray.com/kotlin/kotlin-dev")
jcenter()
maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
}

View File

@ -24,9 +24,6 @@ plugins {
repositories {
mavenCentral()
maven ("https://dl.bintray.com/kotlin/kotlin-eap")
maven("https://dl.bintray.com/kotlin/kotlin-dev")
jcenter()
google()
}

View File

@ -16,12 +16,12 @@
object Versions {
val kotlinCoroutines = "1.5.0-native-mt"
val kotlin = "1.5.10"
val kotlin = "1.5.21"
val kotlinSerialization = "1.0.1"
val kotlinSerializationPlugin = "1.5.10"
val atomicfu = "0.14.3-M2-2-SNAPSHOT" //NOTE: my linux arm32 and arm64 build
val nodePlugin = "1.3.0"
val dokkaPlugin = "1.4.0-rc"
val dokkaPlugin = "1.5.0"
val taskTreePlugin = "1.5"
val kotlinBigNumVersion = "0.2.8"
val jna = "5.7.0"
@ -31,7 +31,7 @@ object Versions {
val timber = "4.7.1"
val kodeinVersion = "7.1.0"
val resourceLoader = "1.3.10"
val resourceLoader = "2.0.1"
@ -67,10 +67,10 @@ object Deps {
object Js {
object JsVersions {
val react = "16.13.1-pre.124-kotlin-1.4.10"
val reactNpm = "16.13.1"
val styled = "5.2.0-pre.124-kotlin-1.4.10"
val styledNpm = "1.0.0"
val react = "17.0.2-pre.218-kotlin-1.5.21"
val reactNpm = "17.0.2"
val styled = "5.3.0-pre.218-kotlin-1.5.21"
val styledNpm = "5.3.0"
}
@ -83,21 +83,11 @@ object Deps {
val ktorClientSerialization = "io.ktor:ktor-client-serialization-js:${Versions.ktor}"
val ktorClientWebSockets = "io.ktor:ktor-client-websockets-js:${Versions.ktor}"
object React {
val react = "org.jetbrains:kotlin-react:${JsVersions.react}"
val reactDom = "org.jetbrains:kotlin-react-dom:${JsVersions.react}"
val styled = "org.jetbrains:kotlin-styled:${JsVersions.styled}"
}
object Npm {
val libsodium = Pair("libsodium-wrappers-sumo", "0.7.8")
val libsodium = Pair("libsodium-wrappers-sumo", "0.7.9")
//val libsodiumWrappers = Pair("libsodium-wrappers-sumo", "file:${getProjectPath()}/multiplatform-crypto-delegated/libsodium-wrappers-sumo-0.7.6.tgz")
val libsodiumWrappers = Pair("libsodium-wrappers-sumo", "0.7.8")
val reactPair = Pair("react", JsVersions.reactNpm)
val reactDomPair = Pair("react-dom", JsVersions.reactNpm)
val styledComponentsPair = Pair("styled-components", "5.2.0")
val inlineStylePrefixesPair = Pair("inline-style-prefixer", "6.0.0")
val libsodiumWrappers = Pair("libsodium-wrappers-sumo", "0.7.9")
}
}
@ -114,7 +104,7 @@ object Deps {
val kotlinPoet = "com.squareup:kotlinpoet:${Versions.kotlinPoet}"
val resourceLoader = "co.libly:resource-loader:${Versions.resourceLoader}"
val resourceLoader = "com.goterl:resource-loader:${Versions.resourceLoader}"
object Delegated {
val jna = "net.java.dev.jna:jna:${Versions.jna}"

View File

@ -24,3 +24,5 @@ kotlin.native.disableCompilerDaemon=true
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=4096m
android.useAndroidX=true
kotlin.js.webpack.major.version=4

View File

@ -16,6 +16,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -30,8 +30,6 @@ plugins {
repositories {
mavenCentral()
jcenter()
}
group = ReleaseInfo.group
version = ReleaseInfo.version

View File

@ -47,7 +47,6 @@ val sonatypeUsernameEnv: String? = System.getenv()["SONATYPE_USERNAME"]
repositories {
mavenCentral()
jcenter()
maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
}
@ -89,9 +88,11 @@ kotlin {
}
jvm()
val projectRef = project
runningOnLinuxx86_64 {
println("Configuring Linux X86-64 targets")
js(IR) {
browser {
testTask {
@ -112,11 +113,11 @@ kotlin {
linuxX64() {
compilations.getByName("main") {
val libsodiumCinterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-linux-x86-64/include/")
defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-linux-x86-64/include/")
}
kotlinOptions.freeCompilerArgs = listOf(
"-include-binary", "${project.rootDir}/sodiumWrapper/static-linux-x86-64/lib/libsodium.a"
"-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-linux-x86-64/lib/libsodium.a"
)
}
binaries {
@ -185,11 +186,11 @@ kotlin {
}
compilations.getByName("main") {
val libsodiumCinterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-macos-x86-64/include")
defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-macos-x86-64/include")
}
kotlinOptions.freeCompilerArgs = listOf(
"-include-binary", "${project.rootDir}/sodiumWrapper/static-macos-x86-64/lib/libsodium.a"
"-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-macos-x86-64/lib/libsodium.a"
)
}
}
@ -241,11 +242,11 @@ kotlin {
}
compilations.getByName("main") {
val libsodiumCinterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-mingw-x86-64/include")
defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-mingw-x86-64/include")
}
kotlinOptions.freeCompilerArgs = listOf(
"-include-binary", "${project.rootDir}/sodiumWrapper/static-mingw-x86-64/lib/libsodium.a"
"-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-mingw-x86-64/lib/libsodium.a"
)
}
}
@ -351,11 +352,11 @@ kotlin {
compilations.getByName("main") {
val libsodiumCinterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-arm64/include/")
defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-arm64/include/")
}
kotlinOptions.freeCompilerArgs = listOf(
"-include-binary", "${project.rootDir}/sodiumWrapper/static-arm64/lib/libsodium.a"
"-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-arm64/lib/libsodium.a"
)
}
}
@ -370,11 +371,11 @@ kotlin {
defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies))
println("Setting ios cinterop for $this")
val libsodiumCinterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-ios/include")
defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-ios/include")
}
kotlinOptions.freeCompilerArgs = listOf(
"-include-binary", "${project.rootDir}/sodiumWrapper/static-ios/lib/libsodium.a"
"-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-ios/lib/libsodium.a"
)
}
@ -382,11 +383,11 @@ kotlin {
defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies))
println("Setting ios cinterop for $this")
val libsodiumCinterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-ios-simulators/include")
defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-ios-simulators/include")
}
kotlinOptions.freeCompilerArgs = listOf(
"-include-binary", "${project.rootDir}/sodiumWrapper/static-ios-simulators/lib/libsodium.a"
"-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-ios-simulators/lib/libsodium.a"
)
}
@ -394,11 +395,11 @@ kotlin {
defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies))
println("Setting ios cinterop for $this")
val libsodiumCinterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-tvos/include")
defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-tvos/include")
}
kotlinOptions.freeCompilerArgs = listOf(
"-include-binary", "${project.rootDir}/sodiumWrapper/static-tvos/lib/libsodium.a"
"-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-tvos/lib/libsodium.a"
)
}
@ -406,11 +407,11 @@ kotlin {
defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies))
println("Setting ios cinterop for $this")
val libsodiumCinterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-tvos-simulators/include")
defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-tvos-simulators/include")
}
kotlinOptions.freeCompilerArgs = listOf(
"-include-binary", "${project.rootDir}/sodiumWrapper/static-tvos-simulators/lib/libsodium.a"
"-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-tvos-simulators/lib/libsodium.a"
)
}
@ -418,11 +419,11 @@ kotlin {
defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies))
println("Setting ios cinterop for $this")
val libsodiumCinterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-watchos/include")
defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-watchos/include")
}
kotlinOptions.freeCompilerArgs = listOf(
"-include-binary", "${project.rootDir}/sodiumWrapper/static-watchos/lib/libsodium.a"
"-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-watchos/lib/libsodium.a"
)
}
@ -430,11 +431,11 @@ kotlin {
defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies))
println("Setting ios cinterop for $this")
val libsodiumCinterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-watchos-simulators/include")
defFile(projectRef.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${projectRef.rootDir}/sodiumWrapper/static-watchos-simulators/include")
}
kotlinOptions.freeCompilerArgs = listOf(
"-include-binary", "${project.rootDir}/sodiumWrapper/static-watchos-simulators/lib/libsodium.a"
"-include-binary", "${projectRef.rootDir}/sodiumWrapper/static-watchos-simulators/lib/libsodium.a"
)
}
@ -602,21 +603,19 @@ tasks {
dokkaJavadoc {
create<Jar>("javadocJar") {
dependsOn(dokkaHtml)
archiveClassifier.set("javadoc")
from(dokkaHtml.get().outputDirectory)
}
dokkaHtml {
println("Dokka !")
dokkaSourceSets {
create("commonMain") {
displayName = "common"
platform = "common"
}
}
}
create<Jar>("javadocJar") {
dependsOn(dokkaJavadoc)
archiveClassifier.set("javadoc")
from(dokkaJavadoc.get().outputDirectory)
}
if (getHostOsName() == "linux" && getHostArchitecture() == "x86-64") {
val jvmTest by getting(Test::class) {
testLogging {
@ -753,18 +752,5 @@ publishing {
}
}
//configurations.forEach {
//
// if (it.name == "linuxCompileKlibraries") {
// println("Configuration name: ${it.name}")
// it.attributes {
// this.keySet().forEach { key ->
// val attribute = getAttribute(key)
// println(" |-- Attribute $key ${attribute}")
// attribute(org.jetbrains.kotlin.gradle.plugin.ProjectLocalConfigurations.ATTRIBUTE, "publicZ")
// }
// }
// }
//}

View File

@ -44,6 +44,8 @@ class BoxTest {
assertFailsWith<BoxCorruptedOrTamperedDataException>() {
val tampered = encrypted.copyOf()
tampered[1] = 0U
tampered[2] = 0U
tampered[3] = 0U
Box.openEasy(tampered, messageNonce, senderKeypair.publicKey, recipientKeypair.secretKey)
}
}
@ -71,6 +73,8 @@ class BoxTest {
assertFailsWith<BoxCorruptedOrTamperedDataException>() {
val tampered = encrypted.ciphertext.copyOf()
tampered[1] = 0U
tampered[2] = 0U
tampered[3] = 0U
Box.openDetached(
tampered,
encrypted.tag,
@ -104,6 +108,8 @@ class BoxTest {
assertFailsWith<BoxCorruptedOrTamperedDataException>() {
val tampered = encrypted.copyOf()
tampered[1] = 0U
tampered[2] = 0U
tampered[3] = 0U
Box.openEasyAfterNM(tampered, messageNonce, recipientComputedSessionKey)
}
}
@ -124,6 +130,8 @@ class BoxTest {
assertFailsWith<BoxCorruptedOrTamperedDataException>() {
val tampered = sealed.copyOf()
tampered[1] = 0U
tampered[2] = 0U
tampered[3] = 0U
Box.sealOpen(tampered, recipientKeypair.publicKey, recipientKeypair.secretKey)
}
}

View File

@ -1,7 +1,6 @@
package com.ionspin.kotlin.crypto
import co.libly.resourceloader.FileLoader
import co.libly.resourceloader.SharedLibraryLoader
import com.goterl.resourceloader.SharedLibraryLoader
import com.sun.jna.Native
import com.sun.jna.Platform
import java.io.File

View File

@ -32,7 +32,6 @@ plugins {
kotlin(PluginsDeps.kotlinSerializationPlugin) version Versions.kotlinSerializationPlugin
}
org.jetbrains.kotlin.gradle.targets.js.npm.NpmResolverPlugin.apply(project)
val sonatypeStaging = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
val sonatypeSnapshots = "https://oss.sonatype.org/content/repositories/snapshots/"
@ -41,8 +40,6 @@ val sonatypeSnapshots = "https://oss.sonatype.org/content/repositories/snapshots
repositories {
mavenCentral()
jcenter()
maven("https://dl.bintray.com/terl/lazysodium-maven")
maven("https://oss.sonatype.org/content/repositories/snapshots/")
}
@ -82,7 +79,7 @@ kotlin {
}
}
// binaries.executable()
binaries.executable()
}
@ -205,11 +202,7 @@ kotlin {
implementation("androidx.core:core-ktx:1.3.2")
implementation("androidx.constraintlayout:constraintlayout:2.0.2")
implementation("com.google.android.material:material:1.3.0-alpha03")
// implementation("androidx.ui:ui-tooling:$composeDevVersion")
// implementation("androidx.ui:ui-layout:$composeDevVersion")
// implementation("androidx.ui:ui-material:$composeDevVersion")
// implementation("androidx.ui:ui-foundation:$composeDevVersion")
// implementation("androidx.ui:ui-framework:$composeDevVersion")
implementation(Deps.Android.coroutines)
implementation(Deps.Android.timber)
// implementation("androidx.compose:compose-runtime:$composeDevVersion")
@ -244,7 +237,7 @@ kotlin {
val nativeMain by getting {
dependsOn(commonMain)
dependencies {
implementation(Deps.Desktop.libui)
}
}
nativeMain
@ -252,7 +245,7 @@ kotlin {
val nativeMain by creating {
dependsOn(commonMain)
dependencies {
implementation(Deps.Desktop.libui)
}
}
nativeMain
@ -296,17 +289,6 @@ kotlin {
implementation(kotlin(Deps.Js.stdLib))
implementation(Deps.Js.coroutines)
// React
implementation(Deps.Js.React.react)
implementation(Deps.Js.React.reactDom)
implementation(npm(Deps.Js.Npm.reactPair.first, Deps.Js.Npm.reactPair.second))
implementation(npm(Deps.Js.Npm.reactDomPair.first, Deps.Js.Npm.reactDomPair.second))
// Styled
implementation(Deps.Js.React.styled)
implementation(npm(Deps.Js.Npm.styledComponentsPair.first, Deps.Js.Npm.styledComponentsPair.second))
implementation(npm(Deps.Js.Npm.inlineStylePrefixesPair.first, Deps.Js.Npm.inlineStylePrefixesPair.second))
}
}
val jsTest by getting {
@ -481,12 +463,12 @@ tasks {
}
}
val jsNodeTest by getting(KotlinJsTest::class) {
testLogging {
events("PASSED", "FAILED", "SKIPPED")
showStandardStreams = true
}
}
// val jsNodeTest by getting(KotlinJsTest::class) {
// testLogging {
// events("PASSED", "FAILED", "SKIPPED")
// showStandardStreams = true
// }
// }
}

View File

@ -1,35 +0,0 @@
import com.ionspin.kotlin.crypto.hash.Hash
import com.ionspin.kotlin.crypto.util.encodeToUByteArray
import com.ionspin.kotlin.crypto.util.toHexString
import kotlinx.css.br
import react.RBuilder
import react.RComponent
import react.RProps
import react.RState
import react.ReactElement
import react.dom.h1
external interface RAppState : RState {
var currentState: String
}
external interface RAppProps : RProps {
}
class App(props: RAppProps) : RComponent<RAppProps, RAppState>(props) {
override fun RBuilder.render() {
val hash = Hash.sha512("123".encodeToUByteArray())
h1 {
+"Hash (SHA512) of 123: ${hash.toHexString()}"
}
}
}
fun RBuilder.app(handler: RAppProps.() -> Unit): ReactElement {
return child(App::class) {
this.attrs(handler)
}
}

View File

@ -2,28 +2,13 @@
import com.ionspin.kotlin.crypto.LibsodiumInitializer
import com.ionspin.kotlin.crypto.hash.Hash
import com.ionspin.kotlin.crypto.util.LibsodiumRandom
import com.ionspin.kotlin.crypto.util.encodeToUByteArray
import com.ionspin.kotlin.crypto.util.toHexString
import react.dom.render
import kotlinx.browser.document
import kotlinx.browser.window
fun main() {
val runningOnNode = jsTypeOf(window) == "undefined"
// if (!runningOnNode) = runTest {
LibsodiumInitializer.initializeWithCallback {
render(document.getElementById("root")) {
app {
}
}
}
// } else = runTest {
// LibsodiumInitializer.initializeWithCallback {
// val hash = Hash.sha512("123".encodeToUByteArray())
// println("Hash (SHA512) of 123: ${hash.toHexString()}")
// }
// }
LibsodiumInitializer.initializeWithCallback {
val hash = Hash.sha512("123".encodeToUByteArray())
println("Hash (SHA512) of 123: ${hash.toHexString()}")
}
}

View File

@ -2,5 +2,4 @@ import com.ionspin.kotlin.crypto.sample.Sample
fun main() : Unit {
Sample.runSample()
ui()
}

View File

@ -1,30 +0,0 @@
import com.ionspin.kotlin.crypto.hash.Hash
import com.ionspin.kotlin.crypto.util.encodeToUByteArray
import com.ionspin.kotlin.crypto.util.toHexString
import libui.ktx.TextArea
import libui.ktx.appWindow
import libui.ktx.button
import libui.ktx.textarea
import libui.ktx.vbox
fun ui() = appWindow(
title = "Hello",
width = 320,
height = 240
) {
val hash = Hash.sha512("123".encodeToUByteArray())
val text = "Hash (SHA512) of 123: ${hash.toHexString()}"
vbox {
lateinit var scroll: TextArea
button("Test") {
action {
scroll.append(text.trimMargin())
}
}
scroll = textarea {
readonly = true
stretchy = true
}
}
}

View File

@ -17,11 +17,7 @@
pluginManagement {
repositories {
maven("https://dl.bintray.com/kotlin/kotlin-eap")
maven("https://dl.bintray.com/kotlin/kotlin-dev")
mavenCentral()
maven("https://plugins.gradle.org/m2/")
}
@ -33,7 +29,6 @@ pluginManagement {
}
}
}
enableFeaturePreview("GRADLE_METADATA")
rootProject.name = "KotlinMultiplatformLibsodium"
include("multiplatform-crypto-api")
include("multiplatform-crypto-libsodium-bindings")