-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildIOS.sh
executable file
·86 lines (65 loc) · 3.65 KB
/
buildIOS.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
# Copyright 2023 Breautek
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
source build-tools/assertions.sh
source build-tools/DirectoryTools.sh
source build-tools/Checksum.sh
assertMac "Mac is required to build Fuse Native View iOS"
if [ -z "$BTFUSE_CODESIGN_IDENTITY" ]; then
echo "BTFUSE_CODESIGN_IDENTITY environment variable is required."
exit 2
fi
echo "Building Fuse Native View iOS Framework $(cat ./ios/VERSION)..."
rm -rf ./dist/ios
mkdir -p ./dist/ios
echo "Cleaning the workspace..."
spushd ios
VERSION=$(< VERSION)
BUILD_NO=$(< BUILD)
echo "// This is an auto-generated file, do not edit!" > BTFuseNativeView/VERSION.xcconfig
echo "CURRENT_PROJECT_VERSION = $BUILD_NO" >> BTFuseNativeView/VERSION.xcconfig
echo "MARKETING_VERSION = $VERSION" >> BTFuseNativeView/VERSION.xcconfig
xcodebuild -quiet -workspace BTFuseNativeView.xcworkspace -scheme BTFuseNativeView -configuration Release -destination "generic/platform=iOS" clean
assertLastCall
xcodebuild -quiet -workspace BTFuseNativeView.xcworkspace -scheme BTFuseNativeView -configuration Debug -destination "generic/platform=iOS Simulator" clean
assertLastCall
echo "Building iOS framework..."
xcodebuild -quiet -workspace BTFuseNativeView.xcworkspace -scheme BTFuseNativeView -configuration Release -destination "generic/platform=iOS" build
assertLastCall
echo "Building iOS Simulator framework..."
xcodebuild -quiet -workspace BTFuseNativeView.xcworkspace -scheme BTFuseNativeView -configuration Debug -destination "generic/platform=iOS Simulator" build
assertLastCall
iosBuild=$(echo "$(xcodebuild -workspace BTFuseNativeView.xcworkspace -scheme BTFuseNativeView -configuration Release -sdk iphoneos -showBuildSettings | grep -E '^\s*CONFIGURATION_BUILD_DIR =' | awk -F '= ' '{print $2}' | xargs)")
simBuild=$(echo "$(xcodebuild -workspace BTFuseNativeView.xcworkspace -scheme BTFuseNativeView -configuration Debug -sdk iphonesimulator -showBuildSettings | grep -E '^\s*CONFIGURATION_BUILD_DIR =' | awk -F '= ' '{print $2}' | xargs)")
echo "Signing iOS build..."
codesign -s $BTFUSE_CODESIGN_IDENTITY "$iosBuild/BTFuseNativeView.framework"
echo "Verifying iOS Build"
codesign -dvvvv "$iosBuild/BTFuseNativeView.framework"
assertLastCall
cp -r $iosBuild/BTFuseNativeView.framework.dSYM ../dist/ios/
xcodebuild -create-xcframework \
-framework $iosBuild/BTFuseNativeView.framework \
-debug-symbols $iosBuild/BTFuseNativeView.framework.dSYM \
-framework $simBuild/BTFuseNativeView.framework \
-output ../dist/ios/BTFuseNativeView.xcframework
assertLastCall
spopd
spushd dist/ios
zip -r BTFuseNativeView.xcframework.zip BTFuseNativeView.xcframework > /dev/null
zip -r BTFuseNativeView.framework.dSYM.zip BTFuseNativeView.framework.dSYM > /dev/null
sha1_compute BTFuseNativeView.xcframework.zip
sha1_compute BTFuseNativeView.framework.dSYM.zip
spopd
CHECKSUM=$(cat ./dist/ios/BTFuseNativeView.xcframework.zip.sha1.txt)
podspec=$(<BTFuseNativeView.podspec.template)
podspec=${podspec//\$VERSION\$/$VERSION}
podspec=${podspec//\$CHECKSUM\$/$CHECKSUM}
echo "$podspec" > BTFuseNativeView.podspec