Skip to content

[build] extend support for building with a prebuilt toolchain to the corelibs and llbuild #32922

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 23, 2020
Merged
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
69 changes: 39 additions & 30 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,18 @@ for host in "${ALL_HOSTS[@]}"; do
)
fi

if [[ "${NATIVE_CLANG_TOOLS_PATH}" ]] ; then
CLANG_BIN="${NATIVE_CLANG_TOOLS_PATH}"
else
CLANG_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)"
fi

if [[ "${NATIVE_SWIFT_TOOLS_PATH}" ]] ; then
SWIFTC_BIN="${NATIVE_SWIFT_TOOLS_PATH}/swiftc"
else
SWIFTC_BIN="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
fi

for product in "${PRODUCTS[@]}"; do
[[ $(should_execute_action "${host}-${product/_static}-build") ]] || continue

Expand Down Expand Up @@ -1954,7 +1966,7 @@ for host in "${ALL_HOSTS[@]}"; do
-DCMAKE_C_FLAGS="$(llvm_c_flags ${host})"
-DCMAKE_CXX_FLAGS="$(llvm_c_flags ${host})"
-DCMAKE_BUILD_TYPE:STRING="${LLDB_BUILD_TYPE}"
-DLLDB_SWIFTC:PATH="$(build_directory ${LOCAL_HOST} swift)/bin/swiftc"
-DLLDB_SWIFTC:PATH=${SWIFTC_BIN}
-DLLDB_SWIFT_LIBS:PATH="$(build_directory ${LOCAL_HOST} swift)/lib/swift"
-DCMAKE_INSTALL_PREFIX:PATH="$(get_host_install_prefix ${host})"
-DLLDB_FRAMEWORK_INSTALL_DIR="$(get_host_install_prefix ${host})../System/Library/PrivateFrameworks"
Expand Down Expand Up @@ -2004,15 +2016,17 @@ for host in "${ALL_HOSTS[@]}"; do
"${cmake_options[@]}"

-DCMAKE_BUILD_TYPE:STRING="${LLBUILD_BUILD_TYPE}"
-DCMAKE_C_COMPILER:PATH="${CLANG_BIN}/clang"
-DCMAKE_CXX_COMPILER:PATH="${CLANG_BIN}/clang++"
-DCMAKE_INSTALL_PREFIX:PATH="$(get_host_install_prefix ${host})"
-DCMAKE_Swift_COMPILER:PATH="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
-DCMAKE_Swift_COMPILER:PATH=${SWIFTC_BIN}

-DLLBUILD_ENABLE_ASSERTIONS:BOOL=$(true_false "${LLBUILD_ENABLE_ASSERTIONS}")
-DLLBUILD_SUPPORT_BINDINGS:=Swift

-DLIT_EXECUTABLE:PATH="${LLVM_SOURCE_DIR}/utils/lit/lit.py"
-DFILECHECK_EXECUTABLE:PATH="$(build_directory_bin ${LOCAL_HOST} llvm)/FileCheck"
-DSWIFTC_EXECUTABLE:PATH="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
-DSWIFTC_EXECUTABLE:PATH=${SWIFTC_BIN}
-DFOUNDATION_BUILD_DIR:PATH="$(build_directory ${host} foundation)"
-DLIBDISPATCH_BUILD_DIR:PATH="$(build_directory ${host} libdispatch)"
-DLIBDISPATCH_SOURCE_DIR:PATH="${LIBDISPATCH_SOURCE_DIR}"
Expand All @@ -2035,7 +2049,6 @@ for host in "${ALL_HOSTS[@]}"; do
fi
;;
xctest)
SWIFTC_BIN="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
XCTEST_BUILD_DIR=$(build_directory ${host} xctest)
FOUNDATION_BUILD_DIR=$(build_directory ${host} foundation)
SWIFT_BUILD_DIR=$(build_directory ${host} swift)
Expand Down Expand Up @@ -2073,14 +2086,12 @@ for host in "${ALL_HOSTS[@]}"; do
echo "Cleaning the XCTest build directory"
call rm -rf "${XCTEST_BUILD_DIR}"

LLVM_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)"

cmake_options=(
${cmake_options[@]}
-DCMAKE_BUILD_TYPE:STRING="${XCTEST_BUILD_TYPE}"
-DCMAKE_C_COMPILER:PATH="${LLVM_BIN}/clang"
-DCMAKE_CXX_COMPILER:PATH="${LLVM_BIN}/clang++"
-DCMAKE_Swift_COMPILER:PATH="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
-DCMAKE_C_COMPILER:PATH="${CLANG_BIN}/clang"
-DCMAKE_CXX_COMPILER:PATH="${CLANG_BIN}/clang++"
-DCMAKE_Swift_COMPILER:PATH=${SWIFTC_BIN}
Copy link
Member Author

Choose a reason for hiding this comment

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

This was set this way before but I notice that @benlangmuir changed it, a mistake? Would be good if you could review this pull.

-DCMAKE_INSTALL_PREFIX:PATH="$(get_host_install_prefix ${host})"
-DCMAKE_INSTALL_LIBDIR:PATH="lib"

Expand All @@ -2091,7 +2102,7 @@ for host in "${ALL_HOSTS[@]}"; do
-DXCTEST_PATH_TO_LIBDISPATCH_SOURCE:PATH=${LIBDISPATCH_SOURCE_DIR}
-DXCTEST_PATH_TO_LIBDISPATCH_BUILD:PATH=$(build_directory ${host} libdispatch)
-DXCTEST_PATH_TO_FOUNDATION_BUILD:PATH=${FOUNDATION_BUILD_DIR}
-DCMAKE_SWIFT_COMPILER:PATH="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
-DCMAKE_SWIFT_COMPILER:PATH=${SWIFTC_BIN}
-DCMAKE_PREFIX_PATH:PATH=$(build_directory ${host} llvm)

-DENABLE_TESTING=YES
Expand All @@ -2106,9 +2117,6 @@ for host in "${ALL_HOSTS[@]}"; do
# is not yet built at this point.
XCTEST_BUILD_DIR=$(build_directory ${host} xctest)

SWIFTC_BIN="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
LLVM_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)"

