Created
January 31, 2023 15:38
-
-
Save illescasDaniel/27eb1e886062805d5d1a2cf1de50e4ce to your computer and use it in GitHub Desktop.
Build XCFramework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PROJECT_NAME=DemoFramework | |
# DO NOT MODIFY the code below | |
PROJECT_SCHEME_NAME="${PROJECT_NAME}" | |
FRAMEWORK_FILE_NAME="${PROJECT_NAME}.framework" | |
XCFRAMEWORK_OUTPUT_NAME="${PROJECT_NAME}.xcframework" | |
SIMULATOR_FRAMEWORK_ARCHIVE_OUTPUT_NAME="${PROJECT_NAME}-iphonesimulator.xcarchive" | |
DEVICE_FRAMEWORK_ARCHIVE_OUTPUT_NAME="${PROJECT_NAME}-iphoneos.xcarchive" | |
MAC_FRAMEWORK_ARCHIVE_OUTPUT_NAME="${PROJECT_NAME}-macosx.xcarchive" | |
# Folder structure | |
# - this script | |
# - bin folder | |
# - your project folder | |
# - your project xcodeproj folder | |
rm -rf ./bin/$XCFRAMEWORK_OUTPUT_NAME | |
rm -rf ./bin/$SIMULATOR_FRAMEWORK_ARCHIVE_OUTPUT_NAME | |
rm -rf ./bin/$DEVICE_FRAMEWORK_ARCHIVE_OUTPUT_NAME | |
rm -rf ./bin/$MAC_FRAMEWORK_ARCHIVE_OUTPUT_NAME | |
xcodebuild archive \ | |
-scheme $PROJECT_SCHEME_NAME \ | |
-archivePath ./bin/$SIMULATOR_FRAMEWORK_ARCHIVE_OUTPUT_NAME \ | |
-sdk iphonesimulator \ | |
SKIP_INSTALL=NO \ | |
BUILD_LIBRARY_FOR_DISTRIBUTION=YES | |
xcodebuild archive \ | |
-scheme $PROJECT_SCHEME_NAME \ | |
-archivePath ./bin/$DEVICE_FRAMEWORK_ARCHIVE_OUTPUT_NAME \ | |
-sdk iphoneos \ | |
SKIP_INSTALL=NO \ | |
BUILD_LIBRARY_FOR_DISTRIBUTION=YES | |
xcodebuild archive \ | |
-scheme $PROJECT_SCHEME_NAME \ | |
-archivePath ./bin/$MAC_FRAMEWORK_ARCHIVE_OUTPUT_NAME \ | |
-sdk macosx \ | |
SKIP_INSTALL=NO \ | |
BUILD_LIBRARY_FOR_DISTRIBUTION=YES | |
xcodebuild -create-xcframework \ | |
-archive ./bin/$SIMULATOR_FRAMEWORK_ARCHIVE_OUTPUT_NAME -framework $FRAMEWORK_FILE_NAME \ | |
-archive ./bin/$DEVICE_FRAMEWORK_ARCHIVE_OUTPUT_NAME -framework $FRAMEWORK_FILE_NAME \ | |
-archive ./bin/$MAC_FRAMEWORK_ARCHIVE_OUTPUT_NAME -framework $FRAMEWORK_FILE_NAME \ | |
-output ./bin/$XCFRAMEWORK_OUTPUT_NAME | |
rm -rf ./bin/$SIMULATOR_FRAMEWORK_ARCHIVE_OUTPUT_NAME | |
rm -rf ./bin/$DEVICE_FRAMEWORK_ARCHIVE_OUTPUT_NAME | |
rm -rf ./bin/$MAC_FRAMEWORK_ARCHIVE_OUTPUT_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment