Skip to content

Commit

Permalink
Add temporary dir for optimizing artifacts
Browse files Browse the repository at this point in the history
Remove existing artifacts before building
  • Loading branch information
maurolacy committed Apr 7, 2021
1 parent 183e9d4 commit 15824ea
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions optimize_workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ export PATH="$PATH:/root/.cargo/bin"
rustup toolchain list
cargo --version

# Delete already built artifacts
rm -f target/wasm32-unknown-unknown/release/*/*.wasm

# Build artifacts
echo -n "Building artifacts in workspace..."
/usr/local/bin/build_workspace.py
echo "done."

echo -n "Optimizing artifacts in workspace..."
# Start clean
rm -rf ./artifacts
mkdir artifacts
# Optimize and postprocess artifacts
mkdir -p artifacts
TMPDIR=$(mktemp -d artifacts.XXX)
# Optimize artifacts
(
cd artifacts
cd "$TMPDIR"

for WASM in ../target/wasm32-unknown-unknown/release/*/*.wasm
do
Expand All @@ -28,6 +30,13 @@ mkdir artifacts
chmod -x "$BASE"
echo "done."
done
mv ./*.wasm ../artifacts
)
echo "done."
echo -n "Post-processing artifacts in workspace..."
(
cd artifacts
sha256sum -- *.wasm >checksums.txt
)
rm -rf "$TMPDIR"
echo "done."

0 comments on commit 15824ea

Please sign in to comment.