forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexpected_options.py
886 lines (799 loc) · 34.6 KB
/
expected_options.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
import multiprocessing
from build_swift import argparse
from build_swift import defaults
from swift_build_support.swift_build_support import targets
__all__ = [
'HelpOption',
'SetOption',
'SetTrueOption',
'SetFalseOption',
'DisableOption',
'EnableOption',
'ChoicesOption',
'IntOption',
'StrOption',
'PathOption',
'AppendOption',
'UnsupportedOption',
'IgnoreOption',
'EXPECTED_OPTIONS',
'EXPECTED_DEFAULTS',
]
# -----------------------------------------------------------------------------
EXPECTED_DEFAULTS = {
'android': False,
'android_api_level': '21',
'android_deploy_device_path': '/data/local/tmp',
'android_ndk': None,
'android_arch': 'armv7',
'assertions': True,
'benchmark': False,
'benchmark_num_o_iterations': 3,
'benchmark_num_onone_iterations': 3,
'build_android': False,
'build_args': [],
'build_benchmarks': True,
'build_clang_tools_extra': True,
'build_compiler_rt': True,
'build_cygwin': True,
'build_external_benchmarks': False,
'build_foundation': False,
'build_cmark': True,
'build_swift': True,
'build_llvm': True,
'_build_llvm': True,
'build_freebsd': True,
'build_ios': True,
'build_ios_device': False,
'build_ios_simulator': False,
'build_jobs': multiprocessing.cpu_count(),
'build_libdispatch': False,
'build_libicu': False,
'build_libxml2': False,
'build_zlib': False,
'build_curl': False,
'build_linux': True,
'build_llbuild': False,
'build_lldb': False,
'build_libcxx': False,
'build_linux_static': False,
'build_ninja': False,
'build_lld': True,
'build_osx': True,
'build_playgroundsupport': False,
'build_runtime_with_host_compiler': False,
'build_stdlib_deployment_targets': ['all'],
'build_subdir': None,
'build_swift_dynamic_sdk_overlay': True,
'build_swift_dynamic_stdlib': True,
'build_swift_inspect': False,
'build_swift_external_generic_metadata_builder': True,
'build_swift_private_stdlib': True,
'build_swift_static_sdk_overlay': False,
'build_swift_static_stdlib': False,
'build_swift_stdlib_unittest_extra': False,
'build_swift_stdlib_static_print': False,
'build_swift_stdlib_unicode_data': True,
'build_swift_clang_overlays': True,
'build_swift_remote_mirror': True,
'build_swiftpm': False,
'build_swift_driver': False,
'build_swift_libexec': True,
'build_swift_testing': False,
'build_swift_testing_macros': False,
'build_early_swift_driver': True,
'build_early_swiftsyntax': True,
'build_swiftsyntax': False,
'build_skstresstester': False,
'build_swiftformat': False,
'build_swiftdocc': False,
'build_minimalstdlib': False,
'build_indexstoredb': False,
'test_indexstoredb_sanitize_all': False,
'test_sourcekitlsp_sanitize_all': False,
'build_sourcekitlsp': False,
'sourcekitlsp_lint': False,
'install_llvm': False,
'install_static_linux_config': False,
'install_swiftpm': False,
'install_swiftsyntax': False,
'install_swift_testing': False,
'install_swift_testing_macros': False,
'install_swift_driver': False,
'install_swiftdocc': False,
'swiftsyntax_verify_generated_files': False,
'swiftsyntax_enable_rawsyntax_validation': False,
'swiftsyntax_enable_test_fuzzing': False,
'swiftsyntax_lint': False,
'install_playgroundsupport': False,
'install_sourcekitlsp': False,
'install_swiftformat': False,
'install_skstresstester': False,
'build_toolchainbenchmarks': False,
'build_toolchain_only': False,
'build_tvos': True,
'build_tvos_device': False,
'build_tvos_simulator': False,
'build_variant': 'Debug',
'build_watchos': True,
'build_watchos_device': False,
'build_watchos_simulator': False,
'build_xros': True,
'build_xros_device': False,
'build_xros_simulator': False,
'build_xctest': False,
'build_wasmstdlib': False,
'build_wasmkit': False,
'cmake_c_launcher': None,
'cmake_cxx_launcher': None,
'clang_compiler_version': None,
'clang_profile_instr_use': None,
'clang_user_visible_version': defaults.CLANG_USER_VISIBLE_VERSION,
'clean': False,
'cmake': None,
'cmake_generator': 'Ninja',
'cmark_assertions': True,
'cmark_build_variant': 'Debug',
'color_in_tests': True,
'compiler_vendor': defaults.COMPILER_VENDOR,
'coverage_db': None,
'cross_compile_append_host_target_to_destdir': True,
'cross_compile_deps_path': None,
'cross_compile_hosts': [],
'infer_cross_compile_hosts_on_darwin': False,
'darwin_deployment_version_ios':
defaults.DARWIN_DEPLOYMENT_VERSION_IOS,
'darwin_deployment_version_osx':
defaults.DARWIN_DEPLOYMENT_VERSION_OSX,
'darwin_deployment_version_tvos':
defaults.DARWIN_DEPLOYMENT_VERSION_TVOS,
'darwin_deployment_version_watchos':
defaults.DARWIN_DEPLOYMENT_VERSION_WATCHOS,
'darwin_deployment_version_xros':
defaults.DARWIN_DEPLOYMENT_VERSION_XROS,
'darwin_symroot_path_filters': [],
'darwin_xcrun_toolchain': None,
'distcc': False,
'sccache': False,
'dry_run': False,
'dsymutil_jobs': defaults.DSYMUTIL_JOBS,
'extra_dsymutil_args': [],
'enable_asan': False,
'enable_experimental_differentiable_programming': True,
'enable_experimental_concurrency': True,
'enable_experimental_cxx_interop': True,
'enable_cxx_interop_swift_bridging_header': True,
'enable_experimental_distributed': True,
'enable_experimental_nonescapable_types': False,
'enable_experimental_string_processing': True,
'enable_experimental_observation': True,
'enable_experimental_parser_validation': False,
'swift_enable_backtracing': True,
'enable_synchronization': True,
'enable_lsan': False,
'enable_sanitize_coverage': False,
'disable_guaranteed_normal_arguments': False,
'enable_stdlibcore_exclusivity_checking': False,
'enable_tsan': False,
'enable_tsan_runtime': False,
'enable_ubsan': False,
'export_compile_commands': False,
'extra_cmake_options': [],
'extra_swift_args': [],
'swift_debuginfo_non_lto_args': None,
'force_optimized_typechecker': False,
'foundation_build_variant': 'Debug',
'host_cc': None,
'host_cxx': None,
'host_libtool': None,
'host_lipo': None,
'host_target': targets.StdlibDeploymentTarget.host_target().name,
'host_test': False,
'only_executable_test': False,
'only_non_executable_test': False,
'infer_dependencies': False,
'install_backdeployconcurrency': False,
'install_prefix': targets.install_prefix(),
'install_symroot': None,
'install_destdir': None,
'install_all': False,
'ios': False,
'ios_all': False,
'legacy_impl': False,
'libdispatch_build_variant': 'Debug',
'libicu_build_variant': 'Debug',
'libxml2_build_variant': 'Debug',
'linux_archs': None,
'lit_jobs': multiprocessing.cpu_count(),
'zlib_build_variant': 'Debug',
'curl_build_variant': 'Debug',
'bootstrapping_mode': None,
'lit_args': '-sv',
'llbuild_assertions': True,
'lldb_assertions': True,
'lldb_build_variant': 'Debug',
'lldb_build_with_xcode': '0',
'llvm_assertions': True,
'llvm_build_variant': 'Debug',
'llvm_cmake_options': [],
'llvm_enable_modules': False,
'llvm_include_tests': True,
'llvm_ninja_targets': [],
'llvm_ninja_targets_for_cross_compile_hosts': [],
'llvm_max_parallel_lto_link_jobs':
defaults.LLVM_MAX_PARALLEL_LTO_LINK_JOBS,
'llvm_targets_to_build': 'X86;ARM;AArch64;PowerPC;SystemZ;Mips;RISCV;WebAssembly',
'tsan_libdispatch_test': False,
'long_test': False,
'lto_type': None,
'maccatalyst': False,
'maccatalyst_ios_tests': False,
'musl_path': '/usr/local/musl',
'linux_static_archs': ['x86_64', 'aarch64'],
'native_clang_tools_path': None,
'native_llvm_tools_path': None,
'native_swift_tools_path': None,
'dump_config': False,
'reconfigure': False,
'relocate_xdg_cache_home_under_build_subdir': False,
'show_sdks': False,
'skip_build': False,
'skip_local_build': False,
'stdlib_deployment_targets': None,
'stress_test': False,
'swift_analyze_code_coverage': defaults.SWIFT_ANALYZE_CODE_COVERAGE,
'swift_assertions': True,
'swift_build_variant': 'Debug',
'swift_compiler_version': None,
'swift_disable_dead_stripping': False,
'swift_darwin_module_archs': None,
'swift_darwin_supported_archs': None,
'swift_freestanding_is_darwin': False,
'swift_profile_instr_use': None,
'swift_runtime_fixed_backtracer_path': None,
'swift_stdlib_assertions': True,
'swift_stdlib_build_variant': 'Debug',
'swift_tools_ld64_lto_codegen_only_for_supporting_targets': False,
'swift_tools_max_parallel_lto_link_jobs':
defaults.SWIFT_MAX_PARALLEL_LTO_LINK_JOBS,
'swift_user_visible_version': defaults.SWIFT_USER_VISIBLE_VERSION,
'symbols_package': None,
'clean_libdispatch': True,
'clean_foundation': True,
'clean_xctest': True,
'clean_llbuild': True,
'clean_swiftpm': True,
'clean_swift_driver': True,
'clean_early_swift_driver': False,
'test': None,
'test_early_swift_driver': None,
'test_android': False,
'test_android_host': False,
'test_cygwin': False,
'test_freebsd': False,
'test_ios': False,
'test_watchos_32bit_simulator': False,
'test_ios_host': False,
'test_ios_simulator': False,
'test_linux': False,
'test_linux_static': False,
'test_optimize_for_size': None,
'test_optimize_none_with_implicit_dynamic': None,
'test_optimized': None,
'test_osx': False,
'test_paths': [],
'test_swift_inspect': True,
'test_tvos': False,
'test_tvos_host': False,
'test_tvos_simulator': False,
'test_watchos': False,
'test_watchos_host': False,
'test_watchos_simulator': False,
'test_xros': False,
'test_xros_host': False,
'test_xros_simulator': False,
'test_playgroundsupport': True,
'test_cmark': False,
'test_swiftpm': False,
'test_swift_driver': False,
'test_swiftsyntax': False,
'test_indexstoredb': False,
'test_sourcekitlsp': False,
'test_skstresstester': False,
'test_swiftformat': False,
'test_swiftdocc': False,
'test_toolchainbenchmarks': False,
'test_wasmstdlib': True,
'tvos': False,
'tvos_all': False,
'validation_test': None,
'verbose_build': False,
'watchos': False,
'watchos_all': False,
'xros': False,
'xros_all': False,
'llvm_install_components': defaults.llvm_install_components(),
'clean_install_destdir': False,
}
# -----------------------------------------------------------------------------
def _sanitize_option_string(option_string):
if option_string.startswith('--'):
return option_string[2:].replace('-', '_')
if len(option_string) == 2 and option_string[0] == '-':
return option_string[1]
raise ValueError('invalid option_string format: ' + option_string)
class _BaseOption(object):
def __init__(self, option_string, dest=None, default=None):
if dest is None:
dest = _sanitize_option_string(option_string)
if default is None:
default = EXPECTED_DEFAULTS.get(dest, None)
self.option_string = option_string
self.dest = dest
self.default = default
def sanitized_string(self):
return _sanitize_option_string(self.option_string)
class HelpOption(_BaseOption):
"""Option that prints the help message and exits."""
pass
class SetOption(_BaseOption):
"""Option that accepts no arguments, setting the destination to a
hard-coded value or None.
"""
def __init__(self, *args, **kwargs):
self.value = kwargs.pop('value', None)
super(SetOption, self).__init__(*args, **kwargs)
class SetTrueOption(_BaseOption):
"""Option that accepts no arguments, setting the destination value to True
if parsed and defaulting to False otherwise.
"""
pass
class SetFalseOption(_BaseOption):
"""Option that accepts no arguments, setting the destination value to False
if parsed and defaulting to True otherwise.
"""
pass
class EnableOption(_BaseOption):
"""Option that sets the destination to True when parsed and False by default.
Can be toggled True or False with an optional bool argument.
"""
pass
class DisableOption(_BaseOption):
"""Option that sets the destination to False when parsed and True by default.
Can be toggled True or False with an optional bool argument, which is then
negated. Thus if an option is passed the value 'True' it will set the
destination to False and vice versa.
"""
pass
class ChoicesOption(_BaseOption):
"""Option that accepts an argument from a predefined list of choices."""
def __init__(self, *args, **kwargs):
self.choices = kwargs.pop('choices', None)
super(ChoicesOption, self).__init__(*args, **kwargs)
class IntOption(_BaseOption):
"""Option that accepts an int argument."""
pass
class StrOption(_BaseOption):
"""Option that accepts a str argument."""
pass
class PathOption(_BaseOption):
"""Option that accepts a path argument."""
pass
class AppendOption(_BaseOption):
"""Option that can be called more than once to append argument to internal
list.
"""
pass
class UnsupportedOption(_BaseOption):
"""Option that is not supported."""
pass
class IgnoreOption(_BaseOption):
"""Option that should be ignored when generating tests. Instead a test
should be written manually as the behavior cannot or should not be auto-
generated.
"""
pass
class BuildScriptImplOption(_BaseOption):
"""Option that gets forwarded to build-script-impl by migration.py and is
only listed for disambiguation by argparse.
"""
pass
# -----------------------------------------------------------------------------
EXPECTED_OPTIONS = [
# Ignore the help options since they always call sys.exit(0)
HelpOption('-h', dest='help', default=argparse.SUPPRESS),
HelpOption('--help', dest='help', default=argparse.SUPPRESS),
SetOption('--debug', dest='build_variant', value='Debug'),
SetOption('--debug-cmark', dest='cmark_build_variant', value='Debug'),
SetOption('--debug-foundation',
dest='foundation_build_variant', value='Debug'),
SetOption('--debug-libdispatch',
dest='libdispatch_build_variant', value='Debug'),
SetOption('--debug-libicu', dest='libicu_build_variant', value='Debug'),
SetOption('--debug-libxml2', dest='libxml2_build_variant', value='Debug'),
SetOption('--debug-zlib', dest='zlib_build_variant', value='Debug'),
SetOption('--debug-curl', dest='curl_build_variant', value='Debug'),
SetOption('--debug-lldb', dest='lldb_build_variant', value='Debug'),
SetOption('--lldb-build-with-xcode', dest='lldb_build_with_xcode',
value='1'),
SetOption('--lldb-build-with-cmake', dest='lldb_build_with_xcode',
value='0'),
SetOption('--debug-llvm', dest='llvm_build_variant', value='Debug'),
SetOption('--debug-swift', dest='swift_build_variant', value='Debug'),
SetOption('--debug-swift-stdlib',
dest='swift_stdlib_build_variant', value='Debug'),
SetOption('--eclipse',
dest='cmake_generator', value='Eclipse CDT4 - Ninja'),
SetOption('--make', dest='cmake_generator', value='Unix Makefiles'),
SetOption('--release', dest='build_variant', value='Release'),
SetOption('--release-debuginfo',
dest='build_variant', value='RelWithDebInfo'),
SetOption('--min-size-release',
dest='build_variant', value='MinSizeRel'),
SetOption('--xcode', dest='cmake_generator', value='Xcode'),
SetOption('-R', dest='build_variant', value='Release'),
SetOption('-d', dest='build_variant', value='Debug'),
SetOption('-e', dest='cmake_generator', value='Eclipse CDT4 - Ninja'),
SetOption('-m', dest='cmake_generator', value='Unix Makefiles'),
SetOption('-r', dest='build_variant', value='RelWithDebInfo'),
SetOption('-x', dest='cmake_generator', value='Xcode'),
# FIXME: Convert these options to set_true actions
SetOption('--assertions', value=True),
SetOption('--cmark-assertions', value=True),
SetOption('--lldb-assertions', value=True),
SetOption('--llvm-assertions', value=True),
SetOption('--llbuild-assertions', value=True),
SetOption('--swift-assertions', value=True),
SetOption('--swift-stdlib-assertions', value=True),
SetOption('-T', dest='validation_test', value=True),
SetOption('-o', dest='test_optimized', value=True),
SetOption('-s', dest='test_optimize_for_size', value=True),
SetOption('-y',
dest='test_optimize_none_with_implicit_dynamic', value=True),
SetOption('-t', dest='test', value=True),
SetOption('-a', dest='assertions', value=True),
# FIXME: Convert these options to set_false actions
SetOption('--no-assertions', dest='assertions', value=False),
SetOption('-A', dest='assertions', value=False),
SetOption('--no-lldb-assertions', dest='lldb_assertions', value=False),
SetOption('--no-llvm-assertions', dest='llvm_assertions', value=False),
SetOption('--no-llbuild-assertions',
dest='llbuild_assertions', value=False),
SetOption('--no-swift-assertions', dest='swift_assertions', value=False),
SetOption('--no-swift-stdlib-assertions',
dest='swift_stdlib_assertions', value=False),
SetOption('--skip-ios', dest='ios', value=False),
SetOption('--skip-tvos', dest='tvos', value=False),
SetOption('--skip-watchos', dest='watchos', value=False),
SetOption('--skip-xros', dest='xros', value=False),
SetOption('--skip-test-early-swift-driver',
dest='test_early_swift_driver', value=False),
SetFalseOption('--no-llvm-include-tests', dest='llvm_include_tests'),
SetTrueOption('--install-back-deploy-concurrency',
dest='install_backdeployconcurrency'),
SetTrueOption('--benchmark'),
SetTrueOption('--clean'),
SetTrueOption('--clean-install-destdir'),
SetTrueOption('--dry-run'),
SetTrueOption('--dump-config'),
SetTrueOption('--disable-guaranteed-normal-arguments'),
SetTrueOption('--enable-stdlibcore-exclusivity-checking'),
SetTrueOption('--force-optimized-typechecker'),
SetTrueOption('--ios'),
SetTrueOption('--llbuild', dest='build_llbuild'),
SetTrueOption('--lldb', dest='build_lldb'),
SetTrueOption('--libcxx', dest='build_libcxx'),
SetTrueOption('--maccatalyst', dest='maccatalyst'),
SetTrueOption('--maccatalyst-ios-tests', dest='maccatalyst_ios_tests'),
SetTrueOption('--playgroundsupport', dest='build_playgroundsupport'),
SetTrueOption('--install-playgroundsupport',
dest='install_playgroundsupport'),
SetTrueOption('--skip-build'),
SetTrueOption('--swiftpm', dest='build_swiftpm'),
SetTrueOption('--swift-driver', dest='build_swift_driver'),
SetTrueOption('--swiftsyntax', dest='build_swiftsyntax'),
SetTrueOption('--swift-testing', dest='build_swift_testing'),
SetTrueOption('--swift-testing-macros', dest='build_swift_testing_macros'),
SetTrueOption('--skstresstester', dest='build_skstresstester'),
SetTrueOption('--swiftformat', dest='build_swiftformat'),
SetTrueOption('--swiftdocc', dest='build_swiftdocc'),
SetTrueOption('--build-minimal-stdlib', dest='build_minimalstdlib'),
SetTrueOption('--build-wasm-stdlib', dest='build_wasmstdlib'),
SetTrueOption('--wasmkit', dest='build_wasmkit'),
SetTrueOption('-B', dest='benchmark'),
SetTrueOption('-S', dest='skip_build'),
SetTrueOption('-b', dest='build_llbuild'),
SetTrueOption('-c', dest='clean'),
SetTrueOption('-i', dest='ios'),
SetTrueOption('-l', dest='build_lldb'),
SetTrueOption('-n', dest='dry_run'),
SetTrueOption('-p', dest='build_swiftpm'),
SetTrueOption('--legacy-impl', dest='legacy_impl'),
SetTrueOption('--infer', dest='infer_dependencies'),
SetTrueOption('--reconfigure'),
EnableOption('--android'),
EnableOption('--build-external-benchmarks'),
EnableOption('--build-ninja'),
EnableOption('--build-lld'),
EnableOption('--build-runtime-with-host-compiler'),
EnableOption('--build-swift-dynamic-sdk-overlay'),
EnableOption('--build-swift-dynamic-stdlib'),
EnableOption('--build-swift-static-sdk-overlay'),
EnableOption('--build-swift-static-stdlib'),
EnableOption('--build-swift-stdlib-unittest-extra'),
EnableOption('--build-swift-stdlib-static-print'),
EnableOption('--build-toolchain-only'),
EnableOption('--build-swift-private-stdlib'),
EnableOption('--build-swift-stdlib-unicode-data'),
EnableOption('--build-swift-libexec'),
EnableOption('--build-swift-clang-overlays'),
EnableOption('--build-swift-remote-mirror'),
EnableOption('--build-swift-external-generic-metadata-builder'),
EnableOption('--cross-compile-append-host-target-to-destdir'),
EnableOption('--color-in-tests'),
EnableOption('--distcc'),
EnableOption('--sccache'),
EnableOption('--enable-asan'),
EnableOption('--enable-experimental-differentiable-programming'),
EnableOption('--enable-experimental-concurrency'),
EnableOption('--enable-experimental-cxx-interop'),
EnableOption('--enable-cxx-interop-swift-bridging-header'),
EnableOption('--enable-experimental-distributed'),
EnableOption('--enable-experimental-nonescapable-types'),
EnableOption('--enable-experimental-string-processing'),
EnableOption('--enable-experimental-observation'),
EnableOption('--enable-experimental-parser-validation'),
EnableOption('--enable-lsan'),
EnableOption('--enable-sanitize-coverage'),
EnableOption('--enable-tsan'),
EnableOption('--enable-tsan-runtime'),
EnableOption('--enable-ubsan'),
EnableOption('--export-compile-commands'),
EnableOption('--swift-enable-backtracing'),
EnableOption('--enable-synchronization'),
EnableOption('--foundation', dest='build_foundation'),
EnableOption('--host-test'),
EnableOption('--only-executable-test'),
EnableOption('--only-non-executable-test'),
EnableOption('--libdispatch', dest='build_libdispatch'),
EnableOption('--libicu', dest='build_libicu'),
EnableOption('--static-libxml2', dest='build_libxml2'),
EnableOption('--static-zlib', dest='build_zlib'),
EnableOption('--static-curl', dest='build_curl'),
EnableOption('--indexstore-db', dest='build_indexstoredb'),
EnableOption('--test-indexstore-db-sanitize-all',
dest='test_indexstoredb_sanitize_all'),
EnableOption('--sourcekit-lsp', dest='build_sourcekitlsp'),
EnableOption('--test-sourcekit-lsp-sanitize-all',
dest='test_sourcekitlsp_sanitize_all'),
EnableOption('--sourcekit-lsp-lint',
dest='sourcekitlsp_lint'),
EnableOption('--install-llvm', dest='install_llvm'),
EnableOption('--install-static-linux-config', dest='install_static_linux_config'),
EnableOption('--install-swiftsyntax', dest='install_swiftsyntax'),
EnableOption('--install-swift-testing', dest='install_swift_testing'),
EnableOption('--install-swift-testing-macros',
dest='install_swift_testing_macros'),
EnableOption('--swiftsyntax-verify-generated-files',
dest='swiftsyntax_verify_generated_files'),
EnableOption('--swiftsyntax-enable-rawsyntax-validation',
dest='swiftsyntax_enable_rawsyntax_validation'),
EnableOption('--swiftsyntax-enable-test-fuzzing',
dest='swiftsyntax_enable_test_fuzzing'),
EnableOption('--swiftsyntax-lint',
dest='swiftsyntax_lint'),
EnableOption('--install-swiftpm', dest='install_swiftpm'),
EnableOption('--install-swift-driver', dest='install_swift_driver'),
EnableOption('--install-sourcekit-lsp', dest='install_sourcekitlsp'),
EnableOption('--install-swiftformat', dest='install_swiftformat'),
EnableOption('--install-skstresstester', dest='install_skstresstester'),
EnableOption('--install-swiftdocc', dest='install_swiftdocc'),
EnableOption('--toolchain-benchmarks', dest='build_toolchainbenchmarks'),
EnableOption('--swift-inspect', dest='build_swift_inspect'),
EnableOption('--tsan-libdispatch-test'),
EnableOption('--long-test'),
EnableOption('--show-sdks'),
EnableOption('--skip-local-build'),
EnableOption('--stress-test'),
EnableOption('--test'),
EnableOption('--test-optimize-for-size'),
EnableOption('--test-optimize-none-with-implicit-dynamic'),
EnableOption('--test-optimized'),
EnableOption('--tvos'),
EnableOption('--validation-test'),
EnableOption('--verbose-build'),
EnableOption('--watchos'),
EnableOption('--xros'),
EnableOption('--xctest', dest='build_xctest'),
EnableOption('--swift-disable-dead-stripping'),
EnableOption('--clean-early-swift-driver', dest='clean_early_swift_driver'),
EnableOption('--llvm-enable-modules'),
EnableOption('--build-llvm', dest='_build_llvm'),
DisableOption('--skip-build-cmark', dest='build_cmark'),
DisableOption('--skip-build-llvm', dest='build_llvm'),
DisableOption('--skip-build-swift', dest='build_swift'),
DisableOption('--skip-build-android', dest='build_android'),
DisableOption('--skip-build-benchmarks', dest='build_benchmarks'),
DisableOption('--skip-build-cygwin', dest='build_cygwin'),
DisableOption('--skip-build-freebsd', dest='build_freebsd'),
DisableOption('--skip-build-ios', dest='build_ios'),
DisableOption('--skip-build-ios-device', dest='build_ios_device'),
DisableOption('--skip-build-ios-simulator',
dest='build_ios_simulator'),
DisableOption('--skip-build-linux', dest='build_linux'),
EnableOption('--build-linux-static'),
DisableOption('--skip-build-osx', dest='build_osx'),
DisableOption('--skip-build-tvos', dest='build_tvos'),
DisableOption('--skip-build-tvos-device', dest='build_tvos_device'),
DisableOption('--skip-build-tvos-simulator',
dest='build_tvos_simulator'),
DisableOption('--skip-build-watchos', dest='build_watchos'),
DisableOption('--skip-build-watchos-device',
dest='build_watchos_device'),
DisableOption('--skip-build-watchos-simulator',
dest='build_watchos_simulator'),
DisableOption('--skip-build-xros', dest='build_xros'),
DisableOption('--skip-build-xros-device', dest='build_xros_device'),
DisableOption('--skip-build-xros-simulator', dest='build_xros_simulator'),
DisableOption('--skip-clean-libdispatch', dest='clean_libdispatch'),
DisableOption('--skip-clean-foundation', dest='clean_foundation'),
DisableOption('--skip-clean-xctest', dest='clean_xctest'),
DisableOption('--skip-clean-llbuild', dest='clean_llbuild'),
DisableOption('--skip-early-swift-driver', dest='build_early_swift_driver'),
DisableOption('--skip-early-swiftsyntax', dest='build_early_swiftsyntax'),
DisableOption('--skip-clean-swiftpm', dest='clean_swiftpm'),
DisableOption('--skip-clean-swift-driver', dest='clean_swift_driver'),
DisableOption('--skip-test-android', dest='test_android'),
DisableOption('--skip-test-android-host', dest='test_android_host'),
DisableOption('--skip-test-cygwin', dest='test_cygwin'),
DisableOption('--skip-test-freebsd', dest='test_freebsd'),
DisableOption('--skip-test-ios', dest='test_ios'),
DisableOption('--skip-test-watchos-32bit-simulator',
dest='test_watchos_32bit_simulator'),
DisableOption('--skip-test-ios-host', dest='test_ios_host'),
DisableOption('--skip-test-ios-simulator', dest='test_ios_simulator'),
DisableOption('--skip-test-linux', dest='test_linux'),
DisableOption('--skip-test-linux-static', dest='test_linux_static'),
DisableOption('--skip-test-osx', dest='test_osx'),
DisableOption('--skip-test-tvos', dest='test_tvos'),
DisableOption('--skip-test-tvos-host', dest='test_tvos_host'),
DisableOption('--skip-test-tvos-simulator',
dest='test_tvos_simulator'),
DisableOption('--skip-test-watchos', dest='test_watchos'),
DisableOption('--skip-test-watchos-host', dest='test_watchos_host'),
DisableOption('--skip-test-watchos-simulator',
dest='test_watchos_simulator'),
DisableOption('--skip-test-playgroundsupport',
dest='test_playgroundsupport'),
DisableOption('--skip-test-cmark', dest='test_cmark'),
DisableOption('--skip-test-swiftpm', dest='test_swiftpm'),
DisableOption('--skip-test-swift-driver', dest='test_swift_driver'),
DisableOption('--skip-test-swiftsyntax', dest='test_swiftsyntax'),
DisableOption('--skip-test-indexstore-db', dest='test_indexstoredb'),
DisableOption('--skip-test-sourcekit-lsp', dest='test_sourcekitlsp'),
DisableOption('--skip-test-skstresstester', dest='test_skstresstester'),
DisableOption('--skip-test-swiftformat', dest='test_swiftformat'),
DisableOption('--skip-test-swiftdocc', dest='test_swiftdocc'),
DisableOption('--skip-test-toolchain-benchmarks',
dest='test_toolchainbenchmarks'),
DisableOption('--skip-test-swift-inspect',
dest='test_swift_inspect'),
DisableOption('--skip-test-wasm-stdlib',
dest='test_wasmstdlib'),
DisableOption('--skip-build-clang-tools-extra',
dest='build_clang_tools_extra'),
DisableOption('--skip-build-libxml2', dest='build_libxml2'),
DisableOption('--skip-build-zlib', dest='build_zlib'),
DisableOption('--skip-build-curl', dest='build_curl'),
DisableOption('--skip-build-compiler-rt', dest='build_compiler_rt'),
DisableOption('--skip-build-lld', dest='build_lld'),
ChoicesOption('--compiler-vendor',
choices=['none', 'apple']),
ChoicesOption('--swift-analyze-code-coverage',
choices=['false', 'not-merged', 'merged']),
ChoicesOption('--android-arch',
choices=['armv7', 'aarch64']),
StrOption('--android-api-level'),
StrOption('--build-args'),
StrOption('--build-stdlib-deployment-targets'),
StrOption('--darwin-deployment-version-ios'),
StrOption('--darwin-deployment-version-osx'),
StrOption('--darwin-deployment-version-tvos'),
StrOption('--darwin-deployment-version-watchos'),
StrOption('--darwin-deployment-version-xros'),
DisableOption('--skip-test-xros-host', dest='test_xros_host'),
DisableOption('--skip-test-xros', dest='test_xros'),
DisableOption('--skip-test-xros-simulator', dest='test_xros_simulator'),
StrOption('--darwin-xcrun-toolchain'),
StrOption('--host-target'),
StrOption('--lit-args'),
StrOption('--llvm-targets-to-build'),
StrOption('--stdlib-deployment-targets'),
StrOption('--swift-darwin-module-archs'),
StrOption('--swift-darwin-supported-archs'),
SetTrueOption('--swift-freestanding-is-darwin'),
StrOption('--linux-archs'),
StrOption('--linux-static-archs'),
PathOption('--android-deploy-device-path'),
PathOption('--android-ndk'),
PathOption('--build-subdir'),
SetTrueOption('--relocate-xdg-cache-home-under-build-subdir'),
PathOption('--clang-profile-instr-use'),
PathOption('--cmake'),
PathOption('--coverage-db'),
PathOption('--cross-compile-deps-path'),
PathOption('--host-cc'),
PathOption('--host-cxx'),
PathOption('--host-libtool'),
PathOption('--host-lipo'),
PathOption('--install-prefix'),
PathOption('--install-symroot'),
PathOption('--install-destdir'),
EnableOption('--install-all'),
PathOption('--native-clang-tools-path'),
PathOption('--native-llvm-tools-path'),
PathOption('--native-swift-tools-path'),
PathOption('--symbols-package'),
PathOption('--cmake-c-launcher'),
PathOption('--cmake-cxx-launcher'),
PathOption('--swift-profile-instr-use'),
PathOption('--swift-runtime-fixed-backtracer-path'),
PathOption('--musl-path'),
IntOption('--benchmark-num-o-iterations'),
IntOption('--benchmark-num-onone-iterations'),
IntOption('--jobs', dest='build_jobs'),
IntOption('--llvm-max-parallel-lto-link-jobs'),
IntOption('--swift-tools-max-parallel-lto-link-jobs'),
EnableOption('--swift-tools-ld64-lto-codegen-only-for-supporting-targets'),
IntOption('-j', dest='build_jobs'),
IntOption('--lit-jobs', dest='lit_jobs'),
IntOption('--dsymutil-jobs', dest='dsymutil_jobs'),
AppendOption('--extra-dsymutil-args', dest='extra_dsymutil_args'),
AppendOption('--cross-compile-hosts'),
SetTrueOption('--infer-cross-compile-hosts-on-darwin'),
AppendOption('--extra-cmake-options'),
AppendOption('--extra-swift-args'),
AppendOption('--swift-debuginfo-non-lto-args'),
AppendOption('--test-paths'),
AppendOption('--llvm-ninja-targets'),
AppendOption('--llvm-ninja-targets-for-cross-compile-hosts'),
AppendOption('--llvm-cmake-options'),
AppendOption('--darwin-symroot-path-filters'),
UnsupportedOption('--build-jobs'),
UnsupportedOption('--common-cmake-options'),
UnsupportedOption('--only-execute'),
UnsupportedOption('--skip-test-optimize-for-size'),
UnsupportedOption('--skip-test-optimize-none-with-implicit-dynamic'),
UnsupportedOption('--skip-test-optimized'),
# Options forwarded to build-script-impl
BuildScriptImplOption('--skip-test-swift', dest='impl_skip_test_swift'),
BuildScriptImplOption('--install-swift', dest='impl_install_swift'),
# NOTE: LTO flag is a special case that acts both as an option and has
# valid choices
SetOption('--lto', dest='lto_type'),
ChoicesOption('--lto', dest='lto_type', choices=['thin', 'full']),
SetOption('--bootstrapping', dest='bootstrapping_mode'),
ChoicesOption('--bootstrapping', dest='bootstrapping_mode',
choices=['off', 'hosttools', 'bootstrapping',
'bootstrapping-with-hostlibs']),
# NOTE: We'll need to manually test the behavior of these since they
# validate compiler version strings.
IgnoreOption('--clang-compiler-version'),
IgnoreOption('--clang-user-visible-version'),
IgnoreOption('--swift-compiler-version'),
IgnoreOption('--swift-user-visible-version'),
# TODO: Migrate to unavailable options once new parser is in place
IgnoreOption('-I'),
IgnoreOption('--ios-all'),
IgnoreOption('--tvos-all'),
IgnoreOption('--watchos-all'),
IgnoreOption('--xros-all'),
StrOption('--llvm-install-components'),
]