Skip to content

Commit

Permalink
Merge pull request #6 from amplitude/fix_xcframework_path
Browse files Browse the repository at this point in the history
fix: don't include build path in zipped artifact
  • Loading branch information
crleona authored Oct 30, 2024
2 parents 3da59d5 + d0d1ce6 commit 7c72f3f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ jobs:
run: scripts/build_framework.sh

- name: Zip xcframework
run: zip -r .build/artifacts/AnalyticsConnector.xcframework.zip .build/artifacts/AnalyticsConnector.xcframework
working-directory: .build/artifacts
run: zip -r AnalyticsConnector.xcframework.zip AnalyticsConnector.xcframework

- name: Semantic Release --dry-run
if: ${{ github.event.inputs.dryRun == 'true'}}
Expand Down
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 7c72f3f

Please sign in to comment.