From 52b89191452f856a518dfc2bcf9963958948902d Mon Sep 17 00:00:00 2001 From: Zapta Date: Wed, 20 Nov 2024 21:53:54 -0800 Subject: [PATCH] Extended the 'apio clean' command to clean also files from previous release that were created in the src directory (the new apio creates them in a _build sub directory). This is to clean left-over files that may be left from before the transition. This code can be removed once we release the next apio version. --- apio/scons/scons_util.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/apio/scons/scons_util.py b/apio/scons/scons_util.py index 29d59e4b..e515b97c 100644 --- a/apio/scons/scons_util.py +++ b/apio/scons/scons_util.py @@ -768,12 +768,32 @@ def set_up_cleanup(env: SConsEnvironment) -> None: """ # -- Should be called only when the 'clean' target is specified. + # -- If this fails, this is a programming error and not a user error. assert env.GetOption("clean") # -- Get the list of all files to clean. Scons adds to the list non # -- existing files from other targets it encountered. files_to_clean = env.Glob(f"{BUILD_DIR_SEP}*") + env.Glob("zadig.ini") + # -- TODO: Remove the cleanup of legacy files after releasing the first + # -- release with the _build directory. + # -- + # -- + # -- Until apio 0.9.6, the build artifacts were created in the project + # -- directory rather than the _build directory. To simplify the transition + # -- we clean here also left over files from 0.9.5. + legacy_files_to_clean = ( + env.Glob("hardware.*") + env.Glob("*_tb.vcd") + env.Glob("*_tb.out") + ) + + if legacy_files_to_clean: + msg( + env, + "Deleting also left-over files from previous release.", + fg="yellow", + ) + files_to_clean.extend(legacy_files_to_clean) + # -- Create a dummy target. I dummy_target = env.Command( "no-such-file-1", "no-such-file-2", "no-such-action"