mirror of
https://github.com/mas-cli/mas
synced 2024-11-25 13:00:23 +00:00
466ea67194
Allow them to be run from any directory. Call version from lint & test to create Package.swift with version info. Fail when accessing unset variables. Improve variable names. Fix lint issues. Improve lint & format scripts. Don't require user input to continue linting. Much cleaner lint output. Reorder lint output. Get swift-format from Brewfile instead of from Package.swift: - Speeds up linting. - Properly models dependency (not a code dependency). - swift-format depends on an old version of swift-argument-parser. Will refactor to use SAP soon. Include some improvements from 1.8.7 PR. Other scripts need improvement, too. Resolve #545 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
33 lines
738 B
Bash
Executable file
33 lines
738 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))"
|
|
swift build \
|
|
--configuration release \
|
|
"${ARCH[@]+"${ARCH[@]}"}" \
|
|
--disable-sandbox \
|
|
"${CACHE[@]+"${CACHE[@]}"}"
|