Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WasmJS support + fix test compilation for both JS and Wasm #1866

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions projects/compose/koin-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ kotlin {
browser()
}

wasmJs {
browser()
}

iosX64()
iosArm64()
iosSimulatorArm64()
Expand Down
40 changes: 40 additions & 0 deletions projects/core/koin-core-coroutines/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -13,6 +14,26 @@ kotlin {
nodejs()
browser()
binaries.executable()

// To run tests
compilations.all {
kotlinOptions {
freeCompilerArgs += listOf("-XXLanguage:+JsAllowInvalidCharsIdentifiersEscaping")
}
}
}

wasmJs {
nodejs()
browser()
binaries.executable()

// To run tests
compilations.all {
kotlinOptions {
freeCompilerArgs += listOf("-XXLanguage:+JsAllowInvalidCharsIdentifiersEscaping")
}
}
}

iosX64()
Expand All @@ -31,6 +52,8 @@ kotlin {
linuxX64()
linuxArm64()

applyDefaultHierarchyTemplate()

sourceSets {
commonMain.dependencies {
api(project(":core:koin-core"))
Expand All @@ -40,6 +63,18 @@ kotlin {
implementation(libs.kotlin.test)
implementation(libs.test.coroutines)
}

val jsAndWasmMain by creating {
dependsOn(commonMain.get())
}

val jsMain by getting {
dependsOn(jsAndWasmMain)
}

val wasmJsMain by getting {
dependsOn(jsAndWasmMain)
}
}
}

Expand All @@ -49,4 +84,9 @@ tasks.withType<KotlinCompile>().all {
}
}

rootProject.the<NodeJsRootExtension>().apply {
nodeVersion = "21.0.0-v8-canary202309143a48826a08"
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
}

apply(from = file("../../gradle/publish.gradle.kts"))
41 changes: 41 additions & 0 deletions projects/core/koin-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -13,6 +14,26 @@ kotlin {
nodejs()
browser()
binaries.executable()

// To run tests
compilations.all {
kotlinOptions {
freeCompilerArgs += listOf("-XXLanguage:+JsAllowInvalidCharsIdentifiersEscaping")
}
}
}

wasmJs {
nodejs()
browser()
binaries.executable()

// To run tests
compilations.all {
kotlinOptions {
freeCompilerArgs += listOf("-XXLanguage:+JsAllowInvalidCharsIdentifiersEscaping")
}
}
}

iosX64()
Expand All @@ -31,6 +52,8 @@ kotlin {
linuxX64()
linuxArm64()

applyDefaultHierarchyTemplate()

sourceSets {
commonMain.dependencies {
api(libs.extras.stately)
Expand All @@ -40,6 +63,18 @@ kotlin {
implementation(libs.kotlin.test)
implementation(libs.test.coroutines)
}

val jsAndWasmMain by creating {
dependsOn(commonMain.get())
}

val jsMain by getting {
dependsOn(jsAndWasmMain)
}

val wasmJsMain by getting {
dependsOn(jsAndWasmMain)
}
}
}

Expand All @@ -49,4 +84,10 @@ tasks.withType<KotlinCompile>().all {
}
}


rootProject.the<NodeJsRootExtension>().apply {
nodeVersion = "21.0.0-v8-canary202309143a48826a08"
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
}

apply(from = file("../../gradle/publish.gradle.kts"))
26 changes: 26 additions & 0 deletions projects/core/koin-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -13,6 +14,26 @@ kotlin {
nodejs()
browser()
binaries.executable()

// To run tests
compilations.all {
kotlinOptions {
freeCompilerArgs += listOf("-XXLanguage:+JsAllowInvalidCharsIdentifiersEscaping")
}
}
}

wasmJs {
nodejs()
browser()
binaries.executable()

// To run tests
compilations.all {
kotlinOptions {
freeCompilerArgs += listOf("-XXLanguage:+JsAllowInvalidCharsIdentifiersEscaping")
}
}
}

iosX64()
Expand Down Expand Up @@ -52,4 +73,9 @@ tasks.withType<KotlinCompile>().all {
}
}

rootProject.the<NodeJsRootExtension>().apply {
nodeVersion = "21.0.0-v8-canary202309143a48826a08"
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
}

apply(from = file("../../gradle/publish.gradle.kts"))
6 changes: 3 additions & 3 deletions projects/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# /!\ Koin in gradle.properties /!\

# Core
kotlin = "1.9.22"
kotlin = "1.9.23"
binaryValidator = "0.13.2"
publish = "2.0.0-rc-1"
coroutines = "1.7.3" # "1.8.0-RC2" for wasm
coroutines = "1.8.0" # "1.8.0-RC2" for wasm
dokka = "1.9.10"
# Android
agp = "7.4.1"
Expand All @@ -19,7 +19,7 @@ androidx-workmanager = "2.8.1"
androidx-navigation = "2.7.5"
# Compose
# /!\ Compose compiler in gradle.properties /!\
composeJB = "1.5.12"
composeJB = "1.6.2"
composeJetpackRuntime = "1.5.4"
composeJetpackViewmodel = "2.6.2"
# Test
Expand Down