#!/usr/bin/env bash set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" TEMP_DIR="$(mktemp -d)" trap 'rm -rf "$TEMP_DIR"' EXIT swiftc -swift-version 5 -D AUTH_VERIFICATION_MOCK -module-cache-path "$TEMP_DIR/module-cache" \ "$ROOT/SodaLive/Sources/V2/Auth/AuthVerificationMock.swift" \ "$ROOT/SodaLive/Sources/Extensions/UserDefaultsExtension.swift" \ "$ROOT/SodaLive/Sources/Common/ApiResponse.swift" \ "$ROOT/SodaLive/Sources/MyPage/Auth/AuthVerifyRequest.swift" \ "$ROOT/SodaLive/Sources/MyPage/Auth/AuthResponse.swift" \ "$ROOT/SodaLive/Sources/MyPage/MyPageResponse.swift" \ "$ROOT/SodaLive/Sources/Settings/Content/ContentType.swift" \ "$ROOT/SodaLive/Sources/Settings/Content/UpdateContentPreferenceResponse.swift" \ "$ROOT/SodaLive/Sources/Settings/Notification/GetMemberInfoResponse.swift" \ "$ROOT/work/tests/AuthVerificationMockCheck.swift" \ -o "$TEMP_DIR/check-auth-verification-mock" "$TEMP_DIR/check-auth-verification-mock" for configuration in Debug Release; do FLAGS=() if [[ "$configuration" == Debug ]]; then FLAGS=(-D DEBUG); fi swiftc -swift-version 5 -module-cache-path "$TEMP_DIR/module-cache" "${FLAGS[@]}" \ -emit-library -module-name "AuthMockStandard$configuration" \ "$ROOT/SodaLive/Sources/V2/Auth/AuthVerificationMock.swift" \ "$ROOT/SodaLive/Sources/Extensions/UserDefaultsExtension.swift" \ -o "$TEMP_DIR/standard-$configuration.dylib" nm -j "$TEMP_DIR/standard-$configuration.dylib" > "$TEMP_DIR/symbols-$configuration" if rg -q 'AuthVerificationMock' "$TEMP_DIR/symbols-$configuration"; then printf 'FAIL: mock symbols in standard %s\n' "$configuration" >&2 exit 1 fi printf 'PASS: standard %s contains no mock symbols\n' "$configuration" done