Sorted out native sourcesets, using intialization and sodium srng in js and native
This commit is contained in:
1 parent
ccbb8ebe5b
commit
63c5db199e
12 files changed
+208
-175
No files matched your search
@@ -16,30 +16,26 @@
|
||||
*/
|
||||
|
||||
@file:Suppress("UnstableApiUsage")
|
||||
|
||||
import com.moowork.gradle.node.task.NodeTask
|
||||
import org.gradle.api.tasks.testing.logging.TestLogging
|
||||
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest
|
||||
import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest
|
||||
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
||||
|
||||
plugins {
|
||||
kotlin(PluginsDeps.multiplatform)
|
||||
id (PluginsDeps.mavenPublish)
|
||||
id (PluginsDeps.signing)
|
||||
id (PluginsDeps.node) version Versions.nodePlugin
|
||||
id (PluginsDeps.dokka) version Versions.dokkaPlugin
|
||||
id(PluginsDeps.mavenPublish)
|
||||
id(PluginsDeps.signing)
|
||||
id(PluginsDeps.node) version Versions.nodePlugin
|
||||
id(PluginsDeps.dokka) version Versions.dokkaPlugin
|
||||
}
|
||||
|
||||
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 sonatypePassword: String? by project
|
||||
|
||||
val sonatypeUsername : String? by project
|
||||
val sonatypeUsername: String? by project
|
||||
|
||||
val sonatypePasswordEnv : String? = System.getenv()["SONATYPE_PASSWORD"]
|
||||
val sonatypeUsernameEnv : String? = System.getenv()["SONATYPE_USERNAME"]
|
||||
val sonatypePasswordEnv: String? = System.getenv()["SONATYPE_PASSWORD"]
|
||||
val sonatypeUsernameEnv: String? = System.getenv()["SONATYPE_USERNAME"]
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -61,13 +57,6 @@ fun getHostOsName(): String {
|
||||
|
||||
kotlin {
|
||||
val hostOsName = getHostOsName()
|
||||
if (ideaActive) {
|
||||
when(hostOsName) {
|
||||
"linux" -> linuxX64("native")
|
||||
"macos" -> macosX64("native")
|
||||
"windows" -> mingwX64("native")
|
||||
}
|
||||
}
|
||||
if (hostOsName == "linux") {
|
||||
jvm()
|
||||
js {
|
||||
@@ -196,41 +185,39 @@ kotlin {
|
||||
}
|
||||
}
|
||||
|
||||
val nativeMain = if (ideaActive) {
|
||||
val nativeMain by getting {
|
||||
dependsOn(commonMain)
|
||||
dependencies {
|
||||
implementation(Deps.Native.coroutines)
|
||||
}
|
||||
|
||||
val nativeMain by creating {
|
||||
dependsOn(commonMain)
|
||||
dependencies {
|
||||
implementation(Deps.Native.coroutines)
|
||||
}
|
||||
nativeMain
|
||||
} else {
|
||||
val nativeMain by creating {
|
||||
dependsOn(commonMain)
|
||||
dependencies {
|
||||
implementation(Deps.Native.coroutines)
|
||||
}
|
||||
}
|
||||
nativeMain
|
||||
}
|
||||
val nativeTest = if (ideaActive) {
|
||||
val nativeTest by getting {
|
||||
dependsOn(commonTest)
|
||||
dependencies {
|
||||
implementation(Deps.Native.coroutines)
|
||||
}
|
||||
|
||||
|
||||
val nativeTest by creating {
|
||||
dependsOn(commonTest)
|
||||
dependencies {
|
||||
implementation(Deps.Native.coroutines)
|
||||
}
|
||||
nativeTest
|
||||
} else {
|
||||
val nativeTest by creating {
|
||||
dependsOn(commonTest)
|
||||
dependencies {
|
||||
implementation(Deps.Native.coroutines)
|
||||
}
|
||||
}
|
||||
nativeTest
|
||||
}
|
||||
|
||||
targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget> {
|
||||
compilations.getByName("main") {
|
||||
println("Setting native sourceset dependancy for $name")
|
||||
if (!name.contains("ios")) {
|
||||
defaultSourceSet.dependsOn(nativeMain)
|
||||
}
|
||||
}
|
||||
compilations.getByName("test") {
|
||||
println("Setting native sourceset dependancy for $name")
|
||||
if (!name.contains("ios")) {
|
||||
defaultSourceSet.dependsOn(nativeTest)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (hostOsName == "linux") {
|
||||
val jvmMain by getting {
|
||||
dependencies {
|
||||
@@ -262,9 +249,17 @@ kotlin {
|
||||
}
|
||||
val linuxMain by getting {
|
||||
dependsOn(nativeMain)
|
||||
//Force idea to consider native sourceset
|
||||
if (ideaActive) {
|
||||
kotlin.srcDir("src/nativeMain/kotlin")
|
||||
}
|
||||
}
|
||||
val linuxTest by getting {
|
||||
dependsOn(nativeTest)
|
||||
//Force idea to consider native sourceset
|
||||
if (ideaActive) {
|
||||
kotlin.srcDir("src/nativeTest/kotlin")
|
||||
}
|
||||
}
|
||||
//Not supported in coroutines at the moment
|
||||
// val linuxArm32HfpMain by getting {
|
||||
@@ -355,9 +350,9 @@ kotlin {
|
||||
task<Copy>("copyPackageJson") {
|
||||
dependsOn("compileKotlinJs")
|
||||
println("Copying package.json from $projectDir/core/src/jsMain/npm")
|
||||
from ("$projectDir/src/jsMain/npm")
|
||||
from("$projectDir/src/jsMain/npm")
|
||||
println("Node modules dir ${node.nodeModulesDir}")
|
||||
into ("${node.nodeModulesDir}")
|
||||
into("${node.nodeModulesDir}")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@@ -370,23 +365,20 @@ tasks {
|
||||
}
|
||||
|
||||
dokka {
|
||||
println ("Dokka !")
|
||||
println("Dokka !")
|
||||
impliedPlatforms = mutableListOf("Common")
|
||||
kotlinTasks {
|
||||
listOf()
|
||||
}
|
||||
sourceRoot {
|
||||
println ("Common !")
|
||||
path = "/home/ionspin/Projects/Future/kotlin-multiplatform-crypto/crypto/src/commonMain" //TODO remove static path!
|
||||
println("Common !")
|
||||
path =
|
||||
"/home/ionspin/Projects/Future/kotlin-multiplatform-crypto/crypto/src/commonMain" //TODO remove static path!
|
||||
platforms = listOf("Common")
|
||||
}
|
||||
}
|
||||
if (getHostOsName() == "linux") {
|
||||
|
||||
val npmInstall by getting
|
||||
val compileKotlinJs by getting(AbstractCompile::class)
|
||||
val compileTestKotlinJs by getting(Kotlin2JsCompile::class)
|
||||
|
||||
val jvmTest by getting(Test::class) {
|
||||
testLogging {
|
||||
events("PASSED", "FAILED", "SKIPPED")
|
||||
@@ -397,7 +389,7 @@ tasks {
|
||||
|
||||
testLogging {
|
||||
events("PASSED", "FAILED", "SKIPPED")
|
||||
// showStandardStreams = true
|
||||
// showStandardStreams = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user