Skip to content

Commit d4059a4

Browse files
authored
feat(cat-voices): Add multi-package support to flutter_rust_bridge (#448)
* feat: allow to pass any web prefix * feat: add clang package * feat: remove web prefix in favor of configuration in flutter_rust_bridge.yaml * feat: add no modules global * feat: add WASM_MODULE_NAME param * fix: arg usage * feat: build flutter_rust_bridge in release mode * feat: use forked version of flutter_rust_bridge * fix: syntax * feat: add branch * chore: allow github repo * fix: bump rust version from 1.88.0 to 1.89.0 * chore: reformat * fix: spelling * fix: rust version * feat: allow code formatting after generation * chore: sync deny.toml * chore: TODO * feat: switch to iohk fork * style: typos * chore: disable ruff
1 parent 7cae8f5 commit d4059a4

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed

.config/dictionaries/project.dic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ gopls
5555
gosec
5656
graphviz
5757
idents
58+
iohk
5859
ipynb
5960
javascripts
6061
JDBC

Justfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ check-spelling:
1414
earthly +clean-spelling-list
1515
earthly +check-spelling
1616

17-
1817
# Fix and Check Code Format for Python files
1918
format-python-code:
2019
ruff check --select I --fix .

earthly/flutter_rust_bridge/Earthfile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ builder:
2222
git \
2323
build-essential \
2424
curl \
25-
unzip
25+
unzip \
26+
clang
2627

2728
DO flutter-ci+INSTALL_FLUTTER
2829
DO rust-ci+INSTALL_RUST
@@ -31,11 +32,20 @@ builder:
3132
# Generated necessary files for running Flutter web.
3233
CODE_GENERATOR_WEB:
3334
FUNCTION
35+
ARG --required WASM_MODULE_NAME
3436

35-
RUN flutter_rust_bridge_codegen generate --default-external-library-loader-web-prefix=/assets/packages/catalyst_key_derivation/assets/js/
36-
# https://blog.rust-lang.org/2025/04/04/c-abi-changes-for-wasm32-unknown-unknown/
37-
RUN flutter_rust_bridge_codegen build-web
37+
# TODO(dt-iohk): revert to official version when changes from the fork are merged into the official version
38+
GIT CLONE --branch feat/wasm-bindgen-configurable-module https://github.com/input-output-hk/catalyst_flutter_rust_bridge.git /usr/local/flutter_rust_bridge
39+
RUN cargo run --manifest-path /usr/local/flutter_rust_bridge/frb_codegen/Cargo.toml -- generate
40+
RUN cargo run --manifest-path /usr/local/flutter_rust_bridge/frb_codegen/Cargo.toml -- build-web --wasm-bindgen-args="--no-modules-global=$WASM_MODULE_NAME"
41+
42+
# RUN flutter_rust_bridge_codegen generate
43+
# TODO(damian-molinski) add --release flag to the command below to optimize for performance
44+
# RUN flutter_rust_bridge_codegen build-web --wasm-bindgen-args="--no-modules-global=$WASM_MODULE_NAME"
3845

3946
RUN mkdir -p assets/js && cp -rf ./web/pkg/* assets/js/
4047
# Don't want this gitignore file.
4148
RUN rm -rf ./assets/js/.gitignore
49+
50+
# Reformat code once it's generated under lib directory.
51+
RUN dart format lib

earthly/rust/Earthfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,5 +463,6 @@ INSTALL_TOOLS:
463463
DO +COPY_TOOL --tool="cargo-sweep"
464464
DO +COPY_TOOL --tool="cargo-component"
465465
DO +COPY_TOOL --tool="wasm-pack"
466-
DO +COPY_TOOL --tool="flutter-rust-bridge-codegen" --bin="flutter_rust_bridge_codegen"
466+
# TODO(dt-iohk): reenable when we're no longer using forked flutter_rust_bridge
467+
# DO +COPY_TOOL --tool="flutter-rust-bridge-codegen" --bin="flutter_rust_bridge_codegen"
467468

earthly/rust/stdcfgs/deny.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ allow-git = [
6363
"https://github.com/input-output-hk/mithril",
6464
# Maintained fork of an archived crates-io version.
6565
"https://github.com/dariusc93/rust-ipfs",
66+
# TODO(dt-iohk): remove this when changes from forked flutter_rust_bridge are merged into the official version
67+
"https://github.com/input-output-hk/catalyst_flutter_rust_bridge",
6668
]
6769

6870
[licenses]
@@ -109,7 +111,6 @@ crate = "ring"
109111
expression = "MIT"
110112
license-files = [{ path = "LICENSE", hash = 0xbd0eed23 }]
111113

112-
113114
# SPDX considers OpenSSL to encompass both the OpenSSL and SSLeay licenses
114115
# https://spdx.org/licenses/OpenSSL.html
115116
# ISC - Both BoringSSL and ring use this for their new files

examples/rust/deny.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ allow-git = [
6363
"https://github.com/input-output-hk/mithril",
6464
# Maintained fork of an archived crates-io version.
6565
"https://github.com/dariusc93/rust-ipfs",
66+
# TODO(dt-iohk): remove this when changes from forked flutter_rust_bridge are merged into the official version
67+
"https://github.com/input-output-hk/catalyst_flutter_rust_bridge",
6668
]
6769

6870
[licenses]

0 commit comments

Comments
 (0)