-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-universal-framework.sh
executable file
·58 lines (46 loc) · 1.52 KB
/
build-universal-framework.sh
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
# Configurables:
name="NinchatSDKSwift"
builddir="$(PWD)/Build"
# Build the simulator build
echo "Building for simulator.."
xcodebuild build -workspace $name.xcworkspace -scheme $name \
-sdk iphonesimulator SYMROOT=$builddir
if [ $? -ne 0 ]; then
echo "Simulator build failed."
exit
fi
# Build the device build
echo "Building for device.."
xcodebuild archive -workspace $name.xcworkspace -scheme $name \
-sdk iphoneos SYMROOT=$builddir
if [ $? -ne 0 ]; then
echo "Device build failed."
exit
fi
device_path="$builddir/Release-iphoneos/$name.framework"
device_file="$device_path/$name"
simulator_file="$builddir/Debug-iphonesimulator/$name.framework/$name"
# Check both files exist
if [ ! -f $device_file ]; then
echo "Device Build file not found: $device_file"
exit
fi
if [ ! -f $simulator_file ]; then
echo "Simulator Build file not found: $simulator_file"
exit
fi
universal_path="$builddir/$name.framework"
universal_file="$universal_path/$name"
rm -rf $universal_path
echo "Building universal framework to: $universal_path"
# Use the device framework as the basis for the combined universal framework
cp -r $device_path $universal_path
# Combine into universal framework under the current dir
lipo -create $device_file $simulator_file -output $universal_file
# Create a deliverable archive of the framework
archive="$builddir/NinchatSDK-Universal-Framework.tgz"
rm -f $archive
dir="$(dirname $universal_path)"
file="$(basename $universal_path)"
tar czf $archive -C $dir $file
echo "Done."