@@ -122,11 +122,11 @@ def handle_invocation(toolchain_bin, args):
122122 if args .sysroot :
123123 env ['SDKROOT' ] = args .sysroot
124124
125- print ('Cleaning ' + args .build_path )
126- shutil .rmtree (args .build_path , ignore_errors = True )
127-
128125 if args .action == 'build' :
129126 swiftpm ('build' , swift_exec , swiftpm_args , env )
127+ elif args .action == 'clean' :
128+ print ('Cleaning ' + args .build_path )
129+ shutil .rmtree (args .build_path , ignore_errors = True )
130130 elif args .action == 'test' :
131131 for tool in driver_toolchain_tools :
132132 tool_path = os .path .join (toolchain_bin , tool )
@@ -157,6 +157,9 @@ def add_common_args(parser):
157157 parser .add_argument ('--verbose' , '-v' , action = 'store_true' , help = 'enable verbose output' )
158158
159159 subparsers = parser .add_subparsers (title = 'subcommands' , dest = 'action' , metavar = 'action' )
160+ clean_parser = subparsers .add_parser ('clean' , help = 'clean the package' )
161+ add_common_args (clean_parser )
162+
160163 build_parser = subparsers .add_parser ('build' , help = 'build the package' )
161164 add_common_args (build_parser )
162165
0 commit comments