Skip to content

Commit 15824ea

Browse files
committed
Add temporary dir for optimizing artifacts
Remove existing artifacts before building
1 parent 183e9d4 commit 15824ea

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

optimize_workspace.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@ export PATH="$PATH:/root/.cargo/bin"
77
rustup toolchain list
88
cargo --version
99

10+
# Delete already built artifacts
11+
rm -f target/wasm32-unknown-unknown/release/*/*.wasm
12+
1013
# Build artifacts
1114
echo -n "Building artifacts in workspace..."
1215
/usr/local/bin/build_workspace.py
1316
echo "done."
1417

1518
echo -n "Optimizing artifacts in workspace..."
16-
# Start clean
17-
rm -rf ./artifacts
18-
mkdir artifacts
19-
# Optimize and postprocess artifacts
19+
mkdir -p artifacts
20+
TMPDIR=$(mktemp -d artifacts.XXX)
21+
# Optimize artifacts
2022
(
21-
cd artifacts
23+
cd "$TMPDIR"
2224

2325
for WASM in ../target/wasm32-unknown-unknown/release/*/*.wasm
2426
do
@@ -28,6 +30,13 @@ mkdir artifacts
2830
chmod -x "$BASE"
2931
echo "done."
3032
done
33+
mv ./*.wasm ../artifacts
34+
)
35+
echo "done."
36+
echo -n "Post-processing artifacts in workspace..."
37+
(
38+
cd artifacts
3139
sha256sum -- *.wasm >checksums.txt
3240
)
41+
rm -rf "$TMPDIR"
3342
echo "done."

0 commit comments

Comments
 (0)