@@ -82,6 +82,7 @@ KNOWN_SETTINGS=(
82
82
playgroundsupport-build-type " Debug" " the build variant for PlaygroundSupport"
83
83
xctest-build-type " Debug" " the build variant for xctest"
84
84
swiftpm-build-type " Debug" " the build variant for swiftpm"
85
+ swiftsyntax-build-type " Debug" " the build variant for swiftSyntax"
85
86
llbuild-enable-assertions " 1" " enable assertions in llbuild"
86
87
enable-asan " " " enable Address Sanitizer"
87
88
enable-ubsan " " " enable Undefined Behavior Sanitizer"
@@ -122,6 +123,7 @@ KNOWN_SETTINGS=(
122
123
skip-build-lldb " " " set to skip building LLDB"
123
124
skip-build-llbuild " " " set to skip building llbuild"
124
125
skip-build-swiftpm " " " set to skip building swiftpm"
126
+ skip-build-swiftsyntax " " " set to skip building swiftSyntax"
125
127
skip-build-xctest " " " set to skip building xctest"
126
128
skip-build-foundation " " " set to skip building foundation"
127
129
skip-build-libdispatch " " " set to skip building libdispatch"
@@ -134,6 +136,7 @@ KNOWN_SETTINGS=(
134
136
skip-test-swift " " " set to skip testing Swift"
135
137
skip-test-llbuild " " " set to skip testing llbuild"
136
138
skip-test-swiftpm " " " set to skip testing swiftpm"
139
+ skip-test-swiftsyntax " " " set to skip testing swiftSyntax"
137
140
skip-test-xctest " " " set to skip testing xctest"
138
141
skip-test-foundation " " " set to skip testing foundation"
139
142
skip-test-libdispatch " " " set to skip testing libdispatch"
@@ -142,7 +145,7 @@ KNOWN_SETTINGS=(
142
145
skip-test-linux " " " set to skip testing Swift stdlibs for Linux"
143
146
skip-test-freebsd " " " set to skip testing Swift stdlibs for FreeBSD"
144
147
skip-test-cygwin " " " set to skip testing Swift stdlibs for Cygwin"
145
- skip-test-haiku " " " set to skip testing Swift stdlibs for Haiku"
148
+ skip-test-haiku " " " set to skip testing Swift stdlibs for Haiku"
146
149
skip-test-osx " " " set to skip testing Swift stdlibs for OS X"
147
150
skip-test-ios-32bit-simulator " " " set to skip testing Swift stdlibs for iOS 32bit simulators"
148
151
skip-test-ios-simulator " " " set to skip testing Swift stdlibs for iOS simulators (i.e. test devices only)"
@@ -1162,6 +1165,7 @@ CMARK_SOURCE_DIR="${WORKSPACE}/cmark"
1162
1165
LLDB_SOURCE_DIR=" ${WORKSPACE} /lldb"
1163
1166
LLBUILD_SOURCE_DIR=" ${WORKSPACE} /llbuild"
1164
1167
SWIFTPM_SOURCE_DIR=" ${WORKSPACE} /swiftpm"
1168
+ SWIFTSYNTAX_SOURCE_DIR=" ${WORKSPACE} /swift-syntax"
1165
1169
XCTEST_SOURCE_DIR=" ${WORKSPACE} /swift-corelibs-xctest"
1166
1170
FOUNDATION_SOURCE_DIR=" ${WORKSPACE} /swift-corelibs-foundation"
1167
1171
LIBDISPATCH_SOURCE_DIR=" ${WORKSPACE} /swift-corelibs-libdispatch"
@@ -1202,7 +1206,7 @@ PRODUCTS=("${PRODUCTS[@]}" swift)
1202
1206
if [[ ! " ${SKIP_BUILD_LLDB} " ]] ; then
1203
1207
PRODUCTS=(" ${PRODUCTS[@]} " lldb)
1204
1208
fi
1205
- # LLBuild, SwiftPM and XCTest are dependent on Foundation, so Foundation must be
1209
+ # LLBuild, SwiftPM, SwiftSyntax and XCTest are dependent on Foundation, so Foundation must be
1206
1210
# added to the list of build products first.
1207
1211
if [[ ! " ${SKIP_BUILD_LIBDISPATCH} " ]] ; then
1208
1212
PRODUCTS=(" ${PRODUCTS[@]} " libdispatch)
@@ -1216,14 +1220,19 @@ fi
1216
1220
if [[ ! " ${SKIP_BUILD_PLAYGROUNDSUPPORT} " ]] ; then
1217
1221
PRODUCTS=(" ${PRODUCTS[@]} " playgroundsupport)
1218
1222
fi
1219
- # SwiftPM is dependent on XCTest, so XCTest must be added to the list of
1223
+ # SwiftPM and SwiftSyntax are dependent on XCTest, so XCTest must be added to the list of
1220
1224
# build products first.
1221
1225
if [[ ! " ${SKIP_BUILD_XCTEST} " ]] ; then
1222
1226
PRODUCTS=(" ${PRODUCTS[@]} " xctest)
1223
1227
fi
1228
+ # SwiftSyntax is dependent on SwiftPM, so SwiftPM must be added to the list of
1229
+ # build products first.
1224
1230
if [[ ! " ${SKIP_BUILD_SWIFTPM} " ]] ; then
1225
1231
PRODUCTS=(" ${PRODUCTS[@]} " swiftpm)
1226
1232
fi
1233
+ if [[ ! " ${SKIP_BUILD_SWIFTSYNTAX} " ]] ; then
1234
+ PRODUCTS=(" ${PRODUCTS[@]} " swiftsyntax)
1235
+ fi
1227
1236
1228
1237
# Checks if a given product is enabled (i.e. part of $PRODUCTS array)
1229
1238
function contains_product() {
@@ -1531,6 +1540,9 @@ function build_directory_bin() {
1531
1540
swiftpm)
1532
1541
echo " ${root} /${SWIFTPM_BUILD_TYPE} /bin"
1533
1542
;;
1543
+ swiftsyntax)
1544
+ echo " ${root} /${SWIFTSYNTAX_BUILD_TYPE} /bin"
1545
+ ;;
1534
1546
xctest)
1535
1547
echo " ${root} /${XCTEST_BUILD_TYPE} /bin"
1536
1548
;;
@@ -1551,7 +1563,13 @@ function build_directory_bin() {
1551
1563
;;
1552
1564
esac
1553
1565
else
1554
- echo " ${root} /bin"
1566
+ if [[ " ${product} " == " swiftpm" ]] ; then
1567
+ # All projects that call this depend on SwiftPM so we know that
1568
+ # swiftpm_bootstrap_command has already been set
1569
+ echo " $( ${swiftpm_bootstrap_command[@]} --show-bin-path) "
1570
+ else
1571
+ echo " ${root} /bin"
1572
+ fi
1555
1573
fi
1556
1574
}
1557
1575
@@ -1661,6 +1679,9 @@ function cmake_config_opt() {
1661
1679
swiftpm)
1662
1680
echo " --config ${SWIFTPM_BUILD_TYPE} "
1663
1681
;;
1682
+ swiftsyntax)
1683
+ echo " --config ${SWIFTSYNTAX_BUILD_TYPE} "
1684
+ ;;
1664
1685
xctest)
1665
1686
echo " --config ${XCTEST_BUILD_TYPE} "
1666
1687
;;
@@ -1703,6 +1724,10 @@ function set_swiftpm_bootstrap_command() {
1703
1724
echo " Error: Cannot build swiftpm without llbuild (swift-build-tool)."
1704
1725
exit 1
1705
1726
fi
1727
+ if [[ " ${CMAKE_GENERATOR} " == " Xcode" ]]; then
1728
+ echo " Error: Cannot build swiftpm when llbuild is built using Xcode."
1729
+ exit 1
1730
+ fi
1706
1731
swiftpm_bootstrap_command=(" ${SWIFTPM_SOURCE_DIR} /Utilities/bootstrap" " ${swiftpm_bootstrap_options[@]} " )
1707
1732
# Add --release if we have to build in release mode.
1708
1733
if [[ " ${SWIFTPM_BUILD_TYPE} " == " Release" ]] ; then
@@ -1741,6 +1766,29 @@ function set_swiftpm_bootstrap_command() {
1741
1766
fi
1742
1767
}
1743
1768
1769
+ function set_swiftsyntax_build_command() {
1770
+ if [ " ${SKIP_BUILD_SWIFTPM} " ]; then
1771
+ echo " Error: Cannot build swiftsyntax without swiftpm."
1772
+ exit 1
1773
+ fi
1774
+
1775
+ swiftsyntax_build_command=(" ${SWIFTSYNTAX_SOURCE_DIR} /build-script.py" )
1776
+ # Add --release if we have to build in release mode.
1777
+ if [[ $( is_cmake_release_build_type " ${SWIFTSYNTAX_BUILD_TYPE} " ) ]] ; then
1778
+ swiftsyntax_build_command+=(--release)
1779
+ fi
1780
+ if [[ " ${VERBOSE_BUILD} " ]] ; then
1781
+ swiftsyntax_build_command+=(-v)
1782
+ fi
1783
+ swiftsyntax_build_command+=(
1784
+ --build-dir=" ${build_dir} "
1785
+ --swift-build-exec=" $( build_directory_bin ${LOCAL_HOST} swiftpm) /swift-build"
1786
+ --swift-test-exec=" $( build_directory_bin ${LOCAL_HOST} swiftpm) /swift-test"
1787
+ --swiftc-exec=" $( build_directory_bin ${LOCAL_HOST} swift) /swiftc"
1788
+ --swift-syntax-test-exec=" $( build_directory_bin ${LOCAL_HOST} swift) /swift-syntax-test"
1789
+ --filecheck-exec=" $( build_directory_bin ${LOCAL_HOST} llvm) /FileCheck" )
1790
+ }
1791
+
1744
1792
# Construct the appropriate options to pass to an Xcode
1745
1793
# build of any LLDB target.
1746
1794
function set_lldb_xcodebuild_options() {
@@ -2398,6 +2446,12 @@ for host in "${ALL_HOSTS[@]}"; do
2398
2446
call " ${swiftpm_bootstrap_command[@]} "
2399
2447
2400
2448
# swiftpm installs itself with a bootstrap method. No further cmake building is performed.
2449
+ continue
2450
+ ;;
2451
+ swiftsyntax)
2452
+ set_swiftsyntax_build_command
2453
+ call " ${swiftsyntax_build_command[@]} "
2454
+
2401
2455
continue
2402
2456
;;
2403
2457
xctest)
@@ -2937,6 +2991,15 @@ for host in "${ALL_HOSTS[@]}"; do
2937
2991
# As swiftpm tests itself, we break early here.
2938
2992
continue
2939
2993
;;
2994
+ swiftsyntax)
2995
+ if [[ " ${SKIP_TEST_SWIFTSYNTAX} " ]]; then
2996
+ continue
2997
+ fi
2998
+ echo " --- Running tests for ${product} ---"
2999
+ call " ${swiftsyntax_build_command[@]} " -t
3000
+ # As swiftSyntax tests itself, we break early here.
3001
+ continue
3002
+ ;;
2940
3003
xctest)
2941
3004
if [[ " ${SKIP_TEST_XCTEST} " ]]; then
2942
3005
continue
@@ -3216,6 +3279,10 @@ for host in "${ALL_HOSTS[@]}"; do
3216
3279
# As swiftpm bootstraps the installation itself, we break early here.
3217
3280
continue
3218
3281
;;
3282
+ swiftsyntax)
3283
+ # SwiftSyntax is not installed as part of the toolchain
3284
+ continue
3285
+ ;;
3219
3286
xctest)
3220
3287
if [[ -z " ${INSTALL_XCTEST} " ]] ; then
3221
3288
continue
0 commit comments