From a5fc3c835000e16ff493fd569c5c3ae8095fdff9 Mon Sep 17 00:00:00 2001 From: Ugljesa Jovanovic Date: Sat, 16 May 2020 23:55:26 +0200 Subject: [PATCH 1/5] Limit builds to hosts, bump to 0.0.3 --- multiplatform-crypto/build.gradle.kts | 363 ++++++++++++++------------ 1 file changed, 193 insertions(+), 170 deletions(-) diff --git a/multiplatform-crypto/build.gradle.kts b/multiplatform-crypto/build.gradle.kts index b4e42dd..58f6457 100644 --- a/multiplatform-crypto/build.gradle.kts +++ b/multiplatform-crypto/build.gradle.kts @@ -47,7 +47,7 @@ repositories { } group = "com.ionspin.kotlin" -version = "0.0.3-SNAPSHOT" +version = "0.0.3" val ideaActive = System.getProperty("idea.active") == "true" @@ -68,22 +68,23 @@ kotlin { "windows" -> mingwX64("native") } } - jvm() - js { - compilations { - this.forEach { - it.compileKotlinTask.kotlinOptions.sourceMap = true - it.compileKotlinTask.kotlinOptions.moduleKind = "commonjs" - it.compileKotlinTask.kotlinOptions.metaInfo = true + if (hostOsName == "linux") { + 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" + if (it.name == "main") { + it.compileKotlinTask.kotlinOptions.main = "call" + } + println("Compilation name ${it.name} set") + println("Destination dir ${it.compileKotlinTask.destinationDir}") } - println("Compilation name ${it.name} set") - println("Destination dir ${it.compileKotlinTask.destinationDir}") } - } - //Until I figure out how to run headless chrome on travis + //Until I figure out how to run headless chrome on travis // browser { // // testTask { @@ -92,56 +93,76 @@ kotlin { // } // } // } - nodejs { - testTask { - useMocha() { - timeout = "10s" + nodejs { + testTask { + useMocha() { + timeout = "10s" + } + } + } + + } + linuxX64("linux") { + binaries { + staticLib { + + } + } + } + linuxArm32Hfp() { + binaries { + staticLib { + } + } + } + + linuxArm64() { + binaries { + staticLib { } } } } - linuxX64("linux") { - binaries { - staticLib { + if (hostOsName == "mac") { + iosX64("ios") { + binaries { + framework { + + } + } + } + iosArm64("ios64Arm") { + binaries { + framework { + + } + } + } + + iosArm32("ios32Arm") { + binaries { + framework { + + } + } + } + macosX64() { + binaries { + framework { + + } } } } - iosX64("ios") { - binaries { - framework { + if (hostOsName == "windows") { - } - } - } - iosArm64("ios64Arm") { - binaries { - framework { - - } - } - } - - iosArm32("ios32Arm") { - binaries { - framework { - - } - } - } - macosX64() { - binaries { - framework { - - } - } - } - - mingwX64() { - binaries { - staticLib { + mingwX64() { + binaries { + staticLib { + } } } } @@ -154,19 +175,6 @@ kotlin { // } // } - linuxArm32Hfp() { - binaries { - staticLib { - } - } - } - - linuxArm64() { - binaries { - staticLib { - } - } - } println(targets.names) @@ -185,34 +193,7 @@ kotlin { implementation(kotlin(Deps.Common.testAnnotation)) } } - val jvmMain by getting { - dependencies { - implementation(kotlin(Deps.Jvm.stdLib)) - implementation(kotlin(Deps.Jvm.test)) - implementation(kotlin(Deps.Jvm.testJUnit)) - implementation(Deps.Jvm.coroutinesCore) - } - } - val jvmTest by getting { - dependencies { - implementation(kotlin(Deps.Jvm.test)) - implementation(kotlin(Deps.Jvm.testJUnit)) - implementation(Deps.Jvm.coroutinesTest) - implementation(kotlin(Deps.Jvm.reflection)) - } - } - val jsMain by getting { - dependencies { - implementation(kotlin(Deps.Js.stdLib)) - implementation(kotlin(Deps.Js.test)) - implementation(Deps.Js.coroutines) - } - } - val jsTest by getting { - dependencies { - implementation(kotlin("test-js")) - } - } + val nativeMain = if (ideaActive) { val nativeMain by getting { dependsOn(commonMain) @@ -242,40 +223,91 @@ kotlin { nativeTest } - - val iosMain by getting { - dependsOn(nativeMain) - } - val iosTest by getting { - dependsOn(nativeTest) + if (hostOsName == "linux") { + val jvmMain by getting { + dependencies { + implementation(kotlin(Deps.Jvm.stdLib)) + implementation(kotlin(Deps.Jvm.test)) + implementation(kotlin(Deps.Jvm.testJUnit)) + implementation(Deps.Jvm.coroutinesCore) + } + } + val jvmTest by getting { + dependencies { + implementation(kotlin(Deps.Jvm.test)) + implementation(kotlin(Deps.Jvm.testJUnit)) + implementation(Deps.Jvm.coroutinesTest) + implementation(kotlin(Deps.Jvm.reflection)) + } + } + val jsMain by getting { + dependencies { + implementation(kotlin(Deps.Js.stdLib)) + implementation(kotlin(Deps.Js.test)) + implementation(Deps.Js.coroutines) + } + } + val jsTest by getting { + dependencies { + implementation(kotlin("test-js")) + } + } + val linuxMain by getting { + dependsOn(nativeMain) + } + val linuxTest by getting { + dependsOn(nativeTest) + } + + val linuxArm32HfpMain by getting { + dependsOn(nativeMain) + } + + val linuxArm32HfpTest by getting { + dependsOn(nativeTest) + } + + val linuxArm64Main by getting { + dependsOn(nativeMain) + } + + val linuxArm64Test by getting { + dependsOn(nativeTest) + } + } - val ios64ArmMain by getting { - dependsOn(nativeMain) - } - val ios64ArmTest by getting { - dependsOn(nativeTest) + if (hostOsName == "mac") { + + val iosMain by getting { + dependsOn(nativeMain) + } + val iosTest by getting { + dependsOn(nativeTest) + } + + val ios64ArmMain by getting { + dependsOn(nativeMain) + } + val ios64ArmTest by getting { + dependsOn(nativeTest) + } + + val ios32ArmMain by getting { + dependsOn(nativeMain) + } + val ios32ArmTest by getting { + dependsOn(nativeTest) + } + + val macosX64Main by getting { + dependsOn(nativeMain) + } + val macosX64Test by getting { + dependsOn(nativeTest) + } } - val ios32ArmMain by getting { - dependsOn(nativeMain) - } - val ios32ArmTest by getting { - dependsOn(nativeTest) - } - - val macosX64Main by getting { - dependsOn(nativeMain) - } - val macosX64Test by getting { - dependsOn(nativeTest) - } - val linuxMain by getting { - dependsOn(nativeMain) - } - val linuxTest by getting { - dependsOn(nativeTest) - } // Coroutines don't support mingwx86 yet // val mingwX86Main by getting { // dependsOn(commonMain) @@ -288,32 +320,20 @@ kotlin { // dependsOn(commonTest) // } // - val mingwX64Main by getting { - dependsOn(commonMain) - dependencies { - implementation(Deps.Native.coroutines) + if (hostOsName == "windows") { + val mingwX64Main by getting { + dependsOn(commonMain) + dependencies { + implementation(Deps.Native.coroutines) + } + } + + val mingwX64Test by getting { + dependsOn(commonTest) } } - val mingwX64Test by getting { - dependsOn(commonTest) - } - val linuxArm32HfpMain by getting { - dependsOn(nativeMain) - } - - val linuxArm32HfpTest by getting { - dependsOn(nativeTest) - } - - val linuxArm64Main by getting { - dependsOn(nativeMain) - } - - val linuxArm64Test by getting { - dependsOn(nativeTest) - } all { languageSettings.enableLanguageFeature("InlineClasses") } @@ -355,44 +375,47 @@ tasks { platforms = listOf("Common") } } - - val jvmTest by getting(Test::class) { - testLogging { - events("PASSED", "FAILED", "SKIPPED") + if (getHostOsName() == "linux") { + val jvmTest by getting(Test::class) { + testLogging { + events("PASSED", "FAILED", "SKIPPED") + } } - } - val linuxTest by getting(KotlinNativeTest::class) { + val linuxTest by getting(KotlinNativeTest::class) { - testLogging { - events("PASSED", "FAILED", "SKIPPED") - // showStandardStreams = true + testLogging { + events("PASSED", "FAILED", "SKIPPED") + // showStandardStreams = true + } } - } - val mingwX64Test by getting(KotlinNativeTest::class) { + val jsNodeTest by getting(KotlinJsTest::class) { - testLogging { - events("PASSED", "FAILED", "SKIPPED") - showStandardStreams = true + testLogging { + events("PASSED", "FAILED", "SKIPPED") + showStandardStreams = true + } } - } - val jsNodeTest by getting(KotlinJsTest::class) { - - testLogging { - events("PASSED", "FAILED", "SKIPPED") - showStandardStreams = true - } - } - -// val jsBrowserTest by getting(KotlinJsTest::class) { + // val jsBrowserTest 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 + } + } + } } From 6d6b16edfcf042e4714bf7dcda2bebfcbd591164 Mon Sep 17 00:00:00 2001 From: Ugljesa Jovanovic Date: Sun, 17 May 2020 00:00:01 +0200 Subject: [PATCH 2/5] build gradle fixes --- multiplatform-crypto/build.gradle.kts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/multiplatform-crypto/build.gradle.kts b/multiplatform-crypto/build.gradle.kts index 58f6457..e3c43e0 100644 --- a/multiplatform-crypto/build.gradle.kts +++ b/multiplatform-crypto/build.gradle.kts @@ -353,9 +353,7 @@ task("copyPackageJson") { } tasks { - val npmInstall by getting - val compileKotlinJs by getting(AbstractCompile::class) - val compileTestKotlinJs by getting(Kotlin2JsCompile::class) + create("javadocJar") { dependsOn(dokka) @@ -376,6 +374,11 @@ tasks { } } 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") From 632739c551e00d712069f12a0184756d04e8634e Mon Sep 17 00:00:00 2001 From: Ugljesa Jovanovic Date: Sun, 17 May 2020 00:08:55 +0200 Subject: [PATCH 3/5] fix mac build --- multiplatform-crypto/build.gradle.kts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/multiplatform-crypto/build.gradle.kts b/multiplatform-crypto/build.gradle.kts index e3c43e0..3fd5285 100644 --- a/multiplatform-crypto/build.gradle.kts +++ b/multiplatform-crypto/build.gradle.kts @@ -125,7 +125,7 @@ kotlin { } - if (hostOsName == "mac") { + if (hostOsName == "macos") { iosX64("ios") { binaries { framework { @@ -277,7 +277,7 @@ kotlin { } - if (hostOsName == "mac") { + if (hostOsName == "macos") { val iosMain by getting { dependsOn(nativeMain) @@ -378,7 +378,7 @@ tasks { 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") From 96c9ee0066a79ee51cacbaf96a009bff9d8112ec Mon Sep 17 00:00:00 2001 From: Ugljesa Jovanovic Date: Sun, 17 May 2020 00:27:08 +0200 Subject: [PATCH 4/5] Add mac publish to maven script --- macPublishToMaven.sh | 1 + 1 file changed, 1 insertion(+) create mode 100755 macPublishToMaven.sh diff --git a/macPublishToMaven.sh b/macPublishToMaven.sh new file mode 100755 index 0000000..6c68051 --- /dev/null +++ b/macPublishToMaven.sh @@ -0,0 +1 @@ +./gradlew publishAllPublicationsToMavenRepository -x publishMetadataPublicationToMavenRepository -x publishKotlinMultiplatformPublicationToMavenRepository From 7ef6d23f465b24ce0ac1f8fa2e4f6fb8a03c1b01 Mon Sep 17 00:00:00 2001 From: Ugljesa Jovanovic Date: Sun, 17 May 2020 00:42:40 +0200 Subject: [PATCH 5/5] Fix travis windows deploy (no x86 for windows), bump snapshot to 0.0.4 --- .travis.yml | 2 +- multiplatform-crypto/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index eaab6c3..9fa2784 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,7 @@ matrix: - source ~/.install-jdk-travis.sh script: - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then ./gradlew build -x jvmTest -x jsTest; fi' - - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then ./gradlew build -x jvmTest -x jsTest publishMingwx86PublicationToSnapshotRepository publishMingwx64PublicationToSnapshotRepository; fi' + - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then ./gradlew build -x jvmTest -x jsTest publishMingwx64PublicationToSnapshotRepository; fi' cache: directories: - $HOME/.m2/ diff --git a/multiplatform-crypto/build.gradle.kts b/multiplatform-crypto/build.gradle.kts index 3fd5285..758c67e 100644 --- a/multiplatform-crypto/build.gradle.kts +++ b/multiplatform-crypto/build.gradle.kts @@ -47,7 +47,7 @@ repositories { } group = "com.ionspin.kotlin" -version = "0.0.3" +version = "0.0.4-SNAPSHOT" val ideaActive = System.getProperty("idea.active") == "true"