Skip to content

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

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 1 commit into from
Jul 21, 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
7 changes: 5 additions & 2 deletions utils/build-script
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,11 @@ class BuildScriptInvocation(object):
impl_product_classes = []
if self.args.build_cmark:
impl_product_classes.append(products.CMark)
if self.args.build_llvm:
impl_product_classes.append(products.LLVM)

# If --skip-build-llvm is passed in, LLVM cannot be completely disabled, as
# Swift still needs a few LLVM targets like tblgen to be built for it to be
# configured. Instead, handle this in build-script-impl for now.
impl_product_classes.append(products.LLVM)
if self.args.build_libcxx:
impl_product_classes.append(products.LibCXX)
if self.args.build_libicu:
Expand Down
8 changes: 6 additions & 2 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -1157,10 +1157,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 @@ -1550,7 +1554,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 validation-test/BuildSystem/skip_cmark_swift_llvm.test
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# SKIP-CMARK-CHECK: --- Installing swift ---

# SKIP-LLVM-CHECK: cmake --build {{.*}}cmark-
# SKIP-LLVM-CHECK-NOT: cmake --build {{.*}}llvm-
# SKIP-LLVM-CHECK: cmake --build {{.*}}llvm-tblgen
# SKIP-LLVM-CHECK: cmake --build {{.*}}swift-
# SKIP-LLVM-CHECK: --- Installing cmark ---
# SKIP-LLVM-CHECK-NOT: --- Installing llvm ---
Expand Down