Skip to content

Commit 7d01789

Browse files
authored
chore: Reuse workspace target directory in wasm build script (#2312)
1 parent d6deb0c commit 7d01789

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

crates/wasm/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ require_command wasm-opt
3030

3131
self_path=$(dirname "$(readlink -f "$0")")
3232
export pname=$(toml2json < ${self_path}/Cargo.toml | jq -r .package.name)
33-
export CARGO_TARGET_DIR=$self_path/target
33+
export CARGO_TARGET_DIR=$self_path/../../target
3434

3535
rm -rf $self_path/outputs >/dev/null 2>&1
3636
rm -rf $self_path/result >/dev/null 2>&1

crates/wasm/buildPhaseCargoCommand.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fi
2525

2626
# TODO: Handle the wasm target being built in release mode
2727
TARGET=wasm32-unknown-unknown
28-
WASM_BINARY=${self_path}/../../target/${TARGET}/release/${pname}.wasm
28+
WASM_BINARY=${CARGO_TARGET_DIR}/${TARGET}/release/${pname}.wasm
2929

3030
NODE_DIR=${self_path}/pkg/nodejs/
3131
BROWSER_DIR=${self_path}/pkg/web/

flake.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
BARRETENBERG_BIN_DIR = "${pkgs.barretenberg-wasm}/bin";
8989
};
9090

91-
testEnvironment = sharedEnvironment // {};
91+
testEnvironment = sharedEnvironment // { };
9292

9393
# The `self.rev` property is only available when the working tree is not dirty
9494
GIT_COMMIT = if (self ? rev) then self.rev else "unknown";
@@ -295,6 +295,7 @@
295295
COMMIT_SHORT = builtins.substring 0 7 GIT_COMMIT;
296296
VERSION_APPENDIX = if GIT_DIRTY == "true" then "-dirty" else "";
297297
PKG_PATH = "./pkg";
298+
CARGO_TARGET_DIR = "./target";
298299

299300
nativeBuildInputs = with pkgs; [
300301
which

0 commit comments

Comments
 (0)