Skip to content

Commit 8c93331

Browse files
committed
Allow for a full clean.
1 parent a124b32 commit 8c93331

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

Tools/wasm/emscripten/__main__.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,17 @@ def build_all(context):
452452

453453
def clean_contents(context):
454454
"""Delete all files created by this script."""
455-
host_triple_dir = context.build_paths["host_triple_dir"]
456-
if host_triple_dir.exists():
457-
print(f"🧹 Deleting {host_triple_dir} ...")
458-
shutil.rmtree(host_triple_dir)
455+
if context.target in {"all", "build"}:
456+
build_dir = context.build_paths["native_build_dir"]
457+
if build_dir.exists():
458+
print(f"🧹 Deleting {build_dir} ...")
459+
shutil.rmtree(build_dir)
460+
461+
if context.target in {"all", "host"}:
462+
host_triple_dir = context.build_paths["host_triple_dir"]
463+
if host_triple_dir.exists():
464+
print(f"🧹 Deleting {host_triple_dir} ...")
465+
shutil.rmtree(host_triple_dir)
459466

460467
if LOCAL_SETUP.exists():
461468
with LOCAL_SETUP.open("rb") as file:
@@ -493,6 +500,17 @@ def main():
493500
clean = subcommands.add_parser(
494501
"clean", help="Delete files and directories created by this script"
495502
)
503+
clean.add_argument(
504+
"target",
505+
nargs="?",
506+
default="host",
507+
choices=["all", "host", "build"],
508+
help=(
509+
"What should be cleaned. 'build' for just the build platform, or "
510+
"'host' for the host platform, or 'all' for both. Defaults to 'host'."
511+
),
512+
)
513+
496514
for subcommand in (
497515
build,
498516
configure_build,

0 commit comments

Comments
 (0)