#!/usr/bin/env bash set -euo pipefail source script/lib/blob-store.sh build_flag="--release" target_dir="release" open_result=false local_arch=false local_install=false bundle_name="" # Function for displaying help info help_info() { echo " Usage: ${0##*/} [options] [bundle_name] Build the application bundle for macOS. Options: -d Compile in debug mode -l Compile for local architecture only. -o Open dir with the resulting DMG or launch the app itself in local mode. -i Install the resulting DMG into /Applications in local mode. Noop without -l. -h Display this help and exit. " } build_args="" while getopts 'dloih' flag do case "${flag}" in o) open_result=true build_args="${build_args} -o" ;; d) export CARGO_INCREMENTAL=true export CARGO_BUNDLE_SKIP_BUILD=true build_flag=""; target_dir="debug" build_args="${build_args} -d" ;; l) export CARGO_INCREMENTAL=true export CARGO_BUNDLE_SKIP_BUILD=true local_arch=true local_only=true build_args="${build_args} -l" ;; i) local_install=true;; h) help_info exit 0 ;; esac done shift $((OPTIND-1)) if [[ $# -gt 0 ]]; then if [ "$1" ]; then bundle_name=$1 fi fi script/build-mac $build_args if [ "$local_only" = true ]; then script/notarize-mac $bundle_name else script/notarize-mac $bundle_name fi