Skip to content

Commit

Permalink
Merge branch 'backupsrc' of https://github.com/vmayoral/hlsclt into d…
Browse files Browse the repository at this point in the history
…evelop

Merge in PR to add feature which backs up current source and project
file to HLS solution folder.
  • Loading branch information
benjmarshall committed Jan 6, 2019
2 parents 2b9e2ba + 71d7208 commit 6acbfdd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions hlsclt/build_commands/build_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import subprocess
from hlsclt.helper_funcs import find_solution_num
from hlsclt.report_commands.report_commands import open_report
import shutil

### Supporting Functions ###
# Function to generate the 'pre-amble' within the HLS Tcl build script.
Expand Down Expand Up @@ -108,6 +109,19 @@ def do_export_stuff(ctx,type,evaluate):

# Function which defines the actions that occur after a HLS build.
def do_end_build_stuff(ctx,sub_command_returns,report):
# Copy the src/ files as well as the config file to keep track of the changes over solutions
config = ctx.obj.config
solution_num = ctx.obj.solution_num
click.echo("Copying the source and config files to solution"+str(solution_num))
destiny = config["project_name"] + "/solution" + str(solution_num)
destiny_src = destiny + "/src"
destiny_config = destiny + "/hls_config.py"
# If we are overwriting an existing solution delete the source directory first.
if ctx.params['keep'] == 0:
shutil.rmtree(destiny_src, ignore_errors=True)
shutil.copytree("src", destiny_src)
shutil.copyfile("hls_config.py", destiny_config)

# Check for reporting flag
if report:
if not sub_command_returns:
Expand Down

0 comments on commit 6acbfdd

Please sign in to comment.