2021-12-21 23:20:20 +03:00
|
|
|
#!/bin/sh
|
2024-09-11 05:47:04 +03:00
|
|
|
set -eu
|
2021-12-21 23:20:20 +03:00
|
|
|
|
2022-11-30 23:58:54 +03:00
|
|
|
mkdir -p ./artifacts_cli
|
2021-12-21 23:20:20 +03:00
|
|
|
# Naive substitution to napi artifacts for the cli binary.
|
|
|
|
for filename in artifacts/*/*.node
|
|
|
|
do
|
2024-09-11 05:47:04 +03:00
|
|
|
# filename: artifacts/bindings-core-1.7.24-aarch64-apple-darwin/swc.darwin-arm64.node
|
|
|
|
|
|
|
|
# BINDING_NAME: darwin-arm64.node
|
|
|
|
# BINDING_ABI: darwin-arm64
|
|
|
|
# CLI_BINARY_PATH: artifacts/bindings-core-1.7.24-aarch64-apple-darwin/swc
|
|
|
|
|
|
|
|
BINDING_NAME=$(basename "$filename")
|
|
|
|
BINDING_ABI=$(echo "$BINDING_NAME" | sed 's/swc\.\(.*\)\.node/\1/')
|
|
|
|
CLI_BINARY_PATH=$(dirname "$filename")/swc
|
2021-12-21 23:20:20 +03:00
|
|
|
|
2022-12-12 06:50:09 +03:00
|
|
|
echo "Preparing build artifacts:"
|
|
|
|
echo "Binding name $BINDING_NAME"
|
|
|
|
echo "Filename $filename"
|
|
|
|
echo "Cli binary path $CLI_BINARY_PATH"
|
|
|
|
|
2021-12-21 23:20:20 +03:00
|
|
|
if [ -f "$CLI_BINARY_PATH" ]; then
|
2022-07-28 06:10:08 +03:00
|
|
|
chmod +x $CLI_BINARY_PATH
|
2022-12-30 09:31:57 +03:00
|
|
|
mv -v $CLI_BINARY_PATH ./artifacts_cli/swc-$BINDING_ABI
|
2022-07-28 06:10:08 +03:00
|
|
|
elif [ -f "$CLI_BINARY_PATH.exe" ]; then
|
2022-12-30 09:31:57 +03:00
|
|
|
mv -v $CLI_BINARY_PATH.exe ./artifacts_cli/swc-$BINDING_ABI.exe
|
2021-12-21 23:20:20 +03:00
|
|
|
fi
|
|
|
|
done
|