ScriptCollection 3.5.47__py3-none-any.whl → 3.5.49__py3-none-any.whl
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.
- ScriptCollection/GeneralUtilities.py +8 -2
- ScriptCollection/ScriptCollectionCore.py +88 -36
- ScriptCollection/TasksForCommonProjectStructure.py +93 -28
- {ScriptCollection-3.5.47.dist-info → ScriptCollection-3.5.49.dist-info}/METADATA +1 -1
- {ScriptCollection-3.5.47.dist-info → ScriptCollection-3.5.49.dist-info}/RECORD +8 -8
- {ScriptCollection-3.5.47.dist-info → ScriptCollection-3.5.49.dist-info}/WHEEL +0 -0
- {ScriptCollection-3.5.47.dist-info → ScriptCollection-3.5.49.dist-info}/entry_points.txt +0 -0
- {ScriptCollection-3.5.47.dist-info → ScriptCollection-3.5.49.dist-info}/top_level.txt +0 -0
|
@@ -890,11 +890,17 @@ class GeneralUtilities:
|
|
|
890
890
|
GeneralUtilities.write_message_to_stdout(f"Result: {result}")
|
|
891
891
|
return result
|
|
892
892
|
|
|
893
|
+
@staticmethod
|
|
894
|
+
@check_arguments
|
|
895
|
+
def is_git_repository(folder: str) -> bool:
|
|
896
|
+
combined = os.path.join(folder, ".git")
|
|
897
|
+
# TODO consider check for bare-repositories
|
|
898
|
+
return os.path.isdir(combined) or os.path.isfile(combined)
|
|
899
|
+
|
|
893
900
|
@staticmethod
|
|
894
901
|
@check_arguments
|
|
895
902
|
def assert_is_git_repository(folder: str) -> str:
|
|
896
|
-
|
|
897
|
-
GeneralUtilities.assert_condition(os.path.isdir(git_file_or_folder) or os.path.isfile(git_file_or_folder), f"'{folder}' is not a git-repository.")
|
|
903
|
+
GeneralUtilities.assert_condition(GeneralUtilities.is_git_repository(folder), f"'{folder}' is not a git-repository.")
|
|
898
904
|
|
|
899
905
|
@staticmethod
|
|
900
906
|
@check_arguments
|
|
@@ -31,7 +31,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
|
|
|
31
31
|
from .ProgramRunnerPopen import ProgramRunnerPopen
|
|
32
32
|
from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
|
|
33
33
|
|
|
34
|
-
version = "3.5.
|
|
34
|
+
version = "3.5.49"
|
|
35
35
|
__version__ = version
|
|
36
36
|
|
|
37
37
|
|
|
@@ -117,38 +117,38 @@ class ScriptCollectionCore:
|
|
|
117
117
|
self.run_program("dotnet", f"nuget push {nupkg_file_name} --force-english-output --source {registry_address} --api-key {api_key}", nupkg_file_folder, verbosity)
|
|
118
118
|
|
|
119
119
|
@GeneralUtilities.check_arguments
|
|
120
|
-
def dotnet_build(self,
|
|
121
|
-
self.run_program("dotnet", f"clean -c {configuration}",
|
|
122
|
-
self.run_program("dotnet", f"build {projectname}/{projectname}.csproj -c {configuration}",
|
|
120
|
+
def dotnet_build(self, folder: str, projectname: str, configuration: str):
|
|
121
|
+
self.run_program("dotnet", f"clean -c {configuration}", folder)
|
|
122
|
+
self.run_program("dotnet", f"build {projectname}/{projectname}.csproj -c {configuration}", folder)
|
|
123
123
|
|
|
124
124
|
@GeneralUtilities.check_arguments
|
|
125
|
-
def find_file_by_extension(self, folder: str,
|
|
126
|
-
result = [file for file in GeneralUtilities.get_direct_files_of_folder(folder) if file.endswith(f".{
|
|
125
|
+
def find_file_by_extension(self, folder: str, extension_without_dot: str):
|
|
126
|
+
result = [file for file in GeneralUtilities.get_direct_files_of_folder(folder) if file.endswith(f".{extension_without_dot}")]
|
|
127
127
|
result_length = len(result)
|
|
128
128
|
if result_length == 0:
|
|
129
|
-
raise FileNotFoundError(f"No file available in folder '{folder}' with extension '{
|
|
129
|
+
raise FileNotFoundError(f"No file available in folder '{folder}' with extension '{extension_without_dot}'.")
|
|
130
130
|
if result_length == 1:
|
|
131
131
|
return result[0]
|
|
132
132
|
else:
|
|
133
|
-
raise ValueError(f"Multiple values available in folder '{folder}' with extension '{
|
|
133
|
+
raise ValueError(f"Multiple values available in folder '{folder}' with extension '{extension_without_dot}'.")
|
|
134
134
|
|
|
135
135
|
@GeneralUtilities.check_arguments
|
|
136
|
-
def
|
|
136
|
+
def find_last_file_by_extension(self, folder: str, extension_without_dot: str) -> str:
|
|
137
137
|
files: list[str] = GeneralUtilities.get_direct_files_of_folder(folder)
|
|
138
138
|
possible_results: list[str] = []
|
|
139
139
|
for file in files:
|
|
140
|
-
if file.endswith(f".{
|
|
140
|
+
if file.endswith(f".{extension_without_dot}"):
|
|
141
141
|
possible_results.append(file)
|
|
142
142
|
result_length = len(possible_results)
|
|
143
143
|
if result_length == 0:
|
|
144
|
-
raise FileNotFoundError(f"No file available in folder '{folder}' with extension '{
|
|
144
|
+
raise FileNotFoundError(f"No file available in folder '{folder}' with extension '{extension_without_dot}'.")
|
|
145
145
|
else:
|
|
146
146
|
return possible_results[-1]
|
|
147
147
|
|
|
148
148
|
@GeneralUtilities.check_arguments
|
|
149
149
|
def commit_is_signed_by_key(self, repository_folder: str, revision_identifier: str, key: str) -> bool:
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
151
|
+
result = self.run_program("git", f"verify-commit {revision_identifier}", repository_folder, throw_exception_if_exitcode_is_not_zero=False)
|
|
152
152
|
if (result[0] != 0):
|
|
153
153
|
return False
|
|
154
154
|
if (not GeneralUtilities.contains_line(result[1].splitlines(), f"gpg\\:\\ using\\ [A-Za-z0-9]+\\ key\\ [A-Za-z0-9]+{key}")):
|
|
@@ -161,10 +161,12 @@ class ScriptCollectionCore:
|
|
|
161
161
|
|
|
162
162
|
@GeneralUtilities.check_arguments
|
|
163
163
|
def get_parent_commit_ids_of_commit(self, repository_folder: str, commit_id: str) -> str:
|
|
164
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
164
165
|
return self.run_program("git", f'log --pretty=%P -n 1 "{commit_id}"', repository_folder, throw_exception_if_exitcode_is_not_zero=True)[1].replace("\r", "").replace("\n", "").split(" ")
|
|
165
166
|
|
|
166
167
|
@GeneralUtilities.check_arguments
|
|
167
168
|
def get_all_authors_and_committers_of_repository(self, repository_folder: str, subfolder: str = None, verbosity: int = 1) -> list[tuple[str, str]]:
|
|
169
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
168
170
|
space_character = "_"
|
|
169
171
|
if subfolder is None:
|
|
170
172
|
subfolder_argument = ""
|
|
@@ -184,6 +186,7 @@ class ScriptCollectionCore:
|
|
|
184
186
|
|
|
185
187
|
@GeneralUtilities.check_arguments
|
|
186
188
|
def get_commit_ids_between_dates(self, repository_folder: str, since: datetime, until: datetime, ignore_commits_which_are_not_in_history_of_head: bool = True) -> None:
|
|
189
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
187
190
|
since_as_string = self.__datetime_to_string_for_git(since)
|
|
188
191
|
until_as_string = self.__datetime_to_string_for_git(until)
|
|
189
192
|
result = filter(lambda line: not GeneralUtilities.string_is_none_or_whitespace(line), self.run_program("git", f'log --since "{since_as_string}" --until "{until_as_string}" --pretty=format:"%H" --no-patch', repository_folder, throw_exception_if_exitcode_is_not_zero=True)[1].split("\n").replace("\r", ""))
|
|
@@ -198,6 +201,7 @@ class ScriptCollectionCore:
|
|
|
198
201
|
|
|
199
202
|
@GeneralUtilities.check_arguments
|
|
200
203
|
def git_commit_is_ancestor(self, repository_folder: str, ancestor: str, descendant: str = "HEAD") -> bool:
|
|
204
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
201
205
|
result = self.run_program_argsasarray("git", ["merge-base", "--is-ancestor", ancestor, descendant], repository_folder, throw_exception_if_exitcode_is_not_zero=False)
|
|
202
206
|
exit_code = result[0]
|
|
203
207
|
if exit_code == 0:
|
|
@@ -209,6 +213,7 @@ class ScriptCollectionCore:
|
|
|
209
213
|
|
|
210
214
|
@GeneralUtilities.check_arguments
|
|
211
215
|
def __git_changes_helper(self, repository_folder: str, arguments_as_array: list[str]) -> bool:
|
|
216
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
212
217
|
lines = GeneralUtilities.string_to_lines(self.run_program_argsasarray("git", arguments_as_array, repository_folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)[1], False)
|
|
213
218
|
for line in lines:
|
|
214
219
|
if GeneralUtilities.string_has_content(line):
|
|
@@ -216,27 +221,32 @@ class ScriptCollectionCore:
|
|
|
216
221
|
return False
|
|
217
222
|
|
|
218
223
|
@GeneralUtilities.check_arguments
|
|
219
|
-
def git_repository_has_new_untracked_files(self,
|
|
220
|
-
|
|
224
|
+
def git_repository_has_new_untracked_files(self, repository_folder: str):
|
|
225
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
226
|
+
return self.__git_changes_helper(repository_folder, ["ls-files", "--exclude-standard", "--others"])
|
|
221
227
|
|
|
222
228
|
@GeneralUtilities.check_arguments
|
|
223
|
-
def git_repository_has_unstaged_changes_of_tracked_files(self,
|
|
224
|
-
|
|
229
|
+
def git_repository_has_unstaged_changes_of_tracked_files(self, repository_folder: str):
|
|
230
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
231
|
+
return self.__git_changes_helper(repository_folder, ["--no-pager", "diff"])
|
|
225
232
|
|
|
226
233
|
@GeneralUtilities.check_arguments
|
|
227
|
-
def git_repository_has_staged_changes(self,
|
|
228
|
-
|
|
234
|
+
def git_repository_has_staged_changes(self, repository_folder: str):
|
|
235
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
236
|
+
return self.__git_changes_helper(repository_folder, ["--no-pager", "diff", "--cached"])
|
|
229
237
|
|
|
230
238
|
@GeneralUtilities.check_arguments
|
|
231
|
-
def git_repository_has_uncommitted_changes(self,
|
|
232
|
-
|
|
239
|
+
def git_repository_has_uncommitted_changes(self, repository_folder: str) -> bool:
|
|
240
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
241
|
+
if (self.git_repository_has_unstaged_changes(repository_folder)):
|
|
233
242
|
return True
|
|
234
|
-
if (self.git_repository_has_staged_changes(
|
|
243
|
+
if (self.git_repository_has_staged_changes(repository_folder)):
|
|
235
244
|
return True
|
|
236
245
|
return False
|
|
237
246
|
|
|
238
247
|
@GeneralUtilities.check_arguments
|
|
239
248
|
def git_repository_has_unstaged_changes(self, repository_folder: str) -> bool:
|
|
249
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
240
250
|
if (self.git_repository_has_unstaged_changes_of_tracked_files(repository_folder)):
|
|
241
251
|
return True
|
|
242
252
|
if (self.git_repository_has_new_untracked_files(repository_folder)):
|
|
@@ -245,11 +255,13 @@ class ScriptCollectionCore:
|
|
|
245
255
|
|
|
246
256
|
@GeneralUtilities.check_arguments
|
|
247
257
|
def git_get_commit_id(self, repository_folder: str, commit: str = "HEAD") -> str:
|
|
258
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
248
259
|
result: tuple[int, str, str, int] = self.run_program_argsasarray("git", ["rev-parse", "--verify", commit], repository_folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
|
|
249
260
|
return result[1].replace('\n', '')
|
|
250
261
|
|
|
251
262
|
@GeneralUtilities.check_arguments
|
|
252
263
|
def git_get_commit_date(self, repository_folder: str, commit: str = "HEAD") -> datetime:
|
|
264
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
253
265
|
result: tuple[int, str, str, int] = self.run_program_argsasarray("git", ["show", "-s", "--format=%ci", commit], repository_folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
|
|
254
266
|
date_as_string = result[1].replace('\n', '')
|
|
255
267
|
result = datetime.strptime(date_as_string, '%Y-%m-%d %H:%M:%S %z')
|
|
@@ -448,7 +460,7 @@ class ScriptCollectionCore:
|
|
|
448
460
|
def git_fetch_or_clone_all_in_directory(self, source_directory: str, target_directory: str) -> None:
|
|
449
461
|
for subfolder in GeneralUtilities.get_direct_folders_of_folder(source_directory):
|
|
450
462
|
foldername = os.path.basename(subfolder)
|
|
451
|
-
if
|
|
463
|
+
if GeneralUtilities.is_git_repository(subfolder):
|
|
452
464
|
source_repository = subfolder
|
|
453
465
|
target_repository = os.path.join(target_directory, foldername)
|
|
454
466
|
if os.path.isdir(target_directory):
|
|
@@ -465,12 +477,6 @@ class ScriptCollectionCore:
|
|
|
465
477
|
result.append(submodule_line.split(' ')[1])
|
|
466
478
|
return result
|
|
467
479
|
|
|
468
|
-
@GeneralUtilities.check_arguments
|
|
469
|
-
def is_git_repository(self, folder: str) -> bool:
|
|
470
|
-
combined = os.path.join(folder, ".git")
|
|
471
|
-
# TODO consider check for bare-repositories
|
|
472
|
-
return os.path.isdir(combined) or os.path.isfile(combined)
|
|
473
|
-
|
|
474
480
|
@GeneralUtilities.check_arguments
|
|
475
481
|
def file_is_git_ignored(self, file_in_repository: str, repositorybasefolder: str) -> None:
|
|
476
482
|
exit_code = self.run_program_argsasarray("git", ['check-ignore', file_in_repository], repositorybasefolder, throw_exception_if_exitcode_is_not_zero=False, verbosity=0)[0]
|
|
@@ -524,25 +530,28 @@ class ScriptCollectionCore:
|
|
|
524
530
|
|
|
525
531
|
@GeneralUtilities.check_arguments
|
|
526
532
|
def get_current_git_branch_has_tag(self, repository_folder: str) -> bool:
|
|
533
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
527
534
|
result = self.run_program_argsasarray("git", ["describe", "--tags", "--abbrev=0"], repository_folder, verbosity=0, throw_exception_if_exitcode_is_not_zero=False)
|
|
528
535
|
return result[0] == 0
|
|
529
536
|
|
|
530
537
|
@GeneralUtilities.check_arguments
|
|
531
538
|
def get_latest_git_tag(self, repository_folder: str) -> str:
|
|
532
|
-
|
|
533
|
-
|
|
539
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
540
|
+
result = self.run_program_argsasarray("git", ["describe", "--tags", "--abbrev=0"], repository_folder, verbosity=0)
|
|
534
541
|
result = result[1].replace("\r", "").replace("\n", "")
|
|
535
542
|
return result
|
|
536
543
|
|
|
537
544
|
@GeneralUtilities.check_arguments
|
|
538
545
|
def get_staged_or_committed_git_ignored_files(self, repository_folder: str) -> list[str]:
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
546
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
547
|
+
temp_result = self.run_program_argsasarray("git", ["ls-files", "-i", "-c", "--exclude-standard"], repository_folder, verbosity=0)
|
|
548
|
+
temp_result = temp_result[1].replace("\r", "")
|
|
549
|
+
result = [line for line in temp_result.split("\n") if len(line) > 0]
|
|
542
550
|
return result
|
|
543
551
|
|
|
544
552
|
@GeneralUtilities.check_arguments
|
|
545
553
|
def git_repository_has_commits(self, repository_folder: str) -> bool:
|
|
554
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
546
555
|
return self.run_program_argsasarray("git", ["rev-parse", "--verify", "HEAD"], repository_folder, throw_exception_if_exitcode_is_not_zero=False)[0] == 0
|
|
547
556
|
|
|
548
557
|
@GeneralUtilities.check_arguments
|
|
@@ -1107,6 +1116,7 @@ class ScriptCollectionCore:
|
|
|
1107
1116
|
return tor_version
|
|
1108
1117
|
|
|
1109
1118
|
def run_testcases_for_python_project(self, repository_folder: str):
|
|
1119
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1110
1120
|
self.run_program("coverage", "run -m pytest", repository_folder)
|
|
1111
1121
|
self.run_program("coverage", "xml", repository_folder)
|
|
1112
1122
|
GeneralUtilities.ensure_directory_exists(os.path.join(repository_folder, "Other/TestCoverage"))
|
|
@@ -1398,10 +1408,17 @@ class ScriptCollectionCore:
|
|
|
1398
1408
|
|
|
1399
1409
|
@GeneralUtilities.check_arguments
|
|
1400
1410
|
def __adapt_workingdirectory(self, workingdirectory: str) -> str:
|
|
1411
|
+
result: str = None
|
|
1401
1412
|
if workingdirectory is None:
|
|
1402
|
-
|
|
1413
|
+
result = os.getcwd()
|
|
1403
1414
|
else:
|
|
1404
|
-
|
|
1415
|
+
if os.path.isabs(workingdirectory):
|
|
1416
|
+
result = workingdirectory
|
|
1417
|
+
else:
|
|
1418
|
+
result = GeneralUtilities.resolve_relative_path_from_current_working_directory(workingdirectory)
|
|
1419
|
+
if not os.path.isdir(result):
|
|
1420
|
+
raise ValueError(f"Working-directory '{workingdirectory}' does not exist.")
|
|
1421
|
+
return result
|
|
1405
1422
|
|
|
1406
1423
|
@GeneralUtilities.check_arguments
|
|
1407
1424
|
def verify_no_pending_mock_program_calls(self):
|
|
@@ -1513,6 +1530,7 @@ class ScriptCollectionCore:
|
|
|
1513
1530
|
|
|
1514
1531
|
@GeneralUtilities.check_arguments
|
|
1515
1532
|
def get_semver_version_from_gitversion(self, repository_folder: str) -> str:
|
|
1533
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1516
1534
|
if (self.git_repository_has_commits(repository_folder)):
|
|
1517
1535
|
result = self.get_version_from_gitversion(repository_folder, "MajorMinorPatch")
|
|
1518
1536
|
if self.git_repository_has_uncommitted_changes(repository_folder):
|
|
@@ -1928,3 +1946,37 @@ TXDX
|
|
|
1928
1946
|
return True
|
|
1929
1947
|
else:
|
|
1930
1948
|
return False
|
|
1949
|
+
|
|
1950
|
+
@GeneralUtilities.check_arguments
|
|
1951
|
+
def ensure_local_docker_network_exists(self, network_name: str) -> None:
|
|
1952
|
+
if not self.local_docker_network_exists(network_name):
|
|
1953
|
+
self.create_local_docker_network(network_name)
|
|
1954
|
+
|
|
1955
|
+
@GeneralUtilities.check_arguments
|
|
1956
|
+
def ensure_local_docker_network_does_not_exist(self, network_name: str) -> None:
|
|
1957
|
+
if self.local_docker_network_exists(network_name):
|
|
1958
|
+
self.remove_local_docker_network(network_name)
|
|
1959
|
+
|
|
1960
|
+
@GeneralUtilities.check_arguments
|
|
1961
|
+
def local_docker_network_exists(self, network_name: str) -> bool:
|
|
1962
|
+
return network_name in self.get_all_local_existing_docker_networks()
|
|
1963
|
+
|
|
1964
|
+
@GeneralUtilities.check_arguments
|
|
1965
|
+
def get_all_local_existing_docker_networks(self) -> list[str]:
|
|
1966
|
+
program_call_result = self.run_program("docker", "network list")
|
|
1967
|
+
std_out = program_call_result[1]
|
|
1968
|
+
std_out_lines = std_out.split("\n")[1:]
|
|
1969
|
+
result: list[str] = []
|
|
1970
|
+
for std_out_line in std_out_lines:
|
|
1971
|
+
normalized_line = ';'.join(std_out_line.split())
|
|
1972
|
+
splitted = normalized_line.split(";")
|
|
1973
|
+
result.append(splitted[1])
|
|
1974
|
+
return result
|
|
1975
|
+
|
|
1976
|
+
@GeneralUtilities.check_arguments
|
|
1977
|
+
def remove_local_docker_network(self, network_name: str) -> None:
|
|
1978
|
+
self.run_program("docker", f"network remove {network_name}")
|
|
1979
|
+
|
|
1980
|
+
@GeneralUtilities.check_arguments
|
|
1981
|
+
def create_local_docker_network(self, network_name: str) -> None:
|
|
1982
|
+
self.run_program("docker", f"network create {network_name}")
|
|
@@ -39,6 +39,7 @@ class CreateReleaseConfiguration():
|
|
|
39
39
|
|
|
40
40
|
def __init__(self, projectname: str, remotename: str, build_artifacts_target_folder: str, push_artifacts_scripts_folder: str, verbosity: int, repository_folder: str, additional_arguments_file: str, repository_folder_name: str):
|
|
41
41
|
|
|
42
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
42
43
|
self.__sc = ScriptCollectionCore()
|
|
43
44
|
self.projectname = projectname
|
|
44
45
|
self.remotename = remotename
|
|
@@ -112,6 +113,17 @@ class TasksForCommonProjectStructure:
|
|
|
112
113
|
validate_developers_of_repository: bool = True
|
|
113
114
|
dotnet_runsettings_file = "runsettings.xml"
|
|
114
115
|
|
|
116
|
+
@staticmethod
|
|
117
|
+
@GeneralUtilities.check_arguments
|
|
118
|
+
def assert_is_codeunit_folder(codeunit_folder: str) -> str:
|
|
119
|
+
repo_folder = GeneralUtilities.resolve_relative_path("..", codeunit_folder)
|
|
120
|
+
if not GeneralUtilities.is_git_repository(repo_folder):
|
|
121
|
+
raise ValueError(f"'{codeunit_folder}' can not be a valid codeunit-folder because '{repo_folder}' is not a git-repository.")
|
|
122
|
+
codeunit_name = os.path.basename(codeunit_folder)
|
|
123
|
+
codeunit_file: str = os.path.join(codeunit_folder, f"{codeunit_name}.codeunit.xml")
|
|
124
|
+
if not os.path.isfile(codeunit_file):
|
|
125
|
+
raise ValueError(f"'{codeunit_folder}' is no codeunit-folder because '{codeunit_file}' does not exist.")
|
|
126
|
+
|
|
115
127
|
@staticmethod
|
|
116
128
|
@GeneralUtilities.check_arguments
|
|
117
129
|
def get_development_environment_name() -> str:
|
|
@@ -134,14 +146,17 @@ class TasksForCommonProjectStructure:
|
|
|
134
146
|
|
|
135
147
|
@GeneralUtilities.check_arguments
|
|
136
148
|
def get_build_folder(self, repository_folder: str, codeunit_name: str) -> str:
|
|
149
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
137
150
|
return os.path.join(repository_folder, codeunit_name, "Other", "Build")
|
|
138
151
|
|
|
139
152
|
@GeneralUtilities.check_arguments
|
|
140
153
|
def get_artifacts_folder(self, repository_folder: str, codeunit_name: str) -> str:
|
|
154
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
141
155
|
return os.path.join(repository_folder, codeunit_name, "Other", "Artifacts")
|
|
142
156
|
|
|
143
157
|
@GeneralUtilities.check_arguments
|
|
144
158
|
def get_wheel_file(self, repository_folder: str, codeunit_name: str) -> str:
|
|
159
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
145
160
|
return self.__sc.find_file_by_extension(os.path.join(self.get_artifacts_folder(repository_folder, codeunit_name), "BuildResult_Wheel"), "whl")
|
|
146
161
|
|
|
147
162
|
@GeneralUtilities.check_arguments
|
|
@@ -171,6 +186,7 @@ class TasksForCommonProjectStructure:
|
|
|
171
186
|
|
|
172
187
|
@GeneralUtilities.check_arguments
|
|
173
188
|
def check_testcoverage(self, testcoverage_file_in_cobertura_format: str, repository_folder: str, codeunitname: str) -> None:
|
|
189
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
174
190
|
GeneralUtilities.write_message_to_stdout("Check testcoverage..")
|
|
175
191
|
root: etree._ElementTree = etree.parse(testcoverage_file_in_cobertura_format)
|
|
176
192
|
if len(root.xpath('//coverage/packages/package')) != 1:
|
|
@@ -292,6 +308,7 @@ class TasksForCommonProjectStructure:
|
|
|
292
308
|
|
|
293
309
|
@GeneralUtilities.check_arguments
|
|
294
310
|
def generate_bom_for_python_project(self, verbosity: int, codeunit_folder: str, codeunitname: str, commandline_arguments: list[str]) -> None:
|
|
311
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
295
312
|
verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
|
|
296
313
|
codeunitversion = self.get_version_of_codeunit_folder(codeunit_folder)
|
|
297
314
|
bom_folder = "Other/Artifacts/BOM"
|
|
@@ -338,8 +355,7 @@ class TasksForCommonProjectStructure:
|
|
|
338
355
|
@GeneralUtilities.check_arguments
|
|
339
356
|
def get_version_of_codeunit_file_content(self, codeunit_file_content: str) -> str:
|
|
340
357
|
root: etree._ElementTree = etree.fromstring(codeunit_file_content.encode("utf-8"))
|
|
341
|
-
result = str(root.xpath('//cps:version/text()',
|
|
342
|
-
namespaces={'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure'})[0])
|
|
358
|
+
result = str(root.xpath('//cps:version/text()', namespaces={'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure'})[0])
|
|
343
359
|
return result
|
|
344
360
|
|
|
345
361
|
@GeneralUtilities.check_arguments
|
|
@@ -348,6 +364,7 @@ class TasksForCommonProjectStructure:
|
|
|
348
364
|
|
|
349
365
|
@GeneralUtilities.check_arguments
|
|
350
366
|
def get_version_of_codeunit_folder(self, codeunit_folder: str) -> None:
|
|
367
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
351
368
|
codeunit_file = os.path.join(codeunit_folder, f"{os.path.basename(codeunit_folder)}.codeunit.xml")
|
|
352
369
|
return self.get_version_of_codeunit(codeunit_file)
|
|
353
370
|
|
|
@@ -469,6 +486,7 @@ class TasksForCommonProjectStructure:
|
|
|
469
486
|
GeneralUtilities.ensure_directory_does_not_exist(obj_folder)
|
|
470
487
|
|
|
471
488
|
def standardized_task_verify_standard_format_csproj_files(self, codeunit_folder: str) -> bool:
|
|
489
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
472
490
|
repository_folder = os.path.dirname(codeunit_folder)
|
|
473
491
|
codeunit_name = os.path.basename(codeunit_folder)
|
|
474
492
|
codeunit_folder = os.path.join(repository_folder, codeunit_name)
|
|
@@ -488,6 +506,7 @@ class TasksForCommonProjectStructure:
|
|
|
488
506
|
raise ValueError(test_csproj_file+message+f'"{result2[1]}".')
|
|
489
507
|
|
|
490
508
|
def __standardized_task_verify_standard_format_for_project_csproj_file(self, csproj_file: str, codeunit_folder: str, codeunit_name: str, codeunit_version: str) -> tuple[bool, str]:
|
|
509
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
491
510
|
codeunit_name_regex = re.escape(codeunit_name)
|
|
492
511
|
codeunit_file = os.path.join(codeunit_folder, f"{codeunit_name}.codeunit.xml")
|
|
493
512
|
codeunit_description = self.get_codeunit_description(codeunit_file)
|
|
@@ -628,6 +647,7 @@ class TasksForCommonProjectStructure:
|
|
|
628
647
|
|
|
629
648
|
@GeneralUtilities.check_arguments
|
|
630
649
|
def __standardized_tasks_build_for_dotnet_build(self, csproj_file: str, originaloutputfolder: str, files_to_sign: dict[str, str], commitid: str, verbosity: int, runtimes: list[str], target_environmenttype: str, target_environmenttype_mapping: dict[str, str], copy_license_file_to_target_folder: bool, repository_folder: str, codeunit_name: str, commandline_arguments: list[str]) -> None:
|
|
650
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
631
651
|
csproj_filename = os.path.basename(csproj_file)
|
|
632
652
|
GeneralUtilities.write_message_to_stdout(f"Build {csproj_filename}...")
|
|
633
653
|
dotnet_build_configuration: str = target_environmenttype_mapping[target_environmenttype]
|
|
@@ -676,8 +696,7 @@ class TasksForCommonProjectStructure:
|
|
|
676
696
|
# this function builds an exe
|
|
677
697
|
target_environmenttype = self.get_targetenvironmenttype_from_commandline_arguments(commandline_arguments, default_target_environmenttype)
|
|
678
698
|
self.__standardized_tasks_build_for_dotnet_project(
|
|
679
|
-
buildscript_file, target_environmenttype_mapping, default_target_environmenttype, verbosity, target_environmenttype,
|
|
680
|
-
runtimes, True, commandline_arguments)
|
|
699
|
+
buildscript_file, target_environmenttype_mapping, default_target_environmenttype, verbosity, target_environmenttype, runtimes, True, commandline_arguments)
|
|
681
700
|
|
|
682
701
|
@GeneralUtilities.check_arguments
|
|
683
702
|
def standardized_tasks_build_for_dotnet_library_project(self, buildscript_file: str, default_target_environmenttype: str, target_environmenttype_mapping: dict[str, str], runtimes: list[str], verbosity: int, commandline_arguments: list[str]) -> None:
|
|
@@ -733,6 +752,7 @@ class TasksForCommonProjectStructure:
|
|
|
733
752
|
@GeneralUtilities.check_arguments
|
|
734
753
|
def generate_sbom_for_dotnet_project(self, codeunit_folder: str, verbosity: int, commandline_arguments: list[str]) -> None:
|
|
735
754
|
GeneralUtilities.write_message_to_stdout("Generate SBOM...")
|
|
755
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
736
756
|
codeunit_name = os.path.basename(codeunit_folder)
|
|
737
757
|
sc = ScriptCollectionCore()
|
|
738
758
|
bomfile_folder = "Other\\Artifacts\\BOM"
|
|
@@ -778,6 +798,7 @@ class TasksForCommonProjectStructure:
|
|
|
778
798
|
This script expectes that the testcoverage-reportfolder is '<repositorybasefolder>/<codeunitname>/Other/Artifacts/TestCoverageReport'.
|
|
779
799
|
This script expectes that a test-coverage-badges should be added to '<repositorybasefolder>/<codeunitname>/Other/Resources/Badges'."""
|
|
780
800
|
GeneralUtilities.write_message_to_stdout("Generate testcoverage report..")
|
|
801
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
781
802
|
codeunit_version = self.get_version_of_codeunit(os.path.join(repository_folder, codeunitname, f"{codeunitname}.codeunit.xml"))
|
|
782
803
|
verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
|
|
783
804
|
if verbosity == 0:
|
|
@@ -847,6 +868,7 @@ class TasksForCommonProjectStructure:
|
|
|
847
868
|
|
|
848
869
|
@GeneralUtilities.check_arguments
|
|
849
870
|
def run_testcases_common_post_task(self, repository_folder: str, codeunit_name: str, verbosity: int, generate_badges: bool, targetenvironmenttype: str, commandline_arguments: list[str]) -> None:
|
|
871
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
850
872
|
coverage_file_folder = os.path.join(repository_folder, codeunit_name, "Other/Artifacts/TestCoverage")
|
|
851
873
|
coveragefiletarget = os.path.join(coverage_file_folder, "TestCoverage.xml")
|
|
852
874
|
self.update_path_of_source_in_testcoverage_file(repository_folder, codeunit_name)
|
|
@@ -856,6 +878,7 @@ class TasksForCommonProjectStructure:
|
|
|
856
878
|
@staticmethod
|
|
857
879
|
@GeneralUtilities.check_arguments
|
|
858
880
|
def update_path_of_source_in_testcoverage_file(repository_folder: str, codeunitname: str) -> None:
|
|
881
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
859
882
|
GeneralUtilities.write_message_to_stdout("Update paths of source files in testcoverage files..")
|
|
860
883
|
folder = f"{repository_folder}/{codeunitname}/Other/Artifacts/TestCoverage"
|
|
861
884
|
filename = "TestCoverage.xml"
|
|
@@ -865,6 +888,7 @@ class TasksForCommonProjectStructure:
|
|
|
865
888
|
|
|
866
889
|
@GeneralUtilities.check_arguments
|
|
867
890
|
def __standardized_tasks_run_testcases_for_dotnet_project_helper(self, source: str, codeunit_folder: str, match: re.Match) -> str:
|
|
891
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
868
892
|
filename = match.group(1)
|
|
869
893
|
file = os.path.join(source, filename)
|
|
870
894
|
# GeneralUtilities.assert_condition(os.path.isfile(file),f"File \"{file}\" does not exist.")
|
|
@@ -875,6 +899,7 @@ class TasksForCommonProjectStructure:
|
|
|
875
899
|
@staticmethod
|
|
876
900
|
@GeneralUtilities.check_arguments
|
|
877
901
|
def __remove_not_existing_files_from_testcoverage_file(testcoveragefile: str, repository_folder: str, codeunit_name: str) -> None:
|
|
902
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
878
903
|
root: etree._ElementTree = etree.parse(testcoveragefile)
|
|
879
904
|
codeunit_folder = os.path.join(repository_folder, codeunit_name)
|
|
880
905
|
xpath = f"//coverage/packages/package[@name='{codeunit_name}']/classes/class"
|
|
@@ -1131,6 +1156,7 @@ class TasksForCommonProjectStructure:
|
|
|
1131
1156
|
|
|
1132
1157
|
@GeneralUtilities.check_arguments
|
|
1133
1158
|
def generate_certificate_for_development_purposes_for_product(self, repository_folder: str):
|
|
1159
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1134
1160
|
product_name = os.path.basename(repository_folder)
|
|
1135
1161
|
ca_folder: str = os.path.join(repository_folder, "Other", "Resources", "CA")
|
|
1136
1162
|
self.__generate_certificate_for_development_purposes(product_name, os.path.join(repository_folder, "Other", "Resources"), ca_folder, None)
|
|
@@ -1143,6 +1169,7 @@ class TasksForCommonProjectStructure:
|
|
|
1143
1169
|
|
|
1144
1170
|
@GeneralUtilities.check_arguments
|
|
1145
1171
|
def generate_certificate_for_development_purposes_for_codeunit(self, codeunit_folder: str, domain: str = None):
|
|
1172
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1146
1173
|
codeunit_name = os.path.basename(codeunit_folder)
|
|
1147
1174
|
self.ensure_product_resource_is_imported(codeunit_folder, "CA")
|
|
1148
1175
|
ca_folder: str = os.path.join(codeunit_folder, "Other", "Resources", "CA")
|
|
@@ -1171,7 +1198,7 @@ class TasksForCommonProjectStructure:
|
|
|
1171
1198
|
GeneralUtilities.write_message_to_stdout("Generate TLS-certificate for development-purposes.")
|
|
1172
1199
|
self.__sc.generate_certificate(certificate_folder, domain, resource_content_filename, "DE", "SubjST", "SubjL", "SubjO", "SubjOU")
|
|
1173
1200
|
self.__sc.generate_certificate_sign_request(certificate_folder, domain, resource_content_filename, "DE", "SubjST", "SubjL", "SubjO", "SubjOU")
|
|
1174
|
-
ca_name = os.path.basename(self.__sc.
|
|
1201
|
+
ca_name = os.path.basename(self.__sc.find_last_file_by_extension(ca_folder, "crt"))[:-4]
|
|
1175
1202
|
self.__sc.sign_certificate(certificate_folder, ca_folder, ca_name, domain, resource_content_filename)
|
|
1176
1203
|
GeneralUtilities.ensure_file_does_not_exist(unsignedcertificate_file)
|
|
1177
1204
|
|
|
@@ -1423,6 +1450,7 @@ class TasksForCommonProjectStructure:
|
|
|
1423
1450
|
raise ValueError('An empty array as argument for the "commandline_arguments"-parameter is not valid.')
|
|
1424
1451
|
commandline_arguments = commandline_arguments[1:]
|
|
1425
1452
|
repository_folder: str = str(Path(os.path.dirname(common_tasks_scripts_file)).parent.parent.absolute())
|
|
1453
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1426
1454
|
codeunit_name: str = str(os.path.basename(Path(os.path.dirname(common_tasks_scripts_file)).parent.absolute()))
|
|
1427
1455
|
verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
|
|
1428
1456
|
project_version = self.get_version_of_project(repository_folder)
|
|
@@ -1435,8 +1463,7 @@ class TasksForCommonProjectStructure:
|
|
|
1435
1463
|
if not os.path.isfile(codeunit_file):
|
|
1436
1464
|
raise ValueError(f'Codeunitfile "{codeunit_file}" does not exist.')
|
|
1437
1465
|
# TODO implement usage of self.reference_latest_version_of_xsd_when_generating_xml
|
|
1438
|
-
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure',
|
|
1439
|
-
'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
1466
|
+
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
1440
1467
|
root: etree._ElementTree = etree.parse(codeunit_file)
|
|
1441
1468
|
|
|
1442
1469
|
# Check codeunit-spcecification-version
|
|
@@ -1544,6 +1571,7 @@ class TasksForCommonProjectStructure:
|
|
|
1544
1571
|
|
|
1545
1572
|
@GeneralUtilities.check_arguments
|
|
1546
1573
|
def __suport_information_exists(self, repository_folder: str, version_of_product: str) -> bool:
|
|
1574
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1547
1575
|
folder = os.path.join(repository_folder, "Other", "Resources", "Support")
|
|
1548
1576
|
file = os.path.join(folder, "InformationAboutSupportedVersions.csv")
|
|
1549
1577
|
if not os.path.isfile(file):
|
|
@@ -1556,6 +1584,7 @@ class TasksForCommonProjectStructure:
|
|
|
1556
1584
|
|
|
1557
1585
|
@GeneralUtilities.check_arguments
|
|
1558
1586
|
def get_versions(self, repository_folder: str) -> list[(str, datetime, datetime)]:
|
|
1587
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1559
1588
|
folder = os.path.join(repository_folder, "Other", "Resources", "Support")
|
|
1560
1589
|
file = os.path.join(folder, "InformationAboutSupportedVersions.csv")
|
|
1561
1590
|
result: list[str] = list[(str, datetime, datetime)]()
|
|
@@ -1568,6 +1597,7 @@ class TasksForCommonProjectStructure:
|
|
|
1568
1597
|
|
|
1569
1598
|
@GeneralUtilities.check_arguments
|
|
1570
1599
|
def get_supported_versions(self, repository_folder: str, moment: datetime) -> list[(str, datetime, datetime)]:
|
|
1600
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1571
1601
|
result: list[str] = list[(str, datetime, datetime)]()
|
|
1572
1602
|
for entry in self.get_versions(repository_folder):
|
|
1573
1603
|
if entry[1] <= moment and moment <= entry[2]:
|
|
@@ -1576,6 +1606,7 @@ class TasksForCommonProjectStructure:
|
|
|
1576
1606
|
|
|
1577
1607
|
@GeneralUtilities.check_arguments
|
|
1578
1608
|
def get_unsupported_versions(self, repository_folder: str, moment: datetime) -> list[(str, datetime, datetime)]:
|
|
1609
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1579
1610
|
result: list[str] = list[(str, datetime, datetime)]()
|
|
1580
1611
|
for entry in self.get_versions(repository_folder):
|
|
1581
1612
|
if not (entry[1] <= moment and moment <= entry[2]):
|
|
@@ -1584,6 +1615,7 @@ class TasksForCommonProjectStructure:
|
|
|
1584
1615
|
|
|
1585
1616
|
@GeneralUtilities.check_arguments
|
|
1586
1617
|
def mark_current_version_as_supported(self, repository_folder: str, version_of_product: str, supported_from: datetime, supported_until: datetime):
|
|
1618
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1587
1619
|
if self.__suport_information_exists(repository_folder, version_of_product):
|
|
1588
1620
|
raise ValueError(f"Version-support for v{version_of_product} already defined.")
|
|
1589
1621
|
folder = os.path.join(repository_folder, "Other", "Resources", "Support")
|
|
@@ -1596,22 +1628,21 @@ class TasksForCommonProjectStructure:
|
|
|
1596
1628
|
|
|
1597
1629
|
@GeneralUtilities.check_arguments
|
|
1598
1630
|
def get_codeunit_owner_name(self, codeunit_file: str) -> None:
|
|
1599
|
-
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure',
|
|
1600
|
-
'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
1631
|
+
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
1601
1632
|
root: etree._ElementTree = etree.parse(codeunit_file)
|
|
1602
1633
|
result = root.xpath('//cps:codeunit/cps:codeunitownername/text()', namespaces=namespaces)[0]
|
|
1603
1634
|
return result
|
|
1604
1635
|
|
|
1605
1636
|
@GeneralUtilities.check_arguments
|
|
1606
1637
|
def get_codeunit_owner_emailaddress(self, codeunit_file: str) -> None:
|
|
1607
|
-
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure',
|
|
1608
|
-
'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
1638
|
+
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
1609
1639
|
root: etree._ElementTree = etree.parse(codeunit_file)
|
|
1610
1640
|
result = root.xpath('//cps:codeunit/cps:codeunitowneremailaddress/text()', namespaces=namespaces)[0]
|
|
1611
1641
|
return result
|
|
1612
1642
|
|
|
1613
1643
|
@GeneralUtilities.check_arguments
|
|
1614
1644
|
def generate_diff_report(self, repository_folder: str, codeunit_name: str, current_version: str) -> None:
|
|
1645
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1615
1646
|
codeunit_folder = os.path.join(repository_folder, codeunit_name)
|
|
1616
1647
|
target_folder = GeneralUtilities.resolve_relative_path("Other/Artifacts/DiffReport", codeunit_folder)
|
|
1617
1648
|
GeneralUtilities.ensure_directory_does_not_exist(target_folder)
|
|
@@ -1643,6 +1674,7 @@ class TasksForCommonProjectStructure:
|
|
|
1643
1674
|
|
|
1644
1675
|
@GeneralUtilities.check_arguments
|
|
1645
1676
|
def replace_common_variables_in_nuspec_file(self, codeunit_folder: str) -> None:
|
|
1677
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1646
1678
|
codeunit_name = os.path.basename(codeunit_folder)
|
|
1647
1679
|
codeunit_version = self.get_version_of_codeunit_folder(codeunit_folder)
|
|
1648
1680
|
nuspec_file = os.path.join(codeunit_folder, "Other", "Build", f"{codeunit_name}.nuspec")
|
|
@@ -1666,6 +1698,7 @@ class TasksForCommonProjectStructure:
|
|
|
1666
1698
|
|
|
1667
1699
|
@GeneralUtilities.check_arguments
|
|
1668
1700
|
def standardized_tasks_build_bom_for_node_project(self, codeunit_folder: str, verbosity: int, commandline_arguments: list[str]) -> None:
|
|
1701
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1669
1702
|
verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
|
|
1670
1703
|
# TODO
|
|
1671
1704
|
|
|
@@ -1793,47 +1826,57 @@ class TasksForCommonProjectStructure:
|
|
|
1793
1826
|
|
|
1794
1827
|
@GeneralUtilities.check_arguments
|
|
1795
1828
|
def set_default_constants(self, codeunit_folder: str) -> None:
|
|
1829
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1796
1830
|
self.set_constant_for_commitid(codeunit_folder)
|
|
1797
1831
|
self.set_constant_for_commitdate(codeunit_folder)
|
|
1798
|
-
self.
|
|
1832
|
+
self.set_constant_for_codeunitname(codeunit_folder)
|
|
1799
1833
|
self.set_constant_for_codeunitversion(codeunit_folder)
|
|
1800
1834
|
self.set_constant_for_codeunitmajorversion(codeunit_folder)
|
|
1801
1835
|
self.set_constant_for_description(codeunit_folder)
|
|
1802
1836
|
|
|
1803
1837
|
@GeneralUtilities.check_arguments
|
|
1804
1838
|
def set_constant_for_commitid(self, codeunit_folder: str) -> None:
|
|
1805
|
-
|
|
1839
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1840
|
+
repository = GeneralUtilities.resolve_relative_path("..", codeunit_folder)
|
|
1841
|
+
commit_id = self.__sc.git_get_commit_id(repository)
|
|
1806
1842
|
self.set_constant(codeunit_folder, "CommitId", commit_id)
|
|
1807
1843
|
|
|
1808
1844
|
@GeneralUtilities.check_arguments
|
|
1809
1845
|
def set_constant_for_commitdate(self, codeunit_folder: str) -> None:
|
|
1810
|
-
|
|
1846
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1847
|
+
repository = GeneralUtilities.resolve_relative_path("..", codeunit_folder)
|
|
1848
|
+
commit_date: datetime = self.__sc.git_get_commit_date(repository)
|
|
1811
1849
|
self.set_constant(codeunit_folder, "CommitDate", GeneralUtilities.datetime_to_string(commit_date))
|
|
1812
1850
|
|
|
1813
1851
|
@GeneralUtilities.check_arguments
|
|
1814
|
-
def
|
|
1852
|
+
def set_constant_for_codeunitname(self, codeunit_folder: str) -> None:
|
|
1853
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1815
1854
|
codeunit_name: str = os.path.basename(codeunit_folder)
|
|
1816
1855
|
self.set_constant(codeunit_folder, "CodeUnitName", codeunit_name)
|
|
1817
1856
|
|
|
1818
1857
|
@GeneralUtilities.check_arguments
|
|
1819
1858
|
def set_constant_for_codeunitversion(self, codeunit_folder: str) -> None:
|
|
1859
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1820
1860
|
codeunit_version: str = self.get_version_of_codeunit_folder(codeunit_folder)
|
|
1821
1861
|
self.set_constant(codeunit_folder, "CodeUnitVersion", codeunit_version)
|
|
1822
1862
|
|
|
1823
1863
|
@GeneralUtilities.check_arguments
|
|
1824
1864
|
def set_constant_for_codeunitmajorversion(self, codeunit_folder: str) -> None:
|
|
1865
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1825
1866
|
codeunit_version: str = self.get_version_of_codeunit_folder(codeunit_folder)
|
|
1826
1867
|
major_version = int(codeunit_version.split(".")[0])
|
|
1827
1868
|
self.set_constant(codeunit_folder, "CodeUnitMajorVersion", str(major_version))
|
|
1828
1869
|
|
|
1829
1870
|
@GeneralUtilities.check_arguments
|
|
1830
1871
|
def set_constant_for_description(self, codeunit_folder: str) -> None:
|
|
1872
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1831
1873
|
codeunit_name: str = os.path.basename(codeunit_folder)
|
|
1832
1874
|
codeunit_description: str = self.get_codeunit_description(f"{codeunit_folder}/{codeunit_name}.codeunit.xml")
|
|
1833
1875
|
self.set_constant(codeunit_folder, "CodeUnitDescription", codeunit_description)
|
|
1834
1876
|
|
|
1835
1877
|
@GeneralUtilities.check_arguments
|
|
1836
1878
|
def set_constant(self, codeunit_folder: str, constantname: str, constant_value: str, documentationsummary: str = None, constants_valuefile: str = None) -> None:
|
|
1879
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1837
1880
|
if documentationsummary is None:
|
|
1838
1881
|
documentationsummary = ""
|
|
1839
1882
|
constants_folder = os.path.join(codeunit_folder, "Other", "Resources", "Constants")
|
|
@@ -1861,16 +1904,19 @@ class TasksForCommonProjectStructure:
|
|
|
1861
1904
|
|
|
1862
1905
|
@GeneralUtilities.check_arguments
|
|
1863
1906
|
def get_constant_value(self, source_codeunit_folder: str, constant_name: str) -> str:
|
|
1907
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(source_codeunit_folder)
|
|
1864
1908
|
value_file_relative = self.__get_constant_helper(source_codeunit_folder, constant_name, "path")
|
|
1865
1909
|
value_file = GeneralUtilities.resolve_relative_path(value_file_relative, os.path.join(source_codeunit_folder, "Other", "Resources", "Constants"))
|
|
1866
1910
|
return GeneralUtilities.read_text_from_file(value_file)
|
|
1867
1911
|
|
|
1868
1912
|
@GeneralUtilities.check_arguments
|
|
1869
1913
|
def get_constant_documentation(self, source_codeunit_folder: str, constant_name: str) -> str:
|
|
1914
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(source_codeunit_folder)
|
|
1870
1915
|
return self.__get_constant_helper(source_codeunit_folder, constant_name, "documentationsummary")
|
|
1871
1916
|
|
|
1872
1917
|
@GeneralUtilities.check_arguments
|
|
1873
1918
|
def __get_constant_helper(self, source_codeunit_folder: str, constant_name: str, propertyname: str) -> str:
|
|
1919
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(source_codeunit_folder)
|
|
1874
1920
|
root: etree._ElementTree = etree.parse(os.path.join(source_codeunit_folder, "Other", "Resources", "Constants", f"{constant_name}.constant.xml"))
|
|
1875
1921
|
results = root.xpath(f'//cps:{propertyname}/text()', namespaces={
|
|
1876
1922
|
'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure'
|
|
@@ -1885,6 +1931,7 @@ class TasksForCommonProjectStructure:
|
|
|
1885
1931
|
|
|
1886
1932
|
@GeneralUtilities.check_arguments
|
|
1887
1933
|
def copy_development_certificate_to_default_development_directory(self, codeunit_folder: str, build_environment: str, domain: str = None, certificate_resource_name: str = "DevelopmentCertificate") -> None:
|
|
1934
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1888
1935
|
if build_environment != "Productive":
|
|
1889
1936
|
codeunit_name: str = os.path.basename(codeunit_folder)
|
|
1890
1937
|
if domain is None:
|
|
@@ -1905,7 +1952,7 @@ class TasksForCommonProjectStructure:
|
|
|
1905
1952
|
@GeneralUtilities.check_arguments
|
|
1906
1953
|
def set_constants_for_certificate_public_information(self, codeunit_folder: str, source_constant_name: str = "DevelopmentCertificate", domain: str = None) -> None:
|
|
1907
1954
|
"""Expects a certificate-resource and generates a constant for its public information"""
|
|
1908
|
-
|
|
1955
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1909
1956
|
certificate_file = os.path.join(codeunit_folder, "Other", "Resources", source_constant_name, f"{source_constant_name}.crt")
|
|
1910
1957
|
with open(certificate_file, encoding="utf-8") as text_wrapper:
|
|
1911
1958
|
certificate = crypto.load_certificate(crypto.FILETYPE_PEM, text_wrapper.read())
|
|
@@ -1915,6 +1962,7 @@ class TasksForCommonProjectStructure:
|
|
|
1915
1962
|
@GeneralUtilities.check_arguments
|
|
1916
1963
|
def set_constants_for_certificate_private_information(self, codeunit_folder: str) -> None:
|
|
1917
1964
|
"""Expects a certificate-resource and generates a constant for its sensitive information in hex-format"""
|
|
1965
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1918
1966
|
codeunit_name = os.path.basename(codeunit_folder)
|
|
1919
1967
|
resource_name: str = "DevelopmentCertificate"
|
|
1920
1968
|
filename: str = codeunit_name+"DevelopmentCertificate"
|
|
@@ -1923,6 +1971,7 @@ class TasksForCommonProjectStructure:
|
|
|
1923
1971
|
|
|
1924
1972
|
@GeneralUtilities.check_arguments
|
|
1925
1973
|
def generate_constant_from_resource_by_filename(self, codeunit_folder: str, resource_name: str, filename: str, constant_name: str) -> None:
|
|
1974
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1926
1975
|
certificate_resource_folder = GeneralUtilities.resolve_relative_path(f"Other/Resources/{resource_name}", codeunit_folder)
|
|
1927
1976
|
resource_file = os.path.join(certificate_resource_folder, filename)
|
|
1928
1977
|
resource_file_content = GeneralUtilities.read_binary_from_file(resource_file)
|
|
@@ -1931,6 +1980,7 @@ class TasksForCommonProjectStructure:
|
|
|
1931
1980
|
|
|
1932
1981
|
@GeneralUtilities.check_arguments
|
|
1933
1982
|
def generate_constant_from_resource_by_extension(self, codeunit_folder: str, resource_name: str, extension: str, constant_name: str) -> None:
|
|
1983
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1934
1984
|
certificate_resource_folder = GeneralUtilities.resolve_relative_path(f"Other/Resources/{resource_name}", codeunit_folder)
|
|
1935
1985
|
resource_file = self.__sc.find_file_by_extension(certificate_resource_folder, extension)
|
|
1936
1986
|
resource_file_content = GeneralUtilities.read_binary_from_file(resource_file)
|
|
@@ -1939,6 +1989,7 @@ class TasksForCommonProjectStructure:
|
|
|
1939
1989
|
|
|
1940
1990
|
@GeneralUtilities.check_arguments
|
|
1941
1991
|
def copy_constant_from_dependent_codeunit(self, codeunit_folder: str, constant_name: str, source_codeunit_name: str) -> None:
|
|
1992
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1942
1993
|
source_codeunit_folder: str = GeneralUtilities.resolve_relative_path(f"../{source_codeunit_name}", codeunit_folder)
|
|
1943
1994
|
value = self.get_constant_value(source_codeunit_folder, constant_name)
|
|
1944
1995
|
documentation = self.get_constant_documentation(source_codeunit_folder, constant_name)
|
|
@@ -1946,6 +1997,7 @@ class TasksForCommonProjectStructure:
|
|
|
1946
1997
|
|
|
1947
1998
|
@GeneralUtilities.check_arguments
|
|
1948
1999
|
def copy_resources_from_dependent_codeunit(self, codeunit_folder: str, resource_name: str, source_codeunit_name: str) -> None:
|
|
2000
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1949
2001
|
source_folder: str = GeneralUtilities.resolve_relative_path(f"../{source_codeunit_name}/Other/Resources/{resource_name}", codeunit_folder)
|
|
1950
2002
|
target_folder: str = GeneralUtilities.resolve_relative_path(f"Other/Resources/{resource_name}", codeunit_folder)
|
|
1951
2003
|
GeneralUtilities.ensure_directory_does_not_exist(target_folder)
|
|
@@ -1957,6 +2009,7 @@ class TasksForCommonProjectStructure:
|
|
|
1957
2009
|
codeunitname = os.path.basename(str(Path(os.path.dirname(buildscript_file)).parent.parent.absolute()))
|
|
1958
2010
|
repository_folder = str(Path(os.path.dirname(buildscript_file)).parent.parent.parent.absolute())
|
|
1959
2011
|
codeunit_folder = os.path.join(repository_folder, codeunitname)
|
|
2012
|
+
self.assert_is_codeunit_folder(codeunit_folder)
|
|
1960
2013
|
artifacts_folder = os.path.join(codeunit_folder, "Other", "Artifacts")
|
|
1961
2014
|
GeneralUtilities.ensure_directory_exists(os.path.join(artifacts_folder, "APISpecification"))
|
|
1962
2015
|
verbosity = self.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
|
|
@@ -1994,6 +2047,7 @@ class TasksForCommonProjectStructure:
|
|
|
1994
2047
|
|
|
1995
2048
|
@GeneralUtilities.check_arguments
|
|
1996
2049
|
def ensure_openapigenerator_is_available(self, codeunit_folder: str) -> None:
|
|
2050
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
1997
2051
|
openapigenerator_folder = os.path.join(codeunit_folder, "Other", "Resources", "OpenAPIGenerator")
|
|
1998
2052
|
internet_connection_is_available = GeneralUtilities.internet_connection_is_available()
|
|
1999
2053
|
filename = "open-api-generator.jar"
|
|
@@ -2114,6 +2168,7 @@ class TasksForCommonProjectStructure:
|
|
|
2114
2168
|
|
|
2115
2169
|
@GeneralUtilities.check_arguments
|
|
2116
2170
|
def add_github_release(self, productname: str, projectversion: str, build_artifacts_folder: str, github_username: str, repository_folder: str, commandline_arguments: list[str]) -> None:
|
|
2171
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2117
2172
|
GeneralUtilities.write_message_to_stdout(f"Create GitHub-release for {productname}.")
|
|
2118
2173
|
verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, 1)
|
|
2119
2174
|
github_repo = f"{github_username}/{productname}"
|
|
@@ -2126,8 +2181,8 @@ class TasksForCommonProjectStructure:
|
|
|
2126
2181
|
|
|
2127
2182
|
@GeneralUtilities.check_arguments
|
|
2128
2183
|
def get_dependencies_which_are_ignored_from_updates(self, codeunit_folder: str, print_warnings_for_ignored_dependencies: bool) -> list[str]:
|
|
2129
|
-
|
|
2130
|
-
|
|
2184
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
2185
|
+
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
2131
2186
|
codeunit_name = os.path.basename(codeunit_folder)
|
|
2132
2187
|
codeunit_file = os.path.join(codeunit_folder, f"{codeunit_name}.codeunit.xml")
|
|
2133
2188
|
root: etree._ElementTree = etree.parse(codeunit_file)
|
|
@@ -2200,6 +2255,7 @@ class TasksForCommonProjectStructure:
|
|
|
2200
2255
|
|
|
2201
2256
|
@GeneralUtilities.check_arguments
|
|
2202
2257
|
def generate_tasksfile_from_workspace_file(self, repository_folder: str, append_cli_args_at_end: bool = False) -> None:
|
|
2258
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2203
2259
|
sc: ScriptCollectionCore = ScriptCollectionCore()
|
|
2204
2260
|
workspace_file: str = sc.find_file_by_extension(repository_folder, "code-workspace")
|
|
2205
2261
|
task_file: str = os.path.join(repository_folder, "Taskfile.yml")
|
|
@@ -2320,6 +2376,7 @@ class TasksForCommonProjectStructure:
|
|
|
2320
2376
|
|
|
2321
2377
|
@GeneralUtilities.check_arguments
|
|
2322
2378
|
def create_artifact_for_development_certificate(self, codeunit_folder: str):
|
|
2379
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
2323
2380
|
ce_source_folder = GeneralUtilities.resolve_relative_path("Other/Resources/DevelopmentCertificate", codeunit_folder)
|
|
2324
2381
|
ca_source_folder = GeneralUtilities.resolve_relative_path("Other/Resources/CA", codeunit_folder)
|
|
2325
2382
|
ce_target_folder = GeneralUtilities.resolve_relative_path("Other/Artifacts/DevelopmentCertificate", codeunit_folder)
|
|
@@ -2342,6 +2399,7 @@ class TasksForCommonProjectStructure:
|
|
|
2342
2399
|
|
|
2343
2400
|
@GeneralUtilities.check_arguments
|
|
2344
2401
|
def get_project_name(self, repository_folder: str) -> str:
|
|
2402
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2345
2403
|
for file in GeneralUtilities.get_direct_files_of_folder(repository_folder):
|
|
2346
2404
|
if file.endswith(".code-workspace"):
|
|
2347
2405
|
return Path(file).stem
|
|
@@ -2354,13 +2412,14 @@ class TasksForCommonProjectStructure:
|
|
|
2354
2412
|
|
|
2355
2413
|
@GeneralUtilities.check_arguments
|
|
2356
2414
|
def build_codeunit(self, codeunit_folder: str, verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None, is_pre_merge: bool = False, export_target_directory: str = None, assume_dependent_codeunits_are_already_built: bool = False, commandlinearguments: list[str] = []) -> None:
|
|
2357
|
-
|
|
2415
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
2358
2416
|
codeunit_name = os.path.basename(codeunit_folder)
|
|
2359
2417
|
repository_folder = os.path.dirname(codeunit_folder)
|
|
2360
2418
|
self.build_specific_codeunits(repository_folder, [codeunit_name], verbosity, target_environmenttype, additional_arguments_file, is_pre_merge, export_target_directory, assume_dependent_codeunits_are_already_built, commandlinearguments, False)
|
|
2361
2419
|
|
|
2362
2420
|
@GeneralUtilities.check_arguments
|
|
2363
2421
|
def build_codeunitsC(self, repository_folder: str, image: str, verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None, commandlinearguments: list[str] = []) -> None:
|
|
2422
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2364
2423
|
if target_environmenttype == "Development":
|
|
2365
2424
|
raise ValueError(f"build_codeunitsC is not available for target_environmenttype {target_environmenttype}.")
|
|
2366
2425
|
# TODO handle additional_arguments_file
|
|
@@ -2371,13 +2430,14 @@ class TasksForCommonProjectStructure:
|
|
|
2371
2430
|
@GeneralUtilities.check_arguments
|
|
2372
2431
|
def build_codeunits(self, repository_folder: str, verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None, is_pre_merge: bool = False, export_target_directory: str = None, commandline_arguments: list[str] = [], do_git_clean_when_no_changes: bool = False) -> None:
|
|
2373
2432
|
self.__check_target_environmenttype(target_environmenttype)
|
|
2374
|
-
repository_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(repository_folder)
|
|
2375
2433
|
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2434
|
+
repository_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(repository_folder)
|
|
2376
2435
|
codeunits = self.get_codeunits(repository_folder, False)
|
|
2377
2436
|
self.build_specific_codeunits(repository_folder, codeunits, verbosity, target_environmenttype, additional_arguments_file, is_pre_merge, export_target_directory, False, commandline_arguments, do_git_clean_when_no_changes)
|
|
2378
2437
|
|
|
2379
2438
|
@GeneralUtilities.check_arguments
|
|
2380
2439
|
def build_specific_codeunits(self, repository_folder: str, codeunits: list[str], verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None, is_pre_merge: bool = False, export_target_directory: str = None, assume_dependent_codeunits_are_already_built: bool = True, commandline_arguments: list[str] = [], do_git_clean_when_no_changes: bool = False) -> None:
|
|
2440
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2381
2441
|
self.__check_target_environmenttype(target_environmenttype)
|
|
2382
2442
|
repository_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(repository_folder)
|
|
2383
2443
|
contains_uncommitted_changes = self.__sc.git_repository_has_uncommitted_changes(repository_folder)
|
|
@@ -2409,9 +2469,10 @@ class TasksForCommonProjectStructure:
|
|
|
2409
2469
|
|
|
2410
2470
|
now = datetime.now()
|
|
2411
2471
|
if not self.__suport_information_exists(repository_folder, project_version):
|
|
2412
|
-
support_time = timedelta(days=365*2+30*3) # TODO make this configurable
|
|
2472
|
+
support_time = timedelta(days=365*2+30*3+1) # TODO make this configurable
|
|
2413
2473
|
until = now + support_time
|
|
2414
|
-
|
|
2474
|
+
until_day=datetime(until.year,until.month,until.day,0,0,0)
|
|
2475
|
+
self.mark_current_version_as_supported(repository_folder, project_version, now, until_day)
|
|
2415
2476
|
|
|
2416
2477
|
if len(sorted_codeunits) == 0:
|
|
2417
2478
|
raise ValueError(f'No codeunit found in subfolders of "{repository_folder}".')
|
|
@@ -2449,19 +2510,15 @@ class TasksForCommonProjectStructure:
|
|
|
2449
2510
|
|
|
2450
2511
|
@GeneralUtilities.check_arguments
|
|
2451
2512
|
def __do_repository_checks(self, repository_folder: str, project_version: str) -> None:
|
|
2452
|
-
|
|
2513
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2453
2514
|
self.__check_if_changelog_exists(repository_folder, project_version)
|
|
2454
2515
|
self.__check_whether_security_txt_exists(repository_folder)
|
|
2455
2516
|
self.__check_whether_workspace_file_exists(repository_folder)
|
|
2456
2517
|
self.__check_for_staged_or_committed_ignored_files(repository_folder)
|
|
2457
2518
|
|
|
2458
|
-
@GeneralUtilities.check_arguments
|
|
2459
|
-
def __check_if_folder_is_git_repository(self, repository_folder: str) -> None:
|
|
2460
|
-
if (not self.__sc.is_git_repository(repository_folder)):
|
|
2461
|
-
raise ValueError(f"Folder {repository_folder} is not a git-repository")
|
|
2462
|
-
|
|
2463
2519
|
@GeneralUtilities.check_arguments
|
|
2464
2520
|
def __check_if_changelog_exists(self, repository_folder: str, project_version: str) -> None:
|
|
2521
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2465
2522
|
changelog_folder = os.path.join(repository_folder, "Other", "Resources", "Changelog")
|
|
2466
2523
|
changelog_file = os.path.join(changelog_folder, f"v{project_version}.md")
|
|
2467
2524
|
if not os.path.isfile(changelog_file):
|
|
@@ -2507,6 +2564,7 @@ class TasksForCommonProjectStructure:
|
|
|
2507
2564
|
|
|
2508
2565
|
@GeneralUtilities.check_arguments
|
|
2509
2566
|
def __ensure_grylibrary_is_available(self, codeunit_folder: str) -> None:
|
|
2567
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
2510
2568
|
grylibrary_folder = os.path.join(codeunit_folder, "Other", "Resources", "GRYLibrary")
|
|
2511
2569
|
grylibrary_dll_file = os.path.join(grylibrary_folder, "BuildResult_DotNet_win-x64", "GRYLibrary.dll")
|
|
2512
2570
|
internet_connection_is_available = GeneralUtilities.internet_connection_is_available()
|
|
@@ -2538,6 +2596,7 @@ class TasksForCommonProjectStructure:
|
|
|
2538
2596
|
|
|
2539
2597
|
@GeneralUtilities.check_arguments
|
|
2540
2598
|
def ensure_ffmpeg_is_available(self, codeunit_folder: str) -> None:
|
|
2599
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
2541
2600
|
ffmpeg_folder = os.path.join(codeunit_folder, "Other", "Resources", "FFMPEG")
|
|
2542
2601
|
internet_connection_is_available = GeneralUtilities.internet_connection_is_available()
|
|
2543
2602
|
exe_file = f"{ffmpeg_folder}/ffmpeg.exe"
|
|
@@ -2624,6 +2683,7 @@ class TasksForCommonProjectStructure:
|
|
|
2624
2683
|
|
|
2625
2684
|
@GeneralUtilities.check_arguments
|
|
2626
2685
|
def create_deb_package_for_artifact(self, codeunit_folder: str, maintainername: str, maintaineremail: str, description: str, verbosity: int, cmd_arguments: list[str]) -> None:
|
|
2686
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
2627
2687
|
verbosity = self.get_verbosity_from_commandline_arguments(cmd_arguments, verbosity)
|
|
2628
2688
|
codeunit_name = os.path.basename(codeunit_folder)
|
|
2629
2689
|
binary_folder = GeneralUtilities.resolve_relative_path("Other/Artifacts/BuildResult_DotNet_linux-x64", codeunit_folder)
|
|
@@ -2647,6 +2707,7 @@ class TasksForCommonProjectStructure:
|
|
|
2647
2707
|
|
|
2648
2708
|
@GeneralUtilities.check_arguments
|
|
2649
2709
|
def update_year_for_dotnet_codeunit(self, codeunit_folder: str) -> None:
|
|
2710
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
2650
2711
|
codeunit_name = os.path.basename(codeunit_folder)
|
|
2651
2712
|
csproj_file = os.path.join(codeunit_folder, codeunit_name, f"{codeunit_name}.csproj")
|
|
2652
2713
|
self.__sc.update_year_in_copyright_tags(csproj_file)
|
|
@@ -2662,6 +2723,7 @@ class TasksForCommonProjectStructure:
|
|
|
2662
2723
|
|
|
2663
2724
|
@GeneralUtilities.check_arguments
|
|
2664
2725
|
def verify_artifact_exists(self, codeunit_folder: str, artifact_name_regexes: dict[str, bool]) -> None:
|
|
2726
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
2665
2727
|
codeunit_name: str = os.path.basename(codeunit_folder)
|
|
2666
2728
|
artifacts_folder = os.path.join(codeunit_folder, "Other/Artifacts")
|
|
2667
2729
|
existing_artifacts = [os.path.basename(x) for x in GeneralUtilities.get_direct_folders_of_folder(artifacts_folder)]
|
|
@@ -2680,6 +2742,7 @@ class TasksForCommonProjectStructure:
|
|
|
2680
2742
|
|
|
2681
2743
|
@GeneralUtilities.check_arguments
|
|
2682
2744
|
def __build_codeunit(self, codeunit_folder: str, verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None, is_pre_merge: bool = False, assume_dependent_codeunits_are_already_built: bool = False, commandline_arguments: list[str] = []) -> None:
|
|
2745
|
+
TasksForCommonProjectStructure.assert_is_codeunit_folder(codeunit_folder)
|
|
2683
2746
|
now = datetime.now()
|
|
2684
2747
|
codeunit_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(codeunit_folder)
|
|
2685
2748
|
codeunit_name: str = os.path.basename(codeunit_folder)
|
|
@@ -2800,6 +2863,7 @@ class TasksForCommonProjectStructure:
|
|
|
2800
2863
|
@GeneralUtilities.check_arguments
|
|
2801
2864
|
def generic_update_dependencies(self, repository_folder: str, verbosity: int = 1):
|
|
2802
2865
|
# Prepare
|
|
2866
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2803
2867
|
codeunits = self.get_codeunits(repository_folder)
|
|
2804
2868
|
updated_dependencies = False
|
|
2805
2869
|
update_dependencies_script_filename = "UpdateDependencies.py"
|
|
@@ -2955,6 +3019,7 @@ class TasksForCommonProjectStructure:
|
|
|
2955
3019
|
|
|
2956
3020
|
@GeneralUtilities.check_arguments
|
|
2957
3021
|
def create_changelog_entry(self, repositoryfolder: str, message: str, commit: bool):
|
|
3022
|
+
GeneralUtilities.assert_is_git_repository(repositoryfolder)
|
|
2958
3023
|
current_version = self.get_version_of_project(repositoryfolder)
|
|
2959
3024
|
changelog_file = os.path.join(repositoryfolder, "Other", "Resources", "Changelog", f"v{current_version}.md")
|
|
2960
3025
|
if os.path.isdir(changelog_file):
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
ScriptCollection/Executables.py,sha256=ls3wGZpt48YwwtO0QGWWyIImSE87SyzbL-WxhpwQJug,20837
|
|
2
|
-
ScriptCollection/GeneralUtilities.py,sha256=
|
|
2
|
+
ScriptCollection/GeneralUtilities.py,sha256=Kh_oSUtCyBra5LuH5_5_HkyM14YvA21ug8cK4ODsamI,37744
|
|
3
3
|
ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
|
|
4
4
|
ScriptCollection/ProgramRunnerBase.py,sha256=7QAjoqOz6XPmJH19F2k-Z1fFQB_uZnPFvn-T54IJcHQ,2324
|
|
5
5
|
ScriptCollection/ProgramRunnerEpew.py,sha256=C2Rs3YWOWWWJct7XmKphp5CF1tf0j4Fp-ljV2drLTfs,6349
|
|
6
6
|
ScriptCollection/ProgramRunnerPopen.py,sha256=UGWUK0345DmtnD1gsKa1B3tBLDzKKXUGnSbIuCSWzLU,3714
|
|
7
7
|
ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
|
|
8
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
|
9
|
-
ScriptCollection/TasksForCommonProjectStructure.py,sha256=
|
|
8
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=CgWu2xqIYMu06BJLsBtCZ3v_GNgqzUU84xCtNKyC3O4,106702
|
|
9
|
+
ScriptCollection/TasksForCommonProjectStructure.py,sha256=w19PqN9ICOF7vF9Muxbs-t5wPPh1qqJUvxsY5QAfpB8,213960
|
|
10
10
|
ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
|
|
11
11
|
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
ScriptCollection-3.5.
|
|
13
|
-
ScriptCollection-3.5.
|
|
14
|
-
ScriptCollection-3.5.
|
|
15
|
-
ScriptCollection-3.5.
|
|
16
|
-
ScriptCollection-3.5.
|
|
12
|
+
ScriptCollection-3.5.49.dist-info/METADATA,sha256=aqDa6blUTgJpB6VFlVPGx0SjJwBJWye0lt9ihAl2R_s,7665
|
|
13
|
+
ScriptCollection-3.5.49.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
14
|
+
ScriptCollection-3.5.49.dist-info/entry_points.txt,sha256=_O7BmQ81LdDfrj5uOhjshg9Xc-tABHQJIxDOyOGRzzI,2397
|
|
15
|
+
ScriptCollection-3.5.49.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
|
16
|
+
ScriptCollection-3.5.49.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|