ScriptCollection 3.4.56__py3-none-any.whl → 3.4.57__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.
@@ -36,9 +36,7 @@ class CreateReleaseConfiguration():
36
36
  repository_folder_name: str = None
37
37
  __sc: ScriptCollectionCore = None
38
38
 
39
- def __init__(self, projectname: str, remotename: str, build_artifacts_target_folder: str, push_artifacts_scripts_folder: str,
40
- verbosity: int, repository_folder: str, additional_arguments_file: str,
41
- repository_folder_name: str):
39
+ 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):
42
40
 
43
41
  self.__sc = ScriptCollectionCore()
44
42
  self.projectname = projectname
@@ -69,8 +67,7 @@ class CreateReleaseInformationForProjectInCommonProjectFormat:
69
67
  additional_arguments_file: str = None
70
68
  export_target: str = None
71
69
 
72
- def __init__(self, repository: str, artifacts_folder: str, projectname: str, public_repository_url: str, target_branch_name: str,
73
- additional_arguments_file: str, export_target: str, push_artifacts_scripts_folder: str):
70
+ def __init__(self, repository: str, artifacts_folder: str, projectname: str, public_repository_url: str, target_branch_name: str, additional_arguments_file: str, export_target: str, push_artifacts_scripts_folder: str):
74
71
  self.repository = repository
75
72
  self.public_repository_url = public_repository_url
76
73
  self.target_branch_name = target_branch_name
@@ -144,43 +141,32 @@ class TasksForCommonProjectStructure:
144
141
 
145
142
  @GeneralUtilities.check_arguments
146
143
  def get_wheel_file(self, repository_folder: str, codeunit_name: str) -> str:
147
- return self.__sc.find_file_by_extension(os.path.join(self.get_artifacts_folder(repository_folder, codeunit_name),
148
- "BuildResult_Wheel"), "whl")
144
+ return self.__sc.find_file_by_extension(os.path.join(self.get_artifacts_folder(repository_folder, codeunit_name), "BuildResult_Wheel"), "whl")
149
145
 
150
146
  @GeneralUtilities.check_arguments
151
147
  def get_testcoverage_threshold_from_codeunit_file(self, codeunit_file: str):
152
148
  root: etree._ElementTree = etree.parse(codeunit_file)
153
- return float(str(root.xpath('//cps:properties/cps:testsettings/@minimalcodecoverageinpercent', namespaces={
154
- 'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure'
155
- })[0]))
149
+ return float(str(root.xpath('//cps:properties/cps:testsettings/@minimalcodecoverageinpercent', namespaces={ 'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure' })[0]))
156
150
 
157
151
  @GeneralUtilities.check_arguments
158
152
  def codeunit_has_testable_sourcecode(self, codeunit_file: str) -> bool:
159
153
  root: etree._ElementTree = etree.parse(codeunit_file)
160
- return GeneralUtilities.string_to_boolean(str(root.xpath('//cps:properties/@codeunithastestablesourcecode', namespaces={
161
- 'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure'
162
- })[0]))
154
+ return GeneralUtilities.string_to_boolean(str(root.xpath('//cps:properties/@codeunithastestablesourcecode', namespaces={ 'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure' })[0]))
163
155
 
164
156
  @GeneralUtilities.check_arguments
165
157
  def codeunit_throws_exception_if_codeunitfile_is_not_validatable(self, codeunit_file: str) -> bool:
166
158
  root: etree._ElementTree = etree.parse(codeunit_file)
167
- return GeneralUtilities.string_to_boolean(str(root.xpath('//cps:properties/@throwexceptionifcodeunitfilecannotbevalidated', namespaces={
168
- 'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure'
169
- })[0]))
159
+ return GeneralUtilities.string_to_boolean(str(root.xpath('//cps:properties/@throwexceptionifcodeunitfilecannotbevalidated', namespaces={ 'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure' })[0]))
170
160
 
171
161
  @GeneralUtilities.check_arguments
172
162
  def codeunit_has_updatable_dependencies(self, codeunit_file: str) -> bool:
173
163
  root: etree._ElementTree = etree.parse(codeunit_file)
174
- return GeneralUtilities.string_to_boolean(str(root.xpath('//cps:properties/@codeunithasupdatabledependencies', namespaces={
175
- 'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure'
176
- })[0]))
164
+ return GeneralUtilities.string_to_boolean(str(root.xpath('//cps:properties/@codeunithasupdatabledependencies', namespaces={ 'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure' })[0]))
177
165
 
178
166
  @GeneralUtilities.check_arguments
179
167
  def get_codeunit_description(self, codeunit_file: str) -> bool:
180
168
  root: etree._ElementTree = etree.parse(codeunit_file)
181
- return str(root.xpath('//cps:properties/@description', namespaces={
182
- 'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure'
183
- })[0])
169
+ return str(root.xpath('//cps:properties/@description', namespaces={ 'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure' })[0])
184
170
 
185
171
  @GeneralUtilities.check_arguments
186
172
  def check_testcoverage(self, testcoverage_file_in_cobertura_format: str, repository_folder: str, codeunitname: str) -> None:
@@ -200,14 +186,10 @@ class TasksForCommonProjectStructure:
200
186
 
201
187
  @GeneralUtilities.check_arguments
202
188
  def replace_version_in_python_file(self, file: str, new_version_value: str) -> None:
203
- GeneralUtilities.write_text_to_file(file, re.sub("version = \"\\d+\\.\\d+\\.\\d+\"", f"version = \"{new_version_value}\"",
204
- GeneralUtilities.read_text_from_file(file)))
205
-
206
-
189
+ GeneralUtilities.write_text_to_file(file, re.sub("version = \"\\d+\\.\\d+\\.\\d+\"", f"version = \"{new_version_value}\"", GeneralUtilities.read_text_from_file(file)))
207
190
 
208
191
  @GeneralUtilities.check_arguments
209
- def standardized_tasks_run_testcases_for_python_codeunit(self, run_testcases_file: str, generate_badges: bool, verbosity: int,
210
- targetenvironmenttype: str, commandline_arguments: list[str]) -> None:
192
+ def standardized_tasks_run_testcases_for_python_codeunit(self, run_testcases_file: str, generate_badges: bool, verbosity: int, targetenvironmenttype: str, commandline_arguments: list[str]) -> None:
211
193
  codeunitname: str = Path(os.path.dirname(run_testcases_file)).parent.parent.name
212
194
  verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
213
195
  repository_folder: str = str(Path(os.path.dirname(run_testcases_file)).parent.parent.parent.absolute())
@@ -307,7 +289,13 @@ class TasksForCommonProjectStructure:
307
289
  bom_folder = "Other/Artifacts/BOM"
308
290
  bom_folder_full = os.path.join(codeunit_folder, bom_folder)
309
291
  GeneralUtilities.ensure_directory_exists(bom_folder_full)
310
- self.__sc.run_program("cyclonedx-py", f"-o ./{bom_folder}/{codeunitname}.{codeunitversion}.sbom.xml -r -i requirements.txt", codeunit_folder, verbosity=verbosity)
292
+ if not os.path.isfile(os.path.join(codeunit_folder, "requirements.txt")):
293
+ raise ValueError(f"Codeunit {codeunitname} does not have a 'requirements.txt'-file.")
294
+ #TODO check that all values from setup.cfg are contained in requirements.txt
295
+ result=self.__sc.run_program("cyclonedx-py", "requirements", codeunit_folder, verbosity=verbosity)
296
+ bom_file=os.path.join(codeunit_folder, f"{bom_folder}/{codeunitname}.{codeunitversion}.bom.json")
297
+ GeneralUtilities.ensure_file_exists(bom_file)
298
+ GeneralUtilities.write_text_to_file(bom_file,result[1])
311
299
 
312
300
  @GeneralUtilities.check_arguments
313
301
  def standardized_tasks_push_wheel_file_to_registry(self, wheel_file: str, api_key: str, repository: str, gpg_identity: str, verbosity: int) -> None:
@@ -332,8 +320,7 @@ class TasksForCommonProjectStructure:
332
320
  self.__sc.run_program("twine", twine_argument, folder, verbosity=verbosity, throw_exception_if_exitcode_is_not_zero=True)
333
321
 
334
322
  @GeneralUtilities.check_arguments
