2023-09-11 15:14:10 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-09-11 16:33:50 +08:00
|
|
|
set -e
|
|
|
|
set -o pipefail
|
|
|
|
|
2023-09-11 15:14:10 +08:00
|
|
|
XCODE_VERSION=$(xcodebuild -version | head -n 1| awk -F ' ' '{print $2}')
|
|
|
|
XCODE_VERSION_MAJOR=$(echo $XCODE_VERSION | awk -F '.' '{print $1}')
|
2024-05-07 16:08:42 +08:00
|
|
|
XCODE_VERSION_MINOR=$(echo $XCODE_VERSION | awk -F '.' '{print $2}')
|
|
|
|
XCODE_VERSION_PATCH=$(echo $XCODE_VERSION | awk -F '.' '{print $3}')
|
2023-09-11 15:14:10 +08:00
|
|
|
if [ -z "$SRCROOT" ]
|
|
|
|
then
|
|
|
|
SRCROOT=$(pwd)
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "${SRCROOT}/build"
|
2023-09-11 16:33:50 +08:00
|
|
|
PLATFORMS=("iOS" "iOSSimulator" "macOS" "tvOS" "tvOSSimulator" "watchOS" "watchOSSimulator")
|
|
|
|
|
|
|
|
if [ $XCODE_VERSION_MAJOR -ge 11 ]
|
|
|
|
then
|
|
|
|
PLATFORMS+=("macCatalyst")
|
|
|
|
fi
|
2023-09-11 15:14:10 +08:00
|
|
|
|
2024-05-07 16:08:42 +08:00
|
|
|
if [[ ($XCODE_VERSION_MAJOR -gt 15) || ($XCODE_VERSION_MAJOR -eq 15 && $XCODE_VERSION_MINOR -ge 2) ]]
|
2023-09-11 15:14:10 +08:00
|
|
|
then
|
2023-09-11 16:33:50 +08:00
|
|
|
PLATFORMS+=("visionOS")
|
|
|
|
PLATFORMS+=("visionOSSimulator")
|
2023-09-11 15:14:10 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
for CURRENT_PLATFORM in "${PLATFORMS[@]}"
|
|
|
|
do
|
2023-09-11 16:33:50 +08:00
|
|
|
DESTINATION="generic/platform=${CURRENT_PLATFORM}"
|
|
|
|
|
2023-09-11 15:14:10 +08:00
|
|
|
# macOS Catalyst
|
2023-09-11 16:33:50 +08:00
|
|
|
if [[ $CURRENT_PLATFORM == "macCatalyst" ]]; then
|
|
|
|
DESTINATION="generic/platform=macOS,variant=Mac Catalyst"
|
2023-09-11 15:14:10 +08:00
|
|
|
fi
|
2023-09-11 16:33:50 +08:00
|
|
|
|
|
|
|
# Simulator
|
|
|
|
if [[ $CURRENT_PLATFORM == *Simulator ]]; then
|
|
|
|
CURRENT_PLATFORM_OS=${CURRENT_PLATFORM%Simulator}
|
|
|
|
DESTINATION="generic/platform=${CURRENT_PLATFORM_OS} Simulator"
|
2023-09-11 15:14:10 +08:00
|
|
|
fi
|
2023-09-11 16:33:50 +08:00
|
|
|
|
|
|
|
xcodebuild build -project "SDWebImage.xcodeproj" -destination "${DESTINATION}" -scheme "SDWebImage" -configuration "Release" -derivedDataPath "${SRCROOT}/build/DerivedData" CONFIGURATION_BUILD_DIR="${SRCROOT}/build/${CURRENT_PLATFORM}/"
|
2023-09-11 15:14:10 +08:00
|
|
|
done
|