forked from hydro-project/hydro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get hydroflow to compile to WASM (hydro-project#329)
Tests do not work yet; I have a followup PR. 1. Turn off diagnostics for non-proc-macro crates. Diagnostics don't work when building for WASM. The proc-macro crates that are compiled at compile time still enable diagonstics because they target the (presumably non-WASM) host architecture where diagonstics work. 2. Use version 2 for the Cargo feature resolver. The version 1 resolver does not treat proc-macro edges differently from regular dependency edges. That is, suppose we depend on package P transitively via both a proc-macro edge and a regular edge, and the proc-macro edge enables feature X but the regular edge does not. With the version 1 resolver, Cargo will compile P only once with X enabled (assuming same host and target arch). With the v2 resolver, Cargo will compile P (at least) twice; once with X enabled for the proc-macro crate, once with P disabled. In our project, P = {hydroflow_datalog_core, hydroflow_lang}, X = diagnostics. The version 1 resolver works for non-WASM builds (because diagnostics compiles fine), but for WASM builds the v1 resolver attempts to build hydroflow_datalog_core for WASM with diagnostics enabled (because of feature resolution). Note that enabling the v2 feature resolver should not change compile times: on non-WASM, diagnostics is always enabled so we only compile P once. On WASM builds, we would have compiled twice anyway (once for the host architecture for the proc-macro package, another for WASM). 3. Turn on only a subset of Tokio features when compiling for WASM. In particular, the WASM environment does not natively support threads and fails to compile with threading features enabled. 4. Manually enable the "js" feature for hydroflow/getrandom. See the comment in hydroflow/Cargo.toml.
- Loading branch information
Showing
15 changed files
with
56 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#![cfg(not(target_arch = "wasm32"))] | ||
|
||
use std::collections::HashMap; | ||
|
||
use futures::{SinkExt, StreamExt}; | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#![cfg(not(target_arch = "wasm32"))] | ||
|
||
use std::net::SocketAddr; | ||
|
||
use bytes::Bytes; | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
hydroflow_internalmacro.d: hydroflow_internalmacro/src/lib.rs | ||
|
||
hydroflow_internalmacro/src/lib.rs: | ||
|
||
# env-dep:CARGO_MANIFEST_DIR=/Users/tylerhou/code/hydroflow/hydroflow_internalmacro |
This file contains 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
This file contains 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
This file contains 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