/* * Copyright 2019 Ugljesa Jovanovic * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ @file:Suppress("UnstableApiUsage") import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest plugins { kotlin(PluginsDeps.multiplatform) id (PluginsDeps.mavenPublish) id (PluginsDeps.signing) id (PluginsDeps.dokka) version Versions.dokkaPlugin } repositories { mavenCentral() jcenter() } group = ReleaseInfo.group version = ReleaseInfo.version val ideaActive = System.getProperty("idea.active") == "true" kotlin { val hostOsName = getHostOsName() runningOnLinuxx86_64 { jvm() js { compilations { this.forEach { it.compileKotlinTask.kotlinOptions.sourceMap = true it.compileKotlinTask.kotlinOptions.moduleKind = "commonjs" it.compileKotlinTask.kotlinOptions.metaInfo = true if (it.name == "main") { it.compileKotlinTask.kotlinOptions.main = "call" } println("Compilation name ${it.name} set") println("Destination dir ${it.compileKotlinTask.destinationDir}") } } browser { testTask { enabled = false //Until I sort out testing on travis useKarma { useChrome() } } } nodejs { testTask { useMocha() { timeout = "10s" } } } } linuxX64("linux") { binaries { staticLib { optimized = true } } } //Not supported in OFFICIAL coroutines at the moment linuxArm64() { binaries { staticLib { } } } } runningOnLinuxArm64 { } runningOnLinuxArm32 { //Not supported in OFFICAL coroutines at the moment linuxArm32Hfp() { binaries { staticLib { } } } } runningOnMacos { iosX64() { binaries { framework { optimized = true } } } iosArm64() { binaries { framework { optimized = true } } } iosArm32() { binaries { framework { optimized = true } } } macosX64() { binaries { framework { optimized = true } } } 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 } } } } runningOnWindows { mingwX64() { binaries { staticLib { optimized = true } } } mingwX86() { binaries { staticLib { } } } } println(targets.names) sourceSets { val commonMain by getting { dependencies { implementation(kotlin(Deps.Common.stdLib)) implementation(kotlin(Deps.Common.test)) } } val commonTest by getting { dependencies { implementation(kotlin(Deps.Common.test)) implementation(kotlin(Deps.Common.testAnnotation)) } } runningOnLinuxx86_64 { val jvmMain by getting { dependencies { implementation(kotlin(Deps.Jvm.stdLib)) implementation(kotlin(Deps.Jvm.test)) implementation(kotlin(Deps.Jvm.testJUnit)) } } val jvmTest by getting { dependencies { implementation(kotlin(Deps.Jvm.test)) implementation(kotlin(Deps.Jvm.testJUnit)) implementation(kotlin(Deps.Jvm.reflection)) } } val jsMain by getting { dependencies { implementation(kotlin(Deps.Js.stdLib)) } } val jsTest by getting { dependencies { implementation(kotlin(Deps.Js.test)) } } } runningOnMacos { val tvosX64Main by getting { dependsOn(commonMain) } val tvosArm64Main by getting { dependsOn(commonMain) } val watchosX86Main by getting { dependsOn(commonMain) } val watchosArm64Main by getting { dependsOn(commonMain) } val watchosArm32Main by getting { dependsOn(commonMain) } } all { languageSettings.enableLanguageFeature("InlineClasses") } } } tasks { create("javadocJar") { dependsOn(dokka) archiveClassifier.set("javadoc") from(dokka.get().outputDirectory) } 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! platforms = listOf("Common") } } if (getHostOsName() == "linux" && getHostArchitecture() == "x86-64") { val jvmTest by getting(Test::class) { testLogging { events("PASSED", "FAILED", "SKIPPED") } } val linuxTest by getting(KotlinNativeTest::class) { testLogging { events("PASSED", "FAILED", "SKIPPED") // showStandardStreams = true } } val jsNodeTest by getting(KotlinJsTest::class) { testLogging { events("PASSED", "FAILED", "SKIPPED") showStandardStreams = true } } // 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") { val mingwX64Test by getting(KotlinNativeTest::class) { testLogging { events("PASSED", "FAILED", "SKIPPED") showStandardStreams = true } } } }