Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apio clean now deletes also old build files that are not in the _build directory. #471

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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