Skip to content

Commit e5dbd8d

Browse files
authored
Exercise bootstrapping with the XCBuild codepath in build-using-self (#7253)
This codepath could regress since we previously didn't run it in our PR testing. With this change on macOS we always try to bootstrap SwiftPM with XCBuild on top of the usual llbuild build and test run. It does increase the time spent on the macOS self-hosted job, but that job was already multiple times faster than our smoke test jobs, thus we have enough leeway to make it longer with the benefit of better PR testing.
1 parent a8e6870 commit e5dbd8d

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

Utilities/bootstrap

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ def add_global_args(parser):
8787
def add_build_args(parser):
8888
"""Configures the parser with the arguments necessary for build-related actions."""
8989
add_global_args(parser)
90+
parser.add_argument(
91+
"--swift-build-path",
92+
help="path to the prebuilt SwiftPM `swift-build` binary",
93+
metavar="PATH")
9094
parser.add_argument(
9195
"--swiftc-path",
9296
help="path to the swift compiler",
@@ -154,7 +158,7 @@ def add_build_args(parser):
154158
default=[])
155159
parser.add_argument(
156160
"--cross-compile-config",
157-
help="Swift flags to cross-compile SPM with itself")
161+
help="Swift flags to cross-compile SwiftPM with itself")
158162

159163
def add_test_args(parser):
160164
"""Configures the parser with the arguments necessary for the test action."""
@@ -220,8 +224,9 @@ def parse_build_args(args):
220224

221225
args.swiftc_path = get_swiftc_path(args)
222226
args.clang_path = get_tool_path(args, "clang")
223-
args.cmake_path = get_tool_path(args, "cmake")
224-
args.ninja_path = get_tool_path(args, "ninja")
227+
if not args.skip_cmake_bootstrap:
228+
args.cmake_path = get_tool_path(args, "cmake")
229+
args.ninja_path = get_tool_path(args, "ninja")
225230
args.ar_path = get_tool_path(args, "ar")
226231
args.ranlib_path = get_tool_path(args, "ranlib")
227232
if args.cross_compile_hosts:
@@ -640,7 +645,7 @@ def build_swiftpm_with_swiftpm(args, integrated_swift_driver):
640645
swiftpm_args.append(os.path.join(args.bootstrap_dir, "bin/swift-bootstrap"))
641646
else:
642647
note("Building SwiftPM (with a prebuilt swift-build)")
643-
swiftpm_args.append(os.path.join(os.path.split(args.swiftc_path)[0], "swift-build"))
648+
swiftpm_args.append(args.swift_build_path or os.path.join(os.path.split(args.swiftc_path)[0], "swift-build"))
644649
swiftpm_args.append("--disable-sandbox")
645650

646651
# Enforce resolved versions to avoid stray dependencies that aren't local.

Utilities/build-using-self

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,13 @@ cd IntegrationTests
3434
# Perform package update in order to get the latest commits for the dependencies.
3535
swift package update
3636
$SWIFTPM_BIN_DIR/swift-test --parallel
37+
38+
if [ "$(uname)" == "Darwin" ]; then
39+
cd ..
40+
echo "Current working directory is ${PWD}"
41+
echo "Bootstrapping with the XCBuild codepath..."
42+
./Utilities/bootstrap build --release \
43+
--cross-compile-hosts macosx-arm64 \
44+
--skip-cmake-bootstrap \
45+
--swift-build-path "${SWIFTPM_BIN_DIR}/swift-build"
46+
fi

0 commit comments

Comments
 (0)