@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.
Files changed (68) hide show
  1. package/examples/capacitor/package.json +1 -1
  2. package/examples/cordova/package.json +1 -1
  3. package/examples/ionic/package.json +1 -1
  4. package/examples/react-native/package.json +1 -1
  5. package/package.json +1 -1
  6. package/plugin.xml +1 -1
  7. package/ios-ci/.gitlab-ci.yml +0 -41
  8. package/ios-ci/.sample-env +0 -22
  9. package/ios-ci/README.md +0 -97
  10. package/ios-ci/RegulaDanger/Package.swift +0 -34
  11. package/ios-ci/RegulaDanger/Sources/RegulaDanger/RegulaDanger.swift +0 -44
  12. package/ios-ci/RegulaDanger/Tests/LinuxMain.swift +0 -7
  13. package/ios-ci/RegulaDanger/Tests/RegulaDangerTests/RegulaDangerTests.swift +0 -15
  14. package/ios-ci/RegulaDanger/Tests/RegulaDangerTests/XCTestManifests.swift +0 -9
  15. package/ios-ci/install.sh +0 -9
  16. package/ios-ci/ios_ci/__init__.py +0 -8
  17. package/ios-ci/ios_ci/cli.py +0 -408
  18. package/ios-ci/ios_ci/common/__init__.py +0 -0
  19. package/ios-ci/ios_ci/common/build_index.py +0 -70
  20. package/ios-ci/ios_ci/common/clean_cocoapod.sh +0 -13
  21. package/ios-ci/ios_ci/common/dependency.py +0 -466
  22. package/ios-ci/ios_ci/common/ftp.py +0 -314
  23. package/ios-ci/ios_ci/common/searchpod.sh +0 -6
  24. package/ios-ci/ios_ci/common/wait_for_cocopod.sh +0 -21
  25. package/ios-ci/ios_ci/inject.py +0 -145
  26. package/ios-ci/ios_ci/podspec/__init__.py +0 -0
  27. package/ios-ci/ios_ci/podspec/podspec.py +0 -88
  28. package/ios-ci/ios_ci/podspec/templates/BTDevice.podspec +0 -17
  29. package/ios-ci/ios_ci/podspec/templates/Core.podspec +0 -17
  30. package/ios-ci/ios_ci/podspec/templates/DocumentReader.podspec +0 -19
  31. package/ios-ci/ios_ci/podspec/templates/FaceCore.podspec +0 -17
  32. package/ios-ci/ios_ci/podspec/templates/FaceSDK.podspec +0 -18
  33. package/ios-ci/ios_ci/podspec/templates/IRS.podspec +0 -17
  34. package/ios-ci/ios_ci/podspec/templates/RegulaCommon.podspec +0 -17
  35. package/ios-ci/ios_ci/resolve_podfile_common.py +0 -76
  36. package/ios-ci/ios_ci/spm/AppleRootCA-G3.cer +0 -0
  37. package/ios-ci/ios_ci/spm/AppleWWDRCAG3.cer +0 -0
  38. package/ios-ci/ios_ci/spm/SwiftPackageGenerator+Common.sh +0 -48
  39. package/ios-ci/ios_ci/spm/SwiftPackageGenerator.sh +0 -33
  40. package/ios-ci/ios_ci/spm/XcodeSPMCollection.json +0 -29
  41. package/ios-ci/ios_ci/spm/__init__.py +0 -0
  42. package/ios-ci/ios_ci/spm/askpass.py +0 -19
  43. package/ios-ci/ios_ci/spm/spm.py +0 -227
  44. package/ios-ci/ios_ci/upload_build.py +0 -158
  45. package/ios-ci/ios_ci/version.py +0 -14
  46. package/ios-ci/poetry.lock +0 -342
  47. package/ios-ci/pyproject.toml +0 -26
  48. package/ios-ci/scripts.py +0 -9
  49. package/ios-ci/tests/__init__.py +0 -0
  50. package/ios-ci/tests/podspec/fixtures/BTDevice.podspec +0 -17
  51. package/ios-ci/tests/podspec/fixtures/BTDeviceBeta.podspec +0 -17
  52. package/ios-ci/tests/podspec/fixtures/DocumentReaderBeta_RegulaCommon_Beta.podspec +0 -19
  53. package/ios-ci/tests/podspec/fixtures/DocumentReaderBeta_RegulaCommon_Release.podspec +0 -19
  54. package/ios-ci/tests/podspec/fixtures/DocumentReaderFullRFID.podspec +0 -17
  55. package/ios-ci/tests/podspec/fixtures/DocumentReaderFullRFIDBeta.podspec +0 -17
  56. package/ios-ci/tests/podspec/fixtures/DocumentReader_RegulaCommon_Beta.podspec +0 -19
  57. package/ios-ci/tests/podspec/fixtures/DocumentReader_RegulaCommon_Release.podspec +0 -19
  58. package/ios-ci/tests/podspec/fixtures/FaceSDK.podspec +0 -18
  59. package/ios-ci/tests/podspec/fixtures/FaceSDKBeta.podspec +0 -18
  60. package/ios-ci/tests/podspec/fixtures/IRS.podspec +0 -17
  61. package/ios-ci/tests/podspec/fixtures/IRSBeta.podspec +0 -17
  62. package/ios-ci/tests/podspec/fixtures/RegulaCommon.podspec +0 -17
  63. package/ios-ci/tests/podspec/fixtures/RegulaCommonBeta.podspec +0 -17
  64. package/ios-ci/tests/podspec/test_podspec.py +0 -188
  65. package/ios-ci/tests/test_build_index.py +0 -117
  66. package/ios-ci/tests/test_dependency.py +0 -139
  67. package/ios-ci/tests/test_ios_ci.py +0 -5
  68. package/www/capacitor/internal/webpack.config.js +0 -11
