Example #1
0
    def update_starter_project(self) -> None:
        STARTER_PATH_OLD_SINGLE_HEADER = F"{release_constants.starter_project_dir}/lib/{self.details.old_single_header}"
        STARTER_PATH_NEW_SINGLE_HEADER = F"{release_constants.starter_project_dir}/lib/{self.details.new_single_header}"

        # Make sure starter project folder is clean
        project_dir = release_constants.starter_project_dir
        GitUtilities.reset_and_clean_working_directory(project_dir)

        shutil.copyfile(self.details.release_new_single_header,
                        STARTER_PATH_NEW_SINGLE_HEADER)

        # Delete the last release:
        if os.path.exists(STARTER_PATH_OLD_SINGLE_HEADER):
            os.remove(STARTER_PATH_OLD_SINGLE_HEADER)

        # Update the version in the "redirect" header:
        replace_text_in_file(
            F"{release_constants.starter_project_dir}/lib/ApprovalTests.hpp",
            self.details.old_version.get_version_text(),
            self.details.new_version.get_version_text())

        # Update the version number in the Visual Studio project:
        replace_text_in_file(
            F"{release_constants.starter_project_dir}/visual-studio-2017/StarterProject.vcxproj",
            self.details.old_single_header, self.details.new_single_header)
    def prepare_release(details: ReleaseDetails) -> None:
        GitUtilities.reset_and_clean_working_directory(
            ConanReleaseDetails().conan_repo_dir)

        response = input(
            "  Conan: Has the previous pull request been accepted? [Y/y] ")
        if response in ['Y', 'y']:
            PrepareConanRelease.sync_conan_repo(details.new_version)
        else:
            # Do nothing - we are adding to our previous Pull Request
            # This does assume the same user is doing the previous and current release.
            print('Staying on current branch in conan repo')
        PrepareConanRelease.update_conan_recipe(details)
Example #3
0
    def prepare_release(details: ReleaseDetails) -> None:
        if not details.project_details.update_conan:
            return

        GitUtilities.reset_and_clean_working_directory(details.conan_details.conan_repo_dir)

        accepted = details.old_version.get_version_text_without_v() in PrepareConanRelease.get_accepted_approval_releases(
            details.project_details)
        if accepted:
            PrepareConanRelease.sync_conan_repo(details.conan_details, details.project_details, details.new_version)
        else:
            # Do nothing - we are adding to our previous Pull Request
            # This does assume the same user is doing the previous and current release.
            print('Staying on current branch in conan repo')
        PrepareConanRelease.update_conan_recipe(details)
    def update_starter_project(details: ReleaseDetails) -> None:
        STARTER_PATH_OLD_SINGLE_HEADER = F"{details.locations.starter_project_dir}/lib/{details.old_single_header}"
        STARTER_PATH_NEW_SINGLE_HEADER = F"{details.locations.starter_project_dir}/lib/{details.new_single_header}"

        # Make sure starter project folder is clean
        project_dir = details.locations.starter_project_dir
        GitUtilities.reset_and_clean_working_directory(project_dir)

        shutil.copyfile(details.release_new_single_header,
                        STARTER_PATH_NEW_SINGLE_HEADER)

        # Delete the last release:
        if os.path.exists(STARTER_PATH_OLD_SINGLE_HEADER):
            os.remove(STARTER_PATH_OLD_SINGLE_HEADER)
        else:
            raise RuntimeError(F"""
    ----------------------------------------------------------------
    ERROR: Old header file does not exist:
    {STARTER_PATH_OLD_SINGLE_HEADER}
    Starting state of Starter Project does not match '{details.old_version.get_version_text()}'
    Check whether:
    1. There were uncommitted changes to version.ini in main project,
       from a previous release preparation step.
    2. The Starter Project repo needs pulling.
    3. This is a CI build of a release tag - in which case the
       updated Starter Project has not yet been pushed, and this 
       failure can be ignored.
    ----------------------------------------------------------------
    
    """)

        # Update the version in the "redirect" header:
        replace_text_in_file(
            F"{details.locations.starter_project_dir}/lib/{details.project_details.simulated_single_header_file}",
            details.old_version.get_version_text(),
            details.new_version.get_version_text())

        # Update the version number in the Visual Studio projects:
        PrepareStarterProjectRelease.update_solution_file(
            details,
            F"{details.locations.starter_project_dir}/visual-studio-2017/StarterProject.vcxproj"
        )
        PrepareStarterProjectRelease.update_solution_file(
            details,
            F"{details.locations.starter_project_dir}/visual-studio-2019/StarterProject2019.vcxproj"
        )
    def update_starter_project(self) -> None:
        STARTER_PATH_OLD_SINGLE_HEADER = F"{self.details.locations.starter_project_dir}/lib/{self.details.old_single_header}"
        STARTER_PATH_NEW_SINGLE_HEADER = F"{self.details.locations.starter_project_dir}/lib/{self.details.new_single_header}"

        # Make sure starter project folder is clean
        project_dir = self.details.locations.starter_project_dir
        GitUtilities.reset_and_clean_working_directory(project_dir)

        shutil.copyfile(self.details.release_new_single_header, STARTER_PATH_NEW_SINGLE_HEADER)

        # Delete the last release:
        if os.path.exists(STARTER_PATH_OLD_SINGLE_HEADER):
            os.remove(STARTER_PATH_OLD_SINGLE_HEADER)
        else:
            raise RuntimeError(F"""
----------------------------------------------------------------
ERROR: Old header file does not exist:
{STARTER_PATH_OLD_SINGLE_HEADER}
Starting state of Starter Project does not match '{self.details.old_version.get_version_text()}'
Check whether:
1. There were uncommitted changes to version.ini in main project,
   from a previous release preparation step.
2. The Starter Project repo needs pulling.
----------------------------------------------------------------

""")

        # Update the version in the "redirect" header:
        replace_text_in_file(
            F"{self.details.locations.starter_project_dir}/lib/{self.details.project_details.simulated_single_header_file}",
            self.details.old_version.get_version_text(),
            self.details.new_version.get_version_text())

        # Update the version number in the Visual Studio project:
        visual_studio_2017_sln = F"{self.details.locations.starter_project_dir}/visual-studio-2017/StarterProject.vcxproj"
        if os.path.isfile(visual_studio_2017_sln):
            replace_text_in_file(visual_studio_2017_sln,
                                 self.details.old_single_header,
                                 self.details.new_single_header)
        else:
            print(f"Info: No Visual Studio solution file: {visual_studio_2017_sln}")
Example #6
0
 def prepare_starter_project(details: ReleaseDetails) -> None:
     project_dir = release_constants.starter_project_dir
     GitUtilities.reset_and_clean_working_directory(project_dir)
     PrepareStarterProjectRelease.update_pom(details)
     GitUtilities.add_and_commit_everything(project_dir, details.new_version.get_version_text())
     GitUtilities.push_active_branch_origin(project_dir)