-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
72 lines (62 loc) · 2.07 KB
/
build.sh
File metadata and controls
72 lines (62 loc) · 2.07 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/zsh
workspace=$1
project=$2
scheme=$3
target=$4
config=$5
buildRoot=$6
mode=$7
version=$(sed -n '/MARKETING_VERSION =/{s/MARKETING_VERSION = //;s/;//;s/^[[:space:]]*//;p;q;}' $project/project.pbxproj)
xcframeworkMode=xcframework
embeddedMode=embedded
echo "========== build framework $target =========="
echo workspace: $workspace
echo project: $project
echo scheme: $scheme
echo target: $target
echo config: $config
echo buildRoot: $buildRoot
echo mode: $mode
echo version: $version
echo "========== build framework $target end =========="
if [ $mode = "$xcframeworkMode" ]; then
echo build xcframework
elif [ $mode = "$embeddedMode" ]; then
echo build embeddedframework.zip
else
echo $mode is invalid mode... select either xcframework or embedded
exit 1
fi
archiveRoot=./$buildRoot/archives
iosArchive=$archiveRoot/$target-ios.xcarchive
iosSimulatorArchive=$archiveRoot/$target-ios-simulator.xcarchive
xcodebuild archive \
-workspace $workspace \
-scheme $scheme \
-configuration $config \
-destination "generic/platform=iOS" \
-archivePath $iosArchive \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
xcodebuild archive \
-workspace $workspace \
-scheme $scheme \
-configuration $config \
-destination "generic/platform=iOS Simulator" \
-archivePath $iosSimulatorArchive \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
if [ $mode = "$xcframeworkMode" ]; then
xcodebuild -create-xcframework \
-framework $iosArchive/Products/Library/Frameworks/$target.framework \
-framework $iosSimulatorArchive/Products/Library/Frameworks/$target.framework \
-output $buildRoot/$target-$version.xcframework
elif [ $mode = "$embeddedMode" ]; then
embeddedFramework=$target-$version.embeddedframework
rm -rf ./$buildRoot/$embeddedFramework
mkdir ./$buildRoot/$embeddedFramework
cp -R ./$iosArchive/Products/Library/Frameworks/$target.framework ./$buildRoot/$embeddedFramework/$target.framework
cd $buildRoot
zip -r ./$embeddedFramework.zip ./$embeddedFramework/$target.framework
cd -
fi