@@ -1,17 +0,0 @@
1
- Pod::Spec.new do |s|
2
- s.name = '<POD_NAME>'
3
- s.version = '<VERSION>'
4
- s.summary = 'Databases of travel documents, banknotes, driver\'s licenses and vehicle registration certificates'
5
- s.license = {
6
- type: 'commercial',
7
- text: <<-LICENSE
8
- © <YEAR> RegulaForensics. All rights reserved.
9
- LICENSE
10
- }
11
- s.homepage = 'https://mobile.regulaforensics.com'
12
- s.author = { 'RegulaForensics' => 'support@regulaforensics.com' }
13
- s.source = { http: '<FTP_SOURCE_URL>' }
14
- s.platform = :ios
15
- s.ios.deployment_target = '13.0.0'
16
- s.ios.vendored_frameworks = 'IRS.xcframework'
17
- end
@@ -1,17 +0,0 @@
1
- Pod::Spec.new do |s|
2
- s.name = '<POD_NAME>'
3
- s.version = '<VERSION>'
4
- s.summary = 'Collection of shared code and modules for Regula solutions.'
5
- s.license = {
6
- type: 'commercial',
7
- text: <<-LICENSE
8
- © <YEAR> RegulaForensics. All rights reserved.
9
- LICENSE
10
- }
11
- s.homepage = 'https://mobile.regulaforensics.com'
12
- s.author = { 'RegulaForensics' => 'support@regulaforensics.com' }
13
- s.source = { http: '<FTP_SOURCE_URL>' }
14
- s.platform = :ios
15
- s.ios.deployment_target = '11.0.0'
16
- s.ios.vendored_frameworks = 'RegulaCommon.xcframework'
17
- end
@@ -1,76 +0,0 @@
1
- import os
2
- from ios_ci import DependencyBuildType
3
- from ios_ci import Dependency
4
- from ios_ci import VersionResolver
5
-
6
- ENV = os.environ
7
-
8
-
9
- def main():
10
- print(f"[log] check if any dependency needs to modify Podfile.")
11
- api = Dependency(
12
- "DocumentReader",
13
- ENV["ApiVersion"],
14
- ENV["ApiBranchName"],
15
- ENV["ApiType"],
16
- "xcframework",
17
- )
18
- face_sdk = Dependency(
19
- "FaceSDK",
20
- ENV["FaceSDKVersion"],
21
- ENV["FaceSDKBranchName"],
22
- ENV["FaceSDKType"],
23
- "xcframework",
24
- )
25
- dependencies = [api, face_sdk]
26
-
27
- version_resolver = VersionResolver()
28
- overridables: list[Dependency] = []
29
- dependency_version_map = {}
30
- for dependency in dependencies:
31
- version = version_resolver.fetch_version(dependency)
32
- pod_name = dependency.make_pod_full_name()
33
- print(f"[log] {pod_name} {version}")
34
- if dependency.type != DependencyBuildType.TEMP:
35
- overridables.append(dependency)
36
- dependency_version_map[pod_name] = version
37
-
38
- if len(overridables) == 0:
39
- print(f"[log] There are no dependencies to modify Podfile.")
40
- exit(0)
41
-
42
- updated_podfile_lines: list[str] = []
43
- with open("Podfile") as podfile:
44
- lines = podfile.readlines()
45
- for line in lines:
46
- for dependency in overridables:
47
- pod_name = dependency.make_pod_full_name()
48
- version = dependency_version_map.get(pod_name)
49
- if version is None or version == "":
50
- print(f"[error] failed to fetch version for {pod_name}")
51
- exit(1)
52
-
53
- find_dependency_name = line.find(f"pod '{dependency.dependency_name}'")
54
- find_pod_name = line.find(f"pod '{pod_name}'")
55
- start_index = max(find_dependency_name, find_pod_name)
56
- if start_index != -1:
57
- padding = line[0:start_index]
58
- line = f"{padding}pod '{pod_name}', '{version}'\n"
59
- print(f"[log] replaced line with {line}")
60
-
61
- updated_podfile_lines.append(line)
62
-
63
- with open("Podfile.temp", "w") as podfile_output:
64
- for line in updated_podfile_lines:
65
- podfile_output.write(line)
66
- podfile_output.close()
67
-
68
- os.replace("Podfile.temp", "Podfile")
69
-
70
- with open("Podfile") as test:
71
- content = test.read()
72
- print(f"[log] resulting podfile: {content}")
73
-
74
-
75
- if __name__ == "__main__":
76
- main()
Binary file
@@ -1,48 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Check if four arguments are passed
4
- if [ "$#" -ne 4 ]; then
5
- echo "Usage: $0 <package_name> <packageUrl> <package_checksum> <common_version>"
6
- exit 1
7
- fi
8
-
9
- packageName=$1
10
- packageUrl=$2
11
- packageChecksum=$3
12
- commonVersion=$4
13
-
14
- # Create Package.swift file
15
- cat <<EOF > Package.swift
16
- // swift-tools-version:5.3
17
- import PackageDescription
18
-
19
- let packageName = "$packageName"
20
-
21
- let package = Package(
22
- name: "$packageName",
23
- platforms: [.iOS(.v11)],
24
- products: [
25
- .library(
26
- name: "$packageName",
27
- targets: ["\(packageName)Common"]),
28
- ],
29
- dependencies: [
30
- .package(name: "RegulaCommon", url: "https://github.com/regulaforensics/RegulaCommon-Swift-Package.git", .exact(Version(stringLiteral: "$commonVersion"))),
31
- ],
32
- targets: [
33
- .binaryTarget(name: "$packageName", url: "$packageUrl", checksum: "$packageChecksum"),
34
- .target(
35
- name: "\(packageName)Common",
36
- dependencies: [
37
- .target(name: "$packageName"),
38
- .product(name: "RegulaCommon", package: "RegulaCommon")
39
- ],
40
- path: "Sources",
41
- sources: ["dummy.swift"]
42
- )
43
- ]
44
- )
45
- EOF
46
-
47
- # Print success message
48
- echo "Swift Package created successfully!"
@@ -1,33 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Check if three arguments are passed
4
- if [ "$#" -ne 3 ]; then
5
- echo "Usage: $0 <package_name> <packageUrl> <package_checksum>"
6
- exit 1
7
- fi
8
-
9
- packageName=$1
10
- packageUrl=$2
11
- packageChecksum=$3
12
-
13
- # Create Package.swift file
14
- cat <<EOF > Package.swift
15
- // swift-tools-version:5.3
16
- import PackageDescription
17
-
18
- let package = Package(
19
- name: "$packageName",
20
- platforms: [.iOS(.v11)],
21
- products: [
22
- .library(
23
- name: "$packageName",
24
- targets: ["$packageName"]),
25
- ],
26
- targets: [
27
- .binaryTarget(name: "$packageName", url: "$packageUrl", checksum: "$packageChecksum"),
28
- ]
29
- )
30
- EOF
31
-
32
- # Print success message
33
- echo "Swift Package created successfully!"
@@ -1,29 +0,0 @@
1
- {
2
- "name": "Regula SPM collection",
3
- "overview": "Contains all Regula packages in one SPM collection",
4
- "keywords": ["face", "document", "reader", "documentreader", "regula", "regulaforensics"],
5
- "author": {
6
- "name": "Regula Forensics"
7
- },
8
- "packages": [
9
- { "url": "https://github.com/regulaforensics/RegulaCommon-Swift-Package.git" },
10
- { "url": "https://github.com/regulaforensics/BTDevice-Swift-Package.git" },
11
- { "url": "https://github.com/regulaforensics/FaceCoreMatch-Swift-Package.git" },
12
- { "url": "https://github.com/regulaforensics/FaceCoreBasic-Swift-Package.git" },
13
- { "url": "https://github.com/regulaforensics/DocumentReader-Swift-Package.git" },
14
- { "url": "https://github.com/regulaforensics/DocumentReaderBarcodeMRZRFID-Swift-Package.git" },
15
- { "url": "https://github.com/regulaforensics/DocumentReaderBounds-Swift-Package.git" },
16
- { "url": "https://github.com/regulaforensics/DocumentReaderFullAuth-Swift-Package.git" },
17
- { "url": "https://github.com/regulaforensics/DocumentReaderOCRRFID-Swift-Package.git" },
18
- { "url": "https://github.com/regulaforensics/DocumentReaderMRZRFID-Swift-Package.git" },
19
- { "url": "https://github.com/regulaforensics/DocumentReaderDocType-Swift-Package.git" },
20
- { "url": "https://github.com/regulaforensics/DocumentReaderMRZBarcode-Swift-Package.git" },
21
- { "url": "https://github.com/regulaforensics/DocumentReaderFullAuthRFID-Swift-Package.git" },
22
- { "url": "https://github.com/regulaforensics/DocumentReaderBarcode-Swift-Package.git" },
23
- { "url": "https://github.com/regulaforensics/DocumentReaderMRZ-Swift-Package.git" },
24
- { "url": "https://github.com/regulaforensics/DocumentReaderOCR-Swift-Package.git" },
25
- { "url": "https://github.com/regulaforensics/DocumentReaderFull-Swift-Package.git" },
26
- { "url": "https://github.com/regulaforensics/DocumentReaderFullRFID-Swift-Package.git" },
27
- { "url": "https://github.com/regulaforensics/FaceSDK-Swift-Package.git" },
28
- ]
29
- }
File without changes
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env python3
2
- #
3
- # Short script for use with git clone and fetch credentials.
4
- # Requires GITHUB_USERNAME and GITHUB_PASSWORD environment variables,
5
- # intended to be called by git via GIT_ASKPASS.
6
- #
7
-
8
- from sys import argv
9
- from os import environ
10
-
11
- if "username" in argv[1].lower():
12
- print(environ["GITHUB_USERNAME"])
13
- exit()
14
-
15
- if "password" in argv[1].lower():
16
- print(environ["GITHUB_PASSWORD"])
17
- exit()
18
-
19
- exit(1)
@@ -1,227 +0,0 @@
1
- import sys
2
- import os
3
- import subprocess
4
- import shutil
5
-
6
- from getpass import getpass
7
-
8
- from typing import Optional
9
-
10
- from ios_ci.common import dependency
11
- from ios_ci.common import ftp
12
-
13
- REPLACE_SDK_VERSION_TOKEN = "sdkVersion ="
14
- REPLACE_SDK_CHECKSUM_TOKEN = "sdkChecksum ="
15
- REPLACE_COMMON_VERSION_TOKEN = "commonSDKVersion ="
16
-
17
-
18
- # Uses GITHUB_USERNAME and GITHUB_PASSWORD environment variables for github interactions.
19
- # If the varaiables are not provided the script will prompt the user from the console.
20
- #
21
- # 1. Fetches SPM public repository from `spm_repo_url`.
22
- # 2. Checks if there is a release tag `build_version` already exists. If so - cancells the operation.
23
- # 3. Calculates the hash directly from the link using `curl`.
24
- # 4. Generates spm package using `version`, `name` and `hash`.
25
- # 5. Creates release tag `build_version`.
26
- # 6. Creates release on GitHub.
27
- # 7. Pushes changes and tag to the `spm_repo_url` repository.
28
- # 8. Generates a collection using Swift Package Collection Generator and digitally signs it.
29
- # 9. Uploads the generated collection to `https://pods.regulaforensics.com/SPM/`
30
- # 10. Removes fetched repository from disk.
31
- #
32
- def update_spm(
33
- package_name: str,
34
- build_version: str,
35
- collection_update: str,
36
- common_version: Optional[str],
37
- zipped_build_filepath: str,
38
- spm_repo_url: str,
39
- spm_repo_template_branch: str
40
- ):
41
- if not os.path.isfile(zipped_build_filepath):
42
- print(f"[error] Build archive does not exist at: {zipped_build_filepath}")
43
- sys.exit(0)
44
-
45
- lowercase_core_name = package_name
46
- uppercase_core_name = dependency._core_full_name_from_short_name(package_name)
47
- uppercase_sdk_name = dependency._other_full_name_from_short_name(package_name)
48
- spm_repo_url = dependency._spm_git_url(package_name)
49
-
50
- project_dir = os.path.dirname(os.path.abspath(__file__))
51
- spm_repo_template_dir = f"{project_dir}/manifest_repository"
52
- os.environ["GIT_ASKPASS"] = os.path.join(project_dir, "askpass.py")
53
-
54
- # replace with token auth
55
- #if "GITHUB_USERNAME" not in os.environ:
56
- # os.environ["GITHUB_USERNAME"] = input("GITHUB_USERNAME: ")
57
- #if "GITHUB_PASSWORD" not in os.environ:
58
- # os.environ["GITHUB_PASSWORD"] = getpass("GITHUB_PASSWORD: ")
59
-
60
- subprocess.run(["rm", "-rf", spm_repo_template_dir], check=True, text=True)
61
- subprocess.run(
62
- ["git", "clone", spm_repo_url, "--single-branch", spm_repo_template_dir],
63
- check=True,
64
- text=True,
65
- )
66
- spm_repo_dir = f"{project_dir}/spm_repository"
67
- subprocess.run(["rm", "-rf", spm_repo_dir], check=True, text=True)
68
- subprocess.run(
69
- ["git", "clone", spm_repo_url, "--single-branch", spm_repo_dir],
70
- check=True,
71
- text=True,
72
- )
73
-
74
- try:
75
- tags = subprocess.run(
76
- ["git", "show-ref", "--tags", build_version],
77
- cwd=spm_repo_dir,
78
- stdout=subprocess.PIPE,
79
- check=True,
80
- text=True,
81
- ).stdout
82
- except subprocess.CalledProcessError as e:
83
- if e.returncode == 1:
84
- print(f"[log] there is no {build_version} tag. continue.")
85
- tags = ""
86
- else:
87
- print(f"[error] faild to fetch tags for {build_version}. error: {e}")
88
- sys.exit(1)
89
-
90
- if tags.find(build_version) != -1:
91
- print(f"[error]: Release tag: {build_version} already exits at: {tags}")
92
- subprocess.run(["rm", "-rf", spm_repo_dir], check=True, text=True)
93
- sys.exit(1)
94
-
95
- manifest_filepath = f"{spm_repo_template_dir}/Package.swift" #template path
96
- temp_dir = f"{spm_repo_template_dir}/" #dir for package.swift
97
- release_name = ""
98
-
99
- if uppercase_core_name:
100
- release_name = uppercase_core_name
101
- coreUrl = f"https://pods.regulaforensics.com/{uppercase_core_name}/{build_version}/DocumentReaderCore_{lowercase_core_name}_{build_version}.zip"
102
- checksum = calculate_sha256(coreUrl)
103
- generate_spm_package(temp_dir, uppercase_core_name, coreUrl, checksum, common_version)
104
-
105
- if uppercase_sdk_name:
106
- release_name = uppercase_sdk_name
107
- sdkUrl = f"https://pods.regulaforensics.com/{uppercase_sdk_name}/{build_version}/{uppercase_sdk_name}-{build_version}.zip"
108
- checksum = calculate_sha256(sdkUrl)
109
- generate_spm_package(temp_dir, uppercase_sdk_name, sdkUrl, checksum, common_version)
110
-
111
- shutil.copyfile(manifest_filepath, f"{spm_repo_dir}/Package.swift")
112
-
113
- subprocess.run(["git", "add", "Package.swift"], cwd=spm_repo_dir)
114
- subprocess.run(
115
- ["git", "commit", "-m", f"Release {build_version}"],
116
- cwd=spm_repo_dir,
117
- check=True,
118
- text=True,
119
- )
120
- subprocess.run(["git", "push", "origin"], cwd=spm_repo_dir, check=True, text=True)
121
- subprocess.run(
122
- ["git", "tag", build_version], cwd=spm_repo_dir, check=True, text=True
123
- )
124
- subprocess.run(
125
- ["git", "push", "origin", "--tags"], cwd=spm_repo_dir, check=True, text=True
126
- )
127
- subprocess.run(
128
- ["gh", "release", "create", build_version, "--title", build_version, "--notes", f'Release for {release_name} {build_version} for iOS.'], cwd=spm_repo_dir, check=True, text=True
129
- )
130
- update_collection(collection_update)
131
- subprocess.run(["rm", "-rf", spm_repo_dir], check=True, text=True)
132
-
133
-
134
- def generate_spm_package(
135
- manifest_filepath: str,
136
- framework_name: str,
137
- framework_url: str,
138
- framework_checksum: str,
139
- common_version: Optional[str],
140
- ):
141
- script_abspath=os.path.abspath("ios_ci/spm/SwiftPackageGenerator.sh")
142
- common_script_abspath=os.path.abspath("ios_ci/spm/SwiftPackageGenerator+Common.sh")
143
- if common_version is not None:
144
- subprocess.run(
145
- ["sh", common_script_abspath, framework_name, framework_url, framework_checksum, common_version], cwd=manifest_filepath, check=True, text=True
146
- )
147
- else:
148
- subprocess.run(
149
- ["sh", script_abspath, framework_name, framework_url, framework_checksum], cwd=manifest_filepath, check=True, text=True
150
- )
151
- # Check if the file exists after executing the command
152
- if not os.path.exists(os.path.join(manifest_filepath, "Package.swift")):
153
- print("The file was not saved at the specified location.")
154
- else:
155
- print("The file was successfully saved at", manifest_filepath)
156
-
157
-
158
- def calculate_sha256(url):
159
- try:
160
- # Execute curl command to download the file and shasum to calculate the hash
161
- curl_process = subprocess.Popen(['curl', '-s', url], stdout=subprocess.PIPE)
162
- shasum_process = subprocess.Popen(['shasum', '-a', '256'], stdin=curl_process.stdout, stdout=subprocess.PIPE, text=True)
163
-
164
- # Get output data from shasum and process it
165
- stdout, _ = shasum_process.communicate()
166
- sha256_hash = stdout.split()[0] # Take the first word from the shasum output
167
-
168
- return sha256_hash
169
-
170
- except Exception as e:
171
- print(f"Error executing command: {e}")
172
- return None
173
-
174
- def update_collection(collection_update: str):
175
- if collection_update == "true":
176
-
177
- repo_path = "swift-package-collection-generator"
178
- json_path = os.path.abspath("ios_ci/spm/XcodeSPMCollection.json")
179
- root_cert_path = os.path.abspath("ios_ci/spm/AppleRootCA-G3.cer")
180
- ca_cert_path = os.path.abspath("ios_ci/spm/AppleWWDRCAG3.cer")
181
-
182
- # Generator cloning
183
- if not os.path.exists(repo_path) or not os.listdir(repo_path):
184
- subprocess.run(
185
- ["git", "clone", "https://github.com/Darkzwer/swift-package-collection-generator"],
186
- check=True,
187
- text=True,
188
- )
189
- else:
190
- print(f"Directory {repo_path} is not empty. Skipping cloning.")
191
-
192
- # Building the generator source code
193
- subprocess.run(
194
- ["swift", "build", "--configuration", "release"],
195
- cwd="swift-package-collection-generator",
196
- check=True,
197
- text=True
198
- )
199
-
200
- # Generating a collection of packages
201
- subprocess.run(
202
- ["swift", "run", "package-collection-generate", "--verbose", json_path, "PodsCollection-nonsigned.json"],
203
- cwd="swift-package-collection-generator",
204
- check=True,
205
- text=True
206
- )
207
-
208
- # Sign collection
209
- key_path = os.path.abspath("/Volumes/Masters/Programmers_tools/Mobile/SPM/swift_package_rsa.pem")
210
- cert_path = os.path.abspath("/Volumes/Masters/Programmers_tools/Mobile/SPM/swift_package.cer")
211
- subprocess.run(
212
- ["swift", "run", "package-collection-sign", "PodsCollection-nonsigned.json", "PodsCollection-signed.json", key_path, cert_path, root_cert_path, ca_cert_path, "--verbose"],
213
- cwd="swift-package-collection-generator",
214
- check=True,
215
- text=True
216
- )
217
-
218
- # Uploading the collection to an ftp server
219
- ftp.upload_collection_json("https://pods.regulaforensics.com/SPM")
220
-
221
- # Describe collection
222
- subprocess.run(
223
- ["swift", "package-collection", "describe", "https://pods.regulaforensics.com/SPM/PodsCollection-signed.json"],
224
- cwd="swift-package-collection-generator",
225
- check=True,
226
- text=True
227
- )
@@ -1,158 +0,0 @@
1
- import os
2
- import plistlib
3
- import shutil
4
-
5
- from pathlib import Path
6
-
7
- from ios_ci.common.dependency import DependencyBuildType
8
- from ios_ci.common.dependency import make_dependency
9
- from ios_ci.common.dependency import clean_coaopod
10
-
11
- from ios_ci.common import ftp
12
- from ios_ci.common.build_index import BuildIndex
13
-
14
-
15
- def _find_framework_plist_filepaths(build_location: str) -> list:
16
- framework_path = Path(build_location)
17
- framework_name = framework_path.stem + ".framework"
18
-
19
- plistst = list()
20
- for dirpath, dirnames, filenames in os.walk(build_location):
21
- plistst += [
22
- os.path.join(dirpath, file) for file in filenames if file == "Info.plist"
23
- ]
24
-
25
- framework_plists = list()
26
- for plist_path in plistst:
27
- path = Path(plist_path)
28
- if path.parent.name == framework_name:
29
- framework_plists.append(plist_path)
30
-
31
- return framework_plists
32
-
33
-
34
- def upload_build(
35
- name: str, version: str, dependency_type: str, branch: str, build_location: str
36
- ):
37
- framework_path = Path(build_location)
38
-
39
- plist_filepaths = _find_framework_plist_filepaths(build_location)
40
- for plist_path in plist_filepaths:
41
- print(f"[log] updating Info.plist at {plist_path} with version: {version}")
42
- with open(plist_path, "rb") as f_input:
43
- plist = plistlib.load(f_input)
44
- plist["CFBundleShortVersionString"] = version
45
-
46
- with open(plist_path, "wb") as f_output:
47
- plistlib.dump(plist, f_output)
48
-
49
- temp_folder_name = f"_temp_{name}"
50
- framework_name = framework_path.name
51
- temp_framework_path = framework_path.parent / temp_folder_name / framework_name
52
- temp_framework_path.parent
53
-
54
- try:
55
- print(f"[log] trying cleanup temp folder: {temp_framework_path.parent}")
56
- shutil.rmtree(temp_framework_path.parent)
57
- except Exception as e:
58
- print(f"[warning] error while removing temp folder. error: {e}")
59
-
60
- print(f"[log] copying framework content to {temp_framework_path}")
61
- shutil.copytree(framework_path, temp_framework_path)
62
- print(f"[log] making archive at: {temp_framework_path.parent}")
63
- shutil.make_archive(
64
- temp_framework_path, "zip", temp_framework_path.parent, temp_framework_path.name
65
- )
66
-
67
- build_type = DependencyBuildType(dependency_type)
68
- dependency = make_dependency(name=name, build_type=build_type)
69
- upload_url = ftp.make_ftp_build_archive_url(dependency=dependency, version=version)
70
- the_archive_filepath = str(temp_framework_path) + ".zip"
71
-
72
- if (build_type == dependency.build_type.STAGE or build_type == dependency.build_type.NIGHTLY) and (name == 'RegulaCommon' or name == 'DocumentReader' or name == 'FullAuthRFID'
73
- or name == 'FaceCoreBasic' or name == 'FaceSDK'):
74
- ftp.clean_old_data(ftp.make_ftp_project_url(dependency=dependency))
75
- clean_coaopod(dependency.pod_name)
76
-
77
- print(f"[log] uploading archive at: {upload_url}")
78
- ftp.upload_build(
79
- upload_url=upload_url,
80
- build_version=version,
81
- the_archive_filepath=the_archive_filepath,
82
- )
83
-
84
- os.remove(the_archive_filepath)
85
- shutil.rmtree(temp_framework_path)
86
-
87
- print(f"[log] the archive uploaded successfully at: {upload_url}")
88
-
89
-
90
- def update_index_toml(name: str, version: str, branch: str):
91
- dependency = make_dependency(name=name, build_type=DependencyBuildType.TEMP)
92
- project_url = ftp.make_ftp_project_url(dependency=dependency)
93
- index = ftp.fetch_build_index(project_url=project_url)
94
- if not index:
95
- print(f"[log] there is no index.toml. Creating empty.")
96
- index = BuildIndex.empty()
97
- index.add_version(version=version, branch=branch)
98
- print(f"[log] updating build index.toml file.")
99
- ftp.upload_build_index(index=index, project_url=project_url)
100
-
101
-
102
- def upload_wrapper(name: str, version: str, wrapper: str, build_location: str):
103
- plugin_path = Path(build_location)
104
-
105
- temp_folder_name = f"_temp_{wrapper}_{name}"
106
- plugin_name = plugin_path.name
107
- temp_plugin_path = plugin_path.parent / temp_folder_name / plugin_name
108
- temp_plugin_path.parent
109
-
110
- try:
111
- print(f"[log] trying cleanup temp folder: {temp_plugin_path.parent}")
112
- shutil.rmtree(temp_plugin_path.parent)
113
- except Exception as e:
114
- print(f"[warning] error while removing temp folder. error: {e}")
115
-
116
- print(f"[log] copying plugin content to {temp_plugin_path}")
117
- shutil.copytree(plugin_path, temp_plugin_path)
118
- print(f"[log] making archive at: {temp_plugin_path.parent}")
119
- shutil.make_archive(
120
- temp_plugin_path, "zip", temp_plugin_path.parent, temp_plugin_path.name
121
- )
122
-
123
- upload_url = f"http://ftp.regula.local/Wrapper/{name}/{wrapper}/{version}/plugin-{version}.zip"
124
- the_archive_filepath = str(temp_plugin_path) + ".zip"
125
-
126
- project_url = f"http://ftp.regula.local/Wrapper/{name}/{wrapper}"
127
- print(f"[log] updating latest_version.txt file.")
128
- print(
129
- f"[log] doing it before uploading build because build has to be the latest modified file."
130
- )
131
- ftp.upload_latest_version(version=version, project_url=project_url)
132
-
133
- print(f"[log] uploading archive at: {upload_url}")
134
-
135
- try:
136
- ftp.upload_build(
137
- upload_url=upload_url,
138
- build_version=version,
139
- the_archive_filepath=the_archive_filepath,
140
- )
141
- except Exception as e:
142
- target_dir = f"http://ftp.regula.local/Wrapper/{name}/{wrapper}"
143
- print(f"[warning] Upload failed. Will retry in few seconds.")
144
- print(f"[log] Fixing ftp cleanup: deleting folder {target_dir}")
145
- ftp.delete_dir(dir_url=target_dir)
146
-
147
- print(f"[log] Folder deleted, retrying")
148
- ftp.upload_build(
149
- upload_url=upload_url,
150
- build_version=version,
151
- the_archive_filepath=the_archive_filepath,
152
- )
153
- ftp.upload_latest_version(version=version, project_url=project_url)
154
-
155
- os.remove(the_archive_filepath)
156
- shutil.rmtree(temp_plugin_path)
157
-
158
- print(f"[log] the archive uploaded successfully at: {upload_url}")
@@ -1,14 +0,0 @@
1
- from ios_ci.common.dependency import DependencyBuildType
2
- from ios_ci.common.dependency import VersionResolver
3
- from ios_ci.common.dependency import make_dependency
4
-
5
-
6
- def fetch_version(name: str, type: str, branch: str) -> str:
7
- build_type = DependencyBuildType(type)
8
- dependency = make_dependency(name, build_type)
9
- resolver = VersionResolver()
10
- dependency_version = resolver.resolve_dependency_version(
11
- dependency=dependency, version_selector="+", branch=branch
12
- )
13
-
14
- return dependency_version.version