diff --git a/utils/build-presets.ini b/utils/build-presets.ini index d1345701a848d..9868639c98f1e 100644 --- a/utils/build-presets.ini +++ b/utils/build-presets.ini @@ -1853,6 +1853,7 @@ mixin-preset=mixin_swiftpm_package_macos_platform release assertions swiftsyntax +swiftsyntax-enable-rawsyntax-validation swiftsyntax-verify-generated-files swiftsyntax-lint swiftformat @@ -1866,9 +1867,10 @@ mixin-preset=mixin_swiftpm_package_linux_platform release assertions swiftsyntax -sourcekit-lsp +swiftsyntax-enable-rawsyntax-validation swiftsyntax-verify-generated-files swiftsyntax-lint +sourcekit-lsp swiftformat #===------------------------------------------------------------------------===# diff --git a/utils/build_swift/build_swift/driver_arguments.py b/utils/build_swift/build_swift/driver_arguments.py index f84309a27191c..2f9d7978bb45a 100644 --- a/utils/build_swift/build_swift/driver_arguments.py +++ b/utils/build_swift/build_swift/driver_arguments.py @@ -716,8 +716,13 @@ def create_argument_parser(): help='install SwiftSyntax') option('--swiftsyntax-verify-generated-files', toggle_true('swiftsyntax_verify_generated_files'), - help='set to verify that the generated files in the source tree ' + help='set to verify that the generated files in the source tree ' + 'match the ones that would be generated from current main') + option('--swiftsyntax-enable-rawsyntax-validation', + toggle_true('swiftsyntax_enable_rawsyntax_validation'), + help='set to validate that RawSyntax layout nodes contain children of ' + + 'the expected types and that RawSyntax tokens have the expected ' + + 'token kinds') option('--swiftsyntax-lint', toggle_true('swiftsyntax_lint'), help='verify that swift-syntax Source code is formatted correctly') diff --git a/utils/build_swift/tests/expected_options.py b/utils/build_swift/tests/expected_options.py index ab850ce5ea242..7e76bc829c917 100644 --- a/utils/build_swift/tests/expected_options.py +++ b/utils/build_swift/tests/expected_options.py @@ -111,6 +111,7 @@ 'install_swift_driver': False, 'install_swiftdocc': False, 'swiftsyntax_verify_generated_files': False, + 'swiftsyntax_enable_rawsyntax_validation': False, 'swiftsyntax_lint': False, 'install_playgroundsupport': False, 'install_sourcekitlsp': False, @@ -606,6 +607,8 @@ class BuildScriptImplOption(_BaseOption): EnableOption('--install-swiftsyntax', dest='install_swiftsyntax'), EnableOption('--swiftsyntax-verify-generated-files', dest='swiftsyntax_verify_generated_files'), + EnableOption('--swiftsyntax-enable-rawsyntax-validation', + dest='swiftsyntax_enable_rawsyntax_validation'), EnableOption('--swiftsyntax-lint', dest='swiftsyntax_lint'), EnableOption('--install-swiftpm', dest='install_swiftpm'), diff --git a/utils/swift_build_support/swift_build_support/products/swiftsyntax.py b/utils/swift_build_support/swift_build_support/products/swiftsyntax.py index d3d2bb1cbbd50..1189e358f31e6 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftsyntax.py +++ b/utils/swift_build_support/swift_build_support/products/swiftsyntax.py @@ -63,6 +63,9 @@ def run_swiftsyntax_build_script(self, target, command, additional_params=[]): if self.is_release(): build_cmd.append('--release') + if self.args.swiftsyntax_enable_rawsyntax_validation: + build_cmd.append('--enable-rawsyntax-validation') + if self.args.verbose_build: build_cmd.append('--verbose')