@regulaforensics/face-sdk 6.3.3-beta → 6.3.4-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/examples/capacitor/package.json +1 -1
- package/examples/cordova/package.json +1 -1
- package/examples/ionic/package.json +1 -1
- package/examples/react-native/package.json +1 -1
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/ios-ci/.gitlab-ci.yml +0 -41
- package/ios-ci/.sample-env +0 -22
- package/ios-ci/README.md +0 -97
- package/ios-ci/RegulaDanger/Package.swift +0 -34
- package/ios-ci/RegulaDanger/Sources/RegulaDanger/RegulaDanger.swift +0 -44
- package/ios-ci/RegulaDanger/Tests/LinuxMain.swift +0 -7
- package/ios-ci/RegulaDanger/Tests/RegulaDangerTests/RegulaDangerTests.swift +0 -15
- package/ios-ci/RegulaDanger/Tests/RegulaDangerTests/XCTestManifests.swift +0 -9
- package/ios-ci/install.sh +0 -9
- package/ios-ci/ios_ci/__init__.py +0 -8
- package/ios-ci/ios_ci/cli.py +0 -408
- package/ios-ci/ios_ci/common/__init__.py +0 -0
- package/ios-ci/ios_ci/common/build_index.py +0 -70
- package/ios-ci/ios_ci/common/clean_cocoapod.sh +0 -13
- package/ios-ci/ios_ci/common/dependency.py +0 -466
- package/ios-ci/ios_ci/common/ftp.py +0 -314
- package/ios-ci/ios_ci/common/searchpod.sh +0 -6
- package/ios-ci/ios_ci/common/wait_for_cocopod.sh +0 -21
- package/ios-ci/ios_ci/inject.py +0 -145
- package/ios-ci/ios_ci/podspec/__init__.py +0 -0
- package/ios-ci/ios_ci/podspec/podspec.py +0 -88
- package/ios-ci/ios_ci/podspec/templates/BTDevice.podspec +0 -17
- package/ios-ci/ios_ci/podspec/templates/Core.podspec +0 -17
- package/ios-ci/ios_ci/podspec/templates/DocumentReader.podspec +0 -19
- package/ios-ci/ios_ci/podspec/templates/FaceCore.podspec +0 -17
- package/ios-ci/ios_ci/podspec/templates/FaceSDK.podspec +0 -18
- package/ios-ci/ios_ci/podspec/templates/IRS.podspec +0 -17
- package/ios-ci/ios_ci/podspec/templates/RegulaCommon.podspec +0 -17
- package/ios-ci/ios_ci/resolve_podfile_common.py +0 -76
- package/ios-ci/ios_ci/spm/AppleRootCA-G3.cer +0 -0
- package/ios-ci/ios_ci/spm/AppleWWDRCAG3.cer +0 -0
- package/ios-ci/ios_ci/spm/SwiftPackageGenerator+Common.sh +0 -48
- package/ios-ci/ios_ci/spm/SwiftPackageGenerator.sh +0 -33
- package/ios-ci/ios_ci/spm/XcodeSPMCollection.json +0 -29
- package/ios-ci/ios_ci/spm/__init__.py +0 -0
- package/ios-ci/ios_ci/spm/askpass.py +0 -19
- package/ios-ci/ios_ci/spm/spm.py +0 -227
- package/ios-ci/ios_ci/upload_build.py +0 -158
- package/ios-ci/ios_ci/version.py +0 -14
- package/ios-ci/poetry.lock +0 -342
- package/ios-ci/pyproject.toml +0 -26
- package/ios-ci/scripts.py +0 -9
- package/ios-ci/tests/__init__.py +0 -0
- package/ios-ci/tests/podspec/fixtures/BTDevice.podspec +0 -17
- package/ios-ci/tests/podspec/fixtures/BTDeviceBeta.podspec +0 -17
- package/ios-ci/tests/podspec/fixtures/DocumentReaderBeta_RegulaCommon_Beta.podspec +0 -19
- package/ios-ci/tests/podspec/fixtures/DocumentReaderBeta_RegulaCommon_Release.podspec +0 -19
- package/ios-ci/tests/podspec/fixtures/DocumentReaderFullRFID.podspec +0 -17
- package/ios-ci/tests/podspec/fixtures/DocumentReaderFullRFIDBeta.podspec +0 -17
- package/ios-ci/tests/podspec/fixtures/DocumentReader_RegulaCommon_Beta.podspec +0 -19
- package/ios-ci/tests/podspec/fixtures/DocumentReader_RegulaCommon_Release.podspec +0 -19
- package/ios-ci/tests/podspec/fixtures/FaceSDK.podspec +0 -18
- package/ios-ci/tests/podspec/fixtures/FaceSDKBeta.podspec +0 -18
- package/ios-ci/tests/podspec/fixtures/IRS.podspec +0 -17
- package/ios-ci/tests/podspec/fixtures/IRSBeta.podspec +0 -17
- package/ios-ci/tests/podspec/fixtures/RegulaCommon.podspec +0 -17
- package/ios-ci/tests/podspec/fixtures/RegulaCommonBeta.podspec +0 -17
- package/ios-ci/tests/podspec/test_podspec.py +0 -188
- package/ios-ci/tests/test_build_index.py +0 -117
- package/ios-ci/tests/test_dependency.py +0 -139
- package/ios-ci/tests/test_ios_ci.py +0 -5
- package/www/capacitor/internal/webpack.config.js +0 -11
|
@@ -1,466 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import subprocess
|
|
3
|
-
from enum import Enum, auto
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
from typing import Optional, Tuple
|
|
6
|
-
|
|
7
|
-
from ios_ci import __script_call_location__
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class DependencyBuildType(Enum):
|
|
11
|
-
TEMP = "Temp"
|
|
12
|
-
BETA = "Beta"
|
|
13
|
-
NIGHTLY = "Nightly"
|
|
14
|
-
STAGE = "Stage"
|
|
15
|
-
RELEASE = "Release"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class DependencySourceType(Enum):
|
|
19
|
-
COCOAPODS = auto()
|
|
20
|
-
FTP_PRIVATE = auto()
|
|
21
|
-
FTP_PUBLIC = auto()
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class Dependency:
|
|
25
|
-
name: str
|
|
26
|
-
""" Plain dependency name without `Beta` prefix. Example: `FaceSDK`, `FullRFID`, `DocumentReader` """
|
|
27
|
-
|
|
28
|
-
build_type: DependencyBuildType
|
|
29
|
-
|
|
30
|
-
def __init__(self, name: str, build_type: DependencyBuildType):
|
|
31
|
-
self.name = name
|
|
32
|
-
self.build_type = build_type
|
|
33
|
-
|
|
34
|
-
@property
|
|
35
|
-
def framework_name(self) -> str:
|
|
36
|
-
return f"{self.name}.xcframework"
|
|
37
|
-
|
|
38
|
-
@property
|
|
39
|
-
def pod_name(self) -> str:
|
|
40
|
-
"""The name of the dependency as if it is a pod name in Podfile. Has `Beta` prefix if needed"""
|
|
41
|
-
pod_name = self.name
|
|
42
|
-
if self.build_type == DependencyBuildType.BETA:
|
|
43
|
-
pod_name = f"{pod_name}Beta"
|
|
44
|
-
elif self.build_type == DependencyBuildType.NIGHTLY:
|
|
45
|
-
pod_name = f"{pod_name}Nightly"
|
|
46
|
-
elif self.build_type == DependencyBuildType.STAGE:
|
|
47
|
-
pod_name = f"{pod_name}Stage"
|
|
48
|
-
return pod_name
|
|
49
|
-
|
|
50
|
-
@property
|
|
51
|
-
def pod_name_temp(self) -> str:
|
|
52
|
-
"""The name of the dependency as if it is a pod name in Podfile. Has `Beta` or `Temp` prefix if needed"""
|
|
53
|
-
pod_name = self.name
|
|
54
|
-
if self.build_type == DependencyBuildType.BETA:
|
|
55
|
-
pod_name = f"{pod_name}Beta"
|
|
56
|
-
elif self.build_type == DependencyBuildType.NIGHTLY:
|
|
57
|
-
pod_name = f"{pod_name}Nightly"
|
|
58
|
-
elif self.build_type == DependencyBuildType.STAGE:
|
|
59
|
-
pod_name = f"{pod_name}Stage"
|
|
60
|
-
elif self.build_type == DependencyBuildType.TEMP:
|
|
61
|
-
pod_name = f"{pod_name}Temp"
|
|
62
|
-
return pod_name
|
|
63
|
-
|
|
64
|
-
def ftp_archive_name(self, version: str) -> str:
|
|
65
|
-
archive_name = f"{self.pod_name}-{version}"
|
|
66
|
-
return archive_name
|
|
67
|
-
|
|
68
|
-
@property
|
|
69
|
-
def ftp_project_path(self) -> str:
|
|
70
|
-
if self.build_type == DependencyBuildType.TEMP:
|
|
71
|
-
resource_path = f"iOS/{self.pod_name}"
|
|
72
|
-
else:
|
|
73
|
-
resource_path = f"{self.pod_name}"
|
|
74
|
-
return resource_path
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
def _core_full_name_from_short_name(short_name: str) -> str:
|
|
78
|
-
map = {
|
|
79
|
-
"barcode": "Barcode",
|
|
80
|
-
"barcodemrz": "MRZBarcode",
|
|
81
|
-
"barcodemrzrfid": "BarcodeMRZRFID",
|
|
82
|
-
"bounds": "Bounds",
|
|
83
|
-
"creditcard": "BankCard",
|
|
84
|
-
"doctype": "DocType",
|
|
85
|
-
"full": "Full",
|
|
86
|
-
"fullauth": "FullAuth",
|
|
87
|
-
"fullauthrfid": "FullAuthRFID",
|
|
88
|
-
"fullcc": "FullBankCard",
|
|
89
|
-
"fullrfid": "FullRFID",
|
|
90
|
-
"mrz": "MRZ",
|
|
91
|
-
"mrzcreditcard": "MRZBankCard",
|
|
92
|
-
"mrzrfid": "MRZRFID",
|
|
93
|
-
"ocrandmrz": "OCR",
|
|
94
|
-
"ocrandmrzcc": "OCRBankCard",
|
|
95
|
-
"ocrandmrzrfid": "OCRRFID",
|
|
96
|
-
"ocrmrzccrfid": "OCRBankCardRFID",
|
|
97
|
-
}
|
|
98
|
-
full_name = map.get(short_name)
|
|
99
|
-
return full_name
|
|
100
|
-
|
|
101
|
-
def _other_full_name_from_short_name(lower_case: str) -> str:
|
|
102
|
-
map = {
|
|
103
|
-
"faceSDK": "FaceSDK",
|
|
104
|
-
"basic": "FaceCoreBasic",
|
|
105
|
-
"match": "FaceCoreMatch",
|
|
106
|
-
"common": "RegulaCommon",
|
|
107
|
-
"documentReader": "DocumentReader",
|
|
108
|
-
"btDevice": "BTDevice",
|
|
109
|
-
}
|
|
110
|
-
upper_case = map.get(lower_case)
|
|
111
|
-
return upper_case
|
|
112
|
-
|
|
113
|
-
def _spm_git_url(short_name: str) -> str:
|
|
114
|
-
map = {
|
|
115
|
-
"barcode": "https://github.com/regulaforensics/DocumentReaderBarcode-Swift-Package.git",
|
|
116
|
-
"barcodemrz": "https://github.com/regulaforensics/DocumentReaderMRZBarcode-Swift-Package.git",
|
|
117
|
-
"barcodemrzrfid": "https://github.com/regulaforensics/DocumentReaderBarcodeMRZRFID-Swift-Package.git",
|
|
118
|
-
"bounds": "https://github.com/regulaforensics/DocumentReaderBounds-Swift-Package.git",
|
|
119
|
-
"doctype": "https://github.com/regulaforensics/DocumentReaderDocType-Swift-Package.git",
|
|
120
|
-
"full": "https://github.com/regulaforensics/DocumentReaderFull-Swift-Package.git",
|
|
121
|
-
"fullauth": "https://github.com/regulaforensics/DocumentReaderFullAuth-Swift-Package.git",
|
|
122
|
-
"fullauthrfid": "https://github.com/regulaforensics/DocumentReaderFullAuthRFID-Swift-Package.git",
|
|
123
|
-
"fullrfid": "https://github.com/regulaforensics/DocumentReaderFullRFID-Swift-Package.git",
|
|
124
|
-
"mrz": "https://github.com/regulaforensics/DocumentReaderMRZ-Swift-Package.git",
|
|
125
|
-
"mrzrfid": "https://github.com/regulaforensics/DocumentReaderMRZRFID-Swift-Package.git",
|
|
126
|
-
"ocrandmrz": "https://github.com/regulaforensics/DocumentReaderOCR-Swift-Package.git",
|
|
127
|
-
"ocrandmrzrfid": "https://github.com/regulaforensics/DocumentReaderOCRRFID-Swift-Package.git",
|
|
128
|
-
"basic": "https://github.com/regulaforensics/FaceCoreBasic-Swift-Package.git",
|
|
129
|
-
"match": "https://github.com/regulaforensics/FaceCoreMatch-Swift-Package.git",
|
|
130
|
-
"common": "https://github.com/regulaforensics/RegulaCommon-Swift-Package.git",
|
|
131
|
-
"documentReader": "https://github.com/regulaforensics/DocumentReader-Swift-Package.git",
|
|
132
|
-
"faceSDK": "https://github.com/regulaforensics/FaceSDK-Swift-Package.git",
|
|
133
|
-
"btDevice": "https://github.com/regulaforensics/BTDevice-Swift-Package.git",
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
git_url = map.get(short_name)
|
|
137
|
-
return git_url
|
|
138
|
-
|
|
139
|
-
def _is_core_by_short_name(short_name: str) -> bool:
|
|
140
|
-
return _core_full_name_from_short_name(short_name) is not None
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
class CoreDependency(Dependency):
|
|
144
|
-
core_short_name: str
|
|
145
|
-
""" Short name for Core dependency. Example: `fullrfid`, `mrz`. For decoded name see `name` field. """
|
|
146
|
-
|
|
147
|
-
def __init__(self, core_short_name: str, build_type: DependencyBuildType):
|
|
148
|
-
name = _core_full_name_from_short_name(core_short_name)
|
|
149
|
-
super().__init__(name, build_type)
|
|
150
|
-
self.core_short_name = core_short_name
|
|
151
|
-
|
|
152
|
-
@property
|
|
153
|
-
def framework_name(self) -> str:
|
|
154
|
-
return "DocumentReaderCore.xcframework"
|
|
155
|
-
|
|
156
|
-
@property
|
|
157
|
-
def pod_name(self) -> str:
|
|
158
|
-
pod_name = f"DocumentReader{self.name}"
|
|
159
|
-
if self.build_type == DependencyBuildType.BETA:
|
|
160
|
-
pod_name = f"{pod_name}Beta"
|
|
161
|
-
elif self.build_type == DependencyBuildType.NIGHTLY:
|
|
162
|
-
pod_name = f"{pod_name}Nightly"
|
|
163
|
-
elif self.build_type == DependencyBuildType.STAGE:
|
|
164
|
-
pod_name = f"{pod_name}Stage"
|
|
165
|
-
return pod_name
|
|
166
|
-
|
|
167
|
-
@property
|
|
168
|
-
def pod_name_temp(self) -> str:
|
|
169
|
-
pod_name = f"DocumentReader{self.name}"
|
|
170
|
-
if self.build_type == DependencyBuildType.BETA:
|
|
171
|
-
pod_name = f"{pod_name}Beta"
|
|
172
|
-
elif self.build_type == DependencyBuildType.NIGHTLY:
|
|
173
|
-
pod_name = f"{pod_name}Nightly"
|
|
174
|
-
elif self.build_type == DependencyBuildType.STAGE:
|
|
175
|
-
pod_name = f"{pod_name}Stage"
|
|
176
|
-
elif self.build_type == DependencyBuildType.TEMP:
|
|
177
|
-
pod_name = f"{pod_name}Temp"
|
|
178
|
-
return pod_name
|
|
179
|
-
|
|
180
|
-
@property
|
|
181
|
-
def pod_short_name(self) -> str:
|
|
182
|
-
"""Core pod name without `DocumentReader` prefix. Example: `FullRFID`"""
|
|
183
|
-
pod_name = self.name
|
|
184
|
-
if self.build_type == DependencyBuildType.BETA:
|
|
185
|
-
pod_name = f"{pod_name}Beta"
|
|
186
|
-
elif self.build_type == DependencyBuildType.NIGHTLY:
|
|
187
|
-
pod_name = f"{pod_name}Nightly"
|
|
188
|
-
elif self.build_type == DependencyBuildType.STAGE:
|
|
189
|
-
pod_name = f"{pod_name}Stage"
|
|
190
|
-
return pod_name
|
|
191
|
-
|
|
192
|
-
def ftp_archive_name(self, version: str) -> str:
|
|
193
|
-
archive_name = "DocumentReaderCore"
|
|
194
|
-
if self.build_type == DependencyBuildType.BETA:
|
|
195
|
-
archive_name = f"{archive_name}Beta"
|
|
196
|
-
elif self.build_type == DependencyBuildType.NIGHTLY:
|
|
197
|
-
archive_name = f"{archive_name}Nightly"
|
|
198
|
-
elif self.build_type == DependencyBuildType.STAGE:
|
|
199
|
-
archive_name = f"{archive_name}Stage"
|
|
200
|
-
archive_name = f"{archive_name}_{self.core_short_name}_{version}"
|
|
201
|
-
return archive_name
|
|
202
|
-
|
|
203
|
-
@property
|
|
204
|
-
def ftp_project_path(self) -> str:
|
|
205
|
-
if self.build_type == DependencyBuildType.TEMP:
|
|
206
|
-
resource_path = f"iOS/{self.core_short_name}"
|
|
207
|
-
else:
|
|
208
|
-
resource_path = f"{self.pod_short_name}"
|
|
209
|
-
return resource_path
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
def make_dependency(name: str, build_type: DependencyBuildType) -> Dependency:
|
|
213
|
-
if _is_core_by_short_name(name):
|
|
214
|
-
return CoreDependency(name, build_type)
|
|
215
|
-
else:
|
|
216
|
-
return Dependency(name, build_type)
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
class DependencyVersion:
|
|
220
|
-
version: str
|
|
221
|
-
version_selector: str
|
|
222
|
-
build_type: DependencyBuildType
|
|
223
|
-
source: DependencySourceType
|
|
224
|
-
|
|
225
|
-
def __init__(
|
|
226
|
-
self,
|
|
227
|
-
version: str,
|
|
228
|
-
version_selector: str,
|
|
229
|
-
build_type: DependencyBuildType,
|
|
230
|
-
source: DependencySourceType,
|
|
231
|
-
):
|
|
232
|
-
self.version = version
|
|
233
|
-
self.version_selector = version_selector
|
|
234
|
-
self.build_type = build_type
|
|
235
|
-
self.source = source
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
def inject_destination_path(dependency: Dependency) -> str:
|
|
239
|
-
pods_directory = _find_pods_folder()
|
|
240
|
-
if pods_directory is not None:
|
|
241
|
-
existing_filepath, _ = _find_existing_pod_location(
|
|
242
|
-
root_pods_directory=pods_directory, dependency=dependency
|
|
243
|
-
)
|
|
244
|
-
if existing_filepath is not None:
|
|
245
|
-
return existing_filepath
|
|
246
|
-
else:
|
|
247
|
-
print(
|
|
248
|
-
f"[warning] host project contains Pods folder and the dependency may be resolved as Cocoapods, but there is no folder for the dependency: {dependency.name}. Please make sure the project's frameworks are linked correctly or run pod install prior this script."
|
|
249
|
-
)
|
|
250
|
-
|
|
251
|
-
filepath = f"{pods_directory}/{dependency.pod_name}"
|
|
252
|
-
return filepath
|
|
253
|
-
|
|
254
|
-
filepath = __script_call_location__
|
|
255
|
-
return filepath
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
def _find_pods_folder() -> str:
|
|
259
|
-
script_call_path = Path(__script_call_location__)
|
|
260
|
-
possible_project_locations = [
|
|
261
|
-
script_call_path,
|
|
262
|
-
script_call_path.parent,
|
|
263
|
-
script_call_path.parent.parent,
|
|
264
|
-
]
|
|
265
|
-
|
|
266
|
-
pods_marks = ["Pods", "Podfile", "Podfile.lock"]
|
|
267
|
-
for location in possible_project_locations:
|
|
268
|
-
print(f"[log] looking for pods in {location}")
|
|
269
|
-
host_project_files = os.listdir(location)
|
|
270
|
-
|
|
271
|
-
for mark in pods_marks:
|
|
272
|
-
for filename in host_project_files:
|
|
273
|
-
if filename == mark:
|
|
274
|
-
pods = location / "Pods"
|
|
275
|
-
print(f"[log] found pods at {pods}")
|
|
276
|
-
return pods
|
|
277
|
-
|
|
278
|
-
return None
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
def _find_existing_pod_location(
|
|
282
|
-
root_pods_directory: str, dependency: Dependency
|
|
283
|
-
) -> Tuple[str, DependencyBuildType]:
|
|
284
|
-
pod_name = dependency.pod_name
|
|
285
|
-
possible_names = [pod_name, pod_name.replace("Beta", ""), pod_name.replace("Nightly", ""),
|
|
286
|
-
pod_name.replace("Stage", ""), f"{pod_name}Beta", f"{pod_name}Nightly", f"{pod_name}Stage"]
|
|
287
|
-
|
|
288
|
-
is_core = isinstance(dependency, CoreDependency)
|
|
289
|
-
if is_core:
|
|
290
|
-
possible_names.append("DocumentReaderFull")
|
|
291
|
-
possible_names.append("DocumentReaderFullBeta")
|
|
292
|
-
possible_names.append("DocumentReaderFullNightly")
|
|
293
|
-
possible_names.append("DocumentReaderFullStage")
|
|
294
|
-
|
|
295
|
-
for name in possible_names:
|
|
296
|
-
path = f"{root_pods_directory}/{name}"
|
|
297
|
-
|
|
298
|
-
build_type = DependencyBuildType.RELEASE
|
|
299
|
-
if name.find("Beta") != -1:
|
|
300
|
-
build_type = DependencyBuildType.BETA
|
|
301
|
-
elif name.find("Nightly") != -1:
|
|
302
|
-
build_type = DependencyBuildType.NIGHTLY
|
|
303
|
-
elif name.find("Stage") != -1:
|
|
304
|
-
build_type = DependencyBuildType.STAGE
|
|
305
|
-
|
|
306
|
-
if os.path.exists(path):
|
|
307
|
-
return [path, build_type]
|
|
308
|
-
|
|
309
|
-
return [None, None]
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
def clean_coaopod(pod_name: str):
|
|
313
|
-
this_script_path = os.path.dirname(os.path.realpath(__file__))
|
|
314
|
-
subprocess.run(
|
|
315
|
-
["bash", "clean_cocoapod.sh", pod_name],
|
|
316
|
-
cwd=this_script_path,
|
|
317
|
-
check=True,
|
|
318
|
-
text=True,
|
|
319
|
-
stdout=subprocess.PIPE,
|
|
320
|
-
).stdout
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
class VersionResolver:
|
|
324
|
-
def resolve_dependency_version(
|
|
325
|
-
self, dependency: Dependency, version_selector: str, branch: str
|
|
326
|
-
) -> DependencyVersion:
|
|
327
|
-
version = self.fetch_version(version_selector, branch, dependency)
|
|
328
|
-
pods_directory = _find_pods_folder()
|
|
329
|
-
path, type = _find_existing_pod_location(
|
|
330
|
-
root_pods_directory=pods_directory, dependency=dependency
|
|
331
|
-
)
|
|
332
|
-
|
|
333
|
-
if type is not None:
|
|
334
|
-
# Note: check only for Beta dependency. Temp and Release types are kind of the same.
|
|
335
|
-
if (
|
|
336
|
-
dependency.build_type is DependencyBuildType.BETA
|
|
337
|
-
and type is not DependencyBuildType.BETA
|
|
338
|
-
):
|
|
339
|
-
print(
|
|
340
|
-
f"[warning] given dependency and resolved path do not math: dependency.type: {dependency.build_type} and path: {path}. Make sure the paths and the dependency name are correct."
|
|
341
|
-
)
|
|
342
|
-
print(
|
|
343
|
-
f"[warning] resolving dependency.type by Pods folder: {dependency.build_type}"
|
|
344
|
-
)
|
|
345
|
-
|
|
346
|
-
source: DependencySourceType
|
|
347
|
-
if path is not None:
|
|
348
|
-
source = DependencySourceType.COCOAPODS
|
|
349
|
-
elif dependency.build_type is DependencyBuildType.TEMP:
|
|
350
|
-
source = DependencySourceType.FTP_PRIVATE
|
|
351
|
-
else:
|
|
352
|
-
source = DependencySourceType.FTP_PUBLIC
|
|
353
|
-
|
|
354
|
-
return DependencyVersion(
|
|
355
|
-
version=version,
|
|
356
|
-
version_selector=version_selector,
|
|
357
|
-
build_type=type,
|
|
358
|
-
source=source,
|
|
359
|
-
)
|
|
360
|
-
|
|
361
|
-
def fetch_version(
|
|
362
|
-
self, version_selector: str, branch: str, dependency: Dependency
|
|
363
|
-
) -> Optional[str]:
|
|
364
|
-
version = version_selector
|
|
365
|
-
if (
|
|
366
|
-
version_selector == "+"
|
|
367
|
-
and dependency.build_type != DependencyBuildType.TEMP
|
|
368
|
-
):
|
|
369
|
-
full_pod_name = dependency.pod_name
|
|
370
|
-
print(f"[log] searching for pod version for: {full_pod_name}")
|
|
371
|
-
version = self._search_pod_version(full_pod_name)
|
|
372
|
-
if version == "":
|
|
373
|
-
print(
|
|
374
|
-
f"[warning] search pod version returned empty for dependency: {dependency.name}"
|
|
375
|
-
)
|
|
376
|
-
return None
|
|
377
|
-
elif dependency.build_type == DependencyBuildType.TEMP:
|
|
378
|
-
version = self._search_temp_version(branch, dependency)
|
|
379
|
-
|
|
380
|
-
if version == "+":
|
|
381
|
-
print(
|
|
382
|
-
f"[warning] unable to fetch version for dependency: {dependency.name} – version: {version}"
|
|
383
|
-
)
|
|
384
|
-
return None
|
|
385
|
-
|
|
386
|
-
return version
|
|
387
|
-
|
|
388
|
-
def _search_temp_version(
|
|
389
|
-
self, branch: str, dependency: Dependency
|
|
390
|
-
) -> Optional[str]:
|
|
391
|
-
from ios_ci.common import ftp
|
|
392
|
-
|
|
393
|
-
last_version: Optional[str] = None
|
|
394
|
-
|
|
395
|
-
url = ftp.make_ftp_project_url(dependency=dependency)
|
|
396
|
-
index = ftp.fetch_build_index(project_url=url)
|
|
397
|
-
if index:
|
|
398
|
-
last_version = index.version(branch=branch)
|
|
399
|
-
|
|
400
|
-
if last_version is None:
|
|
401
|
-
# Search the filesystem on shared volume for file with version.
|
|
402
|
-
# This method is usually not appropriate for anything other than Core builds
|
|
403
|
-
# because we have already migrated all the iOS SDK products to use BuildIndex.
|
|
404
|
-
#
|
|
405
|
-
# The only thing is left to use legacy version indexing via shared volumes is Core builds.
|
|
406
|
-
# Maybe we should migrate them at one point too, but it was decided to keep it as it is for now.
|
|
407
|
-
version_filepath = self._make_temp_version_filepath(branch, dependency)
|
|
408
|
-
last_version = self._read_version_from_file(version_filepath)
|
|
409
|
-
|
|
410
|
-
return last_version
|
|
411
|
-
|
|
412
|
-
def _search_pod_version(self, pod_name):
|
|
413
|
-
"""
|
|
414
|
-
Searches pod version in the repository
|
|
415
|
-
Returns a string in a format of `x.x.x` e.g. `5.7.487`
|
|
416
|
-
"""
|
|
417
|
-
this_script_path = os.path.dirname(os.path.realpath(__file__))
|
|
418
|
-
result = subprocess.run(
|
|
419
|
-
["bash", "searchpod.sh", pod_name],
|
|
420
|
-
cwd=this_script_path,
|
|
421
|
-
check=True,
|
|
422
|
-
text=True,
|
|
423
|
-
stdout=subprocess.PIPE,
|
|
424
|
-
).stdout
|
|
425
|
-
if result == "unknown":
|
|
426
|
-
return None
|
|
427
|
-
return result.replace("\n", "")
|
|
428
|
-
|
|
429
|
-
def _read_version_from_file(self, filepath):
|
|
430
|
-
if filepath is None:
|
|
431
|
-
print(f"[warning] [_read_version_from_file]. Filepath is None.")
|
|
432
|
-
return None
|
|
433
|
-
if not os.path.exists(filepath):
|
|
434
|
-
print(
|
|
435
|
-
f"[warning] [_read_version_from_file]. There is no file at path:{filepath}"
|
|
436
|
-
)
|
|
437
|
-
return None
|
|
438
|
-
|
|
439
|
-
content = None
|
|
440
|
-
with open(filepath, "r") as content_file:
|
|
441
|
-
content = content_file.read().replace("\n", "")
|
|
442
|
-
return content
|
|
443
|
-
|
|
444
|
-
def _make_temp_version_filepath(self, branch: str, dependency: Dependency) -> str:
|
|
445
|
-
prefix = "/Volumes/work/software/AutoBuild/MobileApp"
|
|
446
|
-
type = dependency.build_type.value
|
|
447
|
-
paths = {
|
|
448
|
-
"DocumentReader": f"/iOSApi/api_{branch}_{type}.txt",
|
|
449
|
-
"BTDevice": f"/iOSBTDevice/BTDevice_{branch}_{type}.txt",
|
|
450
|
-
"FaceSDK": f"/iOSFaceSDK/facesdk_{branch}_{type}.txt",
|
|
451
|
-
"RegulaCommon": f"/iOSCommon/common_api_{branch}_{type}.txt",
|
|
452
|
-
}
|
|
453
|
-
is_core = isinstance(dependency, CoreDependency)
|
|
454
|
-
if is_core:
|
|
455
|
-
dependency.__class__ = CoreDependency
|
|
456
|
-
path = f"/iOSCore/core_{dependency.core_short_name}_{branch}_{type}.txt"
|
|
457
|
-
else:
|
|
458
|
-
path = paths.get(dependency.name)
|
|
459
|
-
|
|
460
|
-
if path:
|
|
461
|
-
return prefix + path
|
|
462
|
-
else:
|
|
463
|
-
print(
|
|
464
|
-
f"[error] the dependency: {dependency.name} is unknown. There is no .txt version file on local disk."
|
|
465
|
-
)
|
|
466
|
-
return None
|