335
- def push_wheel_build_artifact(self, push_build_artifacts_file, product_name, codeunitname, repository: str,
336
- apikey: str, gpg_identity: str, verbosity: int, commandline_arguments: list[str], repository_folder_name: str) -> None:
323
+ def push_wheel_build_artifact(self, push_build_artifacts_file, product_name, codeunitname, repository: str, apikey: str, gpg_identity: str, verbosity: int, commandline_arguments: list[str], repository_folder_name: str) -> None:
337
324
  verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
338
325
  folder_of_this_file = os.path.dirname(push_build_artifacts_file)
339
326
  repository_folder = GeneralUtilities.resolve_relative_path(f"..{os.path.sep}../Submodules{os.path.sep}{repository_folder_name}", folder_of_this_file)
@@ -491,8 +478,7 @@ class TasksForCommonProjectStructure:
491
478
  if not result2[0]:
492
479
  raise ValueError(test_csproj_file+message+f'"{result2[1]}".')
493
480
 
494
- def __standardized_task_verify_standard_format_for_project_csproj_file(self, csproj_file: str, codeunit_folder: str, codeunit_name: str,
495
- codeunit_version: str) -> tuple[bool, str]:
481
+ 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]:
496
482
  codeunit_name_regex = re.escape(codeunit_name)
497
483
  codeunit_file = os.path.join(codeunit_folder, f"{codeunit_name}.codeunit.xml")
498
484
  codeunit_description = self.get_codeunit_description(codeunit_file)
@@ -559,8 +545,7 @@ class TasksForCommonProjectStructure:
559
545
  <\\/Project>$"""
560
546
  return (self.__standardized_task_verify_standard_format_for_csproj_files(regex, csproj_file), regex)
561
547
 
562
- def __standardized_task_verify_standard_format_for_test_csproj_file(self, csproj_file: str, codeunit_name: str,
563
- codeunit_version: str) -> tuple[bool, str]:
548
+ def __standardized_task_verify_standard_format_for_test_csproj_file(self, csproj_file: str, codeunit_name: str, codeunit_version: str) -> tuple[bool, str]:
564
549
  codeunit_name_regex = re.escape(codeunit_name)
565
550
  codeunit_version_regex = re.escape(codeunit_version)
566
551
  regex = f"""^<Project Sdk=\\"Microsoft\\.NET\\.Sdk\\">
@@ -633,10 +618,7 @@ class TasksForCommonProjectStructure:
633
618
  return match is not None
634
619
 
635
620
  @GeneralUtilities.check_arguments
636
- def __standardized_tasks_build_for_dotnet_build(self, csproj_file: str, originaloutputfolder: str, files_to_sign: dict[str, str], commitid: str,
637
- verbosity: int, runtimes: list[str], target_environmenttype: str, target_environmenttype_mapping: dict[str, str],
638
- copy_license_file_to_target_folder: bool, repository_folder: str,
639
- codeunit_name: str, commandline_arguments: list[str]) -> None:
621
+ 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:
640
622
  dotnet_build_configuration: str = target_environmenttype_mapping[target_environmenttype]
641
623
  verbosity = self.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
642
624
  codeunit_folder = os.path.join(repository_folder, codeunit_name)
@@ -654,8 +636,7 @@ class TasksForCommonProjectStructure:
654
636
  self.__sc.run_program("dotnet", "clean", csproj_file_folder, verbosity=verbosity)
655
637
  GeneralUtilities.ensure_directory_exists(outputfolder)
656
638
  self.__sc.run_program("dotnet", "restore", codeunit_folder, verbosity=verbosity)
657
- self.__sc.run_program("dotnet", f"build {csproj_file_name} -c {dotnet_build_configuration} -o {outputfolder} --runtime {runtime}",
658
- csproj_file_folder, verbosity=verbosity)
639
+ self.__sc.run_program("dotnet", f"build {csproj_file_name} -c {dotnet_build_configuration} -o {outputfolder} --runtime {runtime}", csproj_file_folder, verbosity=verbosity)
659
640
  if copy_license_file_to_target_folder:
660
641
  license_file = os.path.join(repository_folder, "License.txt")
661
642
  target = os.path.join(outputfolder, f"{codeunit_name}.License.txt")
@@ -666,11 +647,9 @@ class TasksForCommonProjectStructure:
666
647
  snk_file=value
667
648
  dll_file_full=os.path.join(outputfolder,dll_file)
668
649
  if os.path.isfile(dll_file_full):
669
- GeneralUtilities.assert_condition(self.__sc.run_program("sn",f"-vf {dll_file}", outputfolder,throw_exception_if_exitcode_is_not_zero=False)[0]==1,
670
- f"Pre-verifying of {dll_file} failed.")
650
+ GeneralUtilities.assert_condition(self.__sc.run_program("sn",f"-vf {dll_file}", outputfolder,throw_exception_if_exitcode_is_not_zero=False)[0]==1, f"Pre-verifying of {dll_file} failed.")
671
651
  self.__sc.run_program("sn",f"-R {dll_file} {snk_file}", outputfolder)
672
- GeneralUtilities.assert_condition(self.__sc.run_program("sn",f"-vf {dll_file}", outputfolder,throw_exception_if_exitcode_is_not_zero=False)[0]==0,
673
- f"Verifying of {dll_file} failed.")
652
+ GeneralUtilities.assert_condition(self.__sc.run_program("sn",f"-vf {dll_file}", outputfolder,throw_exception_if_exitcode_is_not_zero=False)[0]==0, f"Verifying of {dll_file} failed.")
674
653
  sarif_filename = f"{csproj_file_name_without_extension}.sarif"
675
654
  sarif_source_file = os.path.join(sarif_folder, sarif_filename)
676
655
  if os.path.exists(sarif_source_file):
@@ -681,9 +660,7 @@ class TasksForCommonProjectStructure:
681
660
  shutil.copyfile(sarif_source_file, sarif_target_file)
682
661
 
683
662
  @GeneralUtilities.check_arguments
684
- def standardized_tasks_build_for_dotnet_project(self, buildscript_file: str, default_target_environmenttype: str,
685
- target_environmenttype_mapping: dict[str, str], runtimes: list[str],
686
- verbosity: int, commandline_arguments: list[str]) -> None:
663
+ def standardized_tasks_build_for_dotnet_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:
687
664
  # hint: arguments can be overwritten by commandline_arguments
688
665
  # this function builds an exe
689
666
  target_environmenttype = self.get_targetenvironmenttype_from_commandline_arguments(commandline_arguments, default_target_environmenttype)
@@ -692,17 +669,13 @@ class TasksForCommonProjectStructure:
692
669
  runtimes, True, commandline_arguments)
693
670
 
694
671
  @GeneralUtilities.check_arguments
695
- def standardized_tasks_build_for_dotnet_library_project(self, buildscript_file: str, default_target_environmenttype: str,
696
- target_environmenttype_mapping: dict[str, str], runtimes: list[str],
697
- verbosity: int, commandline_arguments: list[str]) -> None:
672
+ 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:
698
673
  # hint: arguments can be overwritten by commandline_arguments
699
674
  # this function builds a dll and converts it to a nupkg-file
700
675
 
701
676
  target_environmenttype = self.get_targetenvironmenttype_from_commandline_arguments(commandline_arguments, default_target_environmenttype)
702
- self.__standardized_tasks_build_for_dotnet_project(buildscript_file, target_environmenttype_mapping, default_target_environmenttype,
703
- verbosity, target_environmenttype, runtimes, True, commandline_arguments)
704
- self.__standardized_tasks_build_nupkg_for_dotnet_create_package(buildscript_file, verbosity,
705
- commandline_arguments)
677
+ self.__standardized_tasks_build_for_dotnet_project(buildscript_file, target_environmenttype_mapping, default_target_environmenttype, verbosity, target_environmenttype, runtimes, True, commandline_arguments)
678
+ self.__standardized_tasks_build_nupkg_for_dotnet_create_package(buildscript_file, verbosity, commandline_arguments)
706
679
 
707
680
  @GeneralUtilities.check_arguments
708
681
  def get_default_target_environmenttype_mapping(self) -> dict[str, str]:
@@ -713,9 +686,7 @@ class TasksForCommonProjectStructure:
713
686
  }
714
687
 
715
688
  @GeneralUtilities.check_arguments
