Skip to content

Commit 6598f91

Browse files
authored
Merge pull request #19064 from ahoppen/swiftsyntax-new-repo-4.2
[4.2] Move SwiftSyntax to its own repository
2 parents 91ae8f1 + 13c41af commit 6598f91

File tree

6 files changed

+97
-4
lines changed

6 files changed

+97
-4
lines changed

utils/build-presets.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,7 @@ assertions
11621162
# Build llbuild & swiftpm here
11631163
llbuild
11641164
swiftpm
1165+
swiftsyntax
11651166

11661167
# Build Playground support
11671168
playgroundsupport

utils/build-script

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ class BuildScriptInvocation(object):
486486
"--libicu-build-type", args.libicu_build_variant,
487487
"--xctest-build-type", args.build_variant,
488488
"--swiftpm-build-type", args.build_variant,
489+
"--swiftsyntax-build-type", args.build_variant,
489490
"--llbuild-build-type", args.build_variant,
490491
"--swift-enable-assertions", str(args.swift_assertions).lower(),
491492
"--swift-stdlib-enable-assertions", str(
@@ -603,6 +604,8 @@ class BuildScriptInvocation(object):
603604
impl_args += ["--skip-build-libicu"]
604605
if not args.build_swiftpm:
605606
impl_args += ["--skip-build-swiftpm"]
607+
if not args.build_swiftsyntax:
608+
impl_args += ["--skip-build-swiftsyntax"]
606609
if not args.build_playgroundsupport:
607610
impl_args += ["--skip-build-playgroundsupport"]
608611
if args.build_swift_dynamic_stdlib:
@@ -646,6 +649,7 @@ class BuildScriptInvocation(object):
646649
"--skip-test-lldb",
647650
"--skip-test-llbuild",
648651
"--skip-test-swiftpm",
652+
"--skip-test-swiftsyntax",
649653
"--skip-test-xctest",
650654
"--skip-test-foundation",
651655
"--skip-test-libdispatch",

utils/build-script-impl

Lines changed: 71 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ KNOWN_SETTINGS=(
8181
playgroundsupport-build-type "Debug" "the build variant for PlaygroundSupport"
8282
xctest-build-type "Debug" "the build variant for xctest"
8383
swiftpm-build-type "Debug" "the build variant for swiftpm"
84+
swiftsyntax-build-type "Debug" "the build variant for swiftSyntax"
8485
llbuild-enable-assertions "1" "enable assertions in llbuild"
8586
enable-asan "" "enable Address Sanitizer"
8687
enable-ubsan "" "enable Undefined Behavior Sanitizer"
@@ -121,6 +122,7 @@ KNOWN_SETTINGS=(
121122
skip-build-lldb "" "set to skip building LLDB"
122123
skip-build-llbuild "" "set to skip building llbuild"
123124
skip-build-swiftpm "" "set to skip building swiftpm"
125+
skip-build-swiftsyntax "" "set to skip building swiftSyntax"
124126
skip-build-xctest "" "set to skip building xctest"
125127
skip-build-foundation "" "set to skip building foundation"
126128
skip-build-libdispatch "" "set to skip building libdispatch"
@@ -133,6 +135,7 @@ KNOWN_SETTINGS=(
133135
skip-test-swift "" "set to skip testing Swift"
134136
skip-test-llbuild "" "set to skip testing llbuild"
135137
skip-test-swiftpm "" "set to skip testing swiftpm"
138+
skip-test-swiftsyntax "" "set to skip testing swiftSyntax"
136139
skip-test-xctest "" "set to skip testing xctest"
137140
skip-test-foundation "" "set to skip testing foundation"
138141
skip-test-libdispatch "" "set to skip testing libdispatch"
@@ -141,7 +144,7 @@ KNOWN_SETTINGS=(
141144
skip-test-linux "" "set to skip testing Swift stdlibs for Linux"
142145
skip-test-freebsd "" "set to skip testing Swift stdlibs for FreeBSD"
143146
skip-test-cygwin "" "set to skip testing Swift stdlibs for Cygwin"
144-
skip-test-haiku "" "set to skip testing Swift stdlibs for Haiku"
147+
skip-test-haiku "" "set to skip testing Swift stdlibs for Haiku"
145148
skip-test-osx "" "set to skip testing Swift stdlibs for OS X"
146149
skip-test-ios-32bit-simulator "" "set to skip testing Swift stdlibs for iOS 32bit simulators"
147150
skip-test-ios-simulator "" "set to skip testing Swift stdlibs for iOS simulators (i.e. test devices only)"
@@ -1161,6 +1164,7 @@ CMARK_SOURCE_DIR="${WORKSPACE}/cmark"
11611164
LLDB_SOURCE_DIR="${WORKSPACE}/lldb"
11621165
LLBUILD_SOURCE_DIR="${WORKSPACE}/llbuild"
11631166
SWIFTPM_SOURCE_DIR="${WORKSPACE}/swiftpm"
1167+
SWIFTSYNTAX_SOURCE_DIR="${WORKSPACE}/swift-syntax"
11641168
XCTEST_SOURCE_DIR="${WORKSPACE}/swift-corelibs-xctest"
11651169
FOUNDATION_SOURCE_DIR="${WORKSPACE}/swift-corelibs-foundation"
11661170
LIBDISPATCH_SOURCE_DIR="${WORKSPACE}/swift-corelibs-libdispatch"
@@ -1207,22 +1211,27 @@ fi
12071211
if [[ ! "${SKIP_BUILD_LIBDISPATCH}" ]] ; then
12081212
PRODUCTS=("${PRODUCTS[@]}" libdispatch)
12091213
fi
1210-
# SwiftPM and XCTest are dependent on Foundation, so Foundation must be
1214+
# LLBuild, SwiftPM, SwiftSyntax and XCTest are dependent on Foundation, so Foundation must be
12111215
# added to the list of build products first.
12121216
if [[ ! "${SKIP_BUILD_FOUNDATION}" ]] ; then
12131217
PRODUCTS=("${PRODUCTS[@]}" foundation)
12141218
fi
12151219
if [[ ! "${SKIP_BUILD_PLAYGROUNDSUPPORT}" ]] ; then
12161220
PRODUCTS=("${PRODUCTS[@]}" playgroundsupport)
12171221
fi
1218-
# SwiftPM is dependent on XCTest, so XCTest must be added to the list of
1222+
# SwiftPM and SwiftSyntax are dependent on XCTest, so XCTest must be added to the list of
12191223
# build products first.
12201224
if [[ ! "${SKIP_BUILD_XCTEST}" ]] ; then
12211225
PRODUCTS=("${PRODUCTS[@]}" xctest)
12221226
fi
1227+
# SwiftSyntax is dependent on SwiftPM, so SwiftPM must be added to the list of
1228+
# build products first.
12231229
if [[ ! "${SKIP_BUILD_SWIFTPM}" ]] ; then
12241230
PRODUCTS=("${PRODUCTS[@]}" swiftpm)
12251231
fi
1232+
if [[ ! "${SKIP_BUILD_SWIFTSYNTAX}" ]] ; then
1233+
PRODUCTS=("${PRODUCTS[@]}" swiftsyntax)
1234+
fi
12261235

12271236
# Checks if a given product is enabled (i.e. part of $PRODUCTS array)
12281237
function contains_product() {
@@ -1530,6 +1539,9 @@ function build_directory_bin() {
15301539
swiftpm)
15311540
echo "${root}/${SWIFTPM_BUILD_TYPE}/bin"
15321541
;;
1542+
swiftsyntax)
1543+
echo "${root}/${SWIFTSYNTAX_BUILD_TYPE}/bin"
1544+
;;
15331545
xctest)
15341546
echo "${root}/${XCTEST_BUILD_TYPE}/bin"
15351547
;;
@@ -1550,7 +1562,13 @@ function build_directory_bin() {
15501562
;;
15511563
esac
15521564
else
1553-
echo "${root}/bin"
1565+
if [[ "${product}" == "swiftpm" ]] ; then
1566+
# All projects that call this depend on SwiftPM so we know that
1567+
# swiftpm_bootstrap_command has already been set
1568+
echo "$(${swiftpm_bootstrap_command[@]} --show-bin-path)"
1569+
else
1570+
echo "${root}/bin"
1571+
fi
15541572
fi
15551573
}
15561574

@@ -1660,6 +1678,9 @@ function cmake_config_opt() {
16601678
swiftpm)
16611679
echo "--config ${SWIFTPM_BUILD_TYPE}"
16621680
;;
1681+
swiftsyntax)
1682+
echo "--config ${SWIFTSYNTAX_BUILD_TYPE}"
1683+
;;
16631684
xctest)
16641685
echo "--config ${XCTEST_BUILD_TYPE}"
16651686
;;
@@ -1702,6 +1723,10 @@ function set_swiftpm_bootstrap_command() {
17021723
echo "Error: Cannot build swiftpm without llbuild (swift-build-tool)."
17031724
exit 1
17041725
fi
1726+
if [[ "${CMAKE_GENERATOR}" == "Xcode" ]]; then
1727+
echo "Error: Cannot build swiftpm when llbuild is built using Xcode."
1728+
exit 1
1729+
fi
17051730
swiftpm_bootstrap_command=("${SWIFTPM_SOURCE_DIR}/Utilities/bootstrap" "${swiftpm_bootstrap_options[@]}")
17061731
# Add --release if we have to build in release mode.
17071732
if [[ "${SWIFTPM_BUILD_TYPE}" == "Release" ]] ; then
@@ -1731,6 +1756,29 @@ function set_swiftpm_bootstrap_command() {
17311756
fi
17321757
}
17331758

1759+
function set_swiftsyntax_build_command() {
1760+
if [ "${SKIP_BUILD_SWIFTPM}" ]; then
1761+
echo "Error: Cannot build swiftsyntax without swiftpm."
1762+
exit 1
1763+
fi
1764+
1765+
swiftsyntax_build_command=("${SWIFTSYNTAX_SOURCE_DIR}/build-script.py")
1766+
# Add --release if we have to build in release mode.
1767+
if [[ $(is_cmake_release_build_type "${SWIFTSYNTAX_BUILD_TYPE}") ]] ; then
1768+
swiftsyntax_build_command+=(--release)
1769+
fi
1770+
if [[ "${VERBOSE_BUILD}" ]] ; then
1771+
swiftsyntax_build_command+=(-v)
1772+
fi
1773+
swiftsyntax_build_command+=(
1774+
--build-dir="${build_dir}"
1775+
--swift-build-exec="$(build_directory_bin ${LOCAL_HOST} swiftpm)/swift-build"
1776+
--swift-test-exec="$(build_directory_bin ${LOCAL_HOST} swiftpm)/swift-test"
1777+
--swiftc-exec="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
1778+
--swift-syntax-test-exec="$(build_directory_bin ${LOCAL_HOST} swift)/swift-syntax-test"
1779+
--filecheck-exec="$(build_directory_bin ${LOCAL_HOST} llvm)/FileCheck")
1780+
}
1781+
17341782
# Construct the appropriate options to pass to an Xcode
17351783
# build of any LLDB target.
17361784
function set_lldb_xcodebuild_options() {
@@ -2381,6 +2429,12 @@ for host in "${ALL_HOSTS[@]}"; do
23812429
call "${swiftpm_bootstrap_command[@]}"
23822430

23832431
# swiftpm installs itself with a bootstrap method. No further cmake building is performed.
2432+
continue
2433+
;;
2434+
swiftsyntax)
2435+
set_swiftsyntax_build_command
2436+
call "${swiftsyntax_build_command[@]}"
2437+
23842438
continue
23852439
;;
23862440
xctest)
@@ -2899,6 +2953,15 @@ for host in "${ALL_HOSTS[@]}"; do
28992953
# As swiftpm tests itself, we break early here.
29002954
continue
29012955
;;
2956+
swiftsyntax)
2957+
if [[ "${SKIP_TEST_SWIFTSYNTAX}" ]]; then
2958+
continue
2959+
fi
2960+
echo "--- Running tests for ${product} ---"
2961+
call "${swiftsyntax_build_command[@]}" -t
2962+
# As swiftSyntax tests itself, we break early here.
2963+
continue
2964+
;;
29022965
xctest)
29032966
if [[ "${SKIP_TEST_XCTEST}" ]]; then
29042967
continue
@@ -3178,6 +3241,10 @@ for host in "${ALL_HOSTS[@]}"; do
31783241
# As swiftpm bootstraps the installation itself, we break early here.
31793242
continue
31803243
;;
3244+
swiftsyntax)
3245+
# SwiftSyntax is not installed as part of the toolchain
3246+
continue
3247+
;;
31813248
xctest)
31823249
if [[ -z "${INSTALL_XCTEST}" ]] ; then
31833250
continue

