Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
anionDev committed Jan 19, 2023
1 parent e210520 commit 582a399
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
5 changes: 5 additions & 0 deletions Other/Resources/Changelog/v3.3.50.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Release notes

## Changes

- Added checks in `scbuildcodeunits`.
2 changes: 1 addition & 1 deletion ScriptCollection/ScriptCollection.codeunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<cps:codeunit xmlns:cps="https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure" codeunitspecificationversion="1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/raw/main/Conventions/RepositoryStructure/CommonProjectStructure/codeunit.xsd">
<cps:name>ScriptCollection</cps:name>
<cps:version>3.3.49</cps:version>
<cps:version>3.3.50</cps:version>
<cps:minimalcodecoverageinpercent>30</cps:minimalcodecoverageinpercent>
<cps:dependentcodeunits></cps:dependentcodeunits>
</cps:codeunit>
2 changes: 1 addition & 1 deletion ScriptCollection/ScriptCollection/ScriptCollectionCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument


version = "3.3.49"
version = "3.3.50"
__version__ = version


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def get_property_from_commandline_arguments(commandline_arguments: list[str], pr
return result

@GeneralUtilities.check_arguments
def update_version_of_codeunit_to_project_version(self, common_tasks_file: str, current_version: str) -> None:
def update_version_of_codeunit(self, common_tasks_file: str, current_version: str) -> None:
codeunit_name: str = os.path.basename(GeneralUtilities.resolve_relative_path("..", os.path.dirname(common_tasks_file)))
codeunit_file: str = os.path.join(GeneralUtilities.resolve_relative_path("..", os.path.dirname(common_tasks_file)), f"{codeunit_name}.codeunit.xml")
self.write_version_to_codeunit_file(codeunit_file, current_version)
Expand Down Expand Up @@ -965,6 +965,7 @@ def standardized_tasks_do_common_tasks(self, common_tasks_scripts_file: str, ver
repository_folder: str = str(Path(os.path.dirname(common_tasks_scripts_file)).parent.parent.absolute())
codeunitname: str = str(os.path.basename(Path(os.path.dirname(common_tasks_scripts_file)).parent.absolute()))
verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
project_version = self.get_version_of_project(repository_folder)

# Clear previously builded artifacts if desired:
if clear_artifacts_folder:
Expand Down Expand Up @@ -996,17 +997,15 @@ def standardized_tasks_do_common_tasks(self, common_tasks_scripts_file: str, ver
self.build_dependent_code_units(repository_folder, codeunitname, verbosity, target_environmenttype, additional_arguments_file)
self.copy_artifacts_from_dependent_code_units(repository_folder, codeunitname)

# Update version
self.update_version_of_codeunit_to_project_version(common_tasks_scripts_file, version)
# Update codeunit-version
self.update_version_of_codeunit(common_tasks_scripts_file, version)

# set default constants
self.set_default_constants(os.path.join(repository_folder, codeunitname))

# Check if changelog exists
# Copy changelog-file
changelog_folder = os.path.join(repository_folder, "Other", "Resources", "Changelog")
changelog_file = os.path.join(changelog_folder, f"v{version}.md")
if not os.path.isfile(changelog_file):
raise ValueError(f"Changelog-file '{changelog_file}' does not exist.")
changelog_file = os.path.join(changelog_folder, f"v{project_version}.md")
target_folder = os.path.join(repository_folder, codeunitname, "Other", "Artifacts", "Changelog")
GeneralUtilities.ensure_directory_exists(target_folder)
shutil.copy(changelog_file, target_folder)
Expand Down Expand Up @@ -1241,6 +1240,7 @@ def build_codeunits(self, repository_folder: str, verbosity: int = 1, target_env
if os.path.exists(codeunit_file):
codeunits[codeunit_name] = self.get_dependent_code_units(codeunit_file)
sorted_codeunits = self._internal_sort_codenits(codeunits)
project_version = self.get_version_of_project(repository_folder)
if len(sorted_codeunits) == 0:
raise ValueError(f'No codeunit found in subfolders of "{repository_folder}".')
else:
Expand All @@ -1250,11 +1250,11 @@ def build_codeunits(self, repository_folder: str, verbosity: int = 1, target_env
for codeunit in sorted_codeunits:
i = i+1
GeneralUtilities.write_message_to_stdout(f"{i}.: {codeunit}")
self.__do_repository_checks(repository_folder, project_version)
for codeunit in sorted_codeunits:
self.__build_codeunit(os.path.join(repository_folder, codeunit), verbosity, target_environmenttype, additional_arguments_file, is_pre_merge, True)
if export_target_directory is not None:
project_name = os.path.basename(repository_folder)
project_version = self.get_version_of_project(repository_folder)
for codeunit in sorted_codeunits:
codeunit_version = self.get_version_of_codeunit_folder(os.path.join(repository_folder, codeunit))
artifacts_folder = os.path.join(repository_folder, codeunit, "Other", "Artifacts")
Expand All @@ -1266,6 +1266,21 @@ def build_codeunits(self, repository_folder: str, verbosity: int = 1, target_env
archive_file = os.path.join(os.getcwd(), f"{filename_without_extension}.zip")
shutil.move(archive_file, target_folder)

@GeneralUtilities.check_arguments
def __do_repository_checks(self, repository_folder: str, project_version: str):
self.__check_if_changelog_exists(repository_folder, project_version)

@GeneralUtilities.check_arguments
def __check_whether_atifacts_exists(self, codeunit_folder: str):
pass # TODO

@GeneralUtilities.check_arguments
def __check_if_changelog_exists(self, repository_folder: str, project_version: str):
changelog_folder = os.path.join(repository_folder, "Other", "Resources", "Changelog")
changelog_file = os.path.join(changelog_folder, f"v{project_version}.md")
if not os.path.isfile(changelog_file):
raise ValueError(f"Changelog-file '{changelog_file}' does not exist.")

@GeneralUtilities.check_arguments
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:
Expand Down Expand Up @@ -1351,4 +1366,5 @@ def __build_codeunit(self, codeunit_folder: str, verbosity: int = 1, target_envi
# TODO validate artifactsinformation_file against xsd
shutil.copyfile(codeunit_file,
os.path.join(artifacts_folder, f"{codeunit_name}.codeunit.xml"))
self.__check_whether_atifacts_exists(codeunit_folder)
GeneralUtilities.write_message_to_stdout(f"Finished building codeunit {codeunit_name}.")
2 changes: 1 addition & 1 deletion ScriptCollection/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = ScriptCollection
version = 3.3.49
version = 3.3.50
author = Marius Göcke
author_email = [email protected]
description = The ScriptCollection is the place for reusable scripts.
Expand Down

0 comments on commit 582a399

Please sign in to comment.