@@ -289,9 +289,15 @@ def clean(host):
289289 delete_glob (CROSS_BUILD_DIR / host )
290290
291291
292- def clean_all (context ):
293- for host in HOSTS + ["build" ]:
294- clean (host )
292+ def clean_targets (context ):
293+ if context .target in {"all" , "build" }:
294+ clean ("build" )
295+
296+ if context .target == "hosts" :
297+ for host in HOSTS :
298+ clean (host )
299+ else :
300+ clean (context .target )
295301
296302
297303def setup_ci ():
@@ -864,7 +870,19 @@ def add_parser(*args, **kwargs):
864870 make_host = add_parser (
865871 "make-host" , help = "Run `make` for Android" )
866872
867- add_parser ("clean" , help = "Delete all build directories" )
873+ clean = add_parser ("clean" , help = "Delete all build directories" )
874+ clean .add_argument (
875+ "target" ,
876+ nargs = "?" ,
877+ default = "all" ,
878+ help = (
879+ "The host triple to clean (e.g., aarch64-linux-android), "
880+ "or 'build' for just the build platform, or 'hosts' for all "
881+ "host platforms, or 'all' for the build platform and all "
882+ "hosts. Defaults to 'all'"
883+ ),
884+ )
885+
868886 add_parser ("build-testbed" , help = "Build the testbed app" )
869887 test = add_parser ("test" , help = "Run the testbed app" )
870888 package = add_parser ("package" , help = "Make a release package" )
@@ -945,7 +963,7 @@ def main():
945963 "configure-host" : configure_host_python ,
946964 "make-host" : make_host_python ,
947965 "build" : build_all ,
948- "clean" : clean_all ,
966+ "clean" : clean_targets ,
949967 "build-testbed" : build_testbed ,
950968 "test" : run_testbed ,
951969 "package" : package ,
0 commit comments