716
- def __standardized_tasks_build_for_dotnet_project(self, buildscript_file: str, target_environmenttype_mapping: dict[str, str],
717
- default_target_environment_type: str, verbosity: int, target_environment_type: str,
718
- runtimes: list[str], copy_license_file_to_target_folder: bool, commandline_arguments: list[str]) -> None:
689
+ def __standardized_tasks_build_for_dotnet_project(self, buildscript_file: str, target_environmenttype_mapping: dict[str, str], default_target_environment_type: str, verbosity: int, target_environment_type: str, runtimes: list[str], copy_license_file_to_target_folder: bool, commandline_arguments: list[str]) -> None:
719
690
  codeunitname: str = os.path.basename(str(Path(os.path.dirname(buildscript_file)).parent.parent.absolute()))
720
691
  verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
721
692
  files_to_sign: dict[str, str] = TasksForCommonProjectStructure.get_filestosign_from_commandline_arguments(commandline_arguments, dict())
@@ -725,12 +696,8 @@ class TasksForCommonProjectStructure:
725
696
  codeunit_folder = os.path.join(repository_folder, codeunitname)
726
697
  csproj_file = os.path.join(codeunit_folder, codeunitname, codeunitname + ".csproj")
727
698
  csproj_test_file = os.path.join(codeunit_folder, codeunitname+"Tests", codeunitname+"Tests.csproj")
728
- self.__standardized_tasks_build_for_dotnet_build(csproj_file, os.path.join(outputfolder, "BuildResult_DotNet_"), files_to_sign, commitid,
729
- verbosity, runtimes, target_environment_type, target_environmenttype_mapping,
730
- copy_license_file_to_target_folder, repository_folder, codeunitname, commandline_arguments)
731
- self.__standardized_tasks_build_for_dotnet_build(csproj_test_file, os.path.join(outputfolder, "BuildResultTests_DotNet_"), files_to_sign, commitid,
732
- verbosity, runtimes, target_environment_type, target_environmenttype_mapping,
733
- copy_license_file_to_target_folder, repository_folder, codeunitname, commandline_arguments)
699
+ self.__standardized_tasks_build_for_dotnet_build(csproj_file, os.path.join(outputfolder, "BuildResult_DotNet_"), files_to_sign, commitid, verbosity, runtimes, target_environment_type, target_environmenttype_mapping, copy_license_file_to_target_folder, repository_folder, codeunitname, commandline_arguments)
700
+ self.__standardized_tasks_build_for_dotnet_build(csproj_test_file, os.path.join(outputfolder, "BuildResultTests_DotNet_"), files_to_sign, commitid, verbosity, runtimes, target_environment_type, target_environmenttype_mapping, copy_license_file_to_target_folder, repository_folder, codeunitname, commandline_arguments)
734
701
  self.generate_sbom_for_dotnet_project(codeunit_folder, verbosity, commandline_arguments)
735
702
  self.copy_source_files_to_output_directory(buildscript_file)
736
703
 
@@ -793,8 +760,7 @@ class TasksForCommonProjectStructure:
793
760
  GeneralUtilities.write_message_to_stdout("No linting-issues found.")
794
761
 
795
762
  @GeneralUtilities.check_arguments