utils/build_swift/driver_arguments.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@ def create_argument_parser():
502502
option(['-p', '--swiftpm'], store_true('build_swiftpm'),
503503
help='build swiftpm')
504504

505+
option(['--swiftsyntax'], store_true('build_swiftsyntax'),
506+
help='build swiftSyntax')
507+
505508
option('--xctest', toggle_true('build_xctest'),
506509
help='build xctest')
507510

@@ -968,6 +971,7 @@ def create_argument_parser():
968971
/lldb (optional)
969972
/llbuild (optional)
970973
/swiftpm (optional, requires llbuild)
974+
/swift-syntax (optional, requires swiftpm)
971975
/compiler-rt (optional)
972976
/swift-corelibs-xctest (optional)
973977
/swift-corelibs-foundation (optional)

utils/build_swift/tests/expected_options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
'build_swift_static_stdlib': False,
8080
'build_swift_stdlib_unittest_extra': False,
8181
'build_swiftpm': False,
82+
'build_swiftsyntax': False,
8283
'build_tvos': True,
8384
'build_tvos_device': False,
8485
'build_tvos_simulator': False,
@@ -393,6 +394,7 @@ class IgnoreOption(_BaseOption):
393394
SetTrueOption('--playgroundsupport', dest='build_playgroundsupport'),
394395
SetTrueOption('--skip-build'),
395396
SetTrueOption('--swiftpm', dest='build_swiftpm'),
397+
SetTrueOption('--swiftsyntax', dest='build_swiftsyntax'),
396398
SetTrueOption('-B', dest='benchmark'),
397399
SetTrueOption('-S', dest='skip_build'),
398400
SetTrueOption('-b', dest='build_llbuild'),

