-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathBuild.sh
More file actions
executable file
·47 lines (38 loc) · 1.37 KB
/
Build.sh
File metadata and controls
executable file
·47 lines (38 loc) · 1.37 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
40
41
42
43
44
45
46
47
#!/bin/sh
# 放在与 .xcodeproj 文件同级目录下,编译结果在 build 目录下,输出结果在 Framework 目录下
# 需要编译的 scheme
scheme="FWDebug"
if [ -z "$scheme" ] || [ "$scheme" = "" ]; then
echo "请填入 scheme 名称"
fi
echo "scheme: $scheme"
cd "$(dirname "$0")" || exit 0
xcodebuild archive \
-scheme "$scheme" \
-sdk iphoneos \
-archivePath "build/iphoneos.xcarchive" \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
SKIP_INSTALL=NO
xcodebuild archive \
-scheme "$scheme" \
-sdk iphonesimulator \
-archivePath "build/iphonesimulator.xcarchive" \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
SKIP_INSTALL=NO
# 优先从 build 文件夹下读取
product_list=$(ls build/iphoneos.xcarchive/Products/Library/Frameworks)
for file_name in $product_list
do
full_product_name=$file_name
break
done
# 读取不到就从 showBuildSettings 读取
if [ -z "$full_product_name" ] || [ "$full_product_name" = "" ]; then
name_dict=$(xcodebuild -showBuildSettings | grep FULL_PRODUCT_NAME)
full_product_name=${name_dict#*= }
fi
product_name=${full_product_name%.*}
xcodebuild -create-xcframework \
-framework build/iphoneos.xcarchive/Products/Library/Frameworks/"$full_product_name" \
-framework build/iphonesimulator.xcarchive/Products/Library/Frameworks/"$full_product_name" \
-output Framework/"$product_name".xcframework