796
- def standardized_tasks_generate_coverage_report(self, repository_folder: str, codeunitname: str, verbosity: int, generate_badges: bool, targetenvironmenttype: str,
797
- commandline_arguments: list[str], add_testcoverage_history_entry: bool = None) -> None:
763
+ def standardized_tasks_generate_coverage_report(self, repository_folder: str, codeunitname: str, verbosity: int, generate_badges: bool, targetenvironmenttype: str, commandline_arguments: list[str], add_testcoverage_history_entry: bool = None) -> None:
798
764
  """This script expects that the file '<repositorybasefolder>/<codeunitname>/Other/Artifacts/TestCoverage/TestCoverage.xml'
799
765
  which contains a test-coverage-report in the cobertura-format exists.
800
766
  This script expectes that the testcoverage-reportfolder is '<repositorybasefolder>/<codeunitname>/Other/Artifacts/TestCoverageReport'.
@@ -842,8 +808,7 @@ class TasksForCommonProjectStructure:
842
808
 
843
809
 
844
810
  @GeneralUtilities.check_arguments
845
- def standardized_tasks_run_testcases_for_dotnet_project(self, runtestcases_file: str, targetenvironmenttype: str, verbosity: int, generate_badges: bool,
846
- target_environmenttype_mapping: dict[str, str], commandline_arguments: list[str]) -> None:
811
+ def standardized_tasks_run_testcases_for_dotnet_project(self, runtestcases_file: str, targetenvironmenttype: str, verbosity: int, generate_badges: bool, target_environmenttype_mapping: dict[str, str], commandline_arguments: list[str]) -> None:
847
812
  dotnet_build_configuration: str = target_environmenttype_mapping[targetenvironmenttype]
848
813
  codeunit_name: str = os.path.basename(str(Path(os.path.dirname(runtestcases_file)).parent.parent.absolute()))
849
814
  verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
@@ -865,8 +830,7 @@ class TasksForCommonProjectStructure:
865
830
  root: etree._ElementTree = etree.parse(target_file)
866
831
  source_base_path_in_coverage_file :str= root.xpath("//coverage/sources/source/text()")[0].replace("\\","/")
867
832
  content=GeneralUtilities.read_text_from_file(target_file)
868
- GeneralUtilities.assert_condition(source_base_path_in_coverage_file.startswith(repository_folder) or repository_folder.startswith(source_base_path_in_coverage_file),
869
- f"Unexpected path for coverage. Sourcepath: \"{source_base_path_in_coverage_file}\"; repository: \"{repository_folder}\"")
833
+ GeneralUtilities.assert_condition(source_base_path_in_coverage_file.startswith(repository_folder) or repository_folder.startswith(source_base_path_in_coverage_file), f"Unexpected path for coverage. Sourcepath: \"{source_base_path_in_coverage_file}\"; repository: \"{repository_folder}\"")
870
834
  content = re.sub('\\\\', '/', content)
871
835
  content= re.sub("filename=\"([^\"]+)\"",lambda match: self.__standardized_tasks_run_testcases_for_dotnet_project_helper(source_base_path_in_coverage_file,codeunit_folder,match), content)
872
836
  GeneralUtilities.write_text_to_file(target_file, content)
@@ -887,8 +851,7 @@ class TasksForCommonProjectStructure:
887
851
  folder = f"{repository_folder}/{codeunitname}/Other/Artifacts/TestCoverage"
888
852
  filename = "TestCoverage.xml"
889
853
  full_file = os.path.join(folder, filename)
890
- GeneralUtilities.write_text_to_file(full_file, re.sub("<source>.+<\\/source>", f"<source><!--[repository]/-->./{codeunitname}/</source>",
891
- GeneralUtilities.read_text_from_file(full_file)))
854
+ GeneralUtilities.write_text_to_file(full_file, re.sub("<source>.+<\\/source>", f"<source><!--[repository]/-->./{codeunitname}/</source>", GeneralUtilities.read_text_from_file(full_file)))
892
855
  TasksForCommonProjectStructure.__remove_not_existing_files_from_testcoverage_file(full_file,repository_folder, codeunitname)
893
856
 
894
857
  @GeneralUtilities.check_arguments
@@ -936,8 +899,7 @@ class TasksForCommonProjectStructure:
936
899
  versiononlyregex = f"^{versionregex}$"
937
900
  pattern = re.compile(versiononlyregex)
938
901
  if pattern.match(current_version):
939
- GeneralUtilities.write_text_to_file(codeunit_file, re.sub(f"<cps:version>{versionregex}<\\/cps:version>",
940
- f"<cps:version>{current_version}</cps:version>", GeneralUtilities.read_text_from_file(codeunit_file)))
902
+ GeneralUtilities.write_text_to_file(codeunit_file, re.sub(f"<cps:version>{versionregex}<\\/cps:version>", f"<cps:version>{current_version}</cps:version>", GeneralUtilities.read_text_from_file(codeunit_file)))
941
903
  else:
942
904
  raise ValueError(f"Version '{current_version}' does not match version-regex '{versiononlyregex}'.")
943
905
 
@@ -947,9 +909,7 @@ class TasksForCommonProjectStructure:
947
909
  # TODO check if there are errors in sarif-file
948
910
 
949
911
  @GeneralUtilities.check_arguments
950
- def __export_codeunit_reference_content_to_reference_repository(self, project_version_identifier: str, replace_existing_content: bool,
951
- target_folder_for_reference_repository: str, repository: str, codeunitname: str, projectname: str,
952
- codeunit_version: str, public_repository_url: str, branch: str) -> None:
912
+ def __export_codeunit_reference_content_to_reference_repository(self, project_version_identifier: str, replace_existing_content: bool, target_folder_for_reference_repository: str, repository: str, codeunitname: str, projectname: str, codeunit_version: str, public_repository_url: str, branch: str) -> None:
953
913
  codeunit_folder = os.path.join(repository, codeunitname)
954
914
  codeunit_file = os.path.join(codeunit_folder, f"{codeunitname}.codeunit.xml")
955
915
  codeunit_has_testcases = self.codeunit_has_testable_sourcecode(codeunit_file)
@@ -1029,8 +989,7 @@ class TasksForCommonProjectStructure:
1029
989
  target_folder_base = os.path.join(information.artifacts_folder, information.projectname, project_version)
1030
990
  GeneralUtilities.ensure_directory_exists(target_folder_base)
1031
991
 
1032
- self.build_codeunits(information.repository, information.verbosity, information.target_environmenttype_for_productive,
1033
- information.additional_arguments_file, False, information.export_target)
992
+ self.build_codeunits(information.repository, information.verbosity, information.target_environmenttype_for_productive, information.additional_arguments_file, False, information.export_target)
1034
993
 
1035
994
  reference_folder = os.path.join(information.reference_repository, "ReferenceContent")
1036
995
 
@@ -1040,17 +999,12 @@ class TasksForCommonProjectStructure:
1040
999
  push_artifact_to_registry_script = os.path.join(information.push_artifacts_scripts_folder, scriptfilename)
1041
1000
  if os.path.isfile(push_artifact_to_registry_script):
1042
1001
  GeneralUtilities.write_message_to_stdout(f"Push artifacts of codeunit {codeunitname}...")
1043
- self.__sc.run_program("python", push_artifact_to_registry_script, information.push_artifacts_scripts_folder,
1044
- verbosity=information.verbosity, throw_exception_if_exitcode_is_not_zero=True)
1002
+ self.__sc.run_program("python", push_artifact_to_registry_script, information.push_artifacts_scripts_folder, verbosity=information.verbosity, throw_exception_if_exitcode_is_not_zero=True)
1045
1003
 
1046
1004
  # Copy reference of codeunit to reference-repository
1047
1005
  codeunit_version = self.get_version_of_codeunit_folder(os.path.join(information.repository, codeunitname))
1048
- self.__export_codeunit_reference_content_to_reference_repository(f"v{project_version}", False, reference_folder, information.repository,
1049
- codeunitname, information.projectname, codeunit_version, information.public_repository_url,
1050
- f"v{project_version}")
1051
- self.__export_codeunit_reference_content_to_reference_repository("Latest", True, reference_folder, information.repository,
1052
- codeunitname, information.projectname, codeunit_version, information.public_repository_url,
1053
- information.target_branch_name)
1006
+ self.__export_codeunit_reference_content_to_reference_repository(f"v{project_version}", False, reference_folder, information.repository, codeunitname, information.projectname, codeunit_version, information.public_repository_url, f"v{project_version}")
1007
+ self.__export_codeunit_reference_content_to_reference_repository("Latest", True, reference_folder, information.repository, codeunitname, information.projectname, codeunit_version, information.public_repository_url, information.target_branch_name)
1054
1008
 
1055
1009
  # Generate reference
1056
1010
  self.__generate_entire_reference(information.projectname, project_version, reference_folder)
@@ -1084,8 +1038,7 @@ class TasksForCommonProjectStructure:
1084
1038
  @GeneralUtilities.check_arguments
1085
1039
  def __generate_entire_reference(self, projectname: str, project_version: str, reference_folder: str) -> None:
1086
1040
  all_available_version_identifier_folders_of_reference: list[str] = list(folder for folder in GeneralUtilities.get_direct_folders_of_folder(reference_folder))
1087
- all_available_version_identifier_folders_of_reference = sorted(all_available_version_identifier_folders_of_reference,
1088
- key=cmp_to_key(TasksForCommonProjectStructure._internal_sort_reference_folder))
1041
+ all_available_version_identifier_folders_of_reference = sorted(all_available_version_identifier_folders_of_reference, key=cmp_to_key(TasksForCommonProjectStructure._internal_sort_reference_folder))
1089
1042
  reference_versions_html_lines = []
1090
1043
  reference_versions_html_lines.append(' <hr/>')
1091
1044
  for all_available_version_identifier_folder_of_reference in all_available_version_identifier_folders_of_reference:
@@ -1141,8 +1094,7 @@ class TasksForCommonProjectStructure:
1141
1094
  # when pusing to "default public" nuget-server then use registry_address: "nuget.org"
1142
1095
  build_artifact_folder = GeneralUtilities.resolve_relative_path(
1143
1096
  f"../../Submodules/{repository_folder_name}/{codeunitname}/Other/Artifacts/BuildResult_NuGet", os.path.dirname(push_script_file))
1144
- self.__sc.push_nuget_build_artifact(self.__sc.find_file_by_extension(build_artifact_folder, "nupkg"),
1145
- registry_address, api_key)
1097
+ self.__sc.push_nuget_build_artifact(self.__sc.find_file_by_extension(build_artifact_folder, "nupkg"), registry_address, api_key)
1146
1098
 
1147
1099
  @GeneralUtilities.check_arguments
1148
1100
  def assert_no_uncommitted_changes(self, repository_folder: str):
@@ -1199,21 +1151,17 @@ class TasksForCommonProjectStructure:
1199
1151
  @GeneralUtilities.check_arguments
1200
1152
  def codeunit_is_enabled(self, codeunit_file: str) -> bool:
1201
1153
  root: etree._ElementTree = etree.parse(codeunit_file)
1202
- return GeneralUtilities.string_to_boolean(str(root.xpath('//cps:codeunit/@enabled', namespaces={
1203
- 'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure'
1204
- })[0]))
1154
+ return GeneralUtilities.string_to_boolean(str(root.xpath('//cps:codeunit/@enabled', namespaces={ 'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure' })[0]))
1205
1155
 
1206
1156
  @GeneralUtilities.check_arguments
1207
- def merge_to_main_branch(self, repository_folder: str, source_branch: str = "other/next-release",
1208
- target_branch: str = "main", verbosity: int = 1, additional_arguments_file: str = None, fast_forward_source_branch: bool = False) -> None:
1157
+ def merge_to_main_branch(self, repository_folder: str, source_branch: str = "other/next-release", target_branch: str = "main", verbosity: int = 1, additional_arguments_file: str = None, fast_forward_source_branch: bool = False) -> None:
1209
1158
  # This is an automatization for automatic merges. Usual this merge would be done by a pull request in a sourcecode-version-control-platform
1210
1159
  # (like GitHub, GitLab or Azure DevOps)
1211
1160
  self.assert_no_uncommitted_changes(repository_folder)
1212
1161
 
1213
1162
  src_branch_commit_id = self.__sc.git_get_commit_id(repository_folder, source_branch)
1214
1163
  if (src_branch_commit_id == self.__sc.git_get_commit_id(repository_folder, target_branch)):
1215
- raise ValueError(
1216
- f"Can not merge because the source-branch and the target-branch are on the same commit (commit-id: {src_branch_commit_id})")
1164
+ raise ValueError( f"Can not merge because the source-branch and the target-branch are on the same commit (commit-id: {src_branch_commit_id})")
1217
1165
 
1218
1166
  self.__sc.git_checkout(repository_folder, source_branch)
1219
1167
  self.build_codeunits(repository_folder, verbosity, "QualityCheck", additional_arguments_file, True, None)
@@ -1235,9 +1183,7 @@ class TasksForCommonProjectStructure:
1235
1183
  self.__sc.git_checkout(build_repository_folder, createRelease_configuration.build_repository_branch)
1236
1184
 
1237
1185
  repository_folder = GeneralUtilities.resolve_relative_path(f"Submodules{os.path.sep}{createRelease_configuration.repository_folder_name}", build_repository_folder)
1238
- mergeInformation = MergeToStableBranchInformationForProjectInCommonProjectFormat(repository_folder,
1239
- createRelease_configuration.additional_arguments_file,
1240
- createRelease_configuration.artifacts_folder)
1186
+ mergeInformation = MergeToStableBranchInformationForProjectInCommonProjectFormat(repository_folder, createRelease_configuration.additional_arguments_file, createRelease_configuration.artifacts_folder)
1241
1187
 
1242
1188
  # TODO check if repository_folder-merge-source-branch and repository_folder-merge-target-branch have different commits
1243
1189
  self.assert_no_uncommitted_changes(repository_folder)
@@ -1248,29 +1194,19 @@ class TasksForCommonProjectStructure:
1248
1194
  mergeInformation.push_source_branch_remote_name = createRelease_configuration.remotename
1249
1195
  new_project_version = self.__standardized_tasks_merge_to_stable_branch(mergeInformation)
1250
1196
 
1251
- createReleaseInformation = CreateReleaseInformationForProjectInCommonProjectFormat(repository_folder,
1252
- createRelease_configuration.artifacts_folder,
1253
- createRelease_configuration.projectname,
1254
- createRelease_configuration.public_repository_url,
1255
- mergeInformation.targetbranch,
1256
- mergeInformation.additional_arguments_file,
1257
- mergeInformation.export_target,
1258
- createRelease_configuration.push_artifacts_scripts_folder)
1197
+ createReleaseInformation = CreateReleaseInformationForProjectInCommonProjectFormat(repository_folder, createRelease_configuration.artifacts_folder, createRelease_configuration.projectname, createRelease_configuration.public_repository_url, mergeInformation.targetbranch, mergeInformation.additional_arguments_file, mergeInformation.export_target, createRelease_configuration.push_artifacts_scripts_folder)
1259
1198
  createReleaseInformation.verbosity = createRelease_configuration.verbosity
1260
1199
  self.__standardized_tasks_release_artifact(createReleaseInformation)
1261
1200
 
1262
1201
  self.__sc.git_commit(createReleaseInformation.reference_repository, f"Added reference of {createRelease_configuration.projectname} v{new_project_version}")
1263
1202
  if createRelease_configuration.reference_repository_remote_name is not None:
1264
- self.__sc.git_push(createReleaseInformation.reference_repository, createRelease_configuration.reference_repository_remote_name,
1265
- createRelease_configuration.reference_repository_branch_name, createRelease_configuration.reference_repository_branch_name,
1266
- verbosity=createRelease_configuration.verbosity)
1203
+ self.__sc.git_push(createReleaseInformation.reference_repository, createRelease_configuration.reference_repository_remote_name, createRelease_configuration.reference_repository_branch_name, createRelease_configuration.reference_repository_branch_name, verbosity=createRelease_configuration.verbosity)
1267
1204
  self.__sc.git_commit(build_repository_folder, f"Added {createRelease_configuration.projectname} release v{new_project_version}")
1268
1205
  GeneralUtilities.write_message_to_stdout(f"Finished release for project {createRelease_configuration.projectname} v{new_project_version} successfully.")
1269
1206
  return new_project_version
1270
1207
 
1271
1208
  @GeneralUtilities.check_arguments
1272
- def create_release_starter_for_repository_in_standardized_format(self, create_release_file: str, logfile: str, verbosity: int, addLogOverhead: bool,
1273
- commandline_arguments: list[str]):
1209
+ def create_release_starter_for_repository_in_standardized_format(self, create_release_file: str, logfile: str, verbosity: int, addLogOverhead: bool, commandline_arguments: list[str]):
1274
1210
  # hint: arguments can be overwritten by commandline_arguments
1275
1211
  folder_of_this_file = os.path.dirname(create_release_file)
1276
1212
  verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
@@ -1279,19 +1215,16 @@ class TasksForCommonProjectStructure:
1279
1215
 
1280
1216
  @GeneralUtilities.check_arguments
1281
1217
  def __standardized_tasks_merge_to_stable_branch(self, information: MergeToStableBranchInformationForProjectInCommonProjectFormat) -> str:
1282
-
1283
1218
  src_branch_commit_id = self.__sc.git_get_commit_id(information.repository, information.sourcebranch)
1284
1219
  if (src_branch_commit_id == self.__sc.git_get_commit_id(information.repository, information.targetbranch)):
1285
- raise ValueError(
1286
- f"Can not merge because the source-branch and the target-branch are on the same commit (commit-id: {src_branch_commit_id})")
1220
+ raise ValueError(f"Can not merge because the source-branch and the target-branch are on the same commit (commit-id: {src_branch_commit_id})")
1287
1221
 
1288
1222
  self.assert_no_uncommitted_changes(information.repository)
1289
1223
  self.__sc.git_checkout(information.repository, information.sourcebranch)
1290
1224
  self.__sc.run_program("git", "clean -dfx", information.repository, verbosity=information.verbosity, throw_exception_if_exitcode_is_not_zero=True)
1291
1225
  project_version = self.__sc.get_semver_version_from_gitversion(information.repository)
1292
1226
 
1293
- self.build_codeunits(information.repository, information.verbosity, information.target_environmenttype_for_qualitycheck,
1294
- information.additional_arguments_file, False, information.export_target)
1227
+ self.build_codeunits(information.repository, information.verbosity, information.target_environmenttype_for_qualitycheck, information.additional_arguments_file, False, information.export_target)
1295
1228
 
1296
1229
  self.assert_no_uncommitted_changes(information.repository)
1297
1230
 
@@ -1300,19 +1233,16 @@ class TasksForCommonProjectStructure:
1300
1233
 
1301
1234
  if information.push_source_branch:
1302
1235
  GeneralUtilities.write_message_to_stdout("Push source-branch...")
1303
- self.__sc.git_push(information.repository, information.push_source_branch_remote_name,
1304
- information.sourcebranch, information.sourcebranch, pushalltags=True, verbosity=information.verbosity)
1236
+ self.__sc.git_push(information.repository, information.push_source_branch_remote_name, information.sourcebranch, information.sourcebranch, pushalltags=True, verbosity=information.verbosity)
1305
1237
 
1306
1238
  if information.push_target_branch:
1307
1239
  GeneralUtilities.write_message_to_stdout("Push target-branch...")
1308
- self.__sc.git_push(information.repository, information.push_target_branch_remote_name,
1309
- information.targetbranch, information.targetbranch, pushalltags=True, verbosity=information.verbosity)
1240
+ self.__sc.git_push(information.repository, information.push_target_branch_remote_name, information.targetbranch, information.targetbranch, pushalltags=True, verbosity=information.verbosity)
1310
1241
 
1311
1242
  return project_version
1312
1243
 
1313
1244
  @GeneralUtilities.check_arguments
1314
- def standardized_tasks_build_for_docker_project(self, build_script_file: str, target_environment_type: str,
1315
- verbosity: int, commandline_arguments: list[str]) -> None:
1245
+ def standardized_tasks_build_for_docker_project(self, build_script_file: str, target_environment_type: str, verbosity: int, commandline_arguments: list[str]) -> None:
1316
1246
  use_cache: bool = False
1317
1247
  verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
1318
1248
  sc: ScriptCollectionCore = ScriptCollectionCore()
@@ -1320,8 +1250,7 @@ class TasksForCommonProjectStructure:
1320
1250
  codeunit_folder = GeneralUtilities.resolve_relative_path("../..", str(os.path.dirname(build_script_file)))
1321
1251
  codeunitname_lower = codeunitname.lower()
1322
1252
  codeunitversion = self.get_version_of_codeunit(os.path.join(codeunit_folder, f"{codeunitname}.codeunit.xml"))
1323
- args = ["image", "build", "--pull", "--force-rm", "--progress=plain", "--build-arg", f"TargetEnvironmentType={target_environment_type}",
1324
- "--tag", f"{codeunitname_lower}:latest", "--tag", f"{codeunitname_lower}:{codeunitversion}", "--file", f"{codeunitname}/Dockerfile"]
1253
+ args = ["image", "build", "--pull", "--force-rm", "--progress=plain", "--build-arg", f"TargetEnvironmentType={target_environment_type}", "--tag", f"{codeunitname_lower}:latest", "--tag", f"{codeunitname_lower}:{codeunitversion}", "--file", f"{codeunitname}/Dockerfile"]
1325
1254
  if not use_cache:
1326
1255
  args.append("--no-cache")
1327
1256
  args.append(".")
@@ -1331,9 +1260,7 @@ class TasksForCommonProjectStructure:
1331
1260
  app_artifacts_folder = os.path.join(artifacts_folder, "BuildResult_OCIImage")
1332
1261
  GeneralUtilities.ensure_directory_does_not_exist(app_artifacts_folder)
1333
1262
  GeneralUtilities.ensure_directory_exists(app_artifacts_folder)
1334
- self.__sc.run_program_argsasarray("docker", ["save", "--output", f"{codeunitname}_v{codeunitversion}.tar",
1335
- f"{codeunitname_lower}:{codeunitversion}"], app_artifacts_folder,
1336
- verbosity=verbosity, print_errors_as_information=True)
1263
+ self.__sc.run_program_argsasarray("docker", ["save", "--output", f"{codeunitname}_v{codeunitversion}.tar", f"{codeunitname_lower}:{codeunitversion}"], app_artifacts_folder, verbosity=verbosity, print_errors_as_information=True)
1337
1264
  self.copy_source_files_to_output_directory(build_script_file)
1338
1265
 
1339
1266
  @GeneralUtilities.check_arguments
@@ -1346,8 +1273,7 @@ class TasksForCommonProjectStructure:
1346
1273
  sbom_folder = os.path.join(artifacts_folder, "BOM")
1347
1274
  codeunitversion = self.get_version_of_codeunit(os.path.join(codeunit_folder, f"{codeunitname}.codeunit.xml"))
1348
1275
  GeneralUtilities.ensure_directory_exists(sbom_folder)
1349
- self.__sc.run_program_argsasarray("docker", ["sbom", "--format", "cyclonedx", f"{codeunitname_lower}:{codeunitversion}",
1350
- "--output", f"{codeunitname}.{codeunitversion}.sbom.xml"], sbom_folder, verbosity=verbosity, print_errors_as_information=True)
1276
+ self.__sc.run_program_argsasarray("docker", ["sbom", "--format", "cyclonedx", f"{codeunitname_lower}:{codeunitversion}", "--output", f"{codeunitname}.{codeunitversion}.sbom.xml"], sbom_folder, verbosity=verbosity, print_errors_as_information=True)
1351
1277
 
1352
1278
  @GeneralUtilities.check_arguments
1353
1279
  def push_docker_build_artifact(self, push_artifacts_file: str, registry: str, verbosity: int, push_readme: bool, commandline_arguments: list[str], repository_folder_name: str) -> None:
@@ -1386,9 +1312,7 @@ class TasksForCommonProjectStructure:
1386
1312
  @GeneralUtilities.check_arguments
1387
1313
  def get_dependent_code_units(self, codeunit_file: str) -> set[str]:
1388
1314
  root: etree._ElementTree = etree.parse(codeunit_file)
1389
- return set(root.xpath('//cps:dependentcodeunit/text()', namespaces={
1390
- 'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure'
1391
- }))
1315
+ return set(root.xpath('//cps:dependentcodeunit/text()', namespaces={ 'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure' }))
1392
1316
 
1393
1317
  @GeneralUtilities.check_arguments
1394
1318
  def dependent_codeunit_exists(self, repository:str,codeunit:str) -> None:
@@ -1417,12 +1341,10 @@ class TasksForCommonProjectStructure:
1417
1341
  shutil.copyfile(source_file, target_file)
1418
1342
 
1419
1343
  @GeneralUtilities.check_arguments
1420
- def standardized_tasks_do_common_tasks(self, common_tasks_scripts_file: str, codeunit_version: str, verbosity: int, targetenvironmenttype: str, clear_artifacts_folder: bool,
1421
- additional_arguments_file: str, assume_dependent_codeunits_are_already_built: bool, commandline_arguments: list[str]) -> None:
1344
+ def standardized_tasks_do_common_tasks(self, common_tasks_scripts_file: str, codeunit_version: str, verbosity: int, targetenvironmenttype: str, clear_artifacts_folder: bool, additional_arguments_file: str, assume_dependent_codeunits_are_already_built: bool, commandline_arguments: list[str]) -> None:
1422
1345
  additional_arguments_file = self.get_additionalargumentsfile_from_commandline_arguments(commandline_arguments, additional_arguments_file)
1423
1346
  target_environmenttype = self.get_targetenvironmenttype_from_commandline_arguments(commandline_arguments, targetenvironmenttype)
1424
- assume_dependent_codeunits_are_already_built = self.get_assume_dependent_codeunits_are_already_built_from_commandline_arguments(commandline_arguments,
1425
- assume_dependent_codeunits_are_already_built)
1347
+ assume_dependent_codeunits_are_already_built = self.get_assume_dependent_codeunits_are_already_built_from_commandline_arguments(commandline_arguments, assume_dependent_codeunits_are_already_built)
1426
1348
  if commandline_arguments is None:
1427
1349
  raise ValueError('The "commandline_arguments"-parameter is not defined.')
1428
1350
  if len(commandline_arguments) == 0:
@@ -1487,10 +1409,7 @@ class TasksForCommonProjectStructure:
1487
1409
  for actual_author in actual_authors:
1488
1410
  if not (actual_author) in expected_authors:
1489
1411
  actual_author_formatted = f"{actual_author[0]} <{actual_author[1]}>"
1490
- raise ValueError(f'Author/Comitter "{actual_author_formatted}" is not in the codeunit-developer-team. If {actual_author} is a '
1491
- + 'authorized developer for this codeunit you should consider defining this in the codeunit-file or adapting the name using a '
1492
- + '.mailmap-file (see https://git-scm.com/docs/gitmailmap). The developer-team-check can also be disabled using '
1493
- + 'the property validate_developers_of_repository.')
1412
+ raise ValueError(f'Author/Comitter "{actual_author_formatted}" is not in the codeunit-developer-team. If {actual_author} is a authorized developer for this codeunit you should consider defining this in the codeunit-file or adapting the name using a .mailmap-file (see https://git-scm.com/docs/gitmailmap). The developer-team-check can also be disabled using the property validate_developers_of_repository.')
1494
1413
 
1495
1414
  dependent_codeunits=self.get_dependent_code_units(codeunit_file)
1496
1415
  for dependent_codeunit in dependent_codeunits:
@@ -1548,9 +1467,7 @@ class TasksForCommonProjectStructure:
1548
1467
  src_prefix = latest_tag
1549
1468
  dst = "HEAD"
1550
1469
  dst_prefix = f"v{current_version}"
1551
- self.__sc.run_program_argsasarray(
1552
- "sh", ['-c', f'git diff --src-prefix={src_prefix}/ --dst-prefix={dst_prefix}/ {src} {dst} -- {codeunit_name} | ' +
1553
- f'pygmentize -l diff -f html -O full -o {target_file} -P style=github-dark'], repository_folder)
1470
+ self.__sc.run_program_argsasarray( "sh", ['-c', f'git diff --src-prefix={src_prefix}/ --dst-prefix={dst_prefix}/ {src} {dst} -- {codeunit_name} | pygmentize -l diff -f html -O full -o {target_file} -P style=github-dark'], repository_folder)
1554
1471
 
1555
1472
  @GeneralUtilities.check_arguments
1556
1473
  def get_version_of_project(self, repository_folder: str) -> str:
@@ -1564,8 +1481,7 @@ class TasksForCommonProjectStructure:
1564
1481
  self.__sc.replace_version_in_nuspec_file(nuspec_file, codeunit_version)
1565
1482
 
1566
1483
  @GeneralUtilities.check_arguments
1567
- def standardized_tasks_build_for_angular_codeunit(self, build_script_file: str, build_environment_target_type: str,
1568
- verbosity: int, commandline_arguments: list[str]) -> None:
1484
+ def standardized_tasks_build_for_angular_codeunit(self, build_script_file: str, build_environment_target_type: str, verbosity: int, commandline_arguments: list[str]) -> None:
1569
1485
  verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
1570
1486
  build_script_folder = os.path.dirname(build_script_file)
1571
1487
  codeunit_folder = GeneralUtilities.resolve_relative_path("../..", build_script_folder)
@@ -1588,8 +1504,7 @@ class TasksForCommonProjectStructure:
1588
1504
  # TODO check if there are errors in sarif-file
1589
1505
 
1590
1506
  @GeneralUtilities.check_arguments
1591
- def standardized_tasks_run_testcases_for_flutter_project_in_common_project_structure(self, script_file: str, verbosity: int,
1592
- args: list[str], package_name: str,build_environment_target_type: str, generate_badges: bool):
1507
+ def standardized_tasks_run_testcases_for_flutter_project_in_common_project_structure(self, script_file: str, verbosity: int, args: list[str], package_name: str,build_environment_target_type: str, generate_badges: bool):
1593
1508
  codeunit_folder = GeneralUtilities.resolve_relative_path("../../..", script_file)
1594
1509
  repository_folder = GeneralUtilities.resolve_relative_path("..", codeunit_folder)
1595
1510
  codeunit_name=os.path.basename(codeunit_folder)
@@ -1614,9 +1529,7 @@ class TasksForCommonProjectStructure:
1614
1529
  self.run_testcases_common_post_task(repository_folder,codeunit_name,verbosity,generate_badges,build_environment_target_type,args)
1615
1530
 
1616
1531
  @GeneralUtilities.check_arguments
1617
- def standardized_tasks_run_testcases_for_angular_codeunit(self, runtestcases_script_file: str,
1618
- build_environment_target_type: str, generate_badges: bool, verbosity: int,
1619
- commandline_arguments: list[str]) -> None:
1532
+ def standardized_tasks_run_testcases_for_angular_codeunit(self, runtestcases_script_file: str, build_environment_target_type: str, generate_badges: bool, verbosity: int, commandline_arguments: list[str]) -> None:
1620
1533
  codeunit_name: str = os.path.basename(str(Path(os.path.dirname(runtestcases_script_file)).parent.parent.absolute()))
1621
1534
  verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
1622
1535
  codeunit_folder = GeneralUtilities.resolve_relative_path("../..", os.path.dirname(runtestcases_script_file))
@@ -1744,8 +1657,7 @@ class TasksForCommonProjectStructure:
1744
1657
  raise ValueError("Too many results found.")
1745
1658
 
1746
1659
  @GeneralUtilities.check_arguments
1747
- def copy_development_certificate_to_default_development_directory(self, codeunit_folder: str, build_environment: str, domain: str = None,
1748
- certificate_resource_name: str = "DevelopmentCertificate") -> None:
1660
+ def copy_development_certificate_to_default_development_directory(self, codeunit_folder: str, build_environment: str, domain: str = None, certificate_resource_name: str = "DevelopmentCertificate") -> None:
1749
1661
  if build_environment == "Development":
1750
1662
  codeunit_name: str = os.path.basename(codeunit_folder)
1751
1663
  if domain is None:
@@ -1813,8 +1725,7 @@ class TasksForCommonProjectStructure:
1813
1725
  shutil.copytree(source_folder, target_folder)
1814
1726
 
1815
1727
  @GeneralUtilities.check_arguments
1816
- def generate_openapi_file(self, buildscript_file: str, runtime: str, verbosity: int, commandline_arguments: list[str],
1817
- swagger_document_name: str = "APISpecification") -> None:
1728
+ def generate_openapi_file(self, buildscript_file: str, runtime: str, verbosity: int, commandline_arguments: list[str], swagger_document_name: str = "APISpecification") -> None:
1818
1729
  codeunitname = os.path.basename(str(Path(os.path.dirname(buildscript_file)).parent.parent.absolute()))
1819
1730
  repository_folder = str(Path(os.path.dirname(buildscript_file)).parent.parent.parent.absolute())
1820
1731
  artifacts_folder = os.path.join(repository_folder, codeunitname, "Other", "Artifacts")
@@ -1835,8 +1746,7 @@ class TasksForCommonProjectStructure:
1835
1746
  json.dump(data, f, indent=2)
1836
1747
 
1837
1748
  @GeneralUtilities.check_arguments
1838
- def build_dependent_code_units(self, repo_folder: str, codeunit_name: str, verbosity: int, target_environmenttype: str,
1839
- additional_arguments_file: str) -> None:
1749
+ def build_dependent_code_units(self, repo_folder: str, codeunit_name: str, verbosity: int, target_environmenttype: str, additional_arguments_file: str) -> None:
1840
1750
  codeunit_file = os.path.join(repo_folder, codeunit_name, codeunit_name + ".codeunit.xml")
1841
1751
  dependent_codeunits = self.get_dependent_code_units(codeunit_file)
1842
1752
  dependent_codeunits_folder = os.path.join(repo_folder, codeunit_name, "Other", "Resources", "DependentCodeUnits")
@@ -1864,8 +1774,7 @@ class TasksForCommonProjectStructure:
1864
1774
  shutil.copytree(artifacts_folder, target_folder)
1865
1775
 
1866
1776
  @GeneralUtilities.check_arguments
1867
- def add_github_release(self, productname: str, projectversion: str, build_artifacts_folder: str, github_username: str, repository_folder: str,
1868
- verbosity: int, commandline_arguments: list[str]) -> None:
1777
+ def add_github_release(self, productname: str, projectversion: str, build_artifacts_folder: str, github_username: str, repository_folder: str, verbosity: int, commandline_arguments: list[str]) -> None:
1869
1778
  verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
1870
1779
  github_repo = f"{github_username}/{productname}"
1871
1780
  artifact_files = []
@@ -1909,6 +1818,13 @@ class TasksForCommonProjectStructure:
1909
1818
  def update_dependencies_of_typical_node_codeunit(self, update_script_file: str, verbosity: int, cmd_args: list[str]) -> None:
1910
1819
  pass # TODO generalize and add option to ignore certain dependencies
1911
1820
 
1821
+ @GeneralUtilities.check_arguments
1822
+ def run_local_test_service(self, file:str):
1823
+ example_folder=os.path.dirname(file)
1824
+ example_name=os.path.basename(example_folder)
1825
+ title=f"Test{example_name}"
1826
+ self.__sc.run_program("docker",f"compose -p {title.lower()} up",example_folder,title=title)
1827
+
1912
1828
  @GeneralUtilities.check_arguments
1913
1829
  def standardized_tasks_update_version_in_docker_examples(self, file, codeunit_version) -> None:
1914
1830
  folder_of_current_file = os.path.dirname(file)
@@ -1955,7 +1871,7 @@ class TasksForCommonProjectStructure:
1955
1871
  sc_epew = ScriptCollectionCore()
1956
1872
  sc_epew.program_runner = ProgramRunnerEpew()
1957
1873
  GeneralUtilities.write_message_to_stdout("Start docker-container...")
1958
- sc_epew.run_program("docker-compose", f"--project-name {docker_project_name} up --abort-on-container-exit", folder, verbosity=verbosity)
1874
+ sc_epew.run_program("docker", f"compose --project-name {docker_project_name} up --abort-on-container-exit", folder, verbosity=verbosity)
1959
1875
 
1960
1876
 
1961
1877
  @GeneralUtilities.check_arguments
@@ -2001,8 +1917,7 @@ class TasksForCommonProjectStructure:
2001
1917
  repository_folder)
2002
1918
 
2003
1919
  @GeneralUtilities.check_arguments
2004
- def build_codeunits(self, repository_folder: str, verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None,
2005
- is_pre_merge: bool = False, export_target_directory: str = None) -> None:
1920
+ 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) -> None:
2006
1921
  repository_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(repository_folder)
2007
1922
  codeunits = self.get_codeunits(repository_folder, False)
2008
1923
  self.build_specific_codeunits(repository_folder, codeunits, verbosity, target_environmenttype, additional_arguments_file, is_pre_merge, export_target_directory)
@@ -2015,9 +1930,7 @@ class TasksForCommonProjectStructure:
2015
1930
  raise ValueError(f'Project-name can not be calculated for repository "{repository_folder}"')
2016
1931
 
2017
1932
  @GeneralUtilities.check_arguments
2018
- def build_specific_codeunits(self, repository_folder: str, codeunits: list[str], verbosity: int = 1, target_environmenttype: str = "QualityCheck",
2019
- additional_arguments_file: str = None, is_pre_merge: bool = False, export_target_directory: str = None,
2020
- assume_dependent_codeunits_are_already_built: bool = True) -> None:
1933
+ 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) -> None:
2021
1934
  repository_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(repository_folder)
2022
1935
  contains_uncommitted_changes = self.__sc.git_repository_has_uncommitted_changes(repository_folder)
2023
1936
  if is_pre_merge and contains_uncommitted_changes:
@@ -2181,13 +2094,11 @@ class TasksForCommonProjectStructure:
2181
2094
 
2182
2095
  @GeneralUtilities.check_arguments
2183
2096
  def ensure_plantuml_is_available(self, codeunit_folder: str) -> None:
2184
- self.ensure_file_from_github_assets_is_available(codeunit_folder, "plantuml", "plantuml", "PlantUML", "plantuml.jar",
2185
- lambda latest_version: "plantuml.jar")
2097
+ self.ensure_file_from_github_assets_is_available(codeunit_folder, "plantuml", "plantuml", "PlantUML", "plantuml.jar", lambda latest_version: "plantuml.jar")
2186
2098
 
2187
2099
  @GeneralUtilities.check_arguments
2188
2100
  def ensure_androidappbundletool_is_available(self, codeunit_folder: str) -> None:
2189
- self.ensure_file_from_github_assets_is_available(codeunit_folder, "google", "bundletool", "AndroidAppBundleTool", "bundletool.jar",
2190
- lambda latest_version: f"bundletool-all-{latest_version}.jar")
2101
+ self.ensure_file_from_github_assets_is_available(codeunit_folder, "google", "bundletool", "AndroidAppBundleTool", "bundletool.jar", lambda latest_version: f"bundletool-all-{latest_version}.jar")
2191
2102
 
2192
2103
  @GeneralUtilities.check_arguments
2193
2104
  def ensure_file_from_github_assets_is_available(self, codeunit_folder: str, githubuser: str, githubprojectname: str, resource_name: str, local_filename: str, get_filename_on_github) -> None:
@@ -2221,9 +2132,7 @@ class TasksForCommonProjectStructure:
2221
2132
  sc.run_program_argsasarray("java", argument, os.path.dirname(file))
2222
2133
 
2223
2134
  @GeneralUtilities.check_arguments
2224
- def load_deb_control_file_content(self, file: str,
2225
- codeunitname: str, codeunitversion: str, installedsize: int,
2226
- maintainername: str, maintaineremail: str, description: str,) -> str:
2135
+ def load_deb_control_file_content(self, file: str, codeunitname: str, codeunitversion: str, installedsize: int, maintainername: str, maintaineremail: str, description: str,) -> str:
2227
2136
  content = GeneralUtilities.read_text_from_file(file)
2228
2137
  content = GeneralUtilities.replace_variable_in_string(content, "codeunitname", codeunitname)
2229
2138
  content = GeneralUtilities.replace_variable_in_string(content, "codeunitversion", codeunitversion)
@@ -2242,17 +2151,14 @@ class TasksForCommonProjectStructure:
2242
2151
  return result
2243
2152
 
2244
2153
  @GeneralUtilities.check_arguments
2245
- def create_deb_package_for_artifact(self, codeunit_folder: str,
2246
- maintainername: str, maintaineremail: str, description: str,
2247
- verbosity: int, cmd_arguments: list[str]) -> None:
2154
+ def create_deb_package_for_artifact(self, codeunit_folder: str, maintainername: str, maintaineremail: str, description: str, verbosity: int, cmd_arguments: list[str]) -> None:
2248
2155
  verbosity = self.get_verbosity_from_commandline_arguments(cmd_arguments, verbosity)
2249
2156
  codeunit_name = os.path.basename(codeunit_folder)
2250
2157
  binary_folder = GeneralUtilities.resolve_relative_path("Other/Artifacts/BuildResult_DotNet_linux-x64", codeunit_folder)
2251
2158
  deb_output_folder = GeneralUtilities.resolve_relative_path("Other/Artifacts/BuildResult_Deb", codeunit_folder)
2252
2159
  control_file = GeneralUtilities.resolve_relative_path("Other/Build/DebControlFile.txt", codeunit_folder)
2253
2160
  installedsize = self.calculate_deb_package_size(binary_folder)
2254
- control_file_content = self.load_deb_control_file_content(control_file, codeunit_name, self.get_version_of_codeunit_folder(codeunit_folder),
2255
- installedsize, maintainername, maintaineremail, description)
2161
+ control_file_content = self.load_deb_control_file_content(control_file, codeunit_name, self.get_version_of_codeunit_folder(codeunit_folder), installedsize, maintainername, maintaineremail, description)
2256
2162
  self.__sc.create_deb_package(codeunit_name, binary_folder, control_file_content, deb_output_folder, verbosity, 555)
2257
2163
 
2258
2164
 
@@ -2306,8 +2212,7 @@ class TasksForCommonProjectStructure:
2306
2212
  GeneralUtilities.write_message_to_stderr(f"Warning: {message}")
2307
2213
 
2308
2214
  @GeneralUtilities.check_arguments
2309
- def __build_codeunit(self, codeunit_folder: str, verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None,
2310
- is_pre_merge: bool = False, assume_dependent_codeunits_are_already_built: bool = False) -> None:
2215
+ 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) -> None:
2311
2216
  now = datetime.now()
2312
2217
  codeunit_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(codeunit_folder)
2313
2218
  codeunit_name: str = os.path.basename(codeunit_folder)
@@ -2370,36 +2275,30 @@ class TasksForCommonProjectStructure:
2370
2275
  c_additionalargumentsfile_argument = f' --overwrite_additionalargumentsfile "{additional_arguments_file}"'
2371
2276
 
2372
2277
  GeneralUtilities.write_message_to_stdout('Run "CommonTasks.py"...')
2373
- self.__sc.run_program("python", f"CommonTasks.py{additional_arguments_c}{general_argument}{c_additionalargumentsfile_argument}", other_folder,
2374
- verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True)
2278
+ self.__sc.run_program("python", f"CommonTasks.py{additional_arguments_c}{general_argument}{c_additionalargumentsfile_argument}", other_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True)
2375
2279
  self.verify_artifact_exists(codeunit_folder, dict[str, bool]({"Changelog": False, "License": True, "DiffReport": True}))
2376
2280
 
2377
2281
  GeneralUtilities.write_message_to_stdout('Run "Build.py"...')
2378
- self.__sc.run_program("python", f"Build.py{additional_arguments_b}{general_argument}", build_folder,
2379
- verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True)
2282
+ self.__sc.run_program("python", f"Build.py{additional_arguments_b}{general_argument}", build_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True)
2380
2283
  self.verify_artifact_exists(codeunit_folder, dict[str, bool]({"BuildResult_.+": True, "BOM": False, "CodeAnalysisResult": False, "SourceCode": True}))
2381
2284
 
2382
2285
  codeunit_hast_testable_sourcecode = self.codeunit_has_testable_sourcecode(codeunit_file)
2383
2286
  if codeunit_hast_testable_sourcecode:
2384
2287
  GeneralUtilities.write_message_to_stdout('Run "RunTestcases.py"...')
2385
- self.__sc.run_program("python", f"RunTestcases.py{additional_arguments_r}{general_argument}",quality_folder,
2386
- verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True)
2288
+ self.__sc.run_program("python", f"RunTestcases.py{additional_arguments_r}{general_argument}",quality_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True)
2387
2289
  self.verify_artifact_exists(codeunit_folder, dict[str, bool]({"TestCoverage": True, "TestCoverageReport": False}))
2388
2290
 
2389
2291
  GeneralUtilities.write_message_to_stdout('Run "Linting.py"...')
2390
- self.__sc.run_program("python", f"Linting.py{additional_arguments_l}{general_argument}", quality_folder,
2391
- verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True)
2292
+ self.__sc.run_program("python", f"Linting.py{additional_arguments_l}{general_argument}", quality_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True)
2392
2293
  self.verify_artifact_exists(codeunit_folder, dict[str, bool]())
2393
2294
 
2394
2295
  GeneralUtilities.write_message_to_stdout('Run "GenerateReference.py"...')
2395
- self.__sc.run_program("python", f"GenerateReference.py{additional_arguments_g}{general_argument}", reference_folder,
2396
- verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True)
2296
+ self.__sc.run_program("python", f"GenerateReference.py{additional_arguments_g}{general_argument}", reference_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True)
2397
2297
  self.verify_artifact_exists(codeunit_folder, dict[str, bool]({"Reference": True}))
2398
2298
 
2399
2299
  if os.path.isfile(os.path.join(other_folder, "OnBuildingFinished.py")):
2400
2300
  GeneralUtilities.write_message_to_stdout('Run "OnBuildingFinished.py"...')
2401
- self.__sc.run_program("python", f"OnBuildingFinished.py{additional_arguments_f}{general_argument}", other_folder,
2402
- verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True)
2301
+ self.__sc.run_program("python", f"OnBuildingFinished.py{additional_arguments_f}{general_argument}", other_folder, verbosity=verbosity_for_executed_programs, throw_exception_if_exitcode_is_not_zero=True)
2403
2302
 
2404
2303
  artifactsinformation_file = os.path.join(artifacts_folder, f"{codeunit_name}.artifactsinformation.xml")
2405
2304
  codeunit_version = self.get_version_of_codeunit(codeunit_file)