2024-09-30 15:28:25 +00:00
|
|
|
#!/bin/bash -eu
|
2019-01-19 04:37:51 +00:00
|
|
|
#
|
|
|
|
# script/build
|
|
|
|
# mas
|
|
|
|
#
|
2021-04-28 21:49:54 +00:00
|
|
|
# Builds the Swift Package.
|
2019-01-19 04:37:51 +00:00
|
|
|
#
|
2015-09-20 10:14:32 +00:00
|
|
|
|
2024-09-30 15:28:25 +00:00
|
|
|
mas_dir="$(readlink -fn "$(dirname "${BASH_SOURCE:-"${0}"}")/..")"
|
|
|
|
|
|
|
|
if ! cd -- "${mas_dir}"; then
|
|
|
|
printf $'Error: Could not cd into mas directory: %s\n' "${mas_dir}" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-05-07 18:33:39 +00:00
|
|
|
# Build for the host architecture by default.
|
2021-06-09 01:56:27 +00:00
|
|
|
ARCH=()
|
2024-11-07 14:30:55 +00:00
|
|
|
if [[ "${#}" -ge 1 && "${1}" == '--universal' ]]; then
|
2024-02-18 07:09:44 +00:00
|
|
|
ARCH=(
|
|
|
|
--arch arm64
|
|
|
|
--arch x86_64
|
2023-11-29 03:25:43 +00:00
|
|
|
)
|
2021-05-07 18:33:39 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Disable the manifest cache on Xcode 12.5 and later.
|
2021-06-09 01:56:27 +00:00
|
|
|
CACHE=()
|
2021-05-07 18:33:39 +00:00
|
|
|
if [[ "$(swift build --help)" =~ manifest-cache ]]; then
|
2021-06-09 01:56:27 +00:00
|
|
|
CACHE=(--manifest-cache none)
|
2021-05-07 18:33:39 +00:00
|
|
|
fi
|
|
|
|
|
2024-10-27 03:48:05 +00:00
|
|
|
echo "==> 🏗️ Building mas ($(script/version --write))"
|
2021-05-07 04:19:11 +00:00
|
|
|
swift build \
|
|
|
|
--configuration release \
|
2024-09-30 15:28:25 +00:00
|
|
|
"${ARCH[@]+"${ARCH[@]}"}" \
|
2021-05-07 04:19:11 +00:00
|
|
|
--disable-sandbox \
|
2024-09-30 15:28:25 +00:00
|
|
|
"${CACHE[@]+"${CACHE[@]}"}"
|