Skip to content

Revert "Revert "[build-script] Update build-script to support building and installing the SourceKit stress tester"" #20513

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
10 changes: 6 additions & 4 deletions utils/build-presets.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,8 @@ watchos
lldb
llbuild
swiftpm
swiftsyntax
skstresstester
playgroundsupport

# Build with debug info, this allows us to symbolicate crashes from
Expand All @@ -1044,6 +1046,9 @@ install-swift
install-lldb
install-llbuild
install-swiftpm
install-swiftsyntax
skip-install-swiftsyntax-module
install-skstresstester
install-playgroundsupport

install-destdir=%(install_destdir)s
Expand Down Expand Up @@ -1151,10 +1156,7 @@ skip-test-lldb
skip-test-cmark
skip-test-playgroundsupport
skip-test-swiftsyntax

swiftsyntax
install-swiftsyntax
skip-install-swiftsyntax-module
skip-test-skstresstester

#===------------------------------------------------------------------------===#
# LLDB build configurations
Expand Down
4 changes: 4 additions & 0 deletions utils/build-script
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ class BuildScriptInvocation(object):
"--xctest-build-type", args.build_variant,
"--swiftpm-build-type", args.build_variant,
"--swiftsyntax-build-type", args.build_variant,
"--skstresstester-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 @@ -593,6 +594,8 @@ class BuildScriptInvocation(object):
impl_args += ["--skip-build-swiftpm"]
if not args.build_swiftsyntax:
impl_args += ["--skip-build-swiftsyntax"]
if not args.build_skstresstester:
impl_args += ["--skip-build-skstresstester"]
if not args.build_playgroundsupport:
impl_args += ["--skip-build-playgroundsupport"]
if args.build_swift_dynamic_stdlib:
Expand Down Expand Up @@ -637,6 +640,7 @@ class BuildScriptInvocation(object):
"--skip-test-llbuild",
"--skip-test-swiftpm",
"--skip-test-swiftsyntax",
"--skip-test-skstresstester",
"--skip-test-xctest",
"--skip-test-foundation",
"--skip-test-libdispatch",
Expand Down
94 changes: 88 additions & 6 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ KNOWN_SETTINGS=(
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"
skstresstester-build-type "Debug" "the build variant for the SourceKit stress tester"
llbuild-enable-assertions "1" "enable assertions in llbuild"
enable-asan "" "enable Address Sanitizer"
enable-ubsan "" "enable Undefined Behavior Sanitizer"
Expand Down Expand Up @@ -124,6 +125,7 @@ KNOWN_SETTINGS=(
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-skstresstester "" "set to skip building the SourceKit stress tester"
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 @@ -137,6 +139,7 @@ KNOWN_SETTINGS=(
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-skstresstester "" "set to skip testing the SourceKit stress tester"
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 Down Expand Up @@ -193,6 +196,7 @@ KNOWN_SETTINGS=(
install-swiftpm "" "whether to install swiftpm"
install-swiftsyntax "" "whether to install swiftsyntax"
skip-install-swiftsyntax-module "" "set to skip installing swiftsyntax modules"
install-skstresstester "" "whether to install the SourceKit stress tester"
install-xctest "" "whether to install xctest"
install-foundation "" "whether to install foundation"
install-libdispatch "" "whether to install libdispatch"
Expand Down Expand Up @@ -1171,6 +1175,7 @@ LLDB_SOURCE_DIR="${WORKSPACE}/lldb"
LLBUILD_SOURCE_DIR="${WORKSPACE}/llbuild"
SWIFTPM_SOURCE_DIR="${WORKSPACE}/swiftpm"
SWIFTSYNTAX_SOURCE_DIR="${WORKSPACE}/swift-syntax"
SKSTRESSTESTER_SOURCE_DIR="${WORKSPACE}/swift-stress-tester/SourceKitStressTester"
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 @@ -1211,8 +1216,9 @@ PRODUCTS=("${PRODUCTS[@]}" swift)
if [[ ! "${SKIP_BUILD_LLDB}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" lldb)
fi
# LLBuild, SwiftPM, SwiftSyntax and XCTest are dependent on Foundation, so Foundation must be
# added to the list of build products first.
# LLBuild, SwiftPM, SwiftSyntax, the SourceKit stress tester and XCTest are
# dependent on Foundation, so Foundation must be added to the list of build
# products first.
if [[ ! "${SKIP_BUILD_LIBDISPATCH}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" libdispatch)
fi
Expand All @@ -1225,19 +1231,24 @@ fi
if [[ ! "${SKIP_BUILD_PLAYGROUNDSUPPORT}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" playgroundsupport)
fi
# SwiftPM and SwiftSyntax are dependent on XCTest, so XCTest must be added to the list of
# build products first.
# SwiftPM, SwiftSyntax and the SourceKit stress tester 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.
# SwiftSyntax and the SourceKit stress tester are dependent on SwiftPM, so
# SwiftPM must be added to the list of build products first.
if [[ ! "${SKIP_BUILD_SWIFTPM}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" swiftpm)
fi
# The SourceKit stress tester is dependent on SwiftSyntax, so it must be added
# to the list of build products first.
if [[ ! "${SKIP_BUILD_SWIFTSYNTAX}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" swiftsyntax)
fi
if [[ ! "${SKIP_BUILD_SKSTRESSTESTER}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" skstresstester)
fi

# Checks if a given product is enabled (i.e. part of $PRODUCTS array)
function contains_product() {
Expand Down Expand Up @@ -1548,6 +1559,9 @@ function build_directory_bin() {
swiftsyntax)
echo "${root}/${SWIFTSYNTAX_BUILD_TYPE}/bin"
;;
skstresstester)
echo "${root}/${SKSTRESSTESTER_BUILD_TYPE}/bin"
;;
xctest)
echo "${root}/${XCTEST_BUILD_TYPE}/bin"
;;
Expand Down Expand Up @@ -1687,6 +1701,9 @@ function cmake_config_opt() {
swiftsyntax)
echo "--config ${SWIFTSYNTAX_BUILD_TYPE}"
;;
skstresstester)
echo "--config ${SKSTRESSTESTER_BUILD_TYPE}"
;;
xctest)
echo "--config ${XCTEST_BUILD_TYPE}"
;;
Expand Down Expand Up @@ -1796,6 +1813,36 @@ function set_swiftsyntax_build_command() {
--filecheck-exec="$(build_directory_bin ${LOCAL_HOST} llvm)/FileCheck")
}

function set_skstresstester_build_command() {
if [ "${SKIP_BUILD_SWIFTSYNTAX}" ]; then
echo "Error: Cannot build the SourceKit stress tester without SwiftSyntax."
exit 1
fi

local swiftsyntax_config="debug"
if [[ $(is_cmake_release_build_type "${SWIFTSYNTAX_BUILD_TYPE}") ]] ; then
swiftsyntax_config="release"
fi
local config="debug"
if [[ $(is_cmake_release_build_type "${SKSTRESSTESTER_BUILD_TYPE}") ]] ; then
config="release"
fi

skstresstester_build_command=("${SKSTRESSTESTER_SOURCE_DIR}/Utilities/build-script-helper.py")
if [[ "${VERBOSE_BUILD}" ]] ; then
skstresstester_build_command+=(-v)
fi

skstresstester_build_command+=(
--build-dir="${build_dir}"
--swiftc-exec="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
--swift-build-exec="${SWIFT_BUILD}"
--swift-test-exec="${SWIFT_TEST}"
--sourcekitd-dir="$(build_directory ${host} swift)/lib"
--swiftsyntax-dir="$(build_directory ${host} swiftsyntax)/${swiftsyntax_config}"
--config="${config}")
}

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

continue
;;
skstresstester)
if [[ "$(uname -s)" != "Darwin" ]]; then
echo "error: unable to build swift-stress-tester on this platform"
continue
fi
set_skstresstester_build_command
call "${skstresstester_build_command[@]}"

continue
;;
xctest)
Expand Down Expand Up @@ -3088,6 +3145,14 @@ for host in "${ALL_HOSTS[@]}"; do
# As swiftSyntax tests itself, we break early here.
continue
;;
skstresstester)
if [[ "${SKIP_TEST_SKSTRESSTESTER}" ]]; then
continue
fi
echo "--- Running tests for ${product} ---"
call "${skstresstester_build_command[@]}" test
continue
;;
xctest)
if [[ "${SKIP_TEST_XCTEST}" ]]; then
continue
Expand Down Expand Up @@ -3401,6 +3466,23 @@ for host in "${ALL_HOSTS[@]}"; do
call "${swiftsyntax_build_command[@]}" --dylib-dir="${DYLIB_DIR}" --install
fi

continue
;;
skstresstester)
if [[ -z "${INSTALL_SKSTRESSTESTER}" ]] ; then
continue
fi
if [[ -z "${INSTALL_DESTDIR}" ]] ; then
echo "--install-destdir is required to install products."
exit 1
fi
if [[ -z "${INSTALL_SWIFTSYNTAX}" ]] ; then
echo "--install-swiftsyntax is required to install the SourceKit stress tester"
exit 1
fi

echo "--- Installing ${product} ---"
call "${skstresstester_build_command[@]}" --prefix="${host_install_destdir}${host_install_prefix}" install
continue
;;
xctest)
Expand Down
5 changes: 5 additions & 0 deletions utils/build_swift/driver_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,9 @@ def create_argument_parser():
option(['--swiftsyntax'], store_true('build_swiftsyntax'),
help='build swiftSyntax')

