Skip to content

Commit c969814

Browse files
committed
[build] Fix --skip-build-llvm so that its minimal targets, like tblgen, are still built
1 parent 3181dd1 commit c969814

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

utils/build-script

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,8 +848,11 @@ class BuildScriptInvocation(object):
848848
impl_product_classes = []
849849
if self.args.build_cmark:
850850
impl_product_classes.append(products.CMark)
851-
if self.args.build_llvm:
852-
impl_product_classes.append(products.LLVM)
851+
852+
# If --skip-build-llvm is passed in, LLVM cannot be completely disabled, as
853+
# Swift still needs a few LLVM targets like tblgen to be built for it to be
854+
# configured. Instead, handle this in build-script-impl for now.
855+
impl_product_classes.append(products.LLVM)
853856
if self.args.build_libcxx:
854857
impl_product_classes.append(products.LibCXX)
855858
if self.args.build_libicu:

utils/build-script-impl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,10 +1157,14 @@ LIBDISPATCH_STATIC_SOURCE_DIR="${WORKSPACE}/swift-corelibs-libdispatch"
11571157
LIBICU_SOURCE_DIR="${WORKSPACE}/icu"
11581158
LIBCXX_SOURCE_DIR="${WORKSPACE}/llvm-project/libcxx"
11591159

1160+
# We cannot currently apply the normal rules of skipping here for LLVM. Even if
1161+
# we are skipping building LLVM, we still need to at least build a few tools
1162+
# like tblgen that Swift relies on for building and testing. See the LLVM
1163+
# configure rules.
1164+
PRODUCTS=(llvm)
11601165
[[ "${SKIP_BUILD_CMARK}" ]] || PRODUCTS+=(cmark)
11611166
[[ "${SKIP_BUILD_LIBCXX}" ]] || PRODUCTS+=(libcxx)
11621167
[[ "${SKIP_BUILD_LIBICU}" ]] || PRODUCTS+=(libicu)
1163-
[[ "${SKIP_BUILD_LLVM}" ]] || PRODUCTS+=(llvm)
11641168
[[ "${SKIP_BUILD_SWIFT}" ]] || PRODUCTS+=(swift)
11651169
[[ "${SKIP_BUILD_LLDB}" ]] || PRODUCTS+=(lldb)
11661170
[[ "${SKIP_BUILD_LIBDISPATCH}" ]] || PRODUCTS+=(libdispatch)
@@ -1550,7 +1554,7 @@ for host in "${ALL_HOSTS[@]}"; do
15501554
if [ "${BUILD_LLVM}" == "0" ] ; then
15511555
build_targets=(clean)
15521556
fi
1553-
if [ "${SKIP_BUILD}" ] ; then
1557+
if [[ "${SKIP_BUILD}" || "${SKIP_BUILD_LLVM}" ]] ; then
15541558
# We can't skip the build completely because the standalone
15551559
# build of Swift depend on these for building and testing.
15561560
build_targets=(llvm-tblgen clang-resource-headers intrinsics_gen clang-tablegen-targets)

validation-test/BuildSystem/skip_cmark_swift_llvm.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# SKIP-CMARK-CHECK: --- Installing swift ---
2121

2222
# SKIP-LLVM-CHECK: cmake --build {{.*}}cmark-
23-
# SKIP-LLVM-CHECK-NOT: cmake --build {{.*}}llvm-
23+
# SKIP-LLVM-CHECK: cmake --build {{.*}}llvm-tblgen
2424
# SKIP-LLVM-CHECK: cmake --build {{.*}}swift-
2525
# SKIP-LLVM-CHECK: --- Installing cmark ---
2626
# SKIP-LLVM-CHECK-NOT: --- Installing llvm ---

0 commit comments

Comments
 (0)