Skip to content

Commit

Permalink
Move maelstrom-web build.sh stuff to build.rs
Browse files Browse the repository at this point in the history
Also make some other improvements
- Depend on wasm-bindgen via library instead of binary existing
- Remove dependency on tar CLI
- Don't fail fatally if wasm-opt isn't found
  • Loading branch information
bobbobbio committed Jan 21, 2024
1 parent bec2536 commit e2e1813
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 57 deletions.
191 changes: 186 additions & 5 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,6 @@ tuple = "0.5.1"
unicode-truncate = "0.2.0"
unicode-width = "0.1.7"
wasm-bindgen = "0.2"
wasm-bindgen-cli-support = "0.2"
wasm-bindgen-futures = "0.4"
wasm-logger = "0.2"
2 changes: 1 addition & 1 deletion crates/maelstrom-broker/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl TarHandler {
for entry in ar.entries().unwrap() {
let entry = entry.unwrap();
let header = entry.header();
let path = header.path().unwrap().to_str().unwrap().into();
let path = format!("./{}", header.path().unwrap().to_str().unwrap());
let start = entry.raw_file_position() as usize;
let end = start + header.size().unwrap() as usize;
map.insert(path, &bytes[start..end]);
Expand Down
8 changes: 8 additions & 0 deletions crates/maelstrom-web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@ features = [
"WebSocket",
"Window",
]

[build-dependencies]
tar.workspace = true
wasm-bindgen-cli-support.workspace = true
cargo_metadata.workspace = true
# These dependencies ensure the build script re-runs
maelstrom-plot.workspace = true
maelstrom-base.workspace = true
Loading

0 comments on commit e2e1813

Please sign in to comment.