Skip to content

Commit

Permalink
WASM support and all targets for Compose
Browse files Browse the repository at this point in the history
  • Loading branch information
wkornewald committed May 30, 2024
1 parent 8635772 commit 9b86ddf
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 123 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 5.8.1

* Build reactivestate-compose for all targets.
* Added WASM target.

## 5.8.0

* Upgraded to Kotlin 2.0.0.
Expand Down
151 changes: 41 additions & 110 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ subprojects {
ext {
isAndroidProject = ["main", "androidMain"].any { project.file("src/$it/AndroidManifest.xml").exists() }
isMultiplatform = ["androidMain", "jvmMain", "jvmCommonMain", "commonMain"].any { project.file("src/$it").exists() }
isIosProject = !project.name.endsWith("-compose") && isMultiplatform && DefaultNativePlatform.currentOperatingSystem.macOsX && ["iosMain", "appleMobileMain", "nativeMain", "nonJvmMain", "commonMain"].any { project.file("src/$it").exists() }
isJsProject = !project.name.endsWith("-compose")
isMacosProject = !project.name.endsWith("-compose")
isLinuxProject = !project.name.endsWith("-compose")
isWindowsProject = !project.name.endsWith("-compose")
isIosProject = isMultiplatform && DefaultNativePlatform.currentOperatingSystem.macOsX && ["iosMain", "appleMobileMain", "nativeMain", "nonJvmMain", "commonMain"].any { project.file("src/$it").exists() }
isPlatformProject = project.name.endsWith("-bom")
isTestProject = project.name.endsWith("-test")
isComposeProject = project.name.endsWith("-compose")
Expand Down Expand Up @@ -78,8 +74,8 @@ subprojects {
nonJvmTest { dependsOn(commonTest) }
nativeMain { dependsOn(nonJvmMain) }
nativeTest { dependsOn(nonJvmTest) }
desktopMain { dependsOn(nativeMain) }
desktopTest { dependsOn(nativeTest) }
wasmJsMain { dependsOn(nonJvmMain) }
wasmJsTest { dependsOn(nonJvmTest) }
jvmCommonMain { dependsOn(commonMain) }
jvmCommonTest { dependsOn(commonTest) }
jvmMain { dependsOn(jvmCommonMain) }
Expand All @@ -102,115 +98,50 @@ subprojects {
}
}

if (isJsProject) {
js(IR) {
browser()
nodejs()
}
// testAll.dependsOn "jsIrNodeTest"
sourceSets {
jsMain { dependsOn(nonJvmMain) }
jsTest { dependsOn(nonJvmTest) }
}
}

// wasm32()

applyDefaultHierarchyTemplate()

if (isIosProject) {
iosArm64()
iosX64()
iosSimulatorArm64()
testAll.dependsOn "iosSimulatorArm64Test"
testAll.dependsOn "iosX64Test"

tvosArm64()
tvosX64()
tvosSimulatorArm64()

watchosArm32()
watchosArm64()
watchosX64()
watchosSimulatorArm64()

sourceSets {
appleMobileMain { dependsOn(nativeMain) }
appleMobileTest { dependsOn(nativeTest) }

iosMain { dependsOn(appleMobileMain) }
iosTest { dependsOn(appleMobileTest) }
iosArm64Main { dependsOn(iosMain) }
iosArm64Test { dependsOn(iosTest) }
iosX64Main { dependsOn(iosMain) }
iosX64Test { dependsOn(iosTest) }
iosSimulatorArm64Main { dependsOn(iosMain) }
iosSimulatorArm64Test { dependsOn(iosTest) }

tvosMain { dependsOn(appleMobileMain) }
tvosTest { dependsOn(appleMobileTest) }
tvosSimulatorArm64Main { dependsOn(tvosMain) }
tvosSimulatorArm64Test { dependsOn(tvosTest) }

watchosMain { dependsOn(appleMobileMain) }
watchosTest { dependsOn(appleMobileTest) }
watchosArm64Main { dependsOn(watchosMain) }
watchosArm64Test { dependsOn(watchosTest) }
watchosArm32Main { dependsOn(watchosMain) }
watchosArm32Test { dependsOn(watchosTest) }
watchosX64Main { dependsOn(watchosMain) }
watchosX64Test { dependsOn(watchosTest) }
watchosSimulatorArm64Main { dependsOn(watchosMain) }
watchosSimulatorArm64Test { dependsOn(watchosTest) }
}
js(IR) {
browser()
nodejs()
}

if (isMacosProject) {
macosArm64()
testAll.dependsOn "macosArm64Test"
macosX64()
testAll.dependsOn "macosX64Test"

sourceSets {
macosMain { dependsOn(desktopMain) }
macosTest { dependsOn(desktopTest) }
macosArm64Main { dependsOn(macosMain) }
macosArm64Test { dependsOn(macosTest) }
macosX64Main { dependsOn(macosMain) }
macosX64Test { dependsOn(macosTest) }
}
// testAll.dependsOn "jsIrNodeTest"
sourceSets {
jsMain { dependsOn(nonJvmMain) }
jsTest { dependsOn(nonJvmTest) }
}

if (isLinuxProject) {
// linuxArm64()
// testAll.dependsOn "linuxArm64Test"
linuxX64()
testAll.dependsOn "linuxX64Test"
// linuxArm32Hfp()
// linuxMips32()
// linuxMipsel32()

sourceSets {
linuxMain { dependsOn(desktopMain) }
linuxTest { dependsOn(desktopTest) }
linuxX64Main { dependsOn(linuxMain) }
linuxX64Test { dependsOn(linuxTest) }
}
wasmJs {
browser()
nodejs()
}

if (isWindowsProject) {
mingwX64()
testAll.dependsOn "mingwX64Test"
// mingwX86()
// testAll.dependsOn "mingwX86Test"
applyDefaultHierarchyTemplate()

sourceSets {
mingwMain { dependsOn(desktopMain) }
mingwTest { dependsOn(desktopTest) }
mingwX64Main { dependsOn(mingwMain) }
mingwX64Test { dependsOn(mingwTest) }
}
}
iosArm64()
iosX64()
iosSimulatorArm64()
testAll.dependsOn "iosSimulatorArm64Test"
testAll.dependsOn "iosX64Test"

tvosArm64()
tvosX64()
tvosSimulatorArm64()

watchosArm32()
watchosArm64()
watchosX64()
watchosSimulatorArm64()

macosArm64()
testAll.dependsOn "macosArm64Test"
macosX64()
testAll.dependsOn "macosX64Test"

linuxArm64()
// testAll.dependsOn "linuxArm64Test"
linuxX64()
testAll.dependsOn "linuxX64Test"

mingwX64()
testAll.dependsOn "mingwX64Test"
}
}

Expand Down
12 changes: 1 addition & 11 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,14 @@ dependencies {

composeVersion = "1.6.7"
jetpackCompose = {
apply plugin: "org.jetbrains.compose"
apply plugin: "org.jetbrains.kotlin.plugin.compose"

composeCompiler {
enableStrongSkippingMode = true
}

androidMainApi "androidx.activity:activity-compose:$activityVersion"
androidMainApi "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycleVersion"

commonMainApi "androidx.compose.runtime:runtime:$composeVersion"
constraints {
api "androidx.compose.foundation:foundation:$composeVersion"
api "androidx.compose.ui:ui:$composeVersion"
api "androidx.compose.animation:animation:$composeVersion"
api "androidx.compose.material:material:$composeVersion"
api "androidx.compose.ui:ui-tooling:$composeVersion"
}
commonMainApi compose.runtime
}
}
}
7 changes: 5 additions & 2 deletions reactivestate-compose/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
apply plugin: "org.jetbrains.compose"
apply plugin: "org.jetbrains.kotlin.plugin.compose"

dependencies {
jetpackCompose()

commonMainApi project(":reactivestate")
jvmTestImplementation project(":reactivestate-test")

jetpackCompose()
}

0 comments on commit 9b86ddf

Please sign in to comment.