Skip to content

Commit 0ef711a

Browse files
authored
Merge pull request #33026 from buttaface/skip
[5.3][build] Fix --skip-build-llvm so that its minimal targets, like tblgen, are still built
2 parents b1afaca + e0716a6 commit 0ef711a

File tree

6 files changed

+38
-3
lines changed

6 files changed

+38
-3
lines changed

test/lit.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ config.test_source_root = os.path.dirname(__file__)
199199
# test_exec_root: The root path where tests should be run.
200200
swift_obj_root = getattr(config, 'swift_obj_root', None)
201201

202+
# cmake. The path to the cmake executable we used to configure swift.
203+
assert(config.cmake)
204+
config.substitutions.append( ('%cmake', config.cmake) )
205+
lit_config.note('Using cmake: ' + config.cmake)
206+
202207
# Set llvm_{src,obj}_root for use by others.
203208
config.llvm_src_root = getattr(config, 'llvm_src_root', None)
204209
config.llvm_obj_root = getattr(config, 'llvm_obj_root', None)

test/lit.site.cfg.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import os
1414
import platform
1515
import sys
1616

17+
config.cmake = "@CMAKE_COMMAND@"
1718
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
1819
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
1920
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"

utils/build-script-impl

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

1144+
# We cannot currently apply the normal rules of skipping here for LLVM. Even if
1145+
# we are skipping building LLVM, we still need to at least build a few tools
1146+
# like tblgen that Swift relies on for building and testing. See the LLVM
1147+
# configure rules.
1148+
PRODUCTS=(llvm)
11441149
[[ "${SKIP_BUILD_CMARK}" ]] || PRODUCTS+=(cmark)
11451150
[[ "${SKIP_BUILD_LIBCXX}" ]] || PRODUCTS+=(libcxx)
11461151
[[ "${SKIP_BUILD_LIBICU}" ]] || PRODUCTS+=(libicu)
1147-
[[ "${SKIP_BUILD_LLVM}" ]] || PRODUCTS+=(llvm)
11481152
[[ "${SKIP_BUILD_SWIFT}" ]] || PRODUCTS+=(swift)
11491153
[[ "${SKIP_BUILD_LLDB}" ]] || PRODUCTS+=(lldb)
11501154
[[ "${SKIP_BUILD_LIBDISPATCH}" ]] || PRODUCTS+=(libdispatch)
@@ -1534,7 +1538,7 @@ for host in "${ALL_HOSTS[@]}"; do
15341538
if [ "${BUILD_LLVM}" == "0" ] ; then
15351539
build_targets=(clean)
15361540
fi
1537-
if [ "${SKIP_BUILD}" ] ; then
1541+
if [[ "${SKIP_BUILD}" || "${SKIP_BUILD_LLVM}" ]] ; then
15381542
# We can't skip the build completely because the standalone
15391543
# build of Swift depend on these for building and testing.
15401544
build_targets=(llvm-tblgen clang-resource-headers intrinsics_gen clang-tablegen-targets)

utils/swift_build_support/swift_build_support/cmake.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def check_cmake_version(self, source_root, build_root):
272272
cmake_binary = 'cmake'
273273

274274
installed_ver = self.installed_cmake_version(cmake_binary)
275-
if installed_ver > self.cmake_source_version(cmake_source_dir):
275+
if installed_ver >= self.cmake_source_version(cmake_source_dir):
276276
return
277277
else:
278278
# Build CMake from source and return the path to the executable.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# RUN: %empty-directory(%t)
2+
# RUN: mkdir -p %t
3+
# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --cmake %cmake --skip-build-cmark 2>&1 | %FileCheck --check-prefix=SKIP-CMARK-CHECK %s
4+
5+
# RUN: %empty-directory(%t)
6+
# RUN: mkdir -p %t
7+
# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --cmake %cmake --skip-build-llvm 2>&1 | %FileCheck --check-prefix=SKIP-LLVM-CHECK %s
8+
9+
# RUN: %empty-directory(%t)
10+
# RUN: mkdir -p %t
11+
# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --cmake %cmake --skip-build-swift 2>&1 | %FileCheck --check-prefix=SKIP-SWIFT-CHECK %s
12+
13+
# SKIP-CMARK-CHECK-NOT: cmake --build {{.*}}cmark-
14+
# SKIP-CMARK-CHECK: cmake --build {{.*}}llvm-
15+
# SKIP-CMARK-CHECK: cmake --build {{.*}}swift-
16+
17+
# SKIP-LLVM-CHECK: cmake --build {{.*}}cmark-
18+
# SKIP-LLVM-CHECK: cmake --build {{.*}}llvm-tblgen
19+
# SKIP-LLVM-CHECK: cmake --build {{.*}}swift-
20+
21+
# SKIP-SWIFT-CHECK: cmake --build {{.*}}cmark-
22+
# SKIP-SWIFT-CHECK: cmake --build {{.*}}llvm-
23+
# SKIP-SWIFT-CHECK-NOT: cmake --build {{.*}}swift-
24+

validation-test/lit.site.cfg.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import sys
1414
import platform
1515

16+
config.cmake = "@CMAKE_COMMAND@"
1617
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
1718
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
1819
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"

0 commit comments

Comments
 (0)