From b13772c2d25bd827e45707a09e5dcf6bd46b0ac2 Mon Sep 17 00:00:00 2001 From: Jake Wharton Date: Wed, 28 Feb 2024 12:54:20 -0500 Subject: [PATCH] Add wasmJs and linuxArm64 targets (#388) These were unblocked by the JetBrains Compose 1.6.0 runtime update. --- CHANGELOG.md | 3 ++ molecule-runtime/build.gradle | 49 ++++++++++++++----- .../molecule/WindowAnimationFrameClock.kt | 0 .../kotlin/app/cash/molecule/timeSource.kt | 0 .../kotlin/app/cash/molecule/timeSource.kt | 0 5 files changed, 41 insertions(+), 11 deletions(-) rename molecule-runtime/src/{jsMain => browserMain}/kotlin/app/cash/molecule/WindowAnimationFrameClock.kt (100%) rename molecule-runtime/src/{jsMain => browserMain}/kotlin/app/cash/molecule/timeSource.kt (100%) rename molecule-runtime/src/{linuxX64Main => linuxMain}/kotlin/app/cash/molecule/timeSource.kt (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0629cbbe..a8ab0e61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] +New: +- Support for `linuxArm64` and `wasmJs` targets. + ## [1.4.0] - 2024-02-27 diff --git a/molecule-runtime/build.gradle b/molecule-runtime/build.gradle index 38045513..4f838bb0 100644 --- a/molecule-runtime/build.gradle +++ b/molecule-runtime/build.gradle @@ -22,6 +22,7 @@ kotlin { jvm() + linuxArm64() linuxX64() macosArm64() @@ -33,11 +34,17 @@ kotlin { tvosSimulatorArm64() tvosX64() + wasmJs { + browser() + } + watchosArm32() watchosArm64() watchosSimulatorArm64() watchosX64() + applyDefaultHierarchyTemplate() + sourceSets { configureEach { languageSettings.optIn("kotlinx.cinterop.BetaInteropApi") @@ -64,6 +71,15 @@ kotlin { } } + // We use a common folder instead of a common source set because there is no commonizer + // which exposes the browser APIs across these two targets. + jsMain { + kotlin.srcDir('src/browserMain/kotlin') + } + wasmJsMain { + kotlin.srcDir('src/browserMain/kotlin') + } + darwinMain { dependsOn(commonMain) } @@ -78,21 +94,32 @@ kotlin { quartzCoreMain { dependsOn(displayLinkMain) } + + iosMain { + dependsOn(quartzCoreMain) + } + iosTest { + // TODO Link against XCTest in order to get frame pulses on iOS. + // dependsOn(displayLinkTest) + } + + tvosMain { + dependsOn(quartzCoreMain) + } + tvosTest { + // TODO Link against XCTest in order to get frame pulses on tvOS. + // dependsOn(displayLinkTest) + } + macosMain { dependsOn(displayLinkMain) } - } + macosTest { + dependsOn(displayLinkTest) + } - targets.each { target -> - if (target.name.startsWith('ios') || target.name.startsWith('tvos')) { - target.compilations.main.defaultSourceSet.dependsOn(sourceSets.quartzCoreMain) - // TODO Link against XCTest in order to get frame pulses on iOS/tvOS. - // target.compilations.test.defaultSourceSet.dependsOn(sourceSets.displayLinkTest) - } else if (target.name.startsWith('macos')) { - target.compilations.main.defaultSourceSet.dependsOn(sourceSets.macosMain) - target.compilations.test.defaultSourceSet.dependsOn(sourceSets.displayLinkTest) - } else if (target.name.startsWith('watchos')) { - target.compilations.main.defaultSourceSet.dependsOn(sourceSets.darwinMain) + watchosMain { + dependsOn(darwinMain) } } } diff --git a/molecule-runtime/src/jsMain/kotlin/app/cash/molecule/WindowAnimationFrameClock.kt b/molecule-runtime/src/browserMain/kotlin/app/cash/molecule/WindowAnimationFrameClock.kt similarity index 100% rename from molecule-runtime/src/jsMain/kotlin/app/cash/molecule/WindowAnimationFrameClock.kt rename to molecule-runtime/src/browserMain/kotlin/app/cash/molecule/WindowAnimationFrameClock.kt diff --git a/molecule-runtime/src/jsMain/kotlin/app/cash/molecule/timeSource.kt b/molecule-runtime/src/browserMain/kotlin/app/cash/molecule/timeSource.kt similarity index 100% rename from molecule-runtime/src/jsMain/kotlin/app/cash/molecule/timeSource.kt rename to molecule-runtime/src/browserMain/kotlin/app/cash/molecule/timeSource.kt diff --git a/molecule-runtime/src/linuxX64Main/kotlin/app/cash/molecule/timeSource.kt b/molecule-runtime/src/linuxMain/kotlin/app/cash/molecule/timeSource.kt similarity index 100% rename from molecule-runtime/src/linuxX64Main/kotlin/app/cash/molecule/timeSource.kt rename to molecule-runtime/src/linuxMain/kotlin/app/cash/molecule/timeSource.kt