Skip to content

Commit

Permalink
Disable wasm target on windows machine on CI (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
findjigar authored Oct 11, 2023
1 parent c043edb commit 9b846cc
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 53 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
strategy:
matrix:
os: [macOS-latest]
os: [macOS-latest, windows-latest]
runs-on: ${{matrix.os}}
steps:
- name: Checkout the repo
Expand Down Expand Up @@ -42,17 +42,27 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build
- name: Build for MacOS
if: matrix.os == 'macOS-latest'
run: ./gradlew build --no-daemon --stacktrace --build-cache
env:
S3_BUILD_CACHE_AWS_REGION: ${{ secrets.S3_BUILD_CACHE_AWS_REGION }}
S3_BUILD_CACHE_BUCKET_NAME: ${{ secrets.S3_BUILD_CACHE_BUCKET_NAME }}
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }}
CI: "true"
- name: Build for Windows
if: matrix.os == 'windows-latest'
run: ./gradlew kotlinUpgradeYarnLock build -PenableWasm=false --no-daemon --stacktrace --build-cache
env:
S3_BUILD_CACHE_AWS_REGION: ${{ secrets.S3_BUILD_CACHE_AWS_REGION }}
S3_BUILD_CACHE_BUCKET_NAME: ${{ secrets.S3_BUILD_CACHE_BUCKET_NAME }}
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }}
CI: "true"
run: ./gradlew -PbuildExtensions=true build --no-daemon --stacktrace --build-cache
- name: Local Publish For Samples
if: matrix.os == 'macOS-latest'
run: ./gradlew -PbuildExtensions=true publishToMavenLocal --no-daemon --stacktrace --build-cache
run: ./gradlew publishToMavenLocal --no-daemon --stacktrace --build-cache
env:
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
Expand Down
7 changes: 7 additions & 0 deletions convention-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}

dependencies {
implementation(libs.kotlin.gradlePlugin)
}
10 changes: 10 additions & 0 deletions convention-plugins/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
dependencyResolutionManagement {
repositories {
gradlePluginPortal()
}
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
41 changes: 41 additions & 0 deletions convention-plugins/src/main/kotlin/wasm-setup.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2023 Touchlab
* 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.
*/

import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

plugins {
kotlin("multiplatform")
}

kotlin {
val wasmEnabled = project.findProperty("enableWasm") == "true"
if (wasmEnabled) {
@OptIn(ExperimentalWasmDsl::class)
wasm {
browser()
nodejs()
d8()
binaries.executable()
}
}
sourceSets {
val jsAndWasmMain by creating
val jsAndWasmTest by creating
if (wasmEnabled) {
val wasmMain by getting {
dependsOn(jsAndWasmMain)
}

val wasmTest by getting {
dependsOn(jsAndWasmTest)
}
}
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ POM_DEVELOPER_ORG=Touchlab
POM_DEVELOPER_URL=https://touchlab.co/

kotlin.js.ir.output.granularity=whole-program
enableWasm=true
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", ve
android-junitTest = { module = "androidx.test.ext:junit", version.ref = "android-junitTest" }
junitTest = { module = "junit:junit", version.ref = "junit" }

# For convention-plugins
kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }

[plugins]
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
Expand Down
16 changes: 4 additions & 12 deletions kermit-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
*/

import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("com.android.library")
kotlin("multiplatform")
id("com.vanniktech.maven.publish")
id("wasm-setup")
}

kotlin {
Expand All @@ -33,13 +33,6 @@ kotlin {
browser()
nodejs()
}
@OptIn(ExperimentalWasmDsl::class)
wasm {
browser()
nodejs()
d8()
binaries.executable()
}

macosX64()
macosArm64()
Expand Down Expand Up @@ -117,15 +110,14 @@ kotlin {
dependsOn(nativeTest)
}

val jsAndWasmMain by creating {
val jsAndWasmMain by getting {
dependsOn(commonMain)
getByName("jsMain").dependsOn(this)
getByName("wasmMain").dependsOn(this)
}
val jsAndWasmTest by creating {

val jsAndWasmTest by getting {
dependsOn(commonTest)
getByName("jsTest").dependsOn(this)
getByName("wasmTest").dependsOn(this)
}

targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>().all {
Expand Down
23 changes: 6 additions & 17 deletions kermit-simple/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension

/*
Expand All @@ -18,6 +17,7 @@ import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
plugins {
kotlin("multiplatform")
id("com.vanniktech.maven.publish")
id("wasm-setup")
}

kotlin {
Expand All @@ -27,13 +27,6 @@ kotlin {
browser()
nodejs()
}
@OptIn(ExperimentalWasmDsl::class)
wasm {
browser()
nodejs()
d8()
binaries.executable()
}

macosX64()
macosArm64()
Expand Down Expand Up @@ -78,19 +71,15 @@ kotlin {
dependsOn(getByName("commonTest"))
}

val jsMain by getting {
val jsAndWasmMain by getting {
dependsOn(nonKotlinMain)
getByName("jsMain").dependsOn(this)
}

val jsTest by getting {
dependsOn(nonKotlinTest)
}
val wasmMain by getting {
dependsOn(nonKotlinMain)
}
val wasmTest by getting {
val jsAndWasmTest by getting {
dependsOn(nonKotlinTest)
getByName("jsTest").dependsOn(this)
}

targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>().all {
val mainSourceSet = compilations.getByName("main").defaultSourceSet
val testSourceSet = compilations.getByName("test").defaultSourceSet
Expand Down
9 changes: 1 addition & 8 deletions kermit-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
*/

import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("com.android.library")
kotlin("multiplatform")
id("com.vanniktech.maven.publish")
id("wasm-setup")
}

kotlin {
Expand All @@ -33,13 +33,6 @@ kotlin {
browser()
nodejs()
}
@OptIn(ExperimentalWasmDsl::class)
wasm {
browser()
nodejs()
d8()
binaries.executable()
}

macosX64()
macosArm64()
Expand Down
17 changes: 5 additions & 12 deletions kermit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
*/

import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("com.android.library")
kotlin("multiplatform")
id("com.vanniktech.maven.publish")
id("wasm-setup")
}

kotlin {
Expand All @@ -33,13 +33,6 @@ kotlin {
browser()
nodejs()
}
@OptIn(ExperimentalWasmDsl::class)
wasm {
browser()
nodejs()
d8()
binaries.executable()
}

macosX64()
macosArm64()
Expand Down Expand Up @@ -70,6 +63,7 @@ kotlin {
api(project(":kermit-core"))
}
}

val commonTest by getting {
dependencies {
implementation(kotlin("test"))
Expand All @@ -90,15 +84,14 @@ kotlin {
dependsOn(nonKotlinMain)
}

val jsAndWasmMain by creating {
val jsAndWasmMain by getting {
dependsOn(nonKotlinMain)
getByName("jsMain").dependsOn(this)
getByName("wasmMain").dependsOn(this)
}
val jsAndWasmTest by creating {

val jsAndWasmTest by getting {
dependsOn(nonKotlinTest)
getByName("jsTest").dependsOn(this)
getByName("wasmTest").dependsOn(this)
}

val commonJvmMain by creating {
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ project(":kermit-koin").projectDir = File("extensions/kermit-koin")
//project(":kermit-ir-plugin-native").projectDir = File("plugin/kermit-ir-plugin-native")

pluginManagement {
includeBuild("convention-plugins")
repositories {
google()
gradlePluginPortal()
Expand Down

0 comments on commit 9b846cc

Please sign in to comment.