Skip to content

Commit

Permalink
[WIP]Initial replacing *.udl with use of Uniffi proc macro
Browse files Browse the repository at this point in the history
  • Loading branch information
Binlogo committed Jul 18, 2024
1 parent 375ea1a commit 110c049
Show file tree
Hide file tree
Showing 18 changed files with 99 additions and 183 deletions.
19 changes: 11 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[workspace]
members = [
"crux_cli",
"crux_core",
"crux_http",
"crux_kv",
"crux_macros",
"crux_platform",
"crux_time",
"doctest_support",
"crux_cli",
"crux_core",
"crux_http",
"crux_kv",
"crux_macros",
"crux_platform",
"crux_time",
"doctest_support",
]
resolver = "1"

Expand All @@ -31,3 +31,6 @@ pedantic = "warn"

[profile.dev]
split-debuginfo = "unpacked"

[patch.crates-io]
uniffi = { path = "../uniffi-rs" }
3 changes: 0 additions & 3 deletions examples/hello_world/shared/build.rs

This file was deleted.

9 changes: 5 additions & 4 deletions examples/hello_world/shared/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
uniffi::setup_scaffolding!();

pub mod app; // not exposed so you can remove this in your project

use lazy_static::lazy_static;
Expand All @@ -7,24 +9,23 @@ pub use crux_core::{bridge::Bridge, Core, Request};

pub use app::*;

// TODO hide this plumbing

uniffi::include_scaffolding!("shared");

lazy_static! {
static ref CORE: Bridge<Effect, Hello> = Bridge::new(Core::new());
}

#[uniffi::export]
#[wasm_bindgen]
pub fn process_event(data: &[u8]) -> Vec<u8> {
CORE.process_event(data)
}

#[uniffi::export]
#[wasm_bindgen]
pub fn handle_response(id: u32, data: &[u8]) -> Vec<u8> {
CORE.handle_response(id, data)
}

#[uniffi::export]
#[wasm_bindgen]
pub fn view() -> Vec<u8> {
CORE.view()
Expand Down
5 changes: 0 additions & 5 deletions examples/hello_world/shared/src/shared.udl

This file was deleted.

2 changes: 2 additions & 0 deletions examples/simple_counter/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
uniffi-gen-swift = "run --bin uniffi-bindgen generate --library target/release/libshared.dylib --language swift --out-dir shared/generated/swift/SharedFFI"
65 changes: 18 additions & 47 deletions examples/simple_counter/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion examples/simple_counter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["shared", "shared_types", "web-dioxus", "web-leptos", "web-yew"]
members = ["shared", "web-dioxus", "web-leptos", "web-yew"]
resolver = "1"

[workspace.package]
Expand All @@ -15,6 +15,7 @@ anyhow = "1.0.86"
crux_core = "0.8"
# crux_core = { path = "../../crux_core" }
serde = "1.0.203"
uniffi = { git = "https://github.com/mozilla/uniffi-rs.git", branch = "main" }

[workspace.metadata.bin]
cargo-xcode = { version = "=1.7.0" }
Loading

0 comments on commit 110c049

Please sign in to comment.