@@ -57,6 +57,12 @@ def main_preset():
57
57
parser = argparse .ArgumentParser (
58
58
formatter_class = argparse .RawDescriptionHelpFormatter ,
59
59
description = """Builds Swift using a preset.""" )
60
+ parser .add_argument (
61
+ "-n" , "--dry-run" ,
62
+ help = "print the commands that would be executed, but do not execute "
63
+ "them" ,
64
+ action = "store_true" ,
65
+ default = False )
60
66
parser .add_argument (
61
67
"--preset-file" ,
62
68
help = "load presets from the specified file" ,
@@ -110,6 +116,8 @@ def main_preset():
110
116
args .preset_substitutions , args .preset_file_names , args .preset )
111
117
112
118
build_script_args = [sys .argv [0 ]]
119
+ if args .dry_run :
120
+ build_script_args += ["--dry-run" ]
113
121
build_script_args += preset_args
114
122
if args .distcc :
115
123
build_script_args += ["--distcc" ]
@@ -306,6 +314,13 @@ It is a policy decision aimed at making the builds uniform across all
306
314
environments and easily reproducible by engineers who are not familiar with the
307
315
details of the setups of other systems or automated environments.""" )
308
316
317
+ parser .add_argument (
318
+ "-n" , "--dry-run" ,
319
+ help = "print the commands that would be executed, but do not execute "
320
+ "them" ,
321
+ action = "store_true" ,
322
+ default = False )
323
+
309
324
targets_group = parser .add_argument_group (
310
325
title = "Host and cross-compilation targets" )
311
326
targets_group .add_argument (
@@ -968,6 +983,8 @@ details of the setups of other systems or automated environments.""")
968
983
if '--check-args-only' in args .build_script_impl_args :
969
984
return 0
970
985
986
+ shell .dry_run = args .dry_run
987
+
971
988
# Prepare and validate toolchain
972
989
toolchain = host_toolchain (xcrun_toolchain = args .darwin_xcrun_toolchain )
973
990
@@ -1419,6 +1436,9 @@ details of the setups of other systems or automated environments.""")
1419
1436
1420
1437
build_script_impl_args += args .build_script_impl_args
1421
1438
1439
+ if args .dry_run :
1440
+ build_script_impl_args += ["--dry-run" ]
1441
+
1422
1442
check_call ([build_script_impl ] + build_script_impl_args ,
1423
1443
disable_sleep = True )
1424
1444
0 commit comments