diff --git a/.gitignore b/.gitignore index 3d16a63..459283c 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,6 @@ build/ /sodiumWrapper/static-tvos/ /sodiumWrapper/static-watchos/ /kotlin-multiplatform-libsodium-generator/out/ +/sodiumWrapper/static-ios-simulators/ +/sodiumWrapper/static-tvos-simulators/ +/sodiumWrapper/static-watchos-simulators/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c1e6426..d1d11f5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +17,7 @@ simpleCheck: script: echo PREPARE tags: - linuxX64 +# ---- Linux builds ---- buildLinux: stage: build @@ -26,6 +27,19 @@ buildLinux: - ./linuxBuild.sh tags: - linuxX64 +linuxPublishToSnapshot: + stage: deploy + script: + - ./linuxBuild.sh + - ./linuxBuildAndPublish.sh + only: + - master + tags: + - linuxX64 + + +# ---- Mac builds ---- + buildMac: stage: build when: manual @@ -34,11 +48,38 @@ buildMac: - ./macBuild.sh tags: - macos + +macPublishToSnapshot: + stage: deploy + script: + - ./macBuild.sh + - ./macBuildAndPublishSnapshot-bindings.sh + - ./macBuildAndPublishSnapshot-delegated.sh + only: + - master + tags: + - macos + +# ---- Windows builds ---- + buildWindows: stage: build when: manual allow_failure: false - script: echo TEST_PULL_REQUEST_WIN + script: + - $env:CHERE_INVOKING = 'yes' + - C:\msys64\usr\bin\bash -lc "./windowsBuild-delegated.sh" + - C:\msys64\usr\bin\bash -lc "./windowsBuild-pure.sh" tags: - windowsX64 +windowsPublishToSnapshot: + stage: deploy + script: + - $env:CHERE_INVOKING = 'yes' + - C:\msys64\usr\bin\bash -lc "./windowsBuildAndPublish-delegated.sh" + - C:\msys64\usr\bin\bash -lc "./windowsBuildAndPublish-pure.sh" + only: + - master + tags: + - windowsX64 diff --git a/README.md b/README.md index 255863e..5b76552 100644 --- a/README.md +++ b/README.md @@ -135,16 +135,23 @@ Currently supported native platforms: ### TODO: - Copy/adapt code documentation, currently only some functions have documentation that is a copy-paste from libsodium website -- Complete the bindings list -- Samples +- Replace LazySodium with direct JNA calls, and add build scripts for required libraries if missing - Android testing - Fix browser testing, both locally and in CI/CD - - - - - - +- LobsodiumUtil `unpad` and `fromBase64` native implementations use a nasty hack to support shared native sourceset. The hack either needs to be removed and replaced with another solution or additional safeguards need to be added. + + + + + +#### Notes for Gitlab runners: +- At the moment all runners need to have android sdk +#### Mac: + +#### Windows: +- Needs android sdk +- Git needs long file path enabled +- msys2 needs to be installed and `pacman update` executed diff --git a/build.gradle.kts b/build.gradle.kts index 7a49d0a..cdadcc4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,9 +15,8 @@ * */ - buildscript { - + repositories { mavenCentral() google() diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 2658b0f..409bfe9 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -17,7 +17,9 @@ plugins { + `java-gradle-plugin` `kotlin-dsl` + `kotlin-dsl-precompiled-script-plugins` } repositories { @@ -29,8 +31,8 @@ repositories { } dependencies { - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0-rc") - implementation("com.android.tools.build:gradle:4.0.1") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10") + implementation("com.android.tools.build:gradle:4.0.2") } System.setProperty("PROJECT_PATH", project.projectDir.parentFile.toString()) diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt index e8b420b..395c929 100644 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/buildSrc/src/main/kotlin/Deps.kt @@ -17,18 +17,21 @@ object Versions { val kotlinCoroutines = "1.3.9" val kotlin = "1.4.10" - val kotlinSerialization = "1.0.0-RC" + val kotlinSerialization = "1.0.0" + val kotlinSerializationPlugin = "1.4.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 taskTreePlugin = "1.5" - - val kotlinBigNumVersion = "0.1.6-1.4.0-rc-SNAPSHOT" - + val kotlinBigNumVersion = "0.2.2" val lazySodium = "4.3.1-SNAPSHOT" val jna = "5.5.0" - val kotlinPoet = "1.6.0" + val libsodiumBindings = "0.1.1-SNAPSHOT" + val ktor = "1.3.2" + val timber = "4.7.1" + val kodeinVersion = "7.1.0" + } @@ -36,6 +39,7 @@ object Versions { object ReleaseInfo { val group = "com.ionspin.kotlin" val version = "0.1.0-SNAPSHOT" + val bindingsVersion = "0.1.1-SNAPSHOT" } object Deps { @@ -45,25 +49,53 @@ object Deps { val test = "test-common" val testAnnotation = "test-annotations-common" val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:${Versions.kotlinCoroutines}" - val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:${Versions.kotlinSerialization}" + val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.kotlinSerialization}" val atomicfu = "com.ionspin.kotlin.atomicfu:atomicfu:${Versions.atomicfu}" val kotlinBigNum = "com.ionspin.kotlin:bignum:${Versions.kotlinBigNumVersion}" val apiProject = ":multiplatform-crypto-api" + + val libsodiumBindings = "com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:${Versions.libsodiumBindings}" + + val kodein = "org.kodein.di:kodein-di:${Versions.kodeinVersion}" } 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 stdLib = "stdlib-js" val test = "test-js" val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:${Versions.kotlinCoroutines}" val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:${Versions.kotlinSerialization}" + val ktorClient = "io.ktor:ktor-client-js:${Versions.ktor}" + 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 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") } } @@ -100,11 +132,24 @@ object Deps { } + object Android { + val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.kotlinCoroutines}" + val ktorClientOkHttp = "io.ktor:ktor-client-okhttp:${Versions.ktor}" + val ktorClient = "io.ktor:ktor-client-android:${Versions.ktor}" + val ktorClientSerialization = "io.ktor:ktor-client-serialization-jvm:${Versions.ktor}" + val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Versions.kotlinSerialization}" + val timber = "com.jakewharton.timber:timber:${Versions.timber}" + } + + object Desktop { + val libui = "com.github.msink:libui:0.1.8" + } + } object PluginsDeps { - val kotlinSerializationPlugin = "kotlinx-serialization" + val kotlinSerializationPlugin = "plugin.serialization" val multiplatform = "multiplatform" val node = "com.github.node-gradle.node" val mavenPublish = "maven-publish" @@ -113,5 +158,8 @@ object PluginsDeps { val taskTree = "com.dorongold.task-tree" val androidLibrary = "com.android.library" val kotlinAndroidExtensions = "kotlin-android-extensions" + val androidApplication = "com.android.application" + val kotlinAndroid = "kotlin-android" + val kapt = "kotlin-kapt" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 65fa2e2..8e234f9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -16,6 +16,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/macBuild-buildLibsodium.sh b/macBuild-buildLibsodium.sh new file mode 100755 index 0000000..84546be --- /dev/null +++ b/macBuild-buildLibsodium.sh @@ -0,0 +1,11 @@ +set -e +#!/bin/sh +#this will hopefully download all konan dependancies that we use in the build scripts +./gradlew multiplatform-crypto-api:build +#now let's build linux deps +cd sodiumWrapper +./makeMacosX86-64.sh +./makeIosWatchosTvos.sh +#now we can do the delegated build +cd .. +set +e \ No newline at end of file diff --git a/macBuild.sh b/macBuild.sh index 9fb86c2..23d0c7c 100755 --- a/macBuild.sh +++ b/macBuild.sh @@ -5,12 +5,12 @@ set -e #now let's build linux deps cd sodiumWrapper ./makeMacosX86-64.sh -./makeIos.sh -./makeTvos.sh -./makeWatchos.sh +./makeIosWatchosTvos.sh #now we can do the delegated build cd .. ./gradlew multiplatform-crypto-delegated:build -#and finally pure build +#pure build ./gradlew multiplatform-crypto:build -set +e \ No newline at end of file +#libsodium bindings +./gradlew multiplatform-crypto-libsodium-bindings:build +set +e diff --git a/macBuildAndPublishSnapshot-bindings.sh b/macBuildAndPublishSnapshot-bindings.sh new file mode 100755 index 0000000..57e2558 --- /dev/null +++ b/macBuildAndPublishSnapshot-bindings.sh @@ -0,0 +1,15 @@ +set -e +#!/bin/sh +./gradlew multiplatform-crypto-libsodium-bindings:publishMacosX64PublicationToSnapshotRepository + +./gradlew multiplatform-crypto-libsodium-bindings:publishIosArm32PublicationToSnapshotRepository \ +multiplatform-crypto-libsodium-bindings:publishIosArm64PublicationToSnapshotRepository \ +multiplatform-crypto-libsodium-bindings:publishIosX64PublicationToSnapshotRepository + +./gradlew multiplatform-crypto-libsodium-bindings:publishWatchosArm32PublicationToSnapshotRepository \ +multiplatform-crypto-libsodium-bindings:publishWatchosArm64PublicationToSnapshotRepository \ +multiplatform-crypto-libsodium-bindings:publishWatchosX86PublicationToSnapshotRepository + +./gradlew multiplatform-crypto-libsodium-bindings:publishTvosArm64PublicationToSnapshotRepository \ +multiplatform-crypto-libsodium-bindings:publishTvosX64PublicationToSnapshotRepository +set +e diff --git a/macBuildAndPublishSnapshot-delegated.sh b/macBuildAndPublishSnapshot-delegated.sh new file mode 100755 index 0000000..8fb7d2d --- /dev/null +++ b/macBuildAndPublishSnapshot-delegated.sh @@ -0,0 +1,15 @@ +set -e +#!/bin/sh +./gradlew multiplatform-crypto-delegated:publishMacosX64PublicationToSnapshotRepository + +./gradlew multiplatform-crypto-delegated:publishIosArm32PublicationToSnapshotRepository \ +multiplatform-crypto-delegated:publishIosArm64PublicationToSnapshotRepository \ +multiplatform-crypto-delegated:publishIosX64PublicationToSnapshotRepository + +./gradlew multiplatform-crypto-delegated:publishWatchosArm32PublicationToSnapshotRepository \ +multiplatform-crypto-delegated:publishWatchosArm64PublicationToSnapshotRepository \ +multiplatform-crypto-delegated:publishWatchosX86PublicationToSnapshotRepository + +./gradlew multiplatform-crypto-delegated:publishTvosArm64PublicationToSnapshotRepository \ +multiplatform-crypto-delegated:publishTvosX64PublicationToSnapshotRepository +set +e diff --git a/multiplatform-crypto-delegated/build.gradle.kts b/multiplatform-crypto-delegated/build.gradle.kts index e0ea1c3..77b5912 100644 --- a/multiplatform-crypto-delegated/build.gradle.kts +++ b/multiplatform-crypto-delegated/build.gradle.kts @@ -297,22 +297,28 @@ kotlin { val macos64Bit = setOf( "macosX64" ) - val ios64Bit = setOf( - "iosArm64", "iosX64" + val iosArm = setOf( + "iosArm64", "iosArm32" ) - val ios32Bit = setOf( - "iosArm32" + val iosSimulator = setOf( + "iosX64" ) val mingw64Bit = setOf( "mingwX64" ) - val tvos64Bit = setOf( - "tvosArm64", "tvosX64" + val tvosArm = setOf( + "tvosArm64" + ) + val tvosSimulator = setOf( + "tvosX64" ) - val watchos32Bit = setOf( - "watchosX86", "watchosArm32", "watchosArm64" + val watchosArm = setOf( + "watchosArm32", "watchosArm64" + ) + val watchosSimulator = setOf( + "watchosX86" ) targets.withType { @@ -347,7 +353,7 @@ kotlin { defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies)) } //All ioses share the same static library - if (ios64Bit.contains(this@withType.name)) { + if (iosArm.contains(this@withType.name)) { defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies)) println("Setting ios cinterop for $this") val libsodiumCinterop by cinterops.creating { @@ -359,19 +365,19 @@ kotlin { ) } - if (ios32Bit.contains(this@withType.name)) { + if (iosSimulator.contains(this@withType.name)) { 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") + compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-ios-simulators/include") } kotlinOptions.freeCompilerArgs = listOf( - "-include-binary", "${project.rootDir}/sodiumWrapper/static-ios/lib/libsodium.a" + "-include-binary", "${project.rootDir}/sodiumWrapper/static-ios-simulators/lib/libsodium.a" ) } - if (tvos64Bit.contains(this@withType.name)) { + if (tvosArm.contains(this@withType.name)) { defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies)) println("Setting ios cinterop for $this") val libsodiumCinterop by cinterops.creating { @@ -383,7 +389,19 @@ kotlin { ) } - if (watchos32Bit.contains(this@withType.name)) { + if (tvosSimulator.contains(this@withType.name)) { + 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") + } + kotlinOptions.freeCompilerArgs = listOf( + "-include-binary", "${project.rootDir}/sodiumWrapper/static-tvos-simulators/lib/libsodium.a" + ) + } + + if (watchosArm.contains(this@withType.name)) { defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies)) println("Setting ios cinterop for $this") val libsodiumCinterop by cinterops.creating { @@ -395,6 +413,18 @@ kotlin { ) } + if (watchosSimulator.contains(this@withType.name)) { + 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") + } + kotlinOptions.freeCompilerArgs = listOf( + "-include-binary", "${project.rootDir}/sodiumWrapper/static-watchos-simulators/lib/libsodium.a" + ) + } + } diff --git a/multiplatform-crypto-delegated/src/commonTest/kotlin/com/ionspin/kotlin/crypto/authenticated/XChaCha20Poly1305Test.kt b/multiplatform-crypto-delegated/src/commonTest/kotlin/com/ionspin/kotlin/crypto/authenticated/XChaCha20Poly1305Test.kt index 6ed851c..f9006e6 100644 --- a/multiplatform-crypto-delegated/src/commonTest/kotlin/com/ionspin/kotlin/crypto/authenticated/XChaCha20Poly1305Test.kt +++ b/multiplatform-crypto-delegated/src/commonTest/kotlin/com/ionspin/kotlin/crypto/authenticated/XChaCha20Poly1305Test.kt @@ -226,7 +226,9 @@ class XChaCha20Poly1305Test { expected.contentEquals(result) && decrypted.contentEquals(data) } val messedUpTag = result.copyOf() + messedUpTag[messedUpTag.size - 3] = 0U messedUpTag[messedUpTag.size - 2] = 0U + messedUpTag[messedUpTag.size - 1] = 0U assertFails { val decryptorForWrongTag = XChaCha20Poly1305Delegated(key, state, header, true) val plaintext = decryptorForWrongTag.decrypt(messedUpTag) diff --git a/multiplatform-crypto-libsodium-bindings/build.gradle.kts b/multiplatform-crypto-libsodium-bindings/build.gradle.kts index f91c1bd..b06227f 100644 --- a/multiplatform-crypto-libsodium-bindings/build.gradle.kts +++ b/multiplatform-crypto-libsodium-bindings/build.gradle.kts @@ -53,14 +53,14 @@ repositories { } group = ReleaseInfo.group -version = ReleaseInfo.version +version = ReleaseInfo.bindingsVersion val ideaActive = isInIdea() println("Idea active: $ideaActive") android { compileSdkVersion(29) defaultConfig { - minSdkVersion(24) + minSdkVersion(21) targetSdkVersion(29) versionCode = 1 versionName = "1.0" @@ -77,10 +77,10 @@ android { kotlin { val hostOsName = getHostOsName() + android() runningOnLinuxx86_64 { println("Configuring Linux X86-64 targets") jvm() - android() js { browser { testTask { @@ -145,107 +145,103 @@ kotlin { println("Configuring Linux Arm 32 targets") } - - runningOnMacos { - println("Configuring macos targets") - iosX64() { - binaries { - framework { - optimized = true - } - } - } - iosArm64() { - binaries { - framework { - optimized = true - } - } - } - - iosArm32() { - binaries { - framework { - optimized = true - } - } - } - macosX64() { - binaries { - framework { - optimized = true - } - } - 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") - } - kotlinOptions.freeCompilerArgs = listOf( - "-include-binary", "${project.rootDir}/sodiumWrapper/static-macos-x86-64/lib/libsodium.a" - ) - } - } - tvosX64() { - binaries { - framework { - optimized = true - } - } - } - - tvosArm64() { - binaries { - framework { - optimized = true - } - } - } - - watchosArm64() { - binaries { - framework { - optimized = true - } - } - } - - watchosArm32() { - binaries { - framework { - optimized = true - } - } - } - - watchosX86() { - binaries { - framework { - optimized = true - } + println("Configuring macos targets") + iosX64() { + binaries { + framework { + optimized = true } } } - runningOnWindows { - println("Configuring Mingw targets") - mingwX64() { - binaries { - staticLib { - optimized = true - } - } - 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") - } - kotlinOptions.freeCompilerArgs = listOf( - "-include-binary", "${project.rootDir}/sodiumWrapper/static-mingw-x86-64/lib/libsodium.a" - ) + iosArm64() { + binaries { + framework { + optimized = true } } } + iosArm32() { + binaries { + framework { + optimized = true + } + } + } + macosX64() { + binaries { + framework { + optimized = true + } + } + 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") + } + kotlinOptions.freeCompilerArgs = listOf( + "-include-binary", "${project.rootDir}/sodiumWrapper/static-macos-x86-64/lib/libsodium.a" + ) + } + } + tvosX64() { + binaries { + framework { + optimized = true + } + } + } + + tvosArm64() { + binaries { + framework { + optimized = true + } + } + } + + watchosArm64() { + binaries { + framework { + optimized = true + } + } + } + + watchosArm32() { + binaries { + framework { + optimized = true + } + } + } + + watchosX86() { + binaries { + framework { + optimized = true + } + } + } + println("Configuring Mingw targets") + mingwX64() { + binaries { + staticLib { + optimized = true + } + } + 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") + } + kotlinOptions.freeCompilerArgs = listOf( + "-include-binary", "${project.rootDir}/sodiumWrapper/static-mingw-x86-64/lib/libsodium.a" + ) + } + } + + println(targets.names) sourceSets { @@ -301,22 +297,28 @@ kotlin { val macos64Bit = setOf( "macosX64" ) - val ios64Bit = setOf( - "iosArm64", "iosX64" + val iosArm = setOf( + "iosArm64", "iosArm32" ) - val ios32Bit = setOf( - "iosArm32" + val iosSimulator = setOf( + "iosX64" ) val mingw64Bit = setOf( "mingwX64" ) - val tvos64Bit = setOf( - "tvosArm64", "tvosX64" + val tvosArm = setOf( + "tvosArm64" + ) + val tvosSimulator = setOf( + "tvosX64" ) - val watchos32Bit = setOf( - "watchosX86", "watchosArm32", "watchosArm64" + val watchosArm = setOf( + "watchosArm32", "watchosArm64" + ) + val watchosSimulator = setOf( + "watchosX86" ) targets.withType { @@ -327,12 +329,12 @@ kotlin { defaultSourceSet.dependsOn(nativeMain) } if (linuxArm64Bit.contains(this@withType.name)) { - defaultSourceSet.dependsOn( - createWorkaroundNativeMainSourceSet( - this@withType.name, - nativeDependencies - ) + defaultSourceSet.dependsOn( + createWorkaroundNativeMainSourceSet( + this@withType.name, + nativeDependencies ) + ) compilations.getByName("main") { val libsodiumCinterop by cinterops.creating { @@ -351,7 +353,7 @@ kotlin { defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies)) } //All ioses share the same static library - if (ios64Bit.contains(this@withType.name)) { + if (iosArm.contains(this@withType.name)) { defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies)) println("Setting ios cinterop for $this") val libsodiumCinterop by cinterops.creating { @@ -363,19 +365,19 @@ kotlin { ) } - if (ios32Bit.contains(this@withType.name)) { + if (iosSimulator.contains(this@withType.name)) { 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") + compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-ios-simulators/include") } kotlinOptions.freeCompilerArgs = listOf( - "-include-binary", "${project.rootDir}/sodiumWrapper/static-ios/lib/libsodium.a" + "-include-binary", "${project.rootDir}/sodiumWrapper/static-ios-simulators/lib/libsodium.a" ) } - if (tvos64Bit.contains(this@withType.name)) { + if (tvosArm.contains(this@withType.name)) { defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies)) println("Setting ios cinterop for $this") val libsodiumCinterop by cinterops.creating { @@ -387,7 +389,19 @@ kotlin { ) } - if (watchos32Bit.contains(this@withType.name)) { + if (tvosSimulator.contains(this@withType.name)) { + 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") + } + kotlinOptions.freeCompilerArgs = listOf( + "-include-binary", "${project.rootDir}/sodiumWrapper/static-tvos-simulators/lib/libsodium.a" + ) + } + + if (watchosArm.contains(this@withType.name)) { defaultSourceSet.dependsOn(createWorkaroundNativeMainSourceSet(this@withType.name, nativeDependencies)) println("Setting ios cinterop for $this") val libsodiumCinterop by cinterops.creating { @@ -399,6 +413,18 @@ kotlin { ) } + if (watchosSimulator.contains(this@withType.name)) { + 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") + } + kotlinOptions.freeCompilerArgs = listOf( + "-include-binary", "${project.rootDir}/sodiumWrapper/static-watchos-simulators/lib/libsodium.a" + ) + } + } @@ -410,7 +436,27 @@ kotlin { } } + val androidMain by getting { + isNotRunningInIdea { + kotlin.srcDirs("src/androidSpecific", "src/jvmMain/kotlin") + } + isRunningInIdea { + kotlin.srcDirs("src/androidSpecific") + } + dependencies { + implementation("com.goterl.lazycode:lazysodium-android:4.2.0@aar") + implementation("net.java.dev.jna:jna:5.5.0@aar") + } + } + val androidTest by getting { + dependencies { + implementation(kotlin(Deps.Jvm.test)) + implementation(kotlin(Deps.Jvm.testJUnit)) + implementation("androidx.test:runner:1.2.0") + implementation("androidx.test:rules:1.2.0") + } + } runningOnLinuxx86_64 { @@ -434,27 +480,7 @@ kotlin { implementation(kotlin(Deps.Jvm.reflection)) } } - val androidMain by getting { - isNotRunningInIdea { - kotlin.srcDirs("src/androidSpecific", "src/jvmMain/kotlin") - } - isRunningInIdea { - kotlin.srcDirs("src/androidSpecific") - } - dependencies { - implementation("com.goterl.lazycode:lazysodium-android:4.2.0@aar") - implementation("net.java.dev.jna:jna:5.5.0@aar") - } - } - val androidTest by getting { - dependencies { - implementation(kotlin(Deps.Jvm.test)) - implementation(kotlin(Deps.Jvm.testJUnit)) - implementation("androidx.test:runner:1.2.0") - implementation("androidx.test:rules:1.2.0") - } - } val jsMain by getting { dependencies { diff --git a/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/aead/AuthenticatedEncryptionWithAssociatedDataTest.kt b/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/aead/AuthenticatedEncryptionWithAssociatedDataTest.kt index c6de2bf..fe3a6b5 100644 --- a/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/aead/AuthenticatedEncryptionWithAssociatedDataTest.kt +++ b/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/aead/AuthenticatedEncryptionWithAssociatedDataTest.kt @@ -53,6 +53,8 @@ class AuthenticatedEncryptionWithAssociatedDataTest { assertFailsWith(AeadCorrupedOrTamperedDataException::class) { val tamperedTag = encrypted.copyOf() tamperedTag[3] = 0U + tamperedTag[1] = 0U + tamperedTag[0] = 0U AuthenticatedEncryptionWithAssociatedData.xChaCha20Poly1305IetfDecrypt( tamperedTag, associatedData, @@ -105,6 +107,8 @@ class AuthenticatedEncryptionWithAssociatedDataTest { assertFailsWith(AeadCorrupedOrTamperedDataException::class) { val tamperedTag = encrypted.tag.copyOf() tamperedTag[3] = 0U + tamperedTag[1] = 0U + tamperedTag[0] = 0U AuthenticatedEncryptionWithAssociatedData.xChaCha20Poly1305IetfDecryptDetached( encrypted.data, tamperedTag, @@ -156,6 +160,8 @@ class AuthenticatedEncryptionWithAssociatedDataTest { assertFailsWith(AeadCorrupedOrTamperedDataException::class) { val tamperedTag = encrypted.copyOf() tamperedTag[3] = 0U + tamperedTag[1] = 0U + tamperedTag[0] = 0U AuthenticatedEncryptionWithAssociatedData.chaCha20Poly1305IetfDecrypt( tamperedTag, associatedData, @@ -207,6 +213,8 @@ class AuthenticatedEncryptionWithAssociatedDataTest { assertFailsWith(AeadCorrupedOrTamperedDataException::class) { val tamperedTag = encrypted.tag.copyOf() tamperedTag[3] = 0U + tamperedTag[1] = 0U + tamperedTag[0] = 0U AuthenticatedEncryptionWithAssociatedData.chaCha20Poly1305IetfDecryptDetached( encrypted.data, tamperedTag, @@ -257,6 +265,8 @@ class AuthenticatedEncryptionWithAssociatedDataTest { assertFailsWith(AeadCorrupedOrTamperedDataException::class) { val tamperedTag = encrypted.copyOf() tamperedTag[3] = 0U + tamperedTag[1] = 0U + tamperedTag[0] = 0U AuthenticatedEncryptionWithAssociatedData.chaCha20Poly1305Decrypt( tamperedTag, associatedData, @@ -307,6 +317,8 @@ class AuthenticatedEncryptionWithAssociatedDataTest { assertFailsWith(AeadCorrupedOrTamperedDataException::class) { val tamperedTag = encrypted.tag.copyOf() tamperedTag[3] = 0U + tamperedTag[1] = 0U + tamperedTag[0] = 0U AuthenticatedEncryptionWithAssociatedData.chaCha20Poly1305DecryptDetached( encrypted.data, tamperedTag, diff --git a/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/secretbox/SecretBoxTest.kt b/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/secretbox/SecretBoxTest.kt index caf19a5..bae56b1 100644 --- a/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/secretbox/SecretBoxTest.kt +++ b/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/secretbox/SecretBoxTest.kt @@ -40,6 +40,8 @@ class SecretBoxTest { assertFailsWith(SecretBoxCorruptedOrTamperedDataExceptionOrInvalidKey::class) { val tamperedTag = encrypted.copyOf() tamperedTag[2] = 0U + tamperedTag[1] = 0U + tamperedTag[0] = 0U SecretBox.openEasy(tamperedTag, nonce, key) } } @@ -73,6 +75,8 @@ class SecretBoxTest { assertFailsWith(SecretBoxCorruptedOrTamperedDataExceptionOrInvalidKey::class) { val tamperedTag = encrypted.tag.copyOf() tamperedTag[2] = 0U + tamperedTag[1] = 0U + tamperedTag[0] = 0U SecretBox.openDetached(encrypted.data, tamperedTag, nonce, key) } } diff --git a/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/secretstream/SecretStreamTest.kt b/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/secretstream/SecretStreamTest.kt index 574891f..a000e99 100644 --- a/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/secretstream/SecretStreamTest.kt +++ b/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/secretstream/SecretStreamTest.kt @@ -75,6 +75,8 @@ class SecretStreamTest { } assertFailsWith(SecretStreamCorruptedOrTamperedDataException::class) { encrypted[encrypted.size - 5] = 0U + encrypted[encrypted.size - 4] = 0U + encrypted[encrypted.size - 3] = 0U val decryptState = SecretStream.xChaCha20Poly1305InitPull(key, stateAndHeader.header) val decrypted = SecretStream.xChaCha20Poly1305Pull(decryptState.state, encrypted, ubyteArrayOf()) diff --git a/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/signature/SignatureTest.kt b/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/signature/SignatureTest.kt index dca334d..d82d939 100644 --- a/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/signature/SignatureTest.kt +++ b/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/signature/SignatureTest.kt @@ -24,6 +24,8 @@ class SignatureTest { assertFailsWith(InvalidSignatureException::class) { val tamperedMessage = signedMessage.copyOf() tamperedMessage[crypto_sign_BYTES + 1] = 0U + tamperedMessage[crypto_sign_BYTES + 2] = 0U + tamperedMessage[crypto_sign_BYTES + 3] = 0U Signature.open(tamperedMessage, keys.publicKey) } } @@ -65,6 +67,8 @@ class SignatureTest { assertFailsWith(InvalidSignatureException::class) { val tamperedSignature = signature.copyOf() tamperedSignature[crypto_sign_BYTES - 1] = 0U + tamperedSignature[crypto_sign_BYTES - 2] = 0U + tamperedSignature[crypto_sign_BYTES - 3] = 0U Signature.finalVerify(verificationState, tamperedSignature, keys.publicKey) } } diff --git a/multiplatform-crypto-libsodium-bindings/src/nativeMain/kotlin/com/ionspin/kotlin/crypto/util/LibsodiumUtil.kt b/multiplatform-crypto-libsodium-bindings/src/nativeMain/kotlin/com/ionspin/kotlin/crypto/util/LibsodiumUtil.kt index 81577aa..afc4209 100644 --- a/multiplatform-crypto-libsodium-bindings/src/nativeMain/kotlin/com/ionspin/kotlin/crypto/util/LibsodiumUtil.kt +++ b/multiplatform-crypto-libsodium-bindings/src/nativeMain/kotlin/com/ionspin/kotlin/crypto/util/LibsodiumUtil.kt @@ -12,6 +12,7 @@ import libsodium.sodium_memcmp import libsodium.sodium_memzero import libsodium.sodium_pad import libsodium.sodium_unpad +import platform.posix.size_tVar /** * Created by Ugljesa Jovanovic @@ -60,15 +61,15 @@ actual object LibsodiumUtil { actual fun unpad(paddedData: UByteArray, blocksize: Int) : UByteArray { val paddedDataCopy = paddedData.copyOf() val paddedDataCopyPinned = paddedDataCopy.pin() - var newSize = ULongArray(1) { 0UL } - val newSizePinned = newSize.pin() + var newSizeULong = ULongArray(1) { 0UL } + val newSizePinned = newSizeULong.pin() sodium_unpad( - newSizePinned.addressOf(0), + newSizePinned.addressOf(0) as kotlinx.cinterop.CValuesRef, // TODO Find a better solution for this! paddedDataCopyPinned.toPtr(), paddedData.size.convert(), blocksize.convert() ) - val unpaddedSize = newSize[0] + val unpaddedSize = newSizeULong[0] if (unpaddedSize > Int.MAX_VALUE.toULong()) { throw RuntimeException("Unsupported array size (larger than Integer max value) $unpaddedSize") } @@ -126,7 +127,7 @@ actual object LibsodiumUtil { data, data.length.convert(), null, - binLenPinned.addressOf(0), + binLenPinned.addressOf(0) as kotlinx.cinterop.CValuesRef, // TODO Find a better solution for this! null, variant.value diff --git a/multiplatform-crypto/build.gradle.kts b/multiplatform-crypto/build.gradle.kts index e75bc59..d458d71 100644 --- a/multiplatform-crypto/build.gradle.kts +++ b/multiplatform-crypto/build.gradle.kts @@ -49,6 +49,7 @@ val ideaActive = System.getProperty("idea.active") == "true" kotlin { val hostOsName = getHostOsName() + val bla =1 runningOnLinuxx86_64 { jvm() js { diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index 50171a8..c03b151 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -17,42 +17,56 @@ @file:Suppress("UnstableApiUsage") -import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest +import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest +import org.jetbrains.kotlin.gradle.tasks.FatFrameworkTask plugins { kotlin(PluginsDeps.multiplatform) - id (PluginsDeps.mavenPublish) - id (PluginsDeps.signing) - id (PluginsDeps.node) version Versions.nodePlugin + id(PluginsDeps.kapt) + id(PluginsDeps.androidApplication) + id(PluginsDeps.kotlinAndroidExtensions) + id(PluginsDeps.mavenPublish) + id(PluginsDeps.signing) + 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/" -val sonatypePassword : String? by project -val sonatypeUsername : String? by project - -val sonatypePasswordEnv : String? = System.getenv()["SONATYPE_PASSWORD"] -val sonatypeUsernameEnv : String? = System.getenv()["SONATYPE_USERNAME"] repositories { mavenCentral() jcenter() + maven("https://dl.bintray.com/terl/lazysodium-maven") + maven("https://oss.sonatype.org/content/repositories/snapshots/") } group = "com.ionspin.kotlin" -version = "0.0.4-SNAPSHOT" +version = "0.1.0-SNAPSHOT" val ideaActive = System.getProperty("idea.active") == "true" kotlin { val hostOsName = getHostOsName() + if (ideaActive) { + when (hostOsName) { + "linux" -> linuxX64("native") + "macos" -> macosX64("native") + "windows" -> mingwX64("native") + } + } + android() runningOnLinuxx86_64 { jvm() js { browser { + webpackTask { + + } testTask { enabled = false //Until I sort out testing on travis useKarma { @@ -61,69 +75,96 @@ kotlin { } } nodejs { + testTask { useMocha() { timeout = "10s" } } } + binaries.executable() } + + linuxX64("linux") { - binaries { - executable { } } } - // Linux 32 is using target-sysroot-2-raspberrypi which is missing getrandom and explicit_bzero in stdlib - // so konanc can't build klib because getrandom missing will cause sodium_misuse() - // so 32bit will be only available from non-delegated flavor -// linuxArm32Hfp() { + + //Disable for now as libui doesnt support arm64 +// linuxArm64() { // binaries { // executable { // } // } // } - linuxArm64() { - binaries { - executable { - } - } - } } runningOnMacos { - iosX64() { + val iosX64Target = iosX64() { binaries { framework { + baseName = "LibsodiumBindings" + export(Deps.Common.libsodiumBindings) + } + } + } + val iosArm64Target = iosArm64() { + binaries { + framework { + baseName = "LibsodiumBindings" + export(Deps.Common.libsodiumBindings) } } } - iosArm64() { + val iosArm32Target = iosArm32() { binaries { framework { - + baseName = "LibsodiumBindings" + export(Deps.Common.libsodiumBindings) } } } + val macosX64Target = macosX64() + val tvosX64Target = tvosX64() + val tvosArm64Target = tvosArm64() + val watchosArm64Target = watchosArm64() + val watchosArm32Target = watchosArm32() + val watchosX86Target = watchosX86() - iosArm32() { - binaries { - framework { - - } - } + configure(listOf(macosX64Target)) { + binaries.executable {} } - macosX64() { - binaries { - executable { - } - } +// configure(listOf( +// iosX64Target, iosArm64Target, iosArm32Target, +// tvosX64Target, tvosArm64Target, watchosArm64Target, +// watchosArm32Target, watchosX86Target) +// ) { +// binaries.framework { +// baseName = "LibsodiumBindings" +// export(Deps.Common.libsodiumBindings) +// } +// } + val mode = System.getenv("CONFIGURATION") ?: "DEBUG" + println("Mode $mode") + // Create a task to build a fat framework. + tasks.create("packForXcode", FatFrameworkTask::class) { + // The fat framework must have the same base name as the initial frameworks. + baseName = "LibsodiumBindings" + // The default destination directory is '/fat-framework'. + destinationDir = File(buildDir, "xcode-frameworks") + // Specify the frameworks to be merged. + from( + iosX64Target.binaries.getFramework(mode), + iosArm64Target.binaries.getFramework(mode), + iosArm32Target.binaries.getFramework(mode) + ) } } runningOnWindows { @@ -138,13 +179,16 @@ kotlin { println(targets.names) + + sourceSets { val commonMain by getting { dependencies { implementation(kotlin(Deps.Common.stdLib)) implementation(kotlin(Deps.Common.test)) implementation(Deps.Common.kotlinBigNum) - implementation(project(":multiplatform-crypto-libsodium-bindings")) + implementation(Deps.Common.serialization) + api(Deps.Common.libsodiumBindings) } } val commonTest by getting { @@ -154,17 +198,83 @@ kotlin { } } + val androidMain by getting { - val nativeMain by creating { - dependsOn(commonMain) dependencies { + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}") + implementation("androidx.appcompat:appcompat:1.2.0") + 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") + } + } + val androidTest by getting { + dependencies { + implementation(kotlin(Deps.Jvm.test)) + implementation(kotlin(Deps.Jvm.testJUnit)) + implementation(Deps.Jvm.coroutinesTest) + implementation(kotlin(Deps.Jvm.reflection)) + implementation(Deps.Jvm.coroutinesCore) } } - val nativeTest by creating { - dependsOn(commonTest) - dependencies { + + +// val nativeMain by creating { +// dependsOn(commonMain) +// dependencies { +// implementation(Deps.Desktop.libui) +// } +// } +// +// val nativeTest by creating { +// dependsOn(commonTest) +// dependencies { +// } +// } + + val nativeMain = if (ideaActive) { + val nativeMain by getting { + dependsOn(commonMain) + dependencies { + implementation(Deps.Desktop.libui) + } } + nativeMain + } else { + val nativeMain by creating { + dependsOn(commonMain) + dependencies { + implementation(Deps.Desktop.libui) + } + } + nativeMain + } + + val nativeTest = if (ideaActive) { + val nativeTest by getting { + dependsOn(commonTest) + dependencies { + implementation(Deps.Native.coroutines) + } + } + nativeTest + } else { + val nativeTest by creating { + dependsOn(commonTest) + dependencies { + implementation(Deps.Native.coroutines) + } + } + nativeTest } runningOnLinuxx86_64 { @@ -185,6 +295,19 @@ kotlin { val jsMain by getting { dependencies { 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 { @@ -192,24 +315,20 @@ kotlin { implementation(kotlin(Deps.Js.test)) } } + val linuxMain by getting { dependsOn(nativeMain) } val linuxTest by getting { dependsOn(nativeTest) } -// val linuxArm32HfpMain by getting { + +// val linuxArm64Main by getting { // dependsOn(nativeMain) // } -// val linuxArm32HfpTest by getting { +// val linuxArm64Test by getting { // dependsOn(nativeTest) // } - val linuxArm64Main by getting { - dependsOn(nativeMain) - } - val linuxArm64Test by getting { - dependsOn(nativeTest) - } } runningOnMacos { @@ -265,6 +384,82 @@ kotlin { } +android { + compileSdkVersion(29) + defaultConfig { + applicationId = "com.ionspin.kotlin.crypto.sample" + minSdkVersion(21) + targetSdkVersion(29) + versionCode = 1 + versionName = "1.0" + testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + getByName("release") { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") + } + } + sourceSets { + val main by getting + main.manifest.srcFile("src/androidMain/AndroidManifest.xml") + main.java.srcDirs("src/androidMain/kotlin") + main.res.srcDirs("src/androidMain/res") + } + packagingOptions { + exclude("META-INF/library_release.kotlin_module") + exclude("META-INF/kotlinx-serialization-runtime.kotlin_module") + exclude("META-INF/ktor-http.kotlin_module") + exclude("META-INF/ktor-utils.kotlin_module") + exclude("META-INF/ktor-io.kotlin_module") + exclude("META-INF/ktor-*") + } + compileOptions { + setSourceCompatibility(JavaVersion.VERSION_1_8) + setTargetCompatibility(JavaVersion.VERSION_1_8) + } + tasks.withType { + kotlinOptions { + jvmTarget = "1.8" + } + } + +// buildFeatures { +// // Enables Jetpack Compose for this module +// this.compose = true +// } + +// composeOptions { +// kotlinCompilerExtensionVersion = "0.1.0-dev05" +// } + + // Magic for compose dev08, but it doesn't work with serialization plugin because of IR. Leave here for future reference. +// project.tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class.java) +// .configureEach { +// println("Task: $this") +// if (this.name.contains("Android")) { +// println("Setting plugins: $this") +// this.kotlinOptions.freeCompilerArgs += listOf( +// "-P", +// "plugin:androidx.compose.plugins.idea:enabled=true" +// ) +// this.kotlinOptions.freeCompilerArgs += "-Xplugin=${project.rootDir}/compose-compiler-0.1.0-dev08.jar" +// this.kotlinOptions.freeCompilerArgs += "-Xuse-ir" +// } +// } +// project.tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class.java) +// .forEach { compile -> +// compile.kotlinOptions.freeCompilerArgs += listOf( +// "-P", +// "plugin:androidx.compose.plugins.idea:enabled=true" +// ) +// compile.kotlinOptions.freeCompilerArgs += "-Xplugin=${project.rootDir}/compose-compiler-0.1.0-dev08.jar" +// compile.kotlinOptions.freeCompilerArgs += "-Xuse-ir" +// println("Compile: $compile") +// println("Compiler free args ${compile.kotlinOptions.freeCompilerArgs}") +// } +} + tasks { @@ -292,20 +487,7 @@ tasks { } } -// val legacyjsNodeTest by getting(KotlinJsTest::class) { -// -// testLogging { -// events("PASSED", "FAILED", "SKIPPED") -// showStandardStreams = true -// } -// } -// val jsIrBrowserTest by getting(KotlinJsTest::class) { -// testLogging { -// events("PASSED", "FAILED", "SKIPPED") -// showStandardStreams = true -// } -// } } if (getHostOsName() == "windows") { @@ -320,6 +502,27 @@ tasks { } +fun org.jetbrains.kotlin.gradle.plugin.mpp.Executable.windowsResources(rcFileName: String) { + val taskName = linkTaskName.replaceFirst("link", "windres") + val inFile = compilation.defaultSourceSet.resources.sourceDirectories.singleFile.resolve(rcFileName) + val outFile = buildDir.resolve("processedResources/$taskName.res") + + val windresTask = tasks.create(taskName) { + val konanUserDir = System.getenv("KONAN_DATA_DIR") ?: "${System.getProperty("user.home")}/.konan" + val konanLlvmDir = "$konanUserDir/dependencies/msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1/bin" + + inputs.file(inFile) + outputs.file(outFile) + commandLine("$konanLlvmDir/windres", inFile, "-D_${buildType.name}", "-O", "coff", "-o", outFile) + environment("PATH", "$konanLlvmDir;${System.getenv("PATH")}") + + dependsOn(compilation.compileKotlinTask) + } + + linkTask.dependsOn(windresTask) + linkerOpts(outFile.toString()) +} + diff --git a/sample/iosApp/iosApp.xcodeproj/project.pbxproj b/sample/iosApp/iosApp.xcodeproj/project.pbxproj new file mode 100644 index 0000000..b8b75c4 --- /dev/null +++ b/sample/iosApp/iosApp.xcodeproj/project.pbxproj @@ -0,0 +1,648 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 5745FD43253E4477006B7D0E /* LibsodiumBindings.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5745FD42253E4477006B7D0E /* LibsodiumBindings.framework */; }; + 5745FD44253E4477006B7D0E /* LibsodiumBindings.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5745FD42253E4477006B7D0E /* LibsodiumBindings.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 7555FF7F242A565900829871 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF7E242A565900829871 /* AppDelegate.swift */; }; + 7555FF81242A565900829871 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF80242A565900829871 /* SceneDelegate.swift */; }; + 7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; }; + 7555FF85242A565B00829871 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7555FF84242A565B00829871 /* Assets.xcassets */; }; + 7555FF88242A565B00829871 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7555FF87242A565B00829871 /* Preview Assets.xcassets */; }; + 7555FF8B242A565B00829871 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7555FF89242A565B00829871 /* LaunchScreen.storyboard */; }; + 7555FF96242A565B00829871 /* iosAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF95242A565B00829871 /* iosAppTests.swift */; }; + 7555FFA1242A565B00829871 /* iosAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FFA0242A565B00829871 /* iosAppUITests.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 7555FF92242A565B00829871 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7555FF73242A565900829871 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7555FF7A242A565900829871; + remoteInfo = iosApp; + }; + 7555FF9D242A565B00829871 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7555FF73242A565900829871 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7555FF7A242A565900829871; + remoteInfo = iosApp; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 5745FD45253E4477006B7D0E /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 5745FD44253E4477006B7D0E /* LibsodiumBindings.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 5745FD42253E4477006B7D0E /* LibsodiumBindings.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LibsodiumBindings.framework; path = "../build/xcode-frameworks/LibsodiumBindings.framework"; sourceTree = ""; }; + 7555FF7B242A565900829871 /* iosApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iosApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 7555FF7E242A565900829871 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7555FF80242A565900829871 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 7555FF84242A565B00829871 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 7555FF87242A565B00829871 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 7555FF8A242A565B00829871 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 7555FF91242A565B00829871 /* iosAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iosAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 7555FF95242A565B00829871 /* iosAppTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iosAppTests.swift; sourceTree = ""; }; + 7555FF97242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 7555FF9C242A565B00829871 /* iosAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iosAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 7555FFA0242A565B00829871 /* iosAppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iosAppUITests.swift; sourceTree = ""; }; + 7555FFA2242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 7555FFB1242A642300829871 /* sample.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = sample.framework; path = "../build/xcode-frameworks/sample.framework"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 7555FF78242A565900829871 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 5745FD43253E4477006B7D0E /* LibsodiumBindings.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7555FF8E242A565B00829871 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7555FF99242A565B00829871 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 7555FF72242A565900829871 = { + isa = PBXGroup; + children = ( + 7555FF7D242A565900829871 /* iosApp */, + 7555FF94242A565B00829871 /* iosAppTests */, + 7555FF9F242A565B00829871 /* iosAppUITests */, + 7555FF7C242A565900829871 /* Products */, + 7555FFB0242A642200829871 /* Frameworks */, + ); + sourceTree = ""; + }; + 7555FF7C242A565900829871 /* Products */ = { + isa = PBXGroup; + children = ( + 7555FF7B242A565900829871 /* iosApp.app */, + 7555FF91242A565B00829871 /* iosAppTests.xctest */, + 7555FF9C242A565B00829871 /* iosAppUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 7555FF7D242A565900829871 /* iosApp */ = { + isa = PBXGroup; + children = ( + 7555FF7E242A565900829871 /* AppDelegate.swift */, + 7555FF80242A565900829871 /* SceneDelegate.swift */, + 7555FF82242A565900829871 /* ContentView.swift */, + 7555FF84242A565B00829871 /* Assets.xcassets */, + 7555FF89242A565B00829871 /* LaunchScreen.storyboard */, + 7555FF8C242A565B00829871 /* Info.plist */, + 7555FF86242A565B00829871 /* Preview Content */, + ); + path = iosApp; + sourceTree = ""; + }; + 7555FF86242A565B00829871 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 7555FF87242A565B00829871 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 7555FF94242A565B00829871 /* iosAppTests */ = { + isa = PBXGroup; + children = ( + 7555FF95242A565B00829871 /* iosAppTests.swift */, + 7555FF97242A565B00829871 /* Info.plist */, + ); + path = iosAppTests; + sourceTree = ""; + }; + 7555FF9F242A565B00829871 /* iosAppUITests */ = { + isa = PBXGroup; + children = ( + 7555FFA0242A565B00829871 /* iosAppUITests.swift */, + 7555FFA2242A565B00829871 /* Info.plist */, + ); + path = iosAppUITests; + sourceTree = ""; + }; + 7555FFB0242A642200829871 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 5745FD42253E4477006B7D0E /* LibsodiumBindings.framework */, + 7555FFB1242A642300829871 /* sample.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 7555FF7A242A565900829871 /* iosApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */; + buildPhases = ( + 7555FFB5242A651A00829871 /* ShellScript */, + 7555FF77242A565900829871 /* Sources */, + 7555FF78242A565900829871 /* Frameworks */, + 7555FF79242A565900829871 /* Resources */, + 5745FD45253E4477006B7D0E /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = iosApp; + productName = iosApp; + productReference = 7555FF7B242A565900829871 /* iosApp.app */; + productType = "com.apple.product-type.application"; + }; + 7555FF90242A565B00829871 /* iosAppTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7555FFA8242A565B00829871 /* Build configuration list for PBXNativeTarget "iosAppTests" */; + buildPhases = ( + 7555FF8D242A565B00829871 /* Sources */, + 7555FF8E242A565B00829871 /* Frameworks */, + 7555FF8F242A565B00829871 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 7555FF93242A565B00829871 /* PBXTargetDependency */, + ); + name = iosAppTests; + productName = iosAppTests; + productReference = 7555FF91242A565B00829871 /* iosAppTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 7555FF9B242A565B00829871 /* iosAppUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7555FFAB242A565B00829871 /* Build configuration list for PBXNativeTarget "iosAppUITests" */; + buildPhases = ( + 7555FF98242A565B00829871 /* Sources */, + 7555FF99242A565B00829871 /* Frameworks */, + 7555FF9A242A565B00829871 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 7555FF9E242A565B00829871 /* PBXTargetDependency */, + ); + name = iosAppUITests; + productName = iosAppUITests; + productReference = 7555FF9C242A565B00829871 /* iosAppUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7555FF73242A565900829871 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1130; + LastUpgradeCheck = 1130; + ORGANIZATIONNAME = orgName; + TargetAttributes = { + 7555FF7A242A565900829871 = { + CreatedOnToolsVersion = 11.3.1; + }; + 7555FF90242A565B00829871 = { + CreatedOnToolsVersion = 11.3.1; + TestTargetID = 7555FF7A242A565900829871; + }; + 7555FF9B242A565B00829871 = { + CreatedOnToolsVersion = 11.3.1; + TestTargetID = 7555FF7A242A565900829871; + }; + }; + }; + buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 7555FF72242A565900829871; + productRefGroup = 7555FF7C242A565900829871 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7555FF7A242A565900829871 /* iosApp */, + 7555FF90242A565B00829871 /* iosAppTests */, + 7555FF9B242A565B00829871 /* iosAppUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 7555FF79242A565900829871 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7555FF8B242A565B00829871 /* LaunchScreen.storyboard in Resources */, + 7555FF88242A565B00829871 /* Preview Assets.xcassets in Resources */, + 7555FF85242A565B00829871 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7555FF8F242A565B00829871 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7555FF9A242A565B00829871 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 7555FFB5242A651A00829871 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cd \"$SRCROOT/..\"\n../gradlew :sample:packForXCode -PXCODE_CONFIGURATION=${CONFIGURATION}\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 7555FF77242A565900829871 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7555FF7F242A565900829871 /* AppDelegate.swift in Sources */, + 7555FF81242A565900829871 /* SceneDelegate.swift in Sources */, + 7555FF83242A565900829871 /* ContentView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7555FF8D242A565B00829871 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7555FF96242A565B00829871 /* iosAppTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7555FF98242A565B00829871 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7555FFA1242A565B00829871 /* iosAppUITests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 7555FF93242A565B00829871 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7555FF7A242A565900829871 /* iosApp */; + targetProxy = 7555FF92242A565B00829871 /* PBXContainerItemProxy */; + }; + 7555FF9E242A565B00829871 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7555FF7A242A565900829871 /* iosApp */; + targetProxy = 7555FF9D242A565B00829871 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 7555FF89242A565B00829871 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 7555FF8A242A565B00829871 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 7555FFA3242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.2; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 7555FFA4242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.2; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 7555FFA6242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = 5U57WAFNJ6; + ENABLE_PREVIEWS = YES; + FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../build/xcode-frameworks"; + INFOPLIST_FILE = iosApp/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.ionspin.kotlin.crypto.sample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 7555FFA7242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = 5U57WAFNJ6; + ENABLE_PREVIEWS = YES; + FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../build/xcode-frameworks"; + INFOPLIST_FILE = iosApp/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.ionspin.kotlin.crypto.sample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 7555FFA9242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = iosAppTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosAppTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iosApp.app/iosApp"; + }; + name = Debug; + }; + 7555FFAA242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = iosAppTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosAppTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iosApp.app/iosApp"; + }; + name = Release; + }; + 7555FFAC242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = iosAppUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosAppUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = iosApp; + }; + name = Debug; + }; + 7555FFAD242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = iosAppUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosAppUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = iosApp; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA3242A565B00829871 /* Debug */, + 7555FFA4242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA6242A565B00829871 /* Debug */, + 7555FFA7242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7555FFA8242A565B00829871 /* Build configuration list for PBXNativeTarget "iosAppTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA9242A565B00829871 /* Debug */, + 7555FFAA242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7555FFAB242A565B00829871 /* Build configuration list for PBXNativeTarget "iosAppUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFAC242A565B00829871 /* Debug */, + 7555FFAD242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 7555FF73242A565900829871 /* Project object */; +} diff --git a/sample/iosApp/iosApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/sample/iosApp/iosApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/sample/iosApp/iosApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/sample/iosApp/iosApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/sample/iosApp/iosApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/sample/iosApp/iosApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/sample/iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/ionspin.xcuserdatad/UserInterfaceState.xcuserstate b/sample/iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/ionspin.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..2694470 Binary files /dev/null and b/sample/iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/ionspin.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/sample/iosApp/iosApp.xcodeproj/xcuserdata/ionspin.xcuserdatad/xcschemes/xcschememanagement.plist b/sample/iosApp/iosApp.xcodeproj/xcuserdata/ionspin.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..56b5955 --- /dev/null +++ b/sample/iosApp/iosApp.xcodeproj/xcuserdata/ionspin.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + iosApp.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/sample/iosApp/iosApp/AppDelegate.swift b/sample/iosApp/iosApp/AppDelegate.swift new file mode 100644 index 0000000..34ca27d --- /dev/null +++ b/sample/iosApp/iosApp/AppDelegate.swift @@ -0,0 +1,29 @@ +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + // MARK: UISceneSession Lifecycle + + func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + } + + func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. + } + + +} + diff --git a/sample/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/sample/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d8db8d6 --- /dev/null +++ b/sample/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/sample/iosApp/iosApp/Assets.xcassets/Contents.json b/sample/iosApp/iosApp/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/sample/iosApp/iosApp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/sample/iosApp/iosApp/Base.lproj/LaunchScreen.storyboard b/sample/iosApp/iosApp/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/sample/iosApp/iosApp/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sample/iosApp/iosApp/ContentView.swift b/sample/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000..1c612dd --- /dev/null +++ b/sample/iosApp/iosApp/ContentView.swift @@ -0,0 +1,21 @@ +import SwiftUI +import LibsodiumBindings + + +struct ContentView: View { + var body: some View { + + Text("Hello, World! \(Sample.init().hashSomething())") + + } +} + +func test() { + +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/sample/iosApp/iosApp/Info.plist b/sample/iosApp/iosApp/Info.plist new file mode 100644 index 0000000..b75fa78 --- /dev/null +++ b/sample/iosApp/iosApp/Info.plist @@ -0,0 +1,62 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + + + + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/sample/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json b/sample/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/sample/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/sample/iosApp/iosApp/SceneDelegate.swift b/sample/iosApp/iosApp/SceneDelegate.swift new file mode 100644 index 0000000..dcee5d0 --- /dev/null +++ b/sample/iosApp/iosApp/SceneDelegate.swift @@ -0,0 +1,56 @@ +import UIKit +import SwiftUI + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + + // Create the SwiftUI view that provides the window contents. + let contentView = ContentView() + + // Use a UIHostingController as window root view controller. + if let windowScene = scene as? UIWindowScene { + let window = UIWindow(windowScene: windowScene) + window.rootViewController = UIHostingController(rootView: contentView) + self.window = window + window.makeKeyAndVisible() + } + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + } + + +} + diff --git a/sample/iosApp/iosAppTests/Info.plist b/sample/iosApp/iosAppTests/Info.plist new file mode 100644 index 0000000..64d65ca --- /dev/null +++ b/sample/iosApp/iosAppTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/sample/iosApp/iosAppTests/iosAppTests.swift b/sample/iosApp/iosAppTests/iosAppTests.swift new file mode 100644 index 0000000..0c6e03d --- /dev/null +++ b/sample/iosApp/iosAppTests/iosAppTests.swift @@ -0,0 +1,26 @@ +import XCTest +@testable import appName + +class appNameTests: XCTestCase { + + override func setUp() { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/sample/iosApp/iosAppUITests/Info.plist b/sample/iosApp/iosAppUITests/Info.plist new file mode 100644 index 0000000..64d65ca --- /dev/null +++ b/sample/iosApp/iosAppUITests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/sample/iosApp/iosAppUITests/iosAppUITests.swift b/sample/iosApp/iosAppUITests/iosAppUITests.swift new file mode 100644 index 0000000..8fb13f2 --- /dev/null +++ b/sample/iosApp/iosAppUITests/iosAppUITests.swift @@ -0,0 +1,35 @@ +import XCTest + +class appNameUITests: XCTestCase { + + override func setUp() { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use recording to get started writing UI tests. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) { + XCUIApplication().launch() + } + } + } +} diff --git a/sample/src/androidMain/AndroidManifest.xml b/sample/src/androidMain/AndroidManifest.xml new file mode 100644 index 0000000..1cf861a --- /dev/null +++ b/sample/src/androidMain/AndroidManifest.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + diff --git a/sample/src/androidMain/kotlin/com/ionspin/kotlin/crypto/sample/LibsodiumBindingsSampleApp.kt b/sample/src/androidMain/kotlin/com/ionspin/kotlin/crypto/sample/LibsodiumBindingsSampleApp.kt new file mode 100644 index 0000000..38ebe9d --- /dev/null +++ b/sample/src/androidMain/kotlin/com/ionspin/kotlin/crypto/sample/LibsodiumBindingsSampleApp.kt @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2020 Ugljesa Jovanovic (ugljesa.jovanovic@ionspin.com) + */ + +package com.ionspin.kotlin.crypto.sample + +import android.app.Application +import com.ionspin.kotlin.crypto.LibsodiumInitializer +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.async +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking +import timber.log.Timber + +/** + * @author [Ugljesa Jovanovic](ugi@mobilabsolutions.com) + */ +class LibsodiumBindingsSampleApp : Application() { + + override fun onCreate() { + super.onCreate() + Timber.plant(Timber.DebugTree()) + val initialization = GlobalScope.async { + LibsodiumInitializer.initialize() + } + runBlocking { + initialization.await() + } + + } +} diff --git a/sample/src/androidMain/kotlin/com/ionspin/kotlin/crypto/sample/MainActivity.kt b/sample/src/androidMain/kotlin/com/ionspin/kotlin/crypto/sample/MainActivity.kt new file mode 100644 index 0000000..f484737 --- /dev/null +++ b/sample/src/androidMain/kotlin/com/ionspin/kotlin/crypto/sample/MainActivity.kt @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2020 Ugljesa Jovanovic (ugljesa.jovanovic@ionspin.com) + */ + +package com.ionspin.kotlin.crypto.sample + +import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity +import com.ionspin.kotlin.crypto.hash.Hash +import com.ionspin.kotlin.crypto.util.encodeToUByteArray +import com.ionspin.kotlin.crypto.util.toHexString +import kotlinx.android.synthetic.main.activity_main.* + +class MainActivity : AppCompatActivity() { + + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + val hash = Hash.sha512("123".encodeToUByteArray()) + helloWorldTextView.setText("Hash (SHA512) of 123: ${hash.toHexString()}") + + + } + +} diff --git a/sample/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml b/sample/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..c82f3ae --- /dev/null +++ b/sample/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/sample/src/androidMain/res/drawable/ic_launcher_background.xml b/sample/src/androidMain/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..5aac4c9 --- /dev/null +++ b/sample/src/androidMain/res/drawable/ic_launcher_background.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sample/src/androidMain/res/layout/activity_main.xml b/sample/src/androidMain/res/layout/activity_main.xml new file mode 100644 index 0000000..2510cdc --- /dev/null +++ b/sample/src/androidMain/res/layout/activity_main.xml @@ -0,0 +1,19 @@ + + + + + + + + diff --git a/sample/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml b/sample/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..30ebbd4 --- /dev/null +++ b/sample/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/sample/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml b/sample/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..30ebbd4 --- /dev/null +++ b/sample/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/sample/src/androidMain/res/mipmap-hdpi/ic_launcher.png b/sample/src/androidMain/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a571e60 Binary files /dev/null and b/sample/src/androidMain/res/mipmap-hdpi/ic_launcher.png differ diff --git a/sample/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png b/sample/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..61da551 Binary files /dev/null and b/sample/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/sample/src/androidMain/res/mipmap-mdpi/ic_launcher.png b/sample/src/androidMain/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c41dd28 Binary files /dev/null and b/sample/src/androidMain/res/mipmap-mdpi/ic_launcher.png differ diff --git a/sample/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png b/sample/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..db5080a Binary files /dev/null and b/sample/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/sample/src/androidMain/res/mipmap-xhdpi/ic_launcher.png b/sample/src/androidMain/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..6dba46d Binary files /dev/null and b/sample/src/androidMain/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/sample/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png b/sample/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..da31a87 Binary files /dev/null and b/sample/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png b/sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..15ac681 Binary files /dev/null and b/sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png b/sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..b216f2d Binary files /dev/null and b/sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png b/sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..f25a419 Binary files /dev/null and b/sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png b/sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..e96783c Binary files /dev/null and b/sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/sample/src/androidMain/res/values/colors.xml b/sample/src/androidMain/res/values/colors.xml new file mode 100644 index 0000000..56c95a6 --- /dev/null +++ b/sample/src/androidMain/res/values/colors.xml @@ -0,0 +1,11 @@ + + + + + #0069A1 + #004970 + #FF5722 + #FF656565 + diff --git a/sample/src/androidMain/res/values/dimen.xml b/sample/src/androidMain/res/values/dimen.xml new file mode 100644 index 0000000..971418e --- /dev/null +++ b/sample/src/androidMain/res/values/dimen.xml @@ -0,0 +1,8 @@ + + + + + 16dp + \ No newline at end of file diff --git a/sample/src/androidMain/res/values/strings.xml b/sample/src/androidMain/res/values/strings.xml new file mode 100644 index 0000000..231daf2 --- /dev/null +++ b/sample/src/androidMain/res/values/strings.xml @@ -0,0 +1,7 @@ + + + + Lbsodium Bindings Sample + diff --git a/sample/src/androidMain/res/values/styles.xml b/sample/src/androidMain/res/values/styles.xml new file mode 100644 index 0000000..cd9e26a --- /dev/null +++ b/sample/src/androidMain/res/values/styles.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + diff --git a/sample/src/androidTest/kotlin/com/ionspin/kotlin/core/Placeholder b/sample/src/androidTest/kotlin/com/ionspin/kotlin/core/Placeholder new file mode 100644 index 0000000..e69de29 diff --git a/sample/src/commonMain/kotlin/com/ionspin/kotlin/crypto/sample/Sample.kt b/sample/src/commonMain/kotlin/com/ionspin/kotlin/crypto/sample/Sample.kt index dd58382..2e4fb1f 100644 --- a/sample/src/commonMain/kotlin/com/ionspin/kotlin/crypto/sample/Sample.kt +++ b/sample/src/commonMain/kotlin/com/ionspin/kotlin/crypto/sample/Sample.kt @@ -1,6 +1,8 @@ package com.ionspin.kotlin.crypto.sample +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 @@ -9,4 +11,9 @@ object Sample { val random = LibsodiumRandom.buf(32) println("Random: ${random.toHexString()}") } + + fun hashSomething() : String { + val hash = Hash.sha512("123".encodeToUByteArray()) + return "Hash (SHA512) of 123: ${hash.toHexString()}" + } } diff --git a/sample/src/commonMain/kotlin/com/ionspin/kotlin/crypto/sample/di/ServiceLocator.kt b/sample/src/commonMain/kotlin/com/ionspin/kotlin/crypto/sample/di/ServiceLocator.kt new file mode 100644 index 0000000..3b50331 --- /dev/null +++ b/sample/src/commonMain/kotlin/com/ionspin/kotlin/crypto/sample/di/ServiceLocator.kt @@ -0,0 +1,28 @@ +package com.ionspin.kotlin.crypto.sample.di + +import kotlinx.serialization.json.Json + +/** + * Created by Ugljesa Jovanovic + * ugljesa.jovanovic@ionspin.com + * on 17-Oct-2020 + */ +object ServiceLocator : ServiceLocatorInterface { + override val Storage: StorageModule = StorageModule.StorageServiceLocator() + + +} + +interface ServiceLocatorInterface { + val Storage: StorageModule +} + +interface StorageModule { + val json: Json + + class StorageServiceLocator : StorageModule { + override val json = Json { + prettyPrint = true + } + } +} diff --git a/sample/src/commonMain/kotlin/com/ionspin/kotlin/crypto/sample/ui/LandingController.kt b/sample/src/commonMain/kotlin/com/ionspin/kotlin/crypto/sample/ui/LandingController.kt new file mode 100644 index 0000000..3166bc3 --- /dev/null +++ b/sample/src/commonMain/kotlin/com/ionspin/kotlin/crypto/sample/ui/LandingController.kt @@ -0,0 +1,10 @@ +package com.ionspin.kotlin.crypto.sample.ui + +/** + * Created by Ugljesa Jovanovic + * ugljesa.jovanovic@ionspin.com + * on 17-Oct-2020 + */ +class LandingController { + +} diff --git a/sample/src/jsMain/kotlin/com/ionspin/kotlin/crypto/sample/App.kt b/sample/src/jsMain/kotlin/com/ionspin/kotlin/crypto/sample/App.kt new file mode 100644 index 0000000..f626f89 --- /dev/null +++ b/sample/src/jsMain/kotlin/com/ionspin/kotlin/crypto/sample/App.kt @@ -0,0 +1,35 @@ +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(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) + } +} diff --git a/sample/src/jsMain/kotlin/com/ionspin/kotlin/crypto/sample/Main.kt b/sample/src/jsMain/kotlin/com/ionspin/kotlin/crypto/sample/Main.kt new file mode 100644 index 0000000..841f0c5 --- /dev/null +++ b/sample/src/jsMain/kotlin/com/ionspin/kotlin/crypto/sample/Main.kt @@ -0,0 +1,28 @@ + + +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 kotlin.browser.window + +fun main() { + val runningOnNode = jsTypeOf(window) == "undefined" + if (!runningOnNode) { + LibsodiumInitializer.initializeWithCallback { + render(document.getElementById("root")) { + app { + + } + } + } + } else { + LibsodiumInitializer.initializeWithCallback { + val hash = Hash.sha512("123".encodeToUByteArray()) + println("Hash (SHA512) of 123: ${hash.toHexString()}") + } + } +} diff --git a/sample/src/jsMain/resources/index.html b/sample/src/jsMain/resources/index.html new file mode 100644 index 0000000..9f04a20 --- /dev/null +++ b/sample/src/jsMain/resources/index.html @@ -0,0 +1,12 @@ + + + + + Libsodium bindings sample app! + + + +
+ + + diff --git a/sample/src/linuxMain/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt b/sample/src/nativeMain/kotlin/Runner.kt similarity index 71% rename from sample/src/linuxMain/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt rename to sample/src/nativeMain/kotlin/Runner.kt index 3343ed0..0630398 100644 --- a/sample/src/linuxMain/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt +++ b/sample/src/nativeMain/kotlin/Runner.kt @@ -1,5 +1,6 @@ import com.ionspin.kotlin.crypto.sample.Sample -fun main() { +fun main() : Unit { Sample.runSample() + ui() } diff --git a/sample/src/nativeMain/kotlin/com/ionspin/kotlin/crypto/sample/UI.kt b/sample/src/nativeMain/kotlin/com/ionspin/kotlin/crypto/sample/UI.kt new file mode 100644 index 0000000..2c84065 --- /dev/null +++ b/sample/src/nativeMain/kotlin/com/ionspin/kotlin/crypto/sample/UI.kt @@ -0,0 +1,30 @@ +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 + } + } +} diff --git a/sample/webpack.config.d/devServer.config.js b/sample/webpack.config.d/devServer.config.js new file mode 100644 index 0000000..c4d84c0 --- /dev/null +++ b/sample/webpack.config.d/devServer.config.js @@ -0,0 +1,7 @@ +config.devServer = config.devServer || {} +config.devServer.port = 8081 +config.devServer.open = false +config.devServer.watchOptions = { + "aggregateTimeout": 1000, + "poll": 1000 +} \ No newline at end of file diff --git a/sodiumWrapper/configureMingw64.sh b/sodiumWrapper/configureMingw64.sh index d39417c..ce70b05 100755 --- a/sodiumWrapper/configureMingw64.sh +++ b/sodiumWrapper/configureMingw64.sh @@ -2,7 +2,7 @@ ## and then borrowed and slightly modified from https://github.com/datkt/sodium/configure ## borrowed from https://github.com/sodium-friends/sodium-native/blob/master/configure PREFIX="${PREFIX:-$PWD/static-mingw-x86-64}" -KONAN="${KONAN:-$HOME/.konan}" +KONAN="C:/Windows/System32/config/systemprofile/.konan" ARCH=${ARCH:-$(uname -m)} echo $PREFIX echo $KONAN diff --git a/sodiumWrapper/libsodium b/sodiumWrapper/libsodium index b0ed382..1a9ef3d 160000 --- a/sodiumWrapper/libsodium +++ b/sodiumWrapper/libsodium @@ -1 +1 @@ -Subproject commit b0ed382e71ff52e5ecef8691d62dfe7a04a803f7 +Subproject commit 1a9ef3db870ba0d98d04a469bdb9b0cd2379a9e3 diff --git a/sodiumWrapper/makeIos.sh b/sodiumWrapper/makeIos.sh deleted file mode 100755 index 317fd70..0000000 --- a/sodiumWrapper/makeIos.sh +++ /dev/null @@ -1,5 +0,0 @@ -cd libsodium -./dist-build/ios.sh -mkdir ../static-ios -cp -R ./libsodium-ios/lib ../static-ios/lib -cp -R ./libsodium-ios/include ../static-ios/include diff --git a/sodiumWrapper/makeIosWatchosTvos.sh b/sodiumWrapper/makeIosWatchosTvos.sh new file mode 100755 index 0000000..0741fa3 --- /dev/null +++ b/sodiumWrapper/makeIosWatchosTvos.sh @@ -0,0 +1,24 @@ +cd libsodium +./dist-build/apple-xcframework.sh + +mkdir ../static-ios +mkdir ../static-ios-simulators +mkdir ../static-watchos +mkdir ../static-watchos-simulators +mkdir ../static-tvos +mkdir ../static-tvos-simulators + +cp -R ./libsodium-apple/ios/lib ../static-ios/lib +cp -R ./libsodium-apple/ios/include ../static-ios +cp -R ./libsodium-apple/ios-simulators/lib ../static-ios-simulators/lib +cp -R ./libsodium-apple/ios-simulators/include ../static-ios-simulators + +cp -R ./libsodium-apple/watchos/lib ../static-watchos/lib +cp -R ./libsodium-apple/watchos/include ../static-watchos +cp -R ./libsodium-apple/watchos-simulators/lib ../static-watchos-simulators/lib +cp -R ./libsodium-apple/watchos-simulators/include ../static-watchos-simulators + +cp -R ./libsodium-apple/tvos/lib ../static-tvos/lib +cp -R ./libsodium-apple/tvos/include ../static-tvos +cp -R ./libsodium-apple/tvos-simulators/lib ../static-tvos-simulators/lib +cp -R ./libsodium-apple/tvos-simulators/include ../static-tvos-simulators \ No newline at end of file diff --git a/windowsBuild-delegated.sh b/windowsBuild-delegated.sh index 655bb92..0d8cf23 100755 --- a/windowsBuild-delegated.sh +++ b/windowsBuild-delegated.sh @@ -1,15 +1,15 @@ set -e #!/bin/sh #this will hopefully download all konan dependancies that we use in the build scripts - +./gradlew clean ./gradlew multiplatform-crypto-api:build cd sodiumWrapper echo "Starting mingw libsodium build" ./configureMingw64.sh echo "Configure done" -$GNU_MAKE -j4 -C libsodium clean -$GNU_MAKE -j4 -C libsodium -$GNU_MAKE -j4 -C libsodium install +make -j4 -C libsodium clean +make -j4 -C libsodium +make -j4 -C libsodium install echo "completed libsodium build" #now we can do the delegated build cd .. diff --git a/windowsBuild-pure.sh b/windowsBuild-pure.sh index 3ad152f..706b61f 100755 --- a/windowsBuild-pure.sh +++ b/windowsBuild-pure.sh @@ -1,5 +1,6 @@ set -e #!/bin/sh +./gradlew clean ./gradlew multiplatform-crypto-api:build ./gradlew multiplatform-crypto:build set +e diff --git a/windowsBuildAndPublish-delegated.sh b/windowsBuildAndPublish-delegated.sh index 6432351..a6a9c0b 100755 --- a/windowsBuildAndPublish-delegated.sh +++ b/windowsBuildAndPublish-delegated.sh @@ -1,15 +1,15 @@ set -e #!/bin/sh #this will hopefully download all konan dependancies that we use in the build scripts - +./gradlew clean ./gradlew multiplatform-crypto-api:build cd sodiumWrapper echo "Starting mingw libsodium build" ./configureMingw64.sh echo "Configure done" -$GNU_MAKE -j4 -C libsodium clean -$GNU_MAKE -j4 -C libsodium -$GNU_MAKE -j4 -C libsodium install +make -j4 -C libsodium clean +make -j4 -C libsodium +make -j4 -C libsodium install echo "completed libsodium build" #now we can do the delegated build cd .. diff --git a/windowsBuildAndPublish-pure.sh b/windowsBuildAndPublish-pure.sh index f1f2c00..6340b8d 100755 --- a/windowsBuildAndPublish-pure.sh +++ b/windowsBuildAndPublish-pure.sh @@ -1,8 +1,8 @@ set -e #!/bin/sh #this will hopefully download all konan dependancies that we use in the build scripts - +./gradlew clean ./gradlew multiplatform-crypto-api:build ./gradlew multiplatform-crypto:build ./gradlew multiplatform-crypto:publishMingwX64PublicationToSnapshotRepository -set +e \ No newline at end of file +set +e