option(['--skstresstester'], store_true('build_skstresstester'),
help='build the SourceKit stress tester')

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

Expand Down Expand Up @@ -985,6 +988,8 @@ def create_argument_parser():
/llbuild (optional)
/swiftpm (optional, requires llbuild)
/swift-syntax (optional, requires swiftpm)
/swift-stress-tester (optional,
requires swift-syntax)
/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 @@ -80,6 +80,7 @@
'build_swift_stdlib_unittest_extra': False,
'build_swiftpm': False,
'build_swiftsyntax': False,
'build_skstresstester': False,
'build_tvos': True,
'build_tvos_device': False,
'build_tvos_simulator': False,
Expand Down Expand Up @@ -396,6 +397,7 @@ class IgnoreOption(_BaseOption):
SetTrueOption('--skip-build'),
SetTrueOption('--swiftpm', dest='build_swiftpm'),
SetTrueOption('--swiftsyntax', dest='build_swiftsyntax'),
SetTrueOption('--skstresstester', dest='build_skstresstester'),
SetTrueOption('-B', dest='benchmark'),
SetTrueOption('-S', dest='skip_build'),
SetTrueOption('-b', dest='build_llbuild'),
Expand Down
10 changes: 10 additions & 0 deletions utils/update_checkout/update-checkout-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"remote": { "id": "apple/swift-package-manager" } },
"swift-syntax": {
"remote": { "id": "apple/swift-syntax" } },
"swift-stress-tester": {
"remote": { "id": "apple/swift-stress-tester" } },
"compiler-rt": {
"remote": { "id": "apple/swift-compiler-rt" } },
"swift-corelibs-xctest": {
Expand Down Expand Up @@ -50,6 +52,7 @@
"llbuild": "master",
"swiftpm": "master",
"swift-syntax": "master",
"swift-stress-tester": "master",
"compiler-rt": "stable",
"swift-corelibs-xctest": "master",
"swift-corelibs-foundation": "master",
Expand All @@ -74,6 +77,7 @@
"llbuild": "master",
"swiftpm": "master",
"swift-syntax": "master",
"swift-stress-tester": "master",
"swift-corelibs-xctest": "master",
"swift-corelibs-foundation": "master",
"swift-corelibs-libdispatch": "master",
Expand All @@ -94,6 +98,7 @@
"llbuild": "swift-3.0-branch",
"swiftpm": "swift-3.0-branch",
"swift-syntax": "master",
"swift-stress-tester": "master",
"compiler-rt": "swift-3.0-branch",
"swift-corelibs-xctest": "swift-3.0-branch",
"swift-corelibs-foundation": "swift-3.0-branch",
Expand All @@ -114,6 +119,7 @@
"llbuild": "swift-3.1-branch",
"swiftpm": "swift-3.1-branch",
"swift-syntax": "master",
"swift-stress-tester": "master",
"compiler-rt": "swift-3.1-branch",
"swift-corelibs-xctest": "swift-3.1-branch",
"swift-corelibs-foundation": "swift-3.1-branch",
Expand All @@ -134,6 +140,7 @@
"llbuild": "swift-4.0-branch",
"swiftpm": "swift-4.0-branch",
"swift-syntax": "master",
"swift-stress-tester": "master",
"compiler-rt": "swift-4.0-branch",
"swift-corelibs-xctest": "swift-4.0-branch",
"swift-corelibs-foundation": "swift-4.0-branch",
Expand All @@ -154,6 +161,7 @@
"llbuild": "swift-4.1-branch",
"swiftpm": "swift-4.1-branch",
"swift-syntax": "master",
"swift-stress-tester": "master",
"compiler-rt": "swift-4.1-branch",
"swift-corelibs-xctest": "swift-4.1-branch",
"swift-corelibs-foundation": "swift-4.1-branch",
Expand All @@ -174,6 +182,7 @@
"llbuild": "swift-4.2-branch",
"swiftpm": "swift-4.2-branch",
"swift-syntax": "swift-4.2-branch",
"swift-stress-tester": "master",
"compiler-rt": "swift-4.2-branch",
"swift-corelibs-xctest": "swift-4.2-branch",
"swift-corelibs-foundation": "swift-4.2-branch",
Expand All @@ -195,6 +204,7 @@
"llbuild": "swift-5.0-branch",
"swiftpm": "swift-5.0-branch",
"swift-syntax": "swift-5.0-branch",
"swift-stress-tester": "swift-5.0-branch",
"swift-corelibs-xctest": "swift-5.0-branch",
"swift-corelibs-foundation": "swift-5.0-branch",
"swift-corelibs-libdispatch": "swift-5.0-branch",
Expand Down