51 lines
1.7 KiB
Bash
Executable File
51 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
dotnet_bin="${DOTNET_BIN:-${HOME}/.dotnet/dotnet}"
|
|
developer_dir="${DEVELOPER_DIR:-/Applications/Xcode.app/Contents/Developer}"
|
|
codesign_key="${UM_TRACE_DEVELOPMENT_KEY:-Apple Development: Brent Perteet (WZ56HVC6FD)}"
|
|
codesign_profile="${UM_TRACE_DEVELOPMENT_PROVISION:-UM Trace Development}"
|
|
device_udid="${1:-${UM_TRACE_DEVICE_UDID:-}}"
|
|
|
|
if [[ -z "${device_udid}" && -f "${repo_dir}/.ios-device" ]]; then
|
|
IFS= read -r device_udid < "${repo_dir}/.ios-device"
|
|
fi
|
|
|
|
if [[ -z "${device_udid}" ]]; then
|
|
echo "Usage: $0 <device-udid>" >&2
|
|
echo "Alternatively, set UM_TRACE_DEVICE_UDID or save the UDID in ${repo_dir}/.ios-device." >&2
|
|
exit 2
|
|
fi
|
|
|
|
if [[ ! -x "${dotnet_bin}" ]]; then
|
|
echo "Missing .NET SDK at ${dotnet_bin}. Set DOTNET_BIN or install the local SDK." >&2
|
|
exit 2
|
|
fi
|
|
|
|
if [[ ! -d "${developer_dir}" ]]; then
|
|
echo "Missing Xcode developer directory at ${developer_dir}. Set DEVELOPER_DIR." >&2
|
|
exit 2
|
|
fi
|
|
|
|
export DEVELOPER_DIR="${developer_dir}"
|
|
|
|
"${dotnet_bin}" restore "${repo_dir}/FieldLogger/FieldLogger.csproj" \
|
|
-p:TargetFrameworks=net9.0-ios \
|
|
-p:RuntimeIdentifier=ios-arm64
|
|
|
|
# Restoring the MAUI head with a narrowed TargetFrameworks property can rewrite the
|
|
# referenced headless library's assets file. Restore that library explicitly before building.
|
|
"${dotnet_bin}" restore "${repo_dir}/src/FieldLogger.Sync/FieldLogger.Sync.csproj"
|
|
|
|
"${dotnet_bin}" build "${repo_dir}/FieldLogger/FieldLogger.csproj" \
|
|
-t:Run \
|
|
-p:TargetFrameworks=net9.0-ios \
|
|
-f net9.0-ios \
|
|
-c Debug \
|
|
-p:RuntimeIdentifier=ios-arm64 \
|
|
-p:_DeviceName="${device_udid}" \
|
|
-p:CodesignKey="${codesign_key}" \
|
|
-p:CodesignProvision="${codesign_profile}" \
|
|
--no-restore
|