Skip to content

Commit

Permalink
Merge pull request #46 from radixdlt/bugfix/wasm-radix-engine-dependency
Browse files Browse the repository at this point in the history
Fix WASM Radix Engine Dependency
  • Loading branch information
0xOmarA authored Mar 22, 2023
2 parents 5f60d71 + fa28bb7 commit f94777a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
40 changes: 24 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,55 +25,55 @@ jobs:
custom-linker: ""
custom-compiler: /usr/local/opt/llvm/bin/clang
custom-archiver: /usr/local/opt/llvm/bin/llvm-ar
features: ""
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: x86_64-apple-ios
custom-linker: ""
custom-compiler: /usr/local/opt/llvm/bin/clang
custom-archiver: /usr/local/opt/llvm/bin/llvm-ar
features: ""
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: x86_64-apple-darwin
custom-linker: ""
custom-compiler: /usr/local/opt/llvm/bin/clang
custom-archiver: /usr/local/opt/llvm/bin/llvm-ar
features: ""
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: aarch64-apple-ios
custom-linker: ""
custom-compiler: /usr/local/opt/llvm/bin/clang
custom-archiver: /usr/local/opt/llvm/bin/llvm-ar
features: ""
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: aarch64-apple-ios-sim
custom-linker: ""
custom-compiler: /usr/local/opt/llvm/bin/clang
custom-archiver: /usr/local/opt/llvm/bin/llvm-ar
features: ""
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: x86_64-pc-windows-gnu
custom-linker: ""
custom-compiler: x86_64-w64-mingw32-gcc
custom-archiver: x86_64-w64-mingw32-ar
features: ""
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: x86_64-unknown-linux-gnu
custom-linker: x86_64-unknown-linux-gnu-gcc
custom-compiler: /usr/local/opt/llvm/bin/clang
custom-archiver: /usr/local/opt/llvm/bin/llvm-ar
features: ""
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: aarch64-unknown-linux-gnu
custom-linker: aarch64-unknown-linux-gnu-gcc
custom-compiler: aarch64-unknown-linux-gnu-gcc
custom-archiver: aarch64-unknown-linux-gnu-gcc-ar
features: ""
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: i686-unknown-linux-gnu
custom-linker: i686-unknown-linux-gnu-gcc
custom-compiler: i686-unknown-linux-gnu-gcc
custom-archiver: i686-unknown-linux-gnu-gcc-ar
features: ""
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: wasm32-unknown-unknown
custom-linker: ""
Expand All @@ -85,19 +85,19 @@ jobs:
custom-linker: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang
custom-compiler: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang
custom-archiver: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar
features: ""
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: armv7-linux-androideabi
custom-linker: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang
custom-compiler: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang
custom-archiver: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar
features: ""
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: i686-linux-android
custom-linker: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang
custom-compiler: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang
custom-archiver: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar
features: ""
features: "jni,radix-engine"

steps:
- uses: FranzDiebold/github-env-vars-action@v2
Expand Down Expand Up @@ -145,15 +145,23 @@ jobs:
export CC=${{ matrix.build-target.custom-compiler }}
export AR=${{ matrix.build-target.custom-archiver }}
export features=${{ matrix.build-target.features }}
export features=${features:="default"}
if [ -z "${{ matrix.build-target.features }}" ];
then
echo "No special feature handling"
export features=""
else
export features="--features ${{ matrix.build-target.features }}"
echo "Special feature handling"
echo $features
fi
cargo +nightly build \
-Z build-std=std,panic_abort \
-Z build-std-features=panic_immediate_abort \
--target ${{ matrix.build-target.target-triple }} \
--features $features \
--release
--no-default-features \
--release $features
unset $LINKER_ENVIRONMENT_VARIABLE
export CC="/usr/local/opt/llvm/bin/clang"
Expand Down
8 changes: 7 additions & 1 deletion native-json-interface/tests/toolkit_wasm_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,13 @@ impl RadixEngineToolkit {
// release.
let status: std::process::ExitStatus = std::process::Command::new("cargo")
.current_dir(&manifest_directory)
.args(["build", "--target", "wasm32-unknown-unknown", "--release"])
.args([
"build",
"--target",
"wasm32-unknown-unknown",
"--release",
"--no-default-features",
])
.status()
.expect("Compilation of WASM for tests failed");
if !status.success() {
Expand Down
3 changes: 1 addition & 2 deletions radix-engine-toolkit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ bech32 = { version = "0.9.0", default-features = false }
# Used for more powerful declarative macros
paste = { version = "1.0.11" }
serde_json = "1.0.91"
getrandom = { version = "0.2.8", features = ["js"], optional = true }

[dev-dependencies]
lazy_static = { version = "1.4.0" }
serde_json = { version = "1.0.91" }

[features]
default = ["radix-engine"]
radix-engine = ["dep:radix-engine", "dep:getrandom"]
radix-engine = ["dep:radix-engine"]

0 comments on commit f94777a

Please sign in to comment.