diff --git a/.github/scripts/.build.zsh b/.github/scripts/.build.zsh index 538ef0c..b5898ba 100755 --- a/.github/scripts/.build.zsh +++ b/.github/scripts/.build.zsh @@ -1,246 +1,246 @@ -#!/usr/bin/env zsh - -builtin emulate -L zsh -setopt EXTENDED_GLOB -setopt PUSHD_SILENT -setopt ERR_EXIT -setopt ERR_RETURN -setopt NO_UNSET -setopt PIPE_FAIL -setopt NO_AUTO_PUSHD -setopt NO_PUSHD_IGNORE_DUPS -setopt FUNCTION_ARGZERO - -## Enable for script debugging -# setopt WARN_CREATE_GLOBAL -# setopt WARN_NESTED_VAR -# setopt XTRACE - -autoload -Uz is-at-least && if ! is-at-least 5.2; then - print -u2 -PR "%F{1}${funcstack[1]##*/}:%f Running on Zsh version %B${ZSH_VERSION}%b, but Zsh %B5.2%b is the minimum supported version. Upgrade Zsh to fix this issue." - exit 1 -fi - -_trap_error() { - print -u2 -PR '%F{1} ✖︎ script execution error%f' - print -PR -e " - Callstack: - ${(j:\n :)funcfiletrace} - " - exit 2 -} - -build() { - if (( ! ${+SCRIPT_HOME} )) typeset -g SCRIPT_HOME=${ZSH_ARGZERO:A:h} - local host_os=${${(s:-:)ZSH_ARGZERO:t:r}[2]} - local target="${host_os}-${CPUTYPE}" - local project_root=${SCRIPT_HOME:A:h:h} - local buildspec_file="${project_root}/buildspec.json" - - trap '_trap_error' ZERR - - fpath=("${SCRIPT_HOME}/utils.zsh" ${fpath}) - autoload -Uz log_info log_error log_output set_loglevel check_${host_os} setup_${host_os} setup_obs setup_ccache - - if [[ ! -r ${buildspec_file} ]] { - log_error \ - 'No buildspec.json found. Please create a build specification for your project.' \ - 'A buildspec.json.template file is provided in the repository to get you started.' - return 2 - } - - typeset -g -a skips=() - local -i _verbosity=1 - local -r _version='1.0.0' - local -r -a _valid_targets=( - macos-x86_64 - macos-arm64 - macos-universal - linux-x86_64 - ) - local -r -a _valid_configs=(Debug RelWithDebInfo Release MinSizeRel) - if [[ ${host_os} == 'macos' ]] { - local -r -a _valid_generators=(Xcode Ninja 'Unix Makefiles') - local generator="${${CI:+Ninja}:-Xcode}" - } else { - local -r -a _valid_generators=(Ninja 'Unix Makefiles') - local generator='Ninja' - } - local -r _usage=" -Usage: %B${functrace[1]%:*}%b