Skip to content

Commit

Permalink
Merge pull request #471 from zapta/develop
Browse files Browse the repository at this point in the history
`apio clean` now deletes also old build files that are not in the _build directory.
  • Loading branch information
Obijuan authored Nov 21, 2024
2 parents ec63a6c + 52b8919 commit 1f880d5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions apio/scons/scons_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 1f880d5

Please sign in to comment.