-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake_release.sh
executable file
·81 lines (63 loc) · 2.1 KB
/
make_release.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
#!/usr/bin/env bash
set -e
BUILD_DIRECTORY="Build"
function archive_project() {
project_name=$1
framework_name=$2
# Archive iOS project.
xcodebuild archive\
-project "../$project_name-Device/$project_name-Device.xcodeproj"\
-scheme "$framework_name"\
-configuration "Release"\
-destination "generic/platform=iOS"\
-archivePath "$framework_name.framework-iphoneos.xcarchive"\
SKIP_INSTALL=NO\
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
# Archive iOS Simulator project.
xcodebuild archive\
-project "../$project_name-Simulator/$project_name-Simulator.xcodeproj"\
-scheme "$framework_name"\
-configuration "Release"\
-destination "generic/platform=iOS Simulator"\
-archivePath "$framework_name.framework-iphonesimulator.xcarchive"\
SKIP_INSTALL=NO\
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
}
function create_xcframework() {
project_name=$1
framework_name=$2
# Archive Xcode project.
archive_project "$project_name" "$framework_name"
# Create XCFramework from the archived project.
xcodebuild -create-xcframework\
-framework "$framework_name.framework-iphoneos.xcarchive/Products/Library/Frameworks/$framework_name.framework"\
-framework "$framework_name.framework-iphonesimulator.xcarchive/Products/Library/Frameworks/$framework_name.framework"\
-output "$framework_name.xcframework"
# Compress the XCFramework.
zip -r -X "$framework_name.xcframework.zip" "$framework_name.xcframework/"
# Save the SHA-256 checksum.
shasum -a 256 "$framework_name.xcframework.zip" >> checksum
}
function prepare() {
# Create Build directory if not existing.
if [ ! -d "$BUILD_DIRECTORY" ]; then
mkdir $BUILD_DIRECTORY
fi
}
function print_completion_message() {
echo $'\n** XCFRAMEWORK CREATION FINISHED **\n'
}
function cleanup() {
rm -r ./*.xcframework
rm -r ./*.xcarchive
}
function build_xcproject_project() {
prepare
cd $BUILD_DIRECTORY
create_xcframework "GoogleMaps" "GoogleMaps"
create_xcframework "GoogleMaps" "GoogleMapsBase"
create_xcframework "GoogleMaps" "GoogleMapsCore"
cleanup
}
build_xcproject_project
print_completion_message