Skip to content

Commit ac0eb23

Browse files
author
Ali
committed
Working state
1 parent 1965e01 commit ac0eb23

File tree

5 files changed

+195
-339
lines changed

5 files changed

+195
-339
lines changed

‎build-system/Make/BuildConfiguration.py

+45-20
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def decrypt_codesigning_directory_recursively(source_base_path, destination_base
112112
decrypt_codesigning_directory_recursively(source_path, destination_path, password)
113113

114114

115-
def load_provisioning_profiles_from_git(working_dir, repo_url, branch, password, always_fetch):
115+
def load_codesigning_data_from_git(working_dir, repo_url, branch, password, always_fetch):
116116
if not os.path.exists(working_dir):
117117
os.makedirs(working_dir, exist_ok=True)
118118

@@ -121,15 +121,15 @@ def load_provisioning_profiles_from_git(working_dir, repo_url, branch, password,
121121
if always_fetch:
122122
original_working_dir = os.getcwd()
123123
os.chdir(encrypted_working_dir)
124-
os.system('git fetch')
124+
os.system('GIT_SSH_COMMAND="ssh -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git fetch')
125125
os.system('git checkout "{branch}"'.format(branch=branch))
126-
os.system('git pull')
126+
os.system('GIT_SSH_COMMAND="ssh -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git pull')
127127
os.chdir(original_working_dir)
128128
else:
129129
os.makedirs(encrypted_working_dir, exist_ok=True)
130130
original_working_dir = os.getcwd()
131131
os.chdir(working_dir)
132-
os.system('git clone {repo_url} -b "{branch}" "{target_path}"'.format(
132+
os.system('git -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null clone {repo_url} -b "{branch}" "{target_path}"'.format(
133133
repo_url=repo_url,
134134
branch=branch,
135135
target_path=encrypted_working_dir
@@ -185,42 +185,67 @@ def copy_profiles_from_directory(source_path, destination_path, team_id, bundle_
185185
print('Warning: skipping provisioning profile at {} with bundle_id {} (base_name {})'.format(file_path, profile_name, profile_base_name))
186186

187187

188-
class ProvisioningProfileSource:
188+
def copy_certificates_from_directory(source_path, destination_path):
189+
for file_name in os.listdir(source_path):
190+
file_path = source_path + '/' + file_name
191+
if os.path.isfile(file_path):
192+
if file_path.endswith('.p12') or file_path.endswith('.cer'):
193+
shutil.copyfile(file_path, destination_path + '/' + file_name)
194+
195+
196+
class CodesigningSource:
189197
def __init__(self):
190198
pass
191199

200+
def load_data(self, working_dir):
201+
raise Exception('Not implemented')
202+
192203
def copy_profiles_to_destination(self, destination_path):
193204
raise Exception('Not implemented')
194205

206+
def copy_certificates_to_destination(self, destination_path):
207+
raise Exception('Not implemented')
208+
195209

196-
class GitProvisioningProfileSource(ProvisioningProfileSource):
197-
def __init__(self, working_dir, repo_url, team_id, bundle_id, profile_type, password, always_fetch):
198-
self.working_dir = working_dir
210+
class GitCodesigningSource(CodesigningSource):
211+
def __init__(self, repo_url, team_id, bundle_id, codesigning_type, password, always_fetch):
199212
self.repo_url = repo_url
200213
self.team_id = team_id
201214
self.bundle_id = bundle_id
202-
self.profile_type = profile_type
215+
self.codesigning_type = codesigning_type
203216
self.password = password
204217
self.always_fetch = always_fetch
205218

219+
def load_data(self, working_dir):
220+
self.working_dir = working_dir
221+
load_codesigning_data_from_git(working_dir=self.working_dir, repo_url=self.repo_url, branch=self.team_id, password=self.password, always_fetch=self.always_fetch)
222+
206223
def copy_profiles_to_destination(self, destination_path):
207-
load_provisioning_profiles_from_git(working_dir=self.working_dir, repo_url=self.repo_url, branch=self.team_id, password=self.password, always_fetch=self.always_fetch)
208-
copy_profiles_from_directory(source_path=self.working_dir + '/decrypted/profiles/{}'.format(self.profile_type), destination_path=destination_path, team_id=self.team_id, bundle_id=self.bundle_id)
224+
source_path = self.working_dir + '/decrypted/profiles/{}'.format(self.codesigning_type)
225+
copy_profiles_from_directory(source_path=source_path, destination_path=destination_path, team_id=self.team_id, bundle_id=self.bundle_id)
209226

227+
def copy_certificates_to_destination(self, destination_path):
228+
source_path = None
229+
if self.codesigning_type in ['adhoc', 'appstore', 'enterprise']:
230+
source_path = self.working_dir + '/decrypted/certs/distribution'
231+
elif self.codesigning_type == 'development':
232+
source_path = self.working_dir + '/decrypted/certs/development'
233+
else:
234+
raise Exception('Unknown codesigning type {}'.format(self.codesigning_type))
235+
copy_certificates_from_directory(source_path=source_path, destination_path=destination_path)
210236

211-
class DirectoryProvisioningProfileSource(ProvisioningProfileSource):
237+
238+
class DirectoryCodesigningSource(CodesigningSource):
212239
def __init__(self, directory_path, team_id, bundle_id):
213240
self.directory_path = directory_path
214241
self.team_id = team_id
215242
self.bundle_id = bundle_id
216243

217-
def copy_profiles_to_destination(self, destination_path):
218-
profiles_path = self.directory_path
219-
if not os.path.exists(profiles_path):
220-
print('{} does not exist'.format(profiles_path))
221-
sys.exit(1)
222-
copy_profiles_from_directory(source_path=profiles_path, destination_path=destination_path, team_id=self.team_id, bundle_id=self.bundle_id)
244+
def load_data(self, working_dir):
245+
pass
223246

247+
def copy_profiles_to_destination(self, destination_path):
248+
copy_profiles_from_directory(source_path=self.directory_path + '/profiles', destination_path=destination_path, team_id=self.team_id, bundle_id=self.bundle_id)
224249

225-
def generate_configuration_repository(path, profile_source):
226-
pass
250+
def copy_certificates_to_destination(self, destination_path):
251+
copy_certificates_from_directory(source_path=self.directory_path + '/certs', destination_path=destination_path)

‎build-system/Make/ImportCertificates.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def import_certificates(certificatesPath):
4040

4141
for file_name in os.listdir(certificatesPath):
4242
file_path = certificatesPath + '/' + file_name
43-
if file_path.endwith('.p12') or file_path.endwith('.cer'):
43+
if file_path.endswith('.p12') or file_path.endswith('.cer'):
4444
run_executable_with_output('security', arguments=[
4545
'import',
4646
file_path,

0 commit comments

Comments
 (0)