Skip to content

[4.2] Move SwiftSyntax to its own repository #19064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions utils/build-presets.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,7 @@ assertions
# Build llbuild & swiftpm here
llbuild
swiftpm
swiftsyntax

# Build Playground support
playgroundsupport
Expand Down
4 changes: 4 additions & 0 deletions utils/build-script
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ class BuildScriptInvocation(object):
"--libicu-build-type", args.libicu_build_variant,
"--xctest-build-type", args.build_variant,
"--swiftpm-build-type", args.build_variant,
"--swiftsyntax-build-type", args.build_variant,
"--llbuild-build-type", args.build_variant,
"--swift-enable-assertions", str(args.swift_assertions).lower(),
"--swift-stdlib-enable-assertions", str(
Expand Down Expand Up @@ -603,6 +604,8 @@ class BuildScriptInvocation(object):
impl_args += ["--skip-build-libicu"]
if not args.build_swiftpm:
impl_args += ["--skip-build-swiftpm"]
if not args.build_swiftsyntax:
impl_args += ["--skip-build-swiftsyntax"]
if not args.build_playgroundsupport:
impl_args += ["--skip-build-playgroundsupport"]
if args.build_swift_dynamic_stdlib:
Expand Down Expand Up @@ -646,6 +649,7 @@ class BuildScriptInvocation(object):
"--skip-test-lldb",
"--skip-test-llbuild",
"--skip-test-swiftpm",
"--skip-test-swiftsyntax",
"--skip-test-xctest",
"--skip-test-foundation",
"--skip-test-libdispatch",
Expand Down
75 changes: 71 additions & 4 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ KNOWN_SETTINGS=(
playgroundsupport-build-type "Debug" "the build variant for PlaygroundSupport"
xctest-build-type "Debug" "the build variant for xctest"
swiftpm-build-type "Debug" "the build variant for swiftpm"
swiftsyntax-build-type "Debug" "the build variant for swiftSyntax"
llbuild-enable-assertions "1" "enable assertions in llbuild"
enable-asan "" "enable Address Sanitizer"
enable-ubsan "" "enable Undefined Behavior Sanitizer"
Expand Down Expand Up @@ -121,6 +122,7 @@ KNOWN_SETTINGS=(
skip-build-lldb "" "set to skip building LLDB"
skip-build-llbuild "" "set to skip building llbuild"
skip-build-swiftpm "" "set to skip building swiftpm"
skip-build-swiftsyntax "" "set to skip building swiftSyntax"
skip-build-xctest "" "set to skip building xctest"
skip-build-foundation "" "set to skip building foundation"
skip-build-libdispatch "" "set to skip building libdispatch"
Expand All @@ -133,6 +135,7 @@ KNOWN_SETTINGS=(
skip-test-swift "" "set to skip testing Swift"
skip-test-llbuild "" "set to skip testing llbuild"
skip-test-swiftpm "" "set to skip testing swiftpm"
skip-test-swiftsyntax "" "set to skip testing swiftSyntax"
skip-test-xctest "" "set to skip testing xctest"
skip-test-foundation "" "set to skip testing foundation"
skip-test-libdispatch "" "set to skip testing libdispatch"
Expand All @@ -141,7 +144,7 @@ KNOWN_SETTINGS=(
skip-test-linux "" "set to skip testing Swift stdlibs for Linux"
skip-test-freebsd "" "set to skip testing Swift stdlibs for FreeBSD"
skip-test-cygwin "" "set to skip testing Swift stdlibs for Cygwin"
skip-test-haiku "" "set to skip testing Swift stdlibs for Haiku"
skip-test-haiku "" "set to skip testing Swift stdlibs for Haiku"
skip-test-osx "" "set to skip testing Swift stdlibs for OS X"
skip-test-ios-32bit-simulator "" "set to skip testing Swift stdlibs for iOS 32bit simulators"
skip-test-ios-simulator "" "set to skip testing Swift stdlibs for iOS simulators (i.e. test devices only)"
Expand Down Expand Up @@ -1161,6 +1164,7 @@ CMARK_SOURCE_DIR="${WORKSPACE}/cmark"
LLDB_SOURCE_DIR="${WORKSPACE}/lldb"
LLBUILD_SOURCE_DIR="${WORKSPACE}/llbuild"
SWIFTPM_SOURCE_DIR="${WORKSPACE}/swiftpm"
SWIFTSYNTAX_SOURCE_DIR="${WORKSPACE}/swift-syntax"
XCTEST_SOURCE_DIR="${WORKSPACE}/swift-corelibs-xctest"
FOUNDATION_SOURCE_DIR="${WORKSPACE}/swift-corelibs-foundation"
LIBDISPATCH_SOURCE_DIR="${WORKSPACE}/swift-corelibs-libdispatch"
Expand Down Expand Up @@ -1207,22 +1211,27 @@ fi
if [[ ! "${SKIP_BUILD_LIBDISPATCH}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" libdispatch)
fi
# SwiftPM and XCTest are dependent on Foundation, so Foundation must be
# LLBuild, SwiftPM, SwiftSyntax and XCTest are dependent on Foundation, so Foundation must be
# added to the list of build products first.
if [[ ! "${SKIP_BUILD_FOUNDATION}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" foundation)
fi
if [[ ! "${SKIP_BUILD_PLAYGROUNDSUPPORT}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" playgroundsupport)
fi
# SwiftPM is dependent on XCTest, so XCTest must be added to the list of
# SwiftPM and SwiftSyntax are dependent on XCTest, so XCTest must be added to the list of
# build products first.
if [[ ! "${SKIP_BUILD_XCTEST}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" xctest)
fi
# SwiftSyntax is dependent on SwiftPM, so SwiftPM must be added to the list of
# build products first.
if [[ ! "${SKIP_BUILD_SWIFTPM}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" swiftpm)
fi
if [[ ! "${SKIP_BUILD_SWIFTSYNTAX}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" swiftsyntax)
fi

# Checks if a given product is enabled (i.e. part of $PRODUCTS array)
function contains_product() {
Expand Down Expand Up @@ -1530,6 +1539,9 @@ function build_directory_bin() {
swiftpm)
echo "${root}/${SWIFTPM_BUILD_TYPE}/bin"
;;
swiftsyntax)
echo "${root}/${SWIFTSYNTAX_BUILD_TYPE}/bin"
;;
xctest)
echo "${root}/${XCTEST_BUILD_TYPE}/bin"
;;
Expand All @@ -1550,7 +1562,13 @@ function build_directory_bin() {
;;
esac
else
echo "${root}/bin"
if [[ "${product}" == "swiftpm" ]] ; then
# All projects that call this depend on SwiftPM so we know that
# swiftpm_bootstrap_command has already been set
echo "$(${swiftpm_bootstrap_command[@]} --show-bin-path)"
else
echo "${root}/bin"
fi
fi
}

Expand Down Expand Up @@ -1660,6 +1678,9 @@ function cmake_config_opt() {
swiftpm)
echo "--config ${SWIFTPM_BUILD_TYPE}"
;;
swiftsyntax)
echo "--config ${SWIFTSYNTAX_BUILD_TYPE}"
;;
xctest)
echo "--config ${XCTEST_BUILD_TYPE}"
;;
Expand Down Expand Up @@ -1702,6 +1723,10 @@ function set_swiftpm_bootstrap_command() {
echo "Error: Cannot build swiftpm without llbuild (swift-build-tool)."
exit 1
fi
if [[ "${CMAKE_GENERATOR}" == "Xcode" ]]; then
echo "Error: Cannot build swiftpm when llbuild is built using Xcode."
exit 1
fi
swiftpm_bootstrap_command=("${SWIFTPM_SOURCE_DIR}/Utilities/bootstrap" "${swiftpm_bootstrap_options[@]}")
# Add --release if we have to build in release mode.
if [[ "${SWIFTPM_BUILD_TYPE}" == "Release" ]] ; then
Expand Down Expand Up @@ -1731,6 +1756,29 @@ function set_swiftpm_bootstrap_command() {
fi
}

function set_swiftsyntax_build_command() {
if [ "${SKIP_BUILD_SWIFTPM}" ]; then
echo "Error: Cannot build swiftsyntax without swiftpm."
exit 1
fi

swiftsyntax_build_command=("${SWIFTSYNTAX_SOURCE_DIR}/build-script.py")
# Add --release if we have to build in release mode.
if [[ $(is_cmake_release_build_type "${SWIFTSYNTAX_BUILD_TYPE}") ]] ; then
swiftsyntax_build_command+=(--release)
fi
if [[ "${VERBOSE_BUILD}" ]] ; then
swiftsyntax_build_command+=(-v)
fi
swiftsyntax_build_command+=(
--build-dir="${build_dir}"
--swift-build-exec="$(build_directory_bin ${LOCAL_HOST} swiftpm)/swift-build"
--swift-test-exec="$(build_directory_bin ${LOCAL_HOST} swiftpm)/swift-test"
--swiftc-exec="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
--swift-syntax-test-exec="$(build_directory_bin ${LOCAL_HOST} swift)/swift-syntax-test"
--filecheck-exec="$(build_directory_bin ${LOCAL_HOST} llvm)/FileCheck")
}

# Construct the appropriate options to pass to an Xcode
# build of any LLDB target.
function set_lldb_xcodebuild_options() {
Expand Down Expand Up @@ -2381,6 +2429,12 @@ for host in "${ALL_HOSTS[@]}"; do
call "${swiftpm_bootstrap_command[@]}"

# swiftpm installs itself with a bootstrap method. No further cmake building is performed.
continue
;;
swiftsyntax)
set_swiftsyntax_build_command
call "${swiftsyntax_build_command[@]}"

continue
;;
xctest)
Expand Down Expand Up @@ -2899,6 +2953,15 @@ for host in "${ALL_HOSTS[@]}"; do
# As swiftpm tests itself, we break early here.
continue
;;
swiftsyntax)
if [[ "${SKIP_TEST_SWIFTSYNTAX}" ]]; then
continue
fi
echo "--- Running tests for ${product} ---"
call "${swiftsyntax_build_command[@]}" -t
# As swiftSyntax tests itself, we break early here.
continue
;;
xctest)
if [[ "${SKIP_TEST_XCTEST}" ]]; then
continue
Expand Down Expand Up @@ -3178,6 +3241,10 @@ for host in "${ALL_HOSTS[@]}"; do
# As swiftpm bootstraps the installation itself, we break early here.
continue
;;
swiftsyntax)
# SwiftSyntax is not installed as part of the toolchain
continue
;;
xctest)
if [[ -z "${INSTALL_XCTEST}" ]] ; then
continue
Expand Down
4 changes: 4 additions & 0 deletions utils/build_swift/driver_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ def create_argument_parser():
option(['-p', '--swiftpm'], store_true('build_swiftpm'),
help='build swiftpm')

option(['--swiftsyntax'], store_true('build_swiftsyntax'),
help='build swiftSyntax')

option('--xctest', toggle_true('build_xctest'),
help='build xctest')

Expand Down Expand Up @@ -968,6 +971,7 @@ def create_argument_parser():
/lldb (optional)
/llbuild (optional)
/swiftpm (optional, requires llbuild)
/swift-syntax (optional, requires swiftpm)
/compiler-rt (optional)
/swift-corelibs-xctest (optional)
/swift-corelibs-foundation (optional)
Expand Down
2 changes: 2 additions & 0 deletions utils/build_swift/tests/expected_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
'build_swift_static_stdlib': False,
'build_swift_stdlib_unittest_extra': False,
'build_swiftpm': False,
'build_swiftsyntax': False,
'build_tvos': True,
'build_tvos_device': False,
'build_tvos_simulator': False,
Expand Down Expand Up @@ -393,6 +394,7 @@ class IgnoreOption(_BaseOption):
SetTrueOption('--playgroundsupport', dest='build_playgroundsupport'),
SetTrueOption('--skip-build'),
SetTrueOption('--swiftpm', dest='build_swiftpm'),
SetTrueOption('--swiftsyntax', dest='build_swiftsyntax'),
SetTrueOption('-B', dest='benchmark'),
SetTrueOption('-S', dest='skip_build'),
SetTrueOption('-b', dest='build_llbuild'),
Expand Down
15 changes: 15 additions & 0 deletions utils/update-checkout-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"remote": { "id": "apple/swift-llbuild" } },
"swiftpm": {
"remote": { "id": "apple/swift-package-manager" } },
"swift-syntax": {
"remote": { "id": "apple/swift-syntax" } },
"compiler-rt": {
"remote": { "id": "apple/swift-compiler-rt" } },
"swift-corelibs-xctest": {
Expand Down Expand Up @@ -43,6 +45,7 @@
"cmark": "master",
"llbuild": "master",
"swiftpm": "master",
"swift-syntax": "master",
"compiler-rt": "stable",
"swift-corelibs-xctest": "master",
"swift-corelibs-foundation": "master",
Expand All @@ -65,6 +68,7 @@
"cmark": "master",
"llbuild": "master",
"swiftpm": "master",
"swift-syntax": "master",
"swift-corelibs-xctest": "master",
"swift-corelibs-foundation": "master",
"swift-corelibs-libdispatch": "master",
Expand All @@ -85,6 +89,7 @@
"cmark": "master",
"llbuild": "master",
"swiftpm": "master",
"swift-syntax": "master",
"swift-corelibs-xctest": "master",
"swift-corelibs-foundation": "master",
"swift-corelibs-libdispatch": "master",
Expand All @@ -103,6 +108,7 @@
"cmark": "swift-3.0-branch",
"llbuild": "swift-3.0-branch",
"swiftpm": "swift-3.0-branch",
"swift-syntax": "master",
"compiler-rt": "swift-3.0-branch",
"swift-corelibs-xctest": "swift-3.0-branch",
"swift-corelibs-foundation": "swift-3.0-branch",
Expand All @@ -122,6 +128,7 @@
"cmark": "swift-3.1-branch",
"llbuild": "swift-3.1-branch",
"swiftpm": "swift-3.1-branch",
"swift-syntax": "master",
"compiler-rt": "swift-3.1-branch",
"swift-corelibs-xctest": "swift-3.1-branch",
"swift-corelibs-foundation": "swift-3.1-branch",
Expand All @@ -141,6 +148,7 @@
"cmark": "swift-4.1-branch",
"llbuild": "swift-4.1-branch",
"swiftpm": "swift-4.1-branch",
"swift-syntax": "master",
"compiler-rt": "swift-4.1-branch",
"swift-corelibs-xctest": "swift-4.1-branch",
"swift-corelibs-foundation": "swift-4.1-branch",
Expand All @@ -160,6 +168,7 @@
"cmark": "swift-4.0-branch",
"llbuild": "swift-4.0-branch",
"swiftpm": "swift-4.0-branch",
"swift-syntax": "master",
"compiler-rt": "swift-4.0-branch",
"swift-corelibs-xctest": "swift-4.0-branch",
"swift-corelibs-foundation": "swift-4.0-branch",
Expand All @@ -179,6 +188,7 @@
"cmark": "swift-4.0-branch",
"llbuild": "swift-4.0-branch",
"swiftpm": "swift-4.0-branch",
"swift-syntax": "swift-4.2-branch",
"compiler-rt": "swift-4.0-branch-07-11-2017",
"swift-corelibs-xctest": "swift-4.0-branch",
"swift-corelibs-foundation": "swift-4.0-branch",
Expand All @@ -198,6 +208,7 @@
"cmark": "swift-4.2-branch",
"llbuild": "swift-4.2-branch",
"swiftpm": "swift-4.2-branch",
"swift-syntax": "swift-4.2-branch",
"compiler-rt": "swift-4.2-branch",
"swift-corelibs-xctest": "swift-4.2-branch",
"swift-corelibs-foundation": "swift-4.2-branch",
Expand All @@ -217,6 +228,7 @@
"cmark": "master",
"llbuild": "master",
"swiftpm": "master",
"swift-syntax": "swift-4.2-branch",
"compiler-rt": "swift-4.2-branch-03-26-2018",
"swift-corelibs-xctest": "swift-4.2-branch",
"swift-corelibs-foundation": "swift-4.2-branch",
Expand All @@ -236,6 +248,7 @@
"cmark": "master",
"llbuild": "master",
"swiftpm": "master",
"swift-syntax": "swift-4.2-branch",
"compiler-rt": "swift-4.2-branch-04-20-2018",
"swift-corelibs-xctest": "swift-4.2-branch-04-20-2018",
"swift-corelibs-foundation": "swift-4.2-branch-04-20-2018",
Expand All @@ -255,6 +268,7 @@
"cmark": "swift-4.2-branch",
"llbuild": "swift-4.2-branch",
"swiftpm": "swift-4.2-branch",
"swift-syntax": "swift-4.2-branch",
"compiler-rt": "swift-4.2-branch",
"swift-corelibs-xctest": "swift-4.2-branch",
"swift-corelibs-foundation": "swift-4.2-branch",
Expand All @@ -275,6 +289,7 @@
"llbuild": "master",
"swiftpm": "master",
"compiler-rt": "swift-4.1-branch",
"swift-syntax": "master",
"swift-corelibs-xctest": "master",
"swift-corelibs-foundation": "master",
"swift-corelibs-libdispatch": "master",
Expand Down