Add the wasmJs target - #75
Open
cloudigits wants to merge 2 commits into
Open
cloudigits wants to merge 2 commits into
cloudigits wants to merge 2 commits into
Conversation
The presets API, js(BOTH), the kotlin("js") plugin and jvmTarget 1.6 are all
gone in current Kotlin, so the existing build no longer configures. Targets are
now declared explicitly and the default hierarchy template replaces the manual
nativeMain wiring.
Metadata compilation additionally requires RegexToken to declare match() on the
expect class, with each actual marked accordingly, and rejects @language in
nativeMain because @OptionalExpectation is limited to common sources (jsMain
already omitted it for the same reason).
Native targets removed from Kotlin since 0.4.4 (iosArm32, linuxArm32Hfp,
linuxMips32, linuxMipsel32, mingwX86, wasm32, watchosX86) are dropped; every
other published target is kept and watchosDeviceArm64 is added.
js and wasmJs form a single web source set in Kotlin's default hierarchy, and Compose Multiplatform builds web as Wasm-first with Kotlin/JS as the fallback, so a js-only artifact leaves out the half modern browsers run. The actual mirrors nativeMain rather than jsMain: the js implementation relies on a sticky-flag RegExp reached through asDynamic(), which Kotlin/Wasm has no equivalent for, so the \\A-anchored form is used instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #74.
What
Adds the
wasmJstarget. js and wasmJs form a singlewebsource set in Kotlin's default hierarchy, and Compose Multiplatform builds web as Wasm-first with Kotlin/JS as the fallback, so a js-only artifact misses the half modern browsers run.Why the toolchain bump is part of this
wasmJsdoes not exist in Kotlin 1.6.20, and the current build does not configure under any Kotlin that has it: the presets API,js(BOTH), thekotlin("js")plugin andjvmTarget = "1.6"are all removed. The bump is a prerequisite, not a separate cleanup, so it is here as its own commit for separate review.Source changes beyond the new actual
Metadata compilation requires
RegexTokento declarematch()on the expect class, with each actual markedactual override. It also rejects@LanguageinnativeMain, since@OptionalExpectationis limited to common sources;jsMainalready omitted it for the same reason.Token.match()staysabstract.Targets
Kept every target 0.4.4 publishes that Kotlin still supports, including the four
androidNative*ones. Dropped only what Kotlin removed:iosArm32,linuxArm32Hfp,linuxMips32,linuxMipsel32,mingwX86,wasm32,watchosX86. AddedwatchosDeviceArm64.Verified
commonTestgreen on jvm (44), js node and browser (41 each), wasmJs node and browser (41 each), macosArm64 (41), iosSimulatorArm64 (41).assemblegreen for all targets. Demos, benchmarks and POM generation all still build.One thing worth your call
wasmJsMain/RegexToken.ktis byte-identical tonativeMain's. The js implementation relies on a sticky-flagRegExpviaasDynamic(), which Kotlin/Wasm has no equivalent for, so wasmJs uses the\A-anchored native form. I left it duplicated rather than introducing a custom source-set group shared by native and wasmJs. Happy to do that instead if you prefer.kotlin-js-store/yarn.lockis generated by the js/wasmJs setup and not included, since committing it is a repo-policy call. Let me know and I will add it.