-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathbuild-xcframework.sh
More file actions
executable file
·39 lines (33 loc) · 1.3 KB
/
build-xcframework.sh
File metadata and controls
executable file
·39 lines (33 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# 设置变量
SCHEME="BmobSDK" # 你的 scheme/target 名称
PROJECT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../Bmob-iOS/Bmob_iOS_Source_New/BmobMutiSDK/BmobSDK/BmobSDK.xcodeproj"
OUTPUT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/BmobSDK_xcframework"
FRAMEWORK_NAME="BmobSDK"
# 清理旧产物
rm -rf "${OUTPUT_DIR}"
mkdir -p "${OUTPUT_DIR}"
# 构建 iOS 设备 framework
xcodebuild archive \
-project "${PROJECT_PATH}" \
-scheme "${SCHEME}" \
-configuration Release \
-sdk iphoneos \
-archivePath "${OUTPUT_DIR}/ios_devices.xcarchive" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
# 构建 iOS 模拟器 framework
xcodebuild archive \
-project "${PROJECT_PATH}" \
-scheme "${SCHEME}" \
-configuration Release \
-sdk iphonesimulator \
-archivePath "${OUTPUT_DIR}/ios_simulator.xcarchive" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
# 合成 xcframework
xcodebuild -create-xcframework \
-framework "${OUTPUT_DIR}/ios_devices.xcarchive/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework" \
-framework "${OUTPUT_DIR}/ios_simulator.xcarchive/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework" \
-output "${OUTPUT_DIR}/${FRAMEWORK_NAME}.xcframework"
echo "✅ XCFramework 已生成:${OUTPUT_DIR}/${FRAMEWORK_NAME}.xcframework"