if [[ ${host} == "macosx"* ]]; then
echo "Skipping Foundation on OS X -- use the Xcode project instead"
continue
Expand Down Expand Up @@ -2148,8 +2156,8 @@ for host in "${ALL_HOSTS[@]}"; do
cmake_options=(
${cmake_options[@]}
-DCMAKE_BUILD_TYPE:STRING=${FOUNDATION_BUILD_TYPE}
-DCMAKE_C_COMPILER:PATH=${LLVM_BIN}/clang
-DCMAKE_CXX_COMPILER:PATH=${LLVM_BIN}/clang++
-DCMAKE_C_COMPILER:PATH=${CLANG_BIN}/clang
-DCMAKE_CXX_COMPILER:PATH=${CLANG_BIN}/clang++
-DCMAKE_SWIFT_COMPILER:PATH=${SWIFTC_BIN}
-DCMAKE_Swift_COMPILER:PATH=${SWIFTC_BIN}
-DCMAKE_INSTALL_PREFIX:PATH=$(get_host_install_prefix ${host})
Expand All @@ -2171,8 +2179,6 @@ for host in "${ALL_HOSTS[@]}"; do
libdispatch|libdispatch_static)
LIBDISPATCH_BUILD_DIR=$(build_directory ${host} ${product})
SWIFT_BUILD_PATH="$(build_directory ${host} swift)"
SWIFTC_BIN="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
LLVM_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)"

case "${host}" in
macosx-*)
Expand All @@ -2191,8 +2197,8 @@ for host in "${ALL_HOSTS[@]}"; do
-DENABLE_SWIFT=YES
${cmake_options[@]}
-DCMAKE_BUILD_TYPE:STRING="${LIBDISPATCH_BUILD_TYPE}"
-DCMAKE_C_COMPILER:PATH="${LLVM_BIN}/clang"
-DCMAKE_CXX_COMPILER:PATH="${LLVM_BIN}/clang++"
-DCMAKE_C_COMPILER:PATH="${CLANG_BIN}/clang"
-DCMAKE_CXX_COMPILER:PATH="${CLANG_BIN}/clang++"
-DCMAKE_SWIFT_COMPILER:PATH="${SWIFTC_BIN}"
-DCMAKE_Swift_COMPILER:PATH="${SWIFTC_BIN}"
-DCMAKE_INSTALL_PREFIX:PATH="$(get_host_install_prefix ${host})"
Expand Down Expand Up @@ -2399,6 +2405,18 @@ for host in "${ALL_HOSTS[@]}"; do

set_build_options_for_host $host

if [[ "${NATIVE_CLANG_TOOLS_PATH}" ]] ; then
CLANG_BIN="${NATIVE_CLANG_TOOLS_PATH}"
else
CLANG_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)"
fi

if [[ "${NATIVE_SWIFT_TOOLS_PATH}" ]] ; then
SWIFTC_BIN="${NATIVE_SWIFT_TOOLS_PATH}/swiftc"
else
SWIFTC_BIN="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
fi

# Run the tests for each product
for product in "${PRODUCTS[@]}"; do
# Check if we should perform this action.
Expand Down Expand Up @@ -2530,7 +2548,6 @@ for host in "${ALL_HOSTS[@]}"; do
fi

echo "--- Running tests for ${product} ---"
SWIFTC_BIN="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
FOUNDATION_BUILD_DIR=$(build_directory ${host} foundation)
XCTEST_BUILD_DIR=$(build_directory ${host} xctest)
call "${XCTEST_SOURCE_DIR}"/build_script.py test \
Expand Down Expand Up @@ -2583,16 +2600,12 @@ for host in "${ALL_HOSTS[@]}"; do
LIBICU_BUILD_ARGS=()
fi


SWIFTC_BIN="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
LLVM_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)"

# NOTE(compnerd) the time has come to enable tests now
cmake_options=(
${cmake_options[@]}
-DCMAKE_BUILD_TYPE:STRING=${FOUNDATION_BUILD_TYPE}
-DCMAKE_C_COMPILER:PATH=${LLVM_BIN}/clang
-DCMAKE_CXX_COMPILER:PATH=${LLVM_BIN}/clang++
-DCMAKE_C_COMPILER:PATH=${CLANG_BIN}/clang
-DCMAKE_CXX_COMPILER:PATH=${CLANG_BIN}/clang++
-DCMAKE_Swift_COMPILER:PATH=${SWIFTC_BIN}
-DCMAKE_INSTALL_PREFIX:PATH=$(get_host_install_prefix ${host})

Expand Down Expand Up @@ -2635,10 +2648,6 @@ for host in "${ALL_HOSTS[@]}"; do
continue
;;
*)
cmake_options=(
${cmake_options[@]}
-DCMAKE_Swift_COMPILER:PATH="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
)
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 for two swiftc invocations that I had missed: lldb above and removing this one that's unused, as cmake_options isn't invoked by the test commands. Since this flag was never used, just remove it.

results_targets=( "test" )
executable_target=""
;;
Expand Down