From 6f0a9205d17a1d39455c5048bf14b9fcdbdab8c4 Mon Sep 17 00:00:00 2001 From: Owen Voorhees Date: Wed, 21 Apr 2021 21:06:30 -0700 Subject: [PATCH] [PackageSyntax] Run the bootstrap script without PackageSyntax if SwiftSyntax isn't checked out or --skip-package-syntax is passed --- Utilities/bootstrap | 15 +++++++++++++-- Utilities/helpers.py | 4 ++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Utilities/bootstrap b/Utilities/bootstrap index ac67de65c50..b186a7c7d9d 100755 --- a/Utilities/bootstrap +++ b/Utilities/bootstrap @@ -23,7 +23,7 @@ import platform import re import shutil import subprocess -from helpers import note, error, symlink_force, mkdir_p, call, call_output +from helpers import note, warning, error, symlink_force, mkdir_p, call, call_output g_macos_deployment_target = '10.15' @@ -144,6 +144,10 @@ def add_build_args(parser): dest="cross_compile_hosts", help="List of cross compile hosts targets.", default=[]) + parser.add_argument( + "--skip-package-syntax", + action="store_true", + help="Build the second stage without PackageSyntax support.") def add_test_args(parser): """Configures the parser with the arguments necessary for the test action.""" @@ -173,6 +177,7 @@ def parse_global_args(args): args.swift_argument_parser_source_dir = os.path.join(args.project_root, "..", "swift-argument-parser") args.swift_driver_source_dir = os.path.join(args.project_root, "..", "swift-driver") args.swift_crypto_source_dir = os.path.join(args.project_root, "..", "swift-crypto") + args.swift_syntax_source_dir = os.path.join(args.project_root, "..", "swift-syntax") args.source_root = os.path.join(args.project_root, "Sources") if platform.system() == 'Darwin': @@ -723,7 +728,13 @@ def get_swiftpm_env_cmd(args): if args.llbuild_link_framework: env_cmd.append("SWIFTPM_LLBUILD_FWK=1") env_cmd.append("SWIFTCI_USE_LOCAL_DEPS=1") - env_cmd.append("SPM_BUILD_PACKAGE_SYNTAX=1") + + # Build package editor support if swift-syntax is checked out. + if os.path.exists(args.swift_syntax_source_dir) and not args.skip_package_syntax: + env_cmd.append("SPM_BUILD_PACKAGE_SYNTAX=1") + elif not args.skip_package_syntax: + warning("Skipping build of PackageSyntax because no SwiftSyntax checkout was found") + env_cmd.append("SWIFTPM_MACOS_DEPLOYMENT_TARGET=%s" % g_macos_deployment_target) if args.bootstrap: diff --git a/Utilities/helpers.py b/Utilities/helpers.py index d17998e19c0..7a20dbf4817 100644 --- a/Utilities/helpers.py +++ b/Utilities/helpers.py @@ -19,6 +19,10 @@ def note(message): print("--- %s: note: %s" % (os.path.basename(sys.argv[0]), message)) sys.stdout.flush() +def warning(message): + print("--- %s: warning: %s" % (os.path.basename(sys.argv[0]), message)) + sys.stdout.flush() + def error(message): print("--- %s: error: %s" % (os.path.basename(sys.argv[0]), message)) sys.stdout.flush()