Skip to content

Commit

Permalink
fix: support mac catalyst
Browse files Browse the repository at this point in the history
  • Loading branch information
crleona committed Oct 29, 2024
1 parent 1113761 commit d0d1ce6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
6 changes: 4 additions & 2 deletions AnalyticsConnector.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AnalyticsConnector;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos watchos watchsimulator appletvos appletvsimulator macosx";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
SUPPORTS_MACCATALYST = YES;
SWIFT_INSTALL_OBJC_HEADER = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -303,7 +304,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AnalyticsConnector;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos watchos watchsimulator appletvos appletvsimulator macosx";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
SUPPORTS_MACCATALYST = YES;
SWIFT_INSTALL_OBJC_HEADER = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4,6";
Expand Down
28 changes: 20 additions & 8 deletions scripts/build_framework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SCHEME="AnalyticsConnector"
FRAMEWORK="AnalyticsConnector"
BUILD_DIR="./.build/artifacts"
OUTPUT_PATH="$BUILD_DIR/$FRAMEWORK.xcframework"
PLATFORMS=("macOS" "iOS" "iOS Simulator" "tvOS" "tvOS Simulator" "watchOS" "watchOS Simulator")
PLATFORMS=("iOS" "iOS Simulator" "macOS" "macOS Cataylst" "watchOS" "watchOS Simulator" "tvOS" "tvOS Simulator")

build_framework_with_configuration_and_name() {
CONFIGURATION=${1}
Expand All @@ -15,13 +15,25 @@ build_framework_with_configuration_and_name() {
for PLATFORM in "${PLATFORMS[@]}"
do
ARCHIVE="$BUILD_DIR/$CONFIGURATION/$FRAMEWORK-$PLATFORM.xcarchive"
xcodebuild archive \
-scheme "$SCHEME" \
-configuration "$CONFIGURATION" \
-archivePath "$ARCHIVE" \
-destination "generic/platform=$PLATFORM" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
if [[ "$PLATFORM" == "macOS Cataylst" ]]
then
xcodebuild archive \
-scheme "$SCHEME" \
-configuration "$CONFIGURATION" \
-archivePath "$ARCHIVE" \
-destination "generic/platform=macOS,variant=Mac Catalyst" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
SUPPORTS_MACCATALYST=YES
else
xcodebuild archive \
-scheme "$SCHEME" \
-configuration "$CONFIGURATION" \
-archivePath "$ARCHIVE" \
-destination "generic/platform=$PLATFORM" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
fi
ARCHIVES+=("$ARCHIVE")
done

Expand Down

0 comments on commit d0d1ce6

Please sign in to comment.