forked from AdamEisfeld/PhyKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildPhy.sh
executable file
·94 lines (73 loc) · 2.39 KB
/
buildPhy.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
87
88
89
90
91
92
93
94
#!/bin/bash
framework_name="PhyKit"
framework_build_dir="Framework"
framework_output_base="$framework_build_dir"
project_path="PhyKit.xcodeproj"
build_ios_scheme="PhyKit-ios"
build_ios_dir="$framework_output_base/ios"
build_ios_full_path="$build_ios_dir.xcarchive"
build_ios_simulator_scheme="PhyKit-ios"
build_ios_simulator_dir="$framework_output_base/ios-simulator"
build_ios_simulator_full_path="$build_ios_simulator_dir.xcarchive"
build_macos_scheme="PhyKit-macos"
build_macos_dir="$framework_output_base/macos"
build_macos_full_path="$build_macos_dir.xcarchive"
build_framework_full_path="$framework_build_dir/$framework_name.xcframework"
function deletePath {
i_path="$1"
if [ -d "$i_path" ]; then rm -Rf "$i_path"; fi
}
function buildArchive {
i_destination="$1"
i_project_path="$2"
i_archive_name="$3"
i_scheme="$4"
i_output_dir="$5"
echo "Building $i_archive_name archive for $i_destination"
xcodebuild archive \
-project "$i_project_path" \
-scheme "$i_scheme" \
-destination "$i_destination" \
-archivePath "$i_output_dir" \
"PRODUCT_NAME=$i_archive_name" \
"SKIP_INSTALL=NO" \
"BUILD_LIBRARY_FOR_DISTRIBUTION=YES" | xcpretty
}
function buildFramework {
i_framework_name="$1"
i_ios_path="$2"
i_ios_simulator_path="$3"
i_macos_path="$4"
i_output_full_path="$5"
echo "Packaging archives into $i_framework_name.xcframework"
xcodebuild \
-create-xcframework \
-framework "$i_ios_path/Products/Library/Frameworks/$i_framework_name.framework" \
-framework "$i_ios_simulator_path/Products/Library/Frameworks/$i_framework_name.framework" \
-framework "$i_macos_path/Products/Library/Frameworks/$i_framework_name.framework" \
-output "$i_output_full_path" | xcpretty
}
deletePath "$build_ios_full_path"
deletePath "$build_ios_simulator_full_path"
deletePath "$build_macos_full_path"
deletePath "$build_framework_full_path"
buildArchive \
"generic/platform=iOS" \
"$project_path" \
"$framework_name" \
"$build_ios_scheme" \
"$build_ios_dir"
buildArchive \
"generic/platform=iOS Simulator" \
"$project_path" \
"$framework_name" \
"$build_ios_simulator_scheme" \
"$build_ios_simulator_dir"
buildArchive \
"platform=macOS" \
"$project_path" \
"$framework_name" \
"$build_macos_scheme" \
"$build_macos_dir"
buildFramework "$framework_name" "$build_ios_full_path" "$build_ios_simulator_full_path" "$build_macos_full_path" "$build_framework_full_path"
echo "Build complete"