Merge branch 'feature-private-builds' into 'main'

Increase privacy for WASM release builds

See merge request veilid/veilid!163
This commit is contained in:
Christien Rioux 2023-09-03 00:28:03 +00:00
commit 9f4ac0e45f
No known key found for this signature in database

View File

@ -26,6 +26,15 @@ if [[ "$1" == "release" ]]; then
OUTPUTDIR=../target/wasm32-unknown-unknown/release/pkg OUTPUTDIR=../target/wasm32-unknown-unknown/release/pkg
INPUTDIR=../target/wasm32-unknown-unknown/release INPUTDIR=../target/wasm32-unknown-unknown/release
# Path to, but not including, the cargo workspace ("veilid")
WORKSPACE_PARENT=$(dirname $(dirname $(cargo locate-project --workspace --message-format=plain)))
# Do not include said path in wasm blob output
RUSTFLAGS="--remap-path-prefix=$WORKSPACE_PARENT=/home/user $RUSTFLAGS"
# Do not include user home directory in wasm blob output
RUSTFLAGS="--remap-path-prefix=$HOME=/home/user $RUSTFLAGS"
# Explicitly mark RUSTFLAGS as an environment variable, so it's passed to cargo
export RUSTFLAGS
cargo build --target wasm32-unknown-unknown --release cargo build --target wasm32-unknown-unknown --release
mkdir -p $OUTPUTDIR mkdir -p $OUTPUTDIR
wasm-bindgen --out-dir $OUTPUTDIR --target web $INPUTDIR/veilid_wasm.wasm wasm-bindgen --out-dir $OUTPUTDIR --target web $INPUTDIR/veilid_wasm.wasm