#!/bin/bash
#set -xv
this_script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ -n "$1" ]
then
    export iso_name="$1"
    shift
else
    fail "Missing parameter iso_name"
fi
if [ -n "$1" ]
then
    export config="$1"
    shift
else
    fail "Missing parameter config"
fi

function do_build {
    local scheme='All targets (SEDUtilities project)'
    local destination='generic/platform=macOS,name=Any Mac'
    xcodebuild -workspace "${xcw_path}" -configuration "${config}" \
               -scheme "${scheme}" -destination "${destination}" ||
        fail "building with -scheme \"${scheme}\" -destination \"${destination}\""
}
export -f do_build

"${this_script_dir}/make_sed_iso" "${iso_name}" "${config}" do_build

