Skip to content

[5.3][build] Fix --skip-build-llvm so that its minimal targets, like tblgen, are still built #33026

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 2 commits into from
Jul 24, 2020
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
5 changes: 5 additions & 0 deletions test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ config.test_source_root = os.path.dirname(__file__)
# test_exec_root: The root path where tests should be run.
swift_obj_root = getattr(config, 'swift_obj_root', None)

# cmake. The path to the cmake executable we used to configure swift.
assert(config.cmake)
config.substitutions.append( ('%cmake', config.cmake) )
lit_config.note('Using cmake: ' + config.cmake)

# Set llvm_{src,obj}_root for use by others.
config.llvm_src_root = getattr(config, 'llvm_src_root', None)
config.llvm_obj_root = getattr(config, 'llvm_obj_root', None)
Expand Down
1 change: 1 addition & 0 deletions test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import os
import platform
import sys

config.cmake = "@CMAKE_COMMAND@"
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Expand Down
8 changes: 6 additions & 2 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -1141,10 +1141,14 @@ LIBDISPATCH_STATIC_SOURCE_DIR="${WORKSPACE}/swift-corelibs-libdispatch"
LIBICU_SOURCE_DIR="${WORKSPACE}/icu"
LIBCXX_SOURCE_DIR="${WORKSPACE}/llvm-project/libcxx"

# We cannot currently apply the normal rules of skipping here for LLVM. Even if
# we are skipping building LLVM, we still need to at least build a few tools
# like tblgen that Swift relies on for building and testing. See the LLVM
# configure rules.
PRODUCTS=(llvm)
[[ "${SKIP_BUILD_CMARK}" ]] || PRODUCTS+=(cmark)
[[ "${SKIP_BUILD_LIBCXX}" ]] || PRODUCTS+=(libcxx)
[[ "${SKIP_BUILD_LIBICU}" ]] || PRODUCTS+=(libicu)
[[ "${SKIP_BUILD_LLVM}" ]] || PRODUCTS+=(llvm)
[[ "${SKIP_BUILD_SWIFT}" ]] || PRODUCTS+=(swift)
[[ "${SKIP_BUILD_LLDB}" ]] || PRODUCTS+=(lldb)
[[ "${SKIP_BUILD_LIBDISPATCH}" ]] || PRODUCTS+=(libdispatch)
Expand Down Expand Up @@ -1534,7 +1538,7 @@ for host in "${ALL_HOSTS[@]}"; do
if [ "${BUILD_LLVM}" == "0" ] ; then
build_targets=(clean)
fi
if [ "${SKIP_BUILD}" ] ; then
if [[ "${SKIP_BUILD}" || "${SKIP_BUILD_LLVM}" ]] ; then
# We can't skip the build completely because the standalone
# build of Swift depend on these for building and testing.
build_targets=(llvm-tblgen clang-resource-headers intrinsics_gen clang-tablegen-targets)
Expand Down
2 changes: 1 addition & 1 deletion utils/swift_build_support/swift_build_support/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def check_cmake_version(self, source_root, build_root):
cmake_binary = 'cmake'

installed_ver = self.installed_cmake_version(cmake_binary)
if installed_ver > self.cmake_source_version(cmake_source_dir):
if installed_ver >= self.cmake_source_version(cmake_source_dir):
return
else:
# Build CMake from source and return the path to the executable.
Expand Down
24 changes: 24 additions & 0 deletions validation-test/BuildSystem/skip_cmark_swift_llvm.test-sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# RUN: %empty-directory(%t)
# RUN: mkdir -p %t
# 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

# RUN: %empty-directory(%t)
# RUN: mkdir -p %t
# 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

# RUN: %empty-directory(%t)
# RUN: mkdir -p %t
# 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

# SKIP-CMARK-CHECK-NOT: cmake --build {{.*}}cmark-
# SKIP-CMARK-CHECK: cmake --build {{.*}}llvm-
# SKIP-CMARK-CHECK: cmake --build {{.*}}swift-

# SKIP-LLVM-CHECK: cmake --build {{.*}}cmark-
# SKIP-LLVM-CHECK: cmake --build {{.*}}llvm-tblgen
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this pull to bring back this test from the main branch, ready for another CI run.

# SKIP-LLVM-CHECK: cmake --build {{.*}}swift-

# SKIP-SWIFT-CHECK: cmake --build {{.*}}cmark-
# SKIP-SWIFT-CHECK: cmake --build {{.*}}llvm-
# SKIP-SWIFT-CHECK-NOT: cmake --build {{.*}}swift-

1 change: 1 addition & 0 deletions validation-test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import sys
import platform

config.cmake = "@CMAKE_COMMAND@"
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Expand Down