utils/update-checkout-config.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"remote": { "id": "apple/swift-llbuild" } },
1717
"swiftpm": {
1818
"remote": { "id": "apple/swift-package-manager" } },
19+
"swift-syntax": {
20+
"remote": { "id": "apple/swift-syntax" } },
1921
"compiler-rt": {
2022
"remote": { "id": "apple/swift-compiler-rt" } },
2123
"swift-corelibs-xctest": {
@@ -43,6 +45,7 @@
4345
"cmark": "master",
4446
"llbuild": "master",
4547
"swiftpm": "master",
48+
"swift-syntax": "master",
4649
"compiler-rt": "stable",
4750
"swift-corelibs-xctest": "master",
4851
"swift-corelibs-foundation": "master",
@@ -65,6 +68,7 @@
6568
"cmark": "master",
6669
"llbuild": "master",
6770
"swiftpm": "master",
71+
"swift-syntax": "master",
6872
"swift-corelibs-xctest": "master",
6973
"swift-corelibs-foundation": "master",
7074
"swift-corelibs-libdispatch": "master",
@@ -85,6 +89,7 @@
8589
"cmark": "master",
8690
"llbuild": "master",
8791
"swiftpm": "master",
92+
"swift-syntax": "master",
8893
"swift-corelibs-xctest": "master",
8994
"swift-corelibs-foundation": "master",
9095
"swift-corelibs-libdispatch": "master",
@@ -103,6 +108,7 @@
103108
"cmark": "swift-3.0-branch",
104109
"llbuild": "swift-3.0-branch",
105110
"swiftpm": "swift-3.0-branch",
111+
"swift-syntax": "master",
106112
"compiler-rt": "swift-3.0-branch",
107113
"swift-corelibs-xctest": "swift-3.0-branch",
108114
"swift-corelibs-foundation": "swift-3.0-branch",
@@ -122,6 +128,7 @@
122128
"cmark": "swift-3.1-branch",
123129
"llbuild": "swift-3.1-branch",
124130
"swiftpm": "swift-3.1-branch",
131+
"swift-syntax": "master",
125132
"compiler-rt": "swift-3.1-branch",
126133
"swift-corelibs-xctest": "swift-3.1-branch",
127134
"swift-corelibs-foundation": "swift-3.1-branch",
@@ -141,6 +148,7 @@
141148
"cmark": "swift-4.1-branch",
142149
"llbuild": "swift-4.1-branch",
143150
"swiftpm": "swift-4.1-branch",
151+
"swift-syntax": "master",
144152
"compiler-rt": "swift-4.1-branch",
145153
"swift-corelibs-xctest": "swift-4.1-branch",
146154
"swift-corelibs-foundation": "swift-4.1-branch",
@@ -160,6 +168,7 @@
160168
"cmark": "swift-4.0-branch",
161169
"llbuild": "swift-4.0-branch",
162170
"swiftpm": "swift-4.0-branch",
171+
"swift-syntax": "master",
163172
"compiler-rt": "swift-4.0-branch",
164173
"swift-corelibs-xctest": "swift-4.0-branch",
165174
"swift-corelibs-foundation": "swift-4.0-branch",
@@ -179,6 +188,7 @@
179188
"cmark": "swift-4.0-branch",
180189
"llbuild": "swift-4.0-branch",
181190
"swiftpm": "swift-4.0-branch",
191+
"swift-syntax": "swift-4.2-branch",
182192
"compiler-rt": "swift-4.0-branch-07-11-2017",
183193
"swift-corelibs-xctest": "swift-4.0-branch",
184194
"swift-corelibs-foundation": "swift-4.0-branch",
@@ -198,6 +208,7 @@
198208
"cmark": "swift-4.2-branch",
199209
"llbuild": "swift-4.2-branch",
200210
"swiftpm": "swift-4.2-branch",
211+
"swift-syntax": "swift-4.2-branch",
201212
"compiler-rt": "swift-4.2-branch",
202213
"swift-corelibs-xctest": "swift-4.2-branch",
203214
"swift-corelibs-foundation": "swift-4.2-branch",
@@ -217,6 +228,7 @@
217228
"cmark": "master",
218229
"llbuild": "master",
219230
"swiftpm": "master",
231+
"swift-syntax": "swift-4.2-branch",
220232
"compiler-rt": "swift-4.2-branch-03-26-2018",
221233
"swift-corelibs-xctest": "swift-4.2-branch",
222234
"swift-corelibs-foundation": "swift-4.2-branch",
@@ -236,6 +248,7 @@
236248
"cmark": "master",
237249
"llbuild": "master",
238250
"swiftpm": "master",
251+
"swift-syntax": "swift-4.2-branch",
239252
"compiler-rt": "swift-4.2-branch-04-20-2018",
240253
"swift-corelibs-xctest": "swift-4.2-branch-04-20-2018",
241254
"swift-corelibs-foundation": "swift-4.2-branch-04-20-2018",
@@ -255,6 +268,7 @@
255268
"cmark": "swift-4.2-branch",
256269
"llbuild": "swift-4.2-branch",
257270
"swiftpm": "swift-4.2-branch",
271+
"swift-syntax": "swift-4.2-branch",
258272
"compiler-rt": "swift-4.2-branch",
259273
"swift-corelibs-xctest": "swift-4.2-branch",
260274
"swift-corelibs-foundation": "swift-4.2-branch",
@@ -275,6 +289,7 @@
275289
"llbuild": "master",
276290
"swiftpm": "master",
277291
"compiler-rt": "swift-4.1-branch",
292+
"swift-syntax": "master",
278293
"swift-corelibs-xctest": "master",
279294
"swift-corelibs-foundation": "master",
280295
"swift-corelibs-libdispatch": "master",

0 commit comments

Comments
 (0)