Files
CleanMM/scripts/atlas/build-native.sh

39 lines
1.1 KiB
Bash
Raw Normal View History

2026-03-10 17:09:35 +08:00
#!/bin/bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
PROJECT_PATH="$ROOT_DIR/Atlas.xcodeproj"
SCHEME="AtlasApp"
CONFIGURATION="${CONFIGURATION:-Release}"
DERIVED_DATA_PATH="${DERIVED_DATA_PATH:-$ROOT_DIR/.build/atlas-native/DerivedData}"
if [[ -f "$ROOT_DIR/project.yml" ]]; then
2026-03-11 08:42:41 +00:00
if command -v xcodegen > /dev/null 2>&1; then
(cd "$ROOT_DIR" && xcodegen generate)
elif [[ ! -d "$PROJECT_PATH" || "$ROOT_DIR/project.yml" -nt "$PROJECT_PATH/project.pbxproj" ]]; then
echo "Atlas.xcodeproj is missing or stale, but xcodegen is not installed." >&2
exit 1
fi
2026-03-10 17:09:35 +08:00
fi
VERSION_OVERRIDES=()
if [[ -n "${ATLAS_VERSION:-}" ]]; then
VERSION_OVERRIDES+=(MARKETING_VERSION="$ATLAS_VERSION")
fi
if [[ -n "${ATLAS_BUILD_NUMBER:-}" ]]; then
VERSION_OVERRIDES+=(CURRENT_PROJECT_VERSION="$ATLAS_BUILD_NUMBER")
fi
xcodebuild_args=(
-project "$PROJECT_PATH"
-scheme "$SCHEME"
-configuration "$CONFIGURATION"
-derivedDataPath "$DERIVED_DATA_PATH"
)
if (( ${#VERSION_OVERRIDES[@]} > 0 )); then
xcodebuild_args+=("${VERSION_OVERRIDES[@]}")
fi
xcodebuild "${xcodebuild_args[@]}" build