-
Notifications
You must be signed in to change notification settings - Fork 1
/
project.yml
180 lines (159 loc) · 5.87 KB
/
project.yml
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: BPBleOTA
options:
#carthage: true
deploymentTarget:
iOS: "12.0"
bundleIdPrefix: com.bbb.zhxf
version: 0.6.4
packages:
iOSMcuManagerLibrary:
url: https://github.com/NordicSemiconductor/IOS-nRF-Connect-Device-Manager
from: 1.3.3
SwiftCBOR:
url: https://github.com/unrelentingtech/SwiftCBOR
from: 0.4.4
NordicDFU:
url: https://github.com/NordicSemiconductor/IOS-DFU-Library
from: 4.13.0
ZIPFoundation:
url: https://github.com/weichsel/ZIPFoundation
from: 0.9.11
targetTemplates:
Framework:
platform: iOS
type: framework
sources:
- ${frameworSourceFolder} #.build/checkouts/${frameworSourceFolder}
swift_versions: ["5.0", "5.1", "5.2", "5.3", "5.4", "5.5", "5.6", "5.7"]
settings:
GENERATE_INFOPLIST_FILE: YES
CODE_SIGNING_ALLOWED: NO
MARKETING_VERSION: ${PACKAGE_VERSION}
CURRENT_PROJECT_VERSION: ${PACKAGE_VERSION}
#MACH_O_TYPE: staticlib
LD_RUNPATH_SEARCH_PATHS: ["$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks"]
DYLIB_COMPATIBILITY_VERSION: ""
#CODE_SIGN_IDENTITY: "iPhone Distribution"
targets:
iOSMcuManagerLibrary:
templates:
- Framework
templateAttributes:
frameworSourceFolder: .build/checkouts/IOS-nRF-Connect-Device-Manager/Source
PACKAGE_VERSION: 1.3.3
dependencies:
- package: SwiftCBOR
SwiftCBOR:
templates:
- Framework
templateAttributes:
frameworSourceFolder: .build/checkouts/SwiftCBOR/Sources
PACKAGE_VERSION: 0.4.4
NordicDFU:
templates:
- Framework
templateAttributes:
frameworSourceFolder: .build/checkouts/IOS-DFU-Library/iOSDFULibrary
PACKAGE_VERSION: 4.13.0
dependencies:
- package: ZIPFoundation
ZIPFoundation:
templates:
- Framework
templateAttributes:
frameworSourceFolder: .build/checkouts/ZIPFoundation/Sources
PACKAGE_VERSION: 0.9.11
BPBleOTA:
templates:
- Framework
templateAttributes:
frameworSourceFolder: Sources
PACKAGE_VERSION: 0.6.4
dependencies:
- package: iOSMcuManagerLibrary
- package: NordicDFU
settings:
SWIFT_ACTIVE_COMPILATION_CONDITIONS: "$(inherited) SWIFT_PACKAGE"
CURRENT_PROJECT_VERSION: 0.6.0220231010
BPBleOTATests:
type: bundle.unit-test
platform: iOS
sources: Tests
dependencies:
- target: BPBleOTA
settings:
HEADER_SEARCH_PATHS: $(SRCROOT)/Sources
GENERATE_INFOPLIST_FILE: YES
CODE_SIGNING_ALLOWED: NO
aggregateTargets:
BuildAllFrameworks :
settings:
HEADER_SEARCH_PATHS: $(SRCROOT)/Sources
SWIFT_ACTIVE_COMPILATION_CONDITIONS: "$(inherited) SWIFT_PACKAGE"
buildScripts:
- name: Run Script
script: |
BUILD_DIR="Build"
PRODUCT_DIR="Products"
success_count=0
function build_framework() {
local framework_name="$1"
local scheme="${framework_name}"
local tmp_dir="${BUILD_DIR}/${framework_name}"
local ios_archive_path="${tmp_dir}/iOS.xcarchive"
local ios_sim_archive_path="${tmp_dir}/iOSSimulator.xcarchive"
# Clean up any previous build artifacts
rm -rf "${tmp_dir}"
#rm -rf "${PRODUCT_DIR}/${framework_name}.xcframework"
# Build archives for iOS and iOS Simulator
xcodebuild archive \
-scheme "${scheme}" \
-project "${PROJECT_NAME}.xcodeproj" \
-archivePath "${ios_sim_archive_path}" \
-destination "generic/platform=iOS Simulator" \
-sdk iphonesimulator \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES || { echo "Error: Failed to build archive for ${framework_name} (iOS Simulator)"; exit 1; }
xcodebuild archive \
-scheme "${scheme}" \
-project "${PROJECT_NAME}.xcodeproj" \
-archivePath "${ios_archive_path}" \
-destination "generic/platform=iOS" \
-sdk iphoneos \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES || { echo "Error: Failed to build archive for ${framework_name} (iOS)"; exit 1; }
rm -rf "${PRODUCT_DIR}/${framework_name}.xcframework"
xcodebuild -create-xcframework \
-framework ${ios_sim_archive_path}/Products/Library/Frameworks/${framework_name}.framework \
-framework ${ios_archive_path}/Products/Library/Frameworks/${framework_name}.framework \
-output ${PRODUCT_DIR}/${framework_name}.xcframework \
#| xcpretty
if [ $? -eq 0 ]; then
echo "build_framework ${framework_name} succeeded!"
((success_count++))
else
echo "Error: Failed to create xcframework for ${framework_name}"
exit 1
fi
#echo "build_framework ${framework_name} Successed!"
}
#build_framework "SwiftCBOR" && \
#build_framework "iOSMcuManagerLibrary" && \
#build_framework "ZIPFoundation" && \
#build_framework "NordicDFU" && \
#build_framework "BPBleOTA"
frameworks=("SwiftCBOR" "iOSMcuManagerLibrary" "ZIPFoundation" "NordicDFU" "BPBleOTA")
for framework in "${frameworks[@]}"; do
build_framework "$framework"
if [ $result -ne 0 ]; then
echo "Terminating script due to build ${framework} failure"
break
fi
done
if [ $success_count -eq ${#frameworks[@]} ]; then
echo "build all frameworks succeeded!"
exit 0
else
echo "Failed to build all frameworks"
exit 1
fi