Created
October 10, 2020 20:46
build_xcframework.sh
This file contains hidden or 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 | |
cd $(dirname $0) | |
# set framework name or read it from project by this variable | |
FRAMEWORK_NAME=$1 | |
#xcframework path | |
FRAMEWORK_PATH="../${FRAMEWORK_NAME}.xcframework" | |
if [ -e ${FRAMEWORK_PATH} ]; then | |
echo "${FRAMEWORK_PATH} exists" | |
if [ "$2" = "force" ]; then | |
rm -r ${FRAMEWORK_PATH} || exit 1 | |
else | |
exit 0 | |
fi | |
fi | |
# set framework namefolder | |
BUILD_FOLDER_NAME=$(mktemp -d -t "${FRAMEWORK_NAME}") | |
# set path for iOS simulator archive | |
SIMULATOR_ARCHIVE_PATH="${BUILD_FOLDER_NAME}/simulator.xcarchive" | |
# set path for iOS device archive | |
IOS_DEVICE_ARCHIVE_PATH="${BUILD_FOLDER_NAME}/iOS.xcarchive" | |
echo "Archiving ${FRAMEWORK_NAME}" | |
xcodebuild archive -scheme ${FRAMEWORK_NAME} -destination="iOS Simulator" -archivePath "${SIMULATOR_ARCHIVE_PATH}" -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES || exit 1 | |
xcodebuild archive -scheme ${FRAMEWORK_NAME} -destination="iOS" -archivePath "${IOS_DEVICE_ARCHIVE_PATH}" -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES || exit 1 | |
#Creating XCFramework | |
xcodebuild -create-xcframework -framework ${SIMULATOR_ARCHIVE_PATH}/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework -framework ${IOS_DEVICE_ARCHIVE_PATH}/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework -output "${FRAMEWORK_PATH}" || exit 1 | |
rm -rf "${BUILD_FOLDER_NAME}" |
I am getting this following error UniversalBuilds.build does not contain an Xcode project, workspace or package.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
xcodebuild -create-xcframework
embeds .gitkeep files that cause warning in the build of dependents