@@ -122,11 +122,11 @@ def handle_invocation(toolchain_bin, args):
122
122
if args .sysroot :
123
123
env ['SDKROOT' ] = args .sysroot
124
124
125
- print ('Cleaning ' + args .build_path )
126
- shutil .rmtree (args .build_path , ignore_errors = True )
127
-
128
125
if args .action == 'build' :
129
126
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 )
130
130
elif args .action == 'test' :
131
131
for tool in driver_toolchain_tools :
132
132
tool_path = os .path .join (toolchain_bin , tool )
@@ -157,6 +157,9 @@ def add_common_args(parser):
157
157
parser .add_argument ('--verbose' , '-v' , action = 'store_true' , help = 'enable verbose output' )
158
158
159
159
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
+
160
163
build_parser = subparsers .add_parser ('build' , help = 'build the package' )
161
164
add_common_args (build_parser )
162
165
0 commit comments