Skip to content

Commit 8e4202d

Browse files
authored
Merge pull request #28035 from aciidb0mb3r/omg-2
Move swiftpm to swift_build_support infra
2 parents b89b58c + 7241030 commit 8e4202d

File tree

6 files changed

+78
-144
lines changed

6 files changed

+78
-144
lines changed

utils/build-presets.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ swift-primary-variant-sdk=OSX
364364
swift-primary-variant-arch=x86_64
365365
skip-build-llbuild
366366
skip-test-llbuild
367-
skip-build-swiftpm
368367
skip-test-swiftpm
369368
skip-build-playgroundsupport
370369
skip-test-playgroundsupport
@@ -843,7 +842,6 @@ android-icu-data=%(arm_dir)s/libicudataswift.so
843842
skip-test-linux
844843
skip-build-lldb
845844
skip-build-llbuild
846-
skip-build-swiftpm
847845
skip-build-libdispatch
848846
skip-build-foundation
849847
skip-build-xctest
@@ -1640,7 +1638,6 @@ darwin-install-extract-symbols=1
16401638
skip-build-cmark
16411639
skip-build-llvm
16421640
skip-build-llbuild
1643-
skip-build-swiftpm
16441641
skip-build-benchmarks
16451642
install-swift
16461643
install-prefix=%(install_toolchain_dir)s/usr

