Skip to content

build(wasm): retire wasm workarounds on a locally built scala-wasm - #46

Draft
sideeffffect wants to merge 9 commits into
feat/wasm-componentfrom
feat/wasm-upstream-snapshot
Draft

sideeffffect wants to merge 9 commits into
feat/wasm-componentfrom
feat/wasm-upstream-snapshot

Conversation

@sideeffffect

@sideeffffect sideeffffect commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #44. Draft: it pins a scala-wasm that is not released yet.

What changes

The wasm build now uses 1.22.1-wasm.7-dapr4s-local. scripts/wasm/build-scala-wasm.sh builds it from source: scala-wasm's scala-wasm branch at 32cda138 plus a local merge of two open PRs, all pinned by SHA. It runs publishLocal. The CI wasm leg runs the script and caches the result by the script's hash. Nothing is pushed to scala-wasm.

Workaround Status Depends on
Patched linker dapr4s-wasm-linker (artifact, script, patch) removed scala-wasm/scala-wasm#268 (merged)
WIT re-embed (component embed --encoding utf16 + component new) removed scala-wasm/scala-wasm#269 (open)
org.scala-js library/javalib exclusions removed scala-wasm/scala-wasm#271 (open)
Fork's 2.13 scalalib exclusion kept #271 leaves this duplicate on Scala 3.8+
Empty javadoc jar of dapr4s-wasm kept scala/scala3#27300 is merged, but no nightly has it yet (newest: 2026-10-15 04:20, before the merge)
Stdlib overlay kept not related to these PRs

Two small new workarounds:

  • useWitAliases in wasm/build.sbt. wit-bindgen-scala 0.1.0 writes a used alias as its structure (type Metadata = Array[...]), so #269 alone does not keep metadata. The rewrite makes it type Metadata = types.Metadata. Without it, compose still fails ("missing expected list export metadata").
  • The fork's scalajs-junit-test-runtime on wallWasm/Test. #271 also removes the upstream JUnit runtime that munit needs and adds no fork one.

Apps now need no WIT files and no wkg: the linker's component is used as is.

Also:

  • PUBLISH_WASM_TO_CENTRAL is 'false'. The plugin's POM would name an sbt-scalajs that is not on Central.

How it was verified (locally)

  • cd wasm && sbt scalafmtCheckAll scalafmtSbtCheck compile wallWasm/test (15 passed), source mode and release mode.
  • scripts/wasm/e2e.sh in source mode: counter-raw, counter (error mapping too), imports-probe (the four imports with more than 16 flat params, against daprd).
  • sbt publishLocal + scripts/wasm/consumer-check.sh: a fresh consumer build with no WIT files, e2e OK.
  • Classpaths of counter and wallWasm/Test: no org.scala-js core library left.
  • Root sbt scalafmtCheckAll scalafmtSbtCheck: OK.

What remains

🤖 Generated with Claude Code

sideeffffect and others added 6 commits October 16, 2026 08:41
…m snapshot

scala-wasm/scala-wasm#268 (merged, unreleased) passes WIT params through
linear memory on both sides, so dapr4s-wasm-linker, its build script and
patch go away. The wasm build now pins 1.22.1-wasm.7-dapr4s-local, built
from source by scripts/wasm/build-scala-wasm.sh (scala-wasm branch + the
heads of #269 and #271); the CI wasm leg builds it, cached by the script
hash. Central publishing of the wasm artifacts is off while the pin is
unreleased.

Also: the fork's JUnit runtime for munit (#271 excludes the upstream one),
and compose.sh pulls the providers under dapr-wasm-components' new OCI
names (v0.7.4 removed the flat ones).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…271)

The scala-wasm plugin now excludes the upstream core libraries itself.
Verified on the counter / wallWasm classpaths (source and release mode):
no org.scala-js scalajs-library/javalib left. The fork's 2.13 scalalib
exclusion stays (#271 leaves that duplicate); the fork's scala-library /
scala3-library rules were no-ops and go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… as is

scala-wasm/scala-wasm#269 keeps a @Witalias reached through a plain type
alias. wit-bindgen-scala 0.1.0 writes a used alias structurally, so
wasm/build.sbt rewrites those lines of the generated bindings to point at
the defining interface (useWitAliases; without it compose fails with
'missing expected list export metadata', checked). dapr4sComponent now
copies the linker's component (already UTF-16): no component embed/new,
and an app needs no WIT files and no wkg.

Docs: AGENTS.md, WASM-COMPONENTS-PROPOSAL.md, the wiki page + log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The scala-wasm plugin generates the bindings for Test into the same
directory as for Compile; on a cold CI build the two parallel runs (and
useWitAliases) corrupted bindings.scala. witGlue has no tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sideeffffect added a commit that referenced this pull request Oct 16, 2026
Under pipefail + set -e, dapr writing after head exited killed the
script with exit 141 (seen on the CI wasm leg of PR #46). Keep the first
line in the shell instead; the helper still returns dapr's status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant