mas/script/build
Ross Goldberg e9fcf2b254
Merge branch 'main' into upstream/releases/release-1.8.7
Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>

# Manual Merge Cleanup:
#	.actrc
#	.github/workflows/pr-checks.yml
#	.github/workflows/release.yml
#	Brewfile
#	script/test
#	script/version_bump

# Conflicts:
#	.github/workflows/build-test.yml
#	.gitignore
#	.swiftlint.yml
#	Brewfile.lock.json
#	Package.resolved
#	Sources/mas/Package.swift
#	Tests/masTests/.swiftlint.yml
#	script/bootstrap
#	script/build
#	script/format
#	script/lint
#	script/uninstall
#	script/version
2024-10-27 01:25:38 -04:00

36 lines
758 B
Bash
Executable file

#!/bin/bash -eu
#
# script/build
# mas
#
# Builds the Swift Package.
#
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
# Build for the host architecture by default.
ARCH=()
if [[ "${#}" -gt 1 && "${1}" == '--universal' ]]; then
ARCH=(
--arch arm64
--arch x86_64
)
fi
# Disable the manifest cache on Xcode 12.5 and later.
CACHE=()
if [[ "$(swift build --help)" =~ manifest-cache ]]; then
CACHE=(--manifest-cache none)
fi
echo "==> 🏗️ Building mas ($(script/version --write))"
swift build \
--configuration release \
"${ARCH[@]+"${ARCH[@]}"}" \
--disable-sandbox \
"${CACHE[@]+"${CACHE[@]}"}"