Skip to content

Instantly share code, notes, and snippets.

@lamvd0101
Created November 2, 2022 04:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lamvd0101/368c84f1a956f77a8ab387465b4d7feb to your computer and use it in GitHub Desktop.
Save lamvd0101/368c84f1a956f77a8ab387465b4d7feb to your computer and use it in GitHub Desktop.
DIR=$PWD
PROJECT_NAME=RNSDKExample
FRAMEWORK_NAME=RNSDK
OUT_BUILD_DIR=$DIR/ios/build
OUT_FW_DIR=$DIR/ios/SDKOutput/Frameworks
rm -rf $OUT_BUILD_DIR
rm -rf $OUT_FW_DIR
SIMULATOR_ARCHIVE_PATH=$OUT_BUILD_DIR/${FRAMEWORK_NAME}-iphonesimulator.xcarchive
DEVICE_ARCHIVE_PATH=$OUT_BUILD_DIR/${FRAMEWORK_NAME}-iphoneos.xcarchive
# Simulator xcarchieve
xcodebuild archive \
-workspace ios/${PROJECT_NAME}.xcworkspace \
-scheme ${FRAMEWORK_NAME} \
-archivePath ${SIMULATOR_ARCHIVE_PATH} \
-configuration Release \
-sdk iphonesimulator \
SKIP_INSTALL=NO \
BUILD_LIBRARIES_FOR_DISTRIBUTION=YES \
clean build
# Device xcarchieve
xcodebuild archive \
-workspace ios/${PROJECT_NAME}.xcworkspace \
-scheme ${FRAMEWORK_NAME} \
-archivePath ${DEVICE_ARCHIVE_PATH} \
-sdk iphoneos \
-configuration Release \
SKIP_INSTALL=NO \
BUILD_LIBRARIES_FOR_DISTRIBUTION=YES \
clean build
cd $SIMULATOR_ARCHIVE_PATH/Products/Library/Frameworks
for framework in *; do
frameworkName=${framework//.framework/}
xcodebuild -create-xcframework \
-framework $SIMULATOR_ARCHIVE_PATH/Products/Library/Frameworks/$frameworkName.framework \
-framework $DEVICE_ARCHIVE_PATH/Products/Library/Frameworks/$frameworkName.framework \
-output $OUT_FW_DIR/$frameworkName.xcframework
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment