#!/usr/bin/env bash set -euo pipefail repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" dotnet_bin="${DOTNET_BIN:-/Users/brent/.dotnet/dotnet}" developer_dir="${DEVELOPER_DIR:-/Applications/Xcode.app/Contents/Developer}" project="${repo_dir}/FieldLogger/FieldLogger.csproj" runtime_identifier="${IOS_RUNTIME:-ios-arm64}" nuget_cache="${UM_TRACE_NUGET_CACHE:-${TMPDIR:-/tmp}/um-trace-ci-nuget}" app_bundle="${repo_dir}/FieldLogger/bin/Debug/net9.0-ios/${runtime_identifier}/FieldLogger.app" artifacts_dir="${repo_dir}/artifacts/ios" artifact_name="UMTrace-unsigned-${runtime_identifier}.app.zip" export DEVELOPER_DIR="${developer_dir}" export NUGET_HTTP_CACHE_PATH="${NUGET_HTTP_CACHE_PATH:-${nuget_cache}/http-cache}" mkdir -p "${NUGET_HTTP_CACHE_PATH}" "${dotnet_bin}" restore "${project}" \ -p:TargetFrameworks=net9.0-ios \ -p:RuntimeIdentifier="${runtime_identifier}" \ -p:NuGetAudit=false # A narrowed restore of the MAUI head can rewrite the referenced library's # assets file, so restore the headless sync library explicitly as well. "${dotnet_bin}" restore "${repo_dir}/src/FieldLogger.Sync/FieldLogger.Sync.csproj" \ -p:NuGetAudit=false "${dotnet_bin}" clean "${project}" \ --framework net9.0-ios \ --configuration Debug \ -p:TargetFrameworks=net9.0-ios \ -p:RuntimeIdentifier="${runtime_identifier}" "${dotnet_bin}" build "${project}" \ --framework net9.0-ios \ --configuration Debug \ --runtime "${runtime_identifier}" \ -p:TargetFrameworks=net9.0-ios \ -p:EnableCodeSigning=false \ -p:CodesignKey= \ -p:CodesignProvision= \ --no-restore if [[ ! -d "${app_bundle}" ]]; then echo "Unsigned app bundle was not created at ${app_bundle}." >&2 exit 3 fi mkdir -p "${artifacts_dir}" ditto -c -k --sequesterRsrc --keepParent \ "${app_bundle}" \ "${artifacts_dir}/${artifact_name}" ( cd "${artifacts_dir}" shasum -a 256 "${artifact_name}" > "${artifact_name}.sha256" ) echo "Archived unsigned iOS app: ${artifacts_dir}/${artifact_name}"