utils/build-script

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ class BuildScriptInvocation(object):
337337
"--libdispatch-build-type", args.libdispatch_build_variant,
338338
"--libicu-build-type", args.libicu_build_variant,
339339
"--xctest-build-type", args.build_variant,
340-
"--swiftpm-build-type", args.build_variant,
341340
"--llbuild-build-type", args.build_variant,
342341
"--swift-enable-assertions", str(args.swift_assertions).lower(),
343342
"--swift-stdlib-enable-assertions", str(
@@ -464,8 +463,6 @@ class BuildScriptInvocation(object):
464463
impl_args += ["--skip-build-libdispatch"]
465464
if not args.build_libicu:
466465
impl_args += ["--skip-build-libicu"]
467-
if not args.build_swiftpm:
468-
impl_args += ["--skip-build-swiftpm"]
469466
if not args.build_playgroundsupport:
470467
impl_args += ["--skip-build-playgroundsupport"]
471468
if args.build_swift_dynamic_stdlib:
@@ -508,7 +505,6 @@ class BuildScriptInvocation(object):
508505
impl_args += ["--skip-test-cmark",
509506
"--skip-test-lldb",
510507
"--skip-test-llbuild",
511-
"--skip-test-swiftpm",
512508
"--skip-test-xctest",
513509
"--skip-test-foundation",
514510
"--skip-test-libdispatch",

utils/build-script-impl

Lines changed: 2 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ KNOWN_SETTINGS=(
7878
libicu-build-type "Debug" "the build variant for libicu"
7979
playgroundsupport-build-type "Debug" "the build variant for PlaygroundSupport"
8080
xctest-build-type "Debug" "the build variant for xctest"
81-
swiftpm-build-type "Debug" "the build variant for swiftpm"
8281
llbuild-enable-assertions "1" "enable assertions in llbuild"
8382
enable-asan "" "enable Address Sanitizer"
8483
enable-ubsan "" "enable Undefined Behavior Sanitizer"
@@ -119,7 +118,6 @@ KNOWN_SETTINGS=(
119118
skip-build-lldb "" "set to skip building LLDB"
120119
skip-build-llbuild "" "set to skip building llbuild"
121120
skip-build-libcxx "" "set to skip building libcxx"
122-
skip-build-swiftpm "" "set to skip building swiftpm"
123121
skip-build-xctest "" "set to skip building xctest"
124122
skip-build-foundation "" "set to skip building foundation"
125123
skip-build-libdispatch "" "set to skip building libdispatch"
@@ -132,7 +130,6 @@ KNOWN_SETTINGS=(
132130
skip-test-lldb "" "set to skip testing lldb"
133131
skip-test-swift "" "set to skip testing Swift"
134132
skip-test-llbuild "" "set to skip testing llbuild"
135-
skip-test-swiftpm "" "set to skip testing swiftpm"
136133
skip-test-xctest "" "set to skip testing xctest"
137134
skip-test-foundation "" "set to skip testing foundation"
138135
skip-test-libdispatch "" "set to skip testing libdispatch"
@@ -189,7 +186,6 @@ KNOWN_SETTINGS=(
189186
install-swift "" "whether to install Swift"
190187
install-lldb "" "whether to install LLDB"
191188
install-llbuild "" "whether to install llbuild"
192-
install-swiftpm "" "whether to install swiftpm"
193189
install-xctest "" "whether to install xctest"
194190
install-foundation "" "whether to install foundation"
195191
install-libcxx "" "whether to install libc++"
@@ -248,7 +244,6 @@ KNOWN_SETTINGS=(
248244
llvm-cmake-options "" "CMake options used for all llvm targets"
249245
ninja-cmake-options "" "CMake options used for all ninja targets"
250246
swift-cmake-options "" "CMake options used for all swift targets"
251-
swiftpm-cmake-options "" "CMake options used for all swiftpm targets"
252247
xctest-cmake-options "" "CMake options used for all xctest targets"
253248
playgroundsupport-cmake-options "" "CMake options used for all playgroundsupport targets"
254249
# TODO: Remove this some time later.
@@ -406,7 +401,6 @@ function set_build_options_for_host() {
406401
swift_cmake_options=()
407402
cmark_cmake_options=()
408403
lldb_cmake_options=()
409-
swiftpm_bootstrap_options=()
410404
SWIFT_HOST_VARIANT=
411405
SWIFT_HOST_VARIANT_SDK=
412406
SWIFT_HOST_VARIANT_ARCH=
@@ -485,9 +479,6 @@ function set_build_options_for_host() {
485479
-DCMAKE_OSX_SYSROOT:PATH="$(xcrun --sdk ${xcrun_sdk_name} --show-sdk-path)"
486480
-DCMAKE_OSX_DEPLOYMENT_TARGET="${cmake_osx_deployment_target}"
487481
)
488-
swiftpm_bootstrap_options=(
489-
--sysroot="$(xcrun --sdk ${xcrun_sdk_name} --show-sdk-path)"
490-
)
491482
;;
492483
iphonesimulator-i386)
493484
xcrun_sdk_name="iphonesimulator"
@@ -1179,7 +1170,6 @@ LLVM_SOURCE_DIR="${WORKSPACE}/llvm"
11791170
CMARK_SOURCE_DIR="${WORKSPACE}/cmark"
11801171
LLDB_SOURCE_DIR="${WORKSPACE}/lldb"
11811172
LLBUILD_SOURCE_DIR="${WORKSPACE}/llbuild"
1182-
SWIFTPM_SOURCE_DIR="${WORKSPACE}/swiftpm"
11831173
STRESSTEST_PACKAGE_DIR="${WORKSPACE}/swift-stress-tester"
11841174
XCTEST_SOURCE_DIR="${WORKSPACE}/swift-corelibs-xctest"
11851175
FOUNDATION_SOURCE_DIR="${WORKSPACE}/swift-corelibs-foundation"
@@ -1233,7 +1223,7 @@ PRODUCTS=("${PRODUCTS[@]}" swift)
12331223
if [[ ! "${SKIP_BUILD_LLDB}" ]] ; then
12341224
PRODUCTS=("${PRODUCTS[@]}" lldb)
12351225
fi
1236-
# LLBuild, SwiftPM and XCTest are dependent on Foundation, so Foundation must
1226+
# LLBuild and XCTest are dependent on Foundation, so Foundation must
12371227
# be added to the list of build products first.
12381228
if [[ ! "${SKIP_BUILD_LIBDISPATCH}" ]] ; then
12391229
PRODUCTS=("${PRODUCTS[@]}" libdispatch)
@@ -1253,14 +1243,9 @@ fi
12531243
if [[ ! "${SKIP_BUILD_PLAYGROUNDSUPPORT}" ]] ; then
12541244
PRODUCTS=("${PRODUCTS[@]}" playgroundsupport)
12551245
fi
1256-
# SwiftPM is dependent on XCTest, so XCTest must be added to the list of build
1257-
# products first.
12581246
if [[ ! "${SKIP_BUILD_XCTEST}" ]] ; then
12591247
PRODUCTS=("${PRODUCTS[@]}" xctest)
12601248
fi
1261-
if [[ ! "${SKIP_BUILD_SWIFTPM}" ]] ; then
1262-
PRODUCTS=("${PRODUCTS[@]}" swiftpm)
1263-
fi
12641249

12651250
# Checks if a given product is enabled (i.e. part of $PRODUCTS array)
12661251
function contains_product() {
@@ -1563,9 +1548,6 @@ function build_directory_bin() {
15631548
llbuild)
15641549
echo "${root}/${LLBUILD_BUILD_TYPE}/bin"
15651550
;;
1566-
swiftpm)
1567-
echo "${root}/${SWIFTPM_BUILD_TYPE}/bin"
1568-
;;
15691551
xctest)
15701552
echo "${root}/${XCTEST_BUILD_TYPE}/bin"
15711553
;;
@@ -1586,12 +1568,7 @@ function build_directory_bin() {
15861568
;;
15871569
esac
15881570
else
1589-
if [[ "${product}" == "swiftpm" ]] ; then
1590-
set_swiftpm_bootstrap_command
1591-
echo "$(${swiftpm_bootstrap_command[@]} --show-bin-path)"
1592-
else
1593-
echo "${root}/bin"
1594-
fi
1571+
echo "${root}/bin"
15951572
fi
15961573
}
15971574

@@ -1705,9 +1682,6 @@ function cmake_config_opt() {
17051682
llbuild)
17061683
echo "--config ${LLBUILD_BUILD_TYPE}"
17071684
;;
1708-
swiftpm)
1709-
echo "--config ${SWIFTPM_BUILD_TYPE}"
1710-
;;
17111685
xctest)
17121686
echo "--config ${XCTEST_BUILD_TYPE}"
17131687
;;
@@ -1730,81 +1704,6 @@ function cmake_config_opt() {
17301704
fi
17311705
}
17321706

1733-
function set_swiftpm_bootstrap_command() {
1734-
if [[ -n "${swiftpm_bootstrap_command[@]}" ]]; then
1735-
# Already set.
1736-
return
1737-
fi
1738-
1739-
SWIFTC_BIN="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
1740-
LLBUILD_BIN="$(build_directory_bin ${LOCAL_HOST} llbuild)/swift-build-tool"
1741-
if [[ ! "${SKIP_BUILD_FOUNDATION}" ]] ; then
1742-
FOUNDATION_BUILD_DIR=$(build_directory ${host} foundation)
1743-
if [[ ! "${SKIP_BUILD_LIBDISPATCH}" ]] ; then
1744-
LIBDISPATCH_BUILD_DIR="$(build_directory ${host} libdispatch)"
1745-
LIBDISPATCH_BUILD_ARGS="--libdispatch-source-dir=${LIBDISPATCH_SOURCE_DIR} --libdispatch-build-dir=${LIBDISPATCH_BUILD_DIR}"
1746-
fi
1747-
if [[ ! "${SKIP_BUILD_LIBICU}" ]] ; then
1748-
LIBICU_BUILD_DIR="$(build_directory ${host} libicu)"
1749-
fi
1750-
if [[ ! "${SKIP_BUILD_XCTEST}" ]] ; then
1751-
XCTEST_BUILD_DIR=$(build_directory ${host} xctest)
1752-
fi
1753-
fi
1754-
if [ "${SKIP_BUILD_LLBUILD}" ]; then
1755-
echo "Error: Cannot build swiftpm without llbuild (swift-build-tool)."
1756-
exit 1
1757-
fi
1758-
if [[ "${CMAKE_GENERATOR}" == "Xcode" ]]; then
1759-
echo "Error: Cannot build swiftpm when llbuild is built using Xcode."
1760-
exit 1
1761-
fi
1762-
swiftpm_bootstrap_command=("${SWIFTPM_SOURCE_DIR}/Utilities/bootstrap" "${swiftpm_bootstrap_options[@]}")
1763-
# Add --release if we have to build in release mode.
1764-
if [[ "${SWIFTPM_BUILD_TYPE}" == "Release" ]] ; then
1765-
swiftpm_bootstrap_command+=(--release)
1766-
fi
1767-
if [[ "${VERBOSE_BUILD}" ]] ; then
1768-
swiftpm_bootstrap_command+=(-v)
1769-
fi
1770-
# FIXME CROSSCOMPILING:
1771-
# SwiftPM needs to be told about the target, sysroot and linker to use
1772-
# when cross-compiling
1773-
swiftpm_bootstrap_command+=(
1774-
--swiftc="${SWIFTC_BIN}"
1775-
--sbt="${LLBUILD_BIN}"
1776-
--build="$(build_directory ${host} swiftpm)")
1777-
1778-
# Add flags to link llbuild.
1779-
LLBUILD_BUILD_DIR="$(build_directory ${host} llbuild)"
1780-
swiftpm_bootstrap_command+=(
1781-
--link-llbuild
1782-
--llbuild-source-dir="${LLBUILD_SOURCE_DIR}"
1783-
--llbuild-build-dir="${LLBUILD_BUILD_DIR}"
1784-
)
1785-
1786-
if [[ ! "${SKIP_BUILD_FOUNDATION}" ]] ; then
1787-
swiftpm_bootstrap_command+=( --foundation="${FOUNDATION_BUILD_DIR}" )
1788-
if [[ ! "${SKIP_BUILD_LIBDISPATCH}" ]] ; then
1789-
swiftpm_bootstrap_command+=(
1790-
$LIBDISPATCH_BUILD_ARGS)
1791-
fi
1792-
if [[ ! "${SKIP_BUILD_XCTEST}" ]] ; then
1793-
swiftpm_bootstrap_command+=(
1794-
--xctest="${XCTEST_BUILD_DIR}")
1795-
fi
1796-
fi
1797-
}
1798-
1799-
function swiftpm_find_tool() {
1800-
tool=$1
1801-
if [[ "${SKIP_BUILD_SWIFTPM}" ]]; then
1802-
echo "$(xcrun_find_tool ${tool})"
1803-
else
1804-
echo "$(build_directory_bin ${LOCAL_HOST} swiftpm)/${tool}"
1805-
fi
1806-
}
1807-
18081707
#
18091708
# Configure and build each product
18101709
#
@@ -2436,13 +2335,6 @@ for host in "${ALL_HOSTS[@]}"; do
24362335
-DLIBDISPATCH_SOURCE_DIR:PATH="${LIBDISPATCH_SOURCE_DIR}"
24372336
)
24382337
;;
2439-
swiftpm)
2440-
set_swiftpm_bootstrap_command
2441-
call "${swiftpm_bootstrap_command[@]}"
2442-
2443-
# swiftpm installs itself with a bootstrap method. No further cmake building is performed.
2444-
continue
2445-
;;
24462338
xctest)
24472339
SWIFTC_BIN="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
24482340
XCTEST_BUILD_DIR=$(build_directory ${host} xctest)
@@ -2935,16 +2827,6 @@ for host in "${ALL_HOSTS[@]}"; do
29352827
results_targets=("test")
29362828
executable_target=""
29372829
;;
2938-
swiftpm)
2939-
if [[ "${SKIP_TEST_SWIFTPM}" ]]; then
2940-
continue
2941-
fi
2942-
echo "--- Running tests for ${product} ---"
2943-
set_swiftpm_bootstrap_command
2944-
call "${swiftpm_bootstrap_command[@]}" test --test-parallel
2945-
# As swiftpm tests itself, we break early here.
2946-
continue
2947-
;;
29482830
xctest)
29492831
if [[ "${SKIP_TEST_XCTEST}" ]]; then
29502832
continue
@@ -3246,21 +3128,6 @@ for host in "${ALL_HOSTS[@]}"; do
32463128
exit 1
32473129
fi
32483130
;;
3249-
swiftpm)
3250-
if [[ -z "${INSTALL_SWIFTPM}" ]] ; then
3251-
continue
3252-
fi
3253-
if [[ -z "${INSTALL_DESTDIR}" ]] ; then
3254-
echo "--install-destdir is required to install products."
3255-
exit 1
3256-
fi
3257-
3258-
echo "--- Installing ${product} ---"
3259-
set_swiftpm_bootstrap_command
3260-
call "${swiftpm_bootstrap_command[@]}" --prefix="${host_install_destdir}${host_install_prefix}" install
3261-
# As swiftpm bootstraps the installation itself, we break early here.
3262-
continue
3263-
;;
32643131
xctest)
32653132
if [[ -z "${INSTALL_XCTEST}" ]] ; then
32663133
continue

utils/build_swift/driver_arguments.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def _apply_default_arguments(args):
203203
args.test_tvos = False
204204
args.test_watchos = False
205205
args.test_android = False
206+
args.test_swiftpm = False
206207
args.test_swiftsyntax = False
207208
args.test_indexstoredb = False
208209
args.test_sourcekitlsp = False
@@ -557,6 +558,9 @@ def create_argument_parser():
557558
option(['-p', '--swiftpm'], store_true('build_swiftpm'),
558559
help='build swiftpm')
559560

561+
option(['--install-swiftpm'], toggle_true('install_swiftpm'),
562+
help='install swiftpm')
563+
560564
option(['--swiftsyntax'], store_true('build_swiftsyntax'),
561565
help='build swiftSyntax')
562566

@@ -968,6 +972,8 @@ def create_argument_parser():
968972
help='skip testing Android device targets on the host machine (the '
969973
'phone itself)')
970974

975+
option('--skip-test-swiftpm', toggle_false('test_swiftpm'),
976+
help='skip testing swiftpm')
971977
option('--skip-test-swiftsyntax', toggle_false('test_swiftsyntax'),
972978
help='skip testing SwiftSyntax')
973979
option('--skip-test-indexstore-db', toggle_false('test_indexstoredb'),

utils/build_swift/tests/expected_options.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
'build_swiftevolve': False,
8989
'build_indexstoredb': False,
9090
'build_sourcekitlsp': False,
91+
'install_swiftpm': False,
9192
'install_swiftsyntax': False,
9293
'skip_install_swiftsyntax_module': False,
9394
'swiftsyntax_verify_generated_files': False,
@@ -208,6 +209,7 @@
208209
'test_watchos': False,
209210
'test_watchos_host': False,
210211
'test_watchos_simulator': False,
212+
'test_swiftpm': False,
211213
'test_swiftsyntax': False,
212214
'test_indexstoredb': False,
213215
'test_sourcekitlsp': False,
@@ -485,6 +487,7 @@ class BuildScriptImplOption(_BaseOption):
485487
dest='skip_install_swiftsyntax_module'),
486488
EnableOption('--swiftsyntax-verify-generated-files',
487489
dest='swiftsyntax_verify_generated_files'),
490+
EnableOption('--install-swiftpm', dest='install_swiftpm'),
488491
EnableOption('--install-sourcekit-lsp', dest='install_sourcekitlsp'),
489492
EnableOption('--install-skstresstester', dest='install_skstresstester'),
490493
EnableOption('--install-swiftevolve', dest='install_swiftevolve'),
@@ -542,6 +545,7 @@ class BuildScriptImplOption(_BaseOption):
542545
DisableOption('--skip-test-watchos-host', dest='test_watchos_host'),
543546
DisableOption('--skip-test-watchos-simulator',
544547
dest='test_watchos_simulator'),
548+
DisableOption('--skip-test-swiftpm', dest='test_swiftpm'),
545549
DisableOption('--skip-test-swiftsyntax', dest='test_swiftsyntax'),
546550
DisableOption('--skip-test-indexstore-db', dest='test_indexstoredb'),
547551
DisableOption('--skip-test-sourcekit-lsp', dest='test_sourcekitlsp'),

0 commit comments

Comments
 (0)