diff --git a/test/Interop/Cxx/class/debug-info-irgen.swift b/test/Interop/Cxx/class/debug-info-irgen.swift index 87bdd867c9886..772c320456d26 100644 --- a/test/Interop/Cxx/class/debug-info-irgen.swift +++ b/test/Interop/Cxx/class/debug-info-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swiftxx-frontend -I %S/Inputs %s -emit-ir -g | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir -g | %FileCheck %s) // Validate that we don't crash when trying to deserialize C++ type debug info. // Note, however, that the actual debug info is not generated, see SR-13223. diff --git a/test/Interop/Cxx/class/destructors-correct-abi-irgen.swift b/test/Interop/Cxx/class/destructors-correct-abi-irgen.swift index 2d355bccb95e7..3d53bff43df4d 100644 --- a/test/Interop/Cxx/class/destructors-correct-abi-irgen.swift +++ b/test/Interop/Cxx/class/destructors-correct-abi-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %swift -I %S/Inputs -enable-cxx-interop -emit-ir %s | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import Destructors diff --git a/test/Interop/Cxx/class/destructors-non-trivial-implicit-irgen.swift b/test/Interop/Cxx/class/destructors-non-trivial-implicit-irgen.swift index 39ed1424d41c3..5db68f97f8f18 100644 --- a/test/Interop/Cxx/class/destructors-non-trivial-implicit-irgen.swift +++ b/test/Interop/Cxx/class/destructors-non-trivial-implicit-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-frontend -enable-cxx-interop -I %S/Inputs %s -emit-ir | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import Destructors diff --git a/test/Interop/Cxx/class/inline-function-codegen/constructor-calls-function-from-nested-struct-irgen.swift b/test/Interop/Cxx/class/inline-function-codegen/constructor-calls-function-from-nested-struct-irgen.swift index cf37774179d90..2dd5c60fb32a1 100644 --- a/test/Interop/Cxx/class/inline-function-codegen/constructor-calls-function-from-nested-struct-irgen.swift +++ b/test/Interop/Cxx/class/inline-function-codegen/constructor-calls-function-from-nested-struct-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import ConstructorCallsFunctionFromNestedStruct diff --git a/test/Interop/Cxx/class/inline-function-codegen/constructor-calls-function-irgen.swift b/test/Interop/Cxx/class/inline-function-codegen/constructor-calls-function-irgen.swift index df594af1a4399..73863ef7befac 100644 --- a/test/Interop/Cxx/class/inline-function-codegen/constructor-calls-function-irgen.swift +++ b/test/Interop/Cxx/class/inline-function-codegen/constructor-calls-function-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import ConstructorCallsFunction diff --git a/test/Interop/Cxx/class/inline-function-codegen/constructor-calls-method-irgen.swift b/test/Interop/Cxx/class/inline-function-codegen/constructor-calls-method-irgen.swift index 3cc710101a1ce..c2fd6cff83bbb 100644 --- a/test/Interop/Cxx/class/inline-function-codegen/constructor-calls-method-irgen.swift +++ b/test/Interop/Cxx/class/inline-function-codegen/constructor-calls-method-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import ConstructorCallsMethod diff --git a/test/Interop/Cxx/class/inline-function-codegen/field-init-calls-function-irgen.swift b/test/Interop/Cxx/class/inline-function-codegen/field-init-calls-function-irgen.swift index e806bcf182101..4edaa062aff8a 100644 --- a/test/Interop/Cxx/class/inline-function-codegen/field-init-calls-function-irgen.swift +++ b/test/Interop/Cxx/class/inline-function-codegen/field-init-calls-function-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import FieldInitCallsFunction diff --git a/test/Interop/Cxx/class/inline-function-codegen/method-calls-function-irgen.swift b/test/Interop/Cxx/class/inline-function-codegen/method-calls-function-irgen.swift index 553349ba21b84..192eb055e9a82 100644 --- a/test/Interop/Cxx/class/inline-function-codegen/method-calls-function-irgen.swift +++ b/test/Interop/Cxx/class/inline-function-codegen/method-calls-function-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import MethodCallsFunction diff --git a/test/Interop/Cxx/class/inline-function-codegen/method-calls-method-from-nested-struct-irgen.swift b/test/Interop/Cxx/class/inline-function-codegen/method-calls-method-from-nested-struct-irgen.swift index 391c6050f233e..5a055f7fd4f84 100644 --- a/test/Interop/Cxx/class/inline-function-codegen/method-calls-method-from-nested-struct-irgen.swift +++ b/test/Interop/Cxx/class/inline-function-codegen/method-calls-method-from-nested-struct-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import MethodCallsMethodFromNestedStruct diff --git a/test/Interop/Cxx/class/inline-function-codegen/method-calls-method-irgen.swift b/test/Interop/Cxx/class/inline-function-codegen/method-calls-method-irgen.swift index 44f8b7c04173b..9613b1b2f932b 100644 --- a/test/Interop/Cxx/class/inline-function-codegen/method-calls-method-irgen.swift +++ b/test/Interop/Cxx/class/inline-function-codegen/method-calls-method-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import MethodCallsMethod diff --git a/test/Interop/Cxx/class/inline-function-codegen/static-var-init-calls-function-irgen.swift b/test/Interop/Cxx/class/inline-function-codegen/static-var-init-calls-function-irgen.swift index 588973b252037..ba63739ae17e4 100644 --- a/test/Interop/Cxx/class/inline-function-codegen/static-var-init-calls-function-irgen.swift +++ b/test/Interop/Cxx/class/inline-function-codegen/static-var-init-calls-function-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop -validate-tbd-against-ir=none | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir -validate-tbd-against-ir=none | %FileCheck %s) // TODO: See why -validate-tbd-against-ir=none is needed here (SR-14069) diff --git a/test/Interop/Cxx/class/type-classification-non-trivial-irgen.swift b/test/Interop/Cxx/class/type-classification-non-trivial-irgen.swift index b7c2af710568c..a7fa5fc6964bf 100644 --- a/test/Interop/Cxx/class/type-classification-non-trivial-irgen.swift +++ b/test/Interop/Cxx/class/type-classification-non-trivial-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swiftxx-frontend -I %S/Inputs %s -emit-ir | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) // Verify that non-trival/address-only C++ classes are constructed and accessed // correctly. Make sure that we correctly IRGen functions that construct diff --git a/test/Interop/Cxx/extern-var/extern-var-irgen.swift b/test/Interop/Cxx/extern-var/extern-var-irgen.swift index c23aa07c11edb..0f5d579cf52b1 100644 --- a/test/Interop/Cxx/extern-var/extern-var-irgen.swift +++ b/test/Interop/Cxx/extern-var/extern-var-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import ExternVar diff --git a/test/Interop/Cxx/namespace/classes-irgen.swift b/test/Interop/Cxx/namespace/classes-irgen.swift index ecc14ef33cfbb..0a326f2521cfe 100644 --- a/test/Interop/Cxx/namespace/classes-irgen.swift +++ b/test/Interop/Cxx/namespace/classes-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir -I %S/Inputs -enable-cxx-interop %s | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import Classes diff --git a/test/Interop/Cxx/namespace/free-functions-irgen.swift b/test/Interop/Cxx/namespace/free-functions-irgen.swift index 1e2da09ed3265..6db3c5a337f83 100644 --- a/test/Interop/Cxx/namespace/free-functions-irgen.swift +++ b/test/Interop/Cxx/namespace/free-functions-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir -I %S/Inputs -enable-cxx-interop %s | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import FreeFunctions diff --git a/test/Interop/Cxx/namespace/templates-irgen.swift b/test/Interop/Cxx/namespace/templates-irgen.swift index 9f373ccb0328a..baa7c095dec39 100644 --- a/test/Interop/Cxx/namespace/templates-irgen.swift +++ b/test/Interop/Cxx/namespace/templates-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir -I %S/Inputs -enable-cxx-interop %s | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import Templates diff --git a/test/Interop/Cxx/static/inline-static-member-var-irgen.swift b/test/Interop/Cxx/static/inline-static-member-var-irgen.swift index bc65b38e58481..0a3d052a43bed 100644 --- a/test/Interop/Cxx/static/inline-static-member-var-irgen.swift +++ b/test/Interop/Cxx/static/inline-static-member-var-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir -I %S/Inputs -enable-cxx-interop %s | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import InlineStaticMemberVar diff --git a/test/Interop/Cxx/static/static-member-func-irgen.swift b/test/Interop/Cxx/static/static-member-func-irgen.swift index 84b1db7afb4f1..b387322c7f21a 100644 --- a/test/Interop/Cxx/static/static-member-func-irgen.swift +++ b/test/Interop/Cxx/static/static-member-func-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import StaticMemberFunc diff --git a/test/Interop/Cxx/templates/function-template-irgen.swift b/test/Interop/Cxx/templates/function-template-irgen.swift index fa5bd1c221605..431d8c4cf065a 100644 --- a/test/Interop/Cxx/templates/function-template-irgen.swift +++ b/test/Interop/Cxx/templates/function-template-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import FunctionTemplates diff --git a/test/Interop/Cxx/templates/linkage-of-swift-symbols-for-imported-types-irgen.swift b/test/Interop/Cxx/templates/linkage-of-swift-symbols-for-imported-types-irgen.swift index f3a2ae75d69ba..c3dc101443a12 100644 --- a/test/Interop/Cxx/templates/linkage-of-swift-symbols-for-imported-types-irgen.swift +++ b/test/Interop/Cxx/templates/linkage-of-swift-symbols-for-imported-types-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import LinkageOfSwiftSymbolsForImportedTypes diff --git a/test/Interop/Cxx/templates/mangling-irgen.swift b/test/Interop/Cxx/templates/mangling-irgen.swift index c55feb8b5dc47..ae579f68937ab 100644 --- a/test/Interop/Cxx/templates/mangling-irgen.swift +++ b/test/Interop/Cxx/templates/mangling-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) import Mangling diff --git a/test/Interop/Cxx/templates/partially-pre-defined-class-template-irgen.swift b/test/Interop/Cxx/templates/partially-pre-defined-class-template-irgen.swift index 1dc4ac92f6fee..5ce09b0a42f2b 100644 --- a/test/Interop/Cxx/templates/partially-pre-defined-class-template-irgen.swift +++ b/test/Interop/Cxx/templates/partially-pre-defined-class-template-irgen.swift @@ -1,5 +1,7 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) + // REQUIRES: rdar67257133 + import PartiallyPreDefinedClassTemplate public func getWrappedMagicInt() -> CInt { diff --git a/test/Interop/Cxx/value-witness-table/custom-destructors-non-virtual-irgen.swift b/test/Interop/Cxx/value-witness-table/custom-destructors-non-virtual-irgen.swift index 19c4fef206c9f..588fec97e5193 100644 --- a/test/Interop/Cxx/value-witness-table/custom-destructors-non-virtual-irgen.swift +++ b/test/Interop/Cxx/value-witness-table/custom-destructors-non-virtual-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-frontend -enable-cxx-interop -I %S/Inputs %s -emit-ir | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) // This tests output needs to be updated for arm64. // XFAIL: CPU=arm64e diff --git a/test/Interop/Cxx/value-witness-table/witness-layout-opts-irgen.swift b/test/Interop/Cxx/value-witness-table/witness-layout-opts-irgen.swift index 42bea66b5b03d..2ef68551621dd 100644 --- a/test/Interop/Cxx/value-witness-table/witness-layout-opts-irgen.swift +++ b/test/Interop/Cxx/value-witness-table/witness-layout-opts-irgen.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s +// RUN: %cxx-all-targets(-I %S/Inputs %s -emit-ir | %FileCheck %s) // This test checks that the compiler uses well-known witness tables for types // that have the appropriate size/shape (for example, { i8 x 4 } -> i32). diff --git a/test/lit.cfg b/test/lit.cfg index b311cd0307649..4c2458dac7c58 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -2203,6 +2203,16 @@ if platform.system() != 'Darwin' or swift_test_mode == 'optimize_none_with_impli # config.substitutions.append(('%target-clangxx', '%s -std=c++11' % config.target_clang)) +config.substitutions.append(('%cxx-all-targets\(([^)]+)\)', + SubstituteCaptures(r"%s -disable-legacy-type-info -enable-cxx-interop -I %s/uswift-macos-arm64/swift -target arm64-apple-macosx10.9 \1 && " + r"%s -disable-legacy-type-info -enable-cxx-interop -I %s/uswift-macos-x86_64/swift -target x86_64-apple-macosx10.9 \1 && " + r"%s -enable-cxx-interop -I %s/uswift-linux-armv7/swift -target armv7-unknown-linux-androideabi \1 &&" + r"%s -enable-cxx-interop -I %s/uswift-windows-x86_64/swift -target x86_64-unknown-windows-msvc \1 " + % (config.swift_frontend, shell_quote(os.path.realpath(swift_obj_root).replace("\\", "/")), + config.swift_frontend, shell_quote(os.path.realpath(swift_obj_root).replace("\\", "/")), + config.swift_frontend, shell_quote(os.path.realpath(swift_obj_root).replace("\\", "/")), + config.swift_frontend, shell_quote(os.path.realpath(swift_obj_root).replace("\\", "/"))) ) + )) config.substitutions.append(('%target-swiftxx-frontend', '%s -enable-cxx-interop' % config.target_swift_frontend)) config.substitutions.append(('%target-runtime', config.target_runtime)) diff --git a/utils/build-script-impl b/utils/build-script-impl index 355f1a086d86d..dd14358e3bbea 100755 --- a/utils/build-script-impl +++ b/utils/build-script-impl @@ -1245,6 +1245,7 @@ NINJA_SOURCE_DIR="${WORKSPACE}/ninja" SWIFT_SOURCE_DIR="${WORKSPACE}/swift" LLVM_SOURCE_DIR="${WORKSPACE}/llvm-project/llvm" CMARK_SOURCE_DIR="${WORKSPACE}/cmark" +USWIFT_SOURCE_DIR="${WORKSPACE}/uswift" LLDB_SOURCE_DIR="${WORKSPACE}/llvm-project/lldb" LLBUILD_SOURCE_DIR="${WORKSPACE}/llbuild" STRESSTEST_PACKAGE_DIR="${WORKSPACE}/swift-stress-tester" @@ -1266,6 +1267,7 @@ PRODUCTS=(llvm) [[ "${SKIP_BUILD_LIBCXX}" ]] || PRODUCTS+=(libcxx) [[ "${SKIP_BUILD_LIBICU}" ]] || PRODUCTS+=(libicu) [[ "${SKIP_BUILD_SWIFT}" ]] || PRODUCTS+=(swift) +PRODUCTS+=(uswift) [[ "${SKIP_BUILD_LLDB}" ]] || PRODUCTS+=(lldb) [[ "${SKIP_BUILD_LIBDISPATCH}" ]] || PRODUCTS+=(libdispatch) [[ "${SKIP_BUILD_STATIC_LIBDISPATCH}" ]] || PRODUCTS+=(libdispatch_static) @@ -1356,6 +1358,8 @@ function build_directory_bin() { ;; libicu) ;; + uswift) + ;; *) echo "error: unknown product: ${product}" exit 1 @@ -1759,6 +1763,91 @@ for host in "${ALL_HOSTS[@]}"; do build_targets=(all) ;; + uswift) + uswift_targets=( + "macos-arm64" "arm64-apple-macosx10.9" + "macos-x86_64" "x86_64-apple-macosx10.9" + "linux-armv7" "armv7-unknown-linux-androideabi" + "windows-x86_64" "x86_64-unknown-windows-msvc" + ) + uswift_targets_length=${#uswift_targets[@]} + + cmake_options=( + "${cmake_options[@]}" + -D BUILD_SHARED_LIBS=NO + -D CMAKE_Swift_COMPILER_WORKS=YES + -D CMAKE_BUILD_TYPE=Release + -D CMAKE_Swift_COMPILER=$(build_directory ${host} swift)/bin/swiftc + ) + + # Build uswift for each target. + for (( i=1; i<${uswift_targets_length}+1; i+=2 )); + do + uswift_target_name=${uswift_targets[$i-1]} + uswift_target=${uswift_targets[$i]} + all_cmake_options=( + "${cmake_options[@]}" + -D CMAKE_Swift_COMPILER_TARGET=${uswift_target} + ) + + if [[ "$uswift_target_name" == "windows-x86_64" ]] ; then + all_cmake_options=( + "${all_cmake_options[@]}" + -D CMAKE_Swift_FLAGS="-use-ld=$(build_directory ${LOCAL_HOST} llvm)/bin/lld-link" + ) + else + all_cmake_options=( + "${all_cmake_options[@]}" + -D CMAKE_Swift_FLAGS="-Xfrontend -disable-legacy-type-info" + ) + fi + + build_dir=$(build_directory ${uswift_target_name} ${product}) + + generator_output_path="" + if [[ "${CMAKE_GENERATOR}" == "Ninja" ]] ; then + generator_output_path="${build_dir}/build.ninja" + fi + + # Configure if necessary. + cmake_cache_path="${build_dir}/CMakeCache.txt" + if [[ "${RECONFIGURE}" || ! -f "${cmake_cache_path}" || \ + ( ! -z "${generator_output_path}" && ! -f "${generator_output_path}" ) ]] ; then + call mkdir -p "${build_dir}" + + # Use `cmake-file-api` in case it is available. + call mkdir -p "${build_dir}/.cmake/api/v1/query" + call touch "${build_dir}/.cmake/api/v1/query/codemodel-v2" "${build_dir}/.cmake/api/v1/query/cache-v2" + + if [[ -n "${DISTCC}" ]]; then + EXTRA_DISTCC_OPTIONS=("DISTCC_HOSTS=localhost,lzo,cpp") + fi + with_pushd "${build_dir}" \ + call env "${EXTRA_DISTCC_OPTIONS[@]}" "${CMAKE}" "${all_cmake_options[@]}" "${EXTRA_CMAKE_OPTIONS[@]}" "${source_dir}" + fi + + # Note: unconditionally build uswift because it is required for running some tests. + if [[ "${CMAKE_GENERATOR}" == "Xcode" ]] ; then + # Xcode generator uses "ALL_BUILD" instead of "all". + # Also, xcodebuild uses -target instead of bare names. + build_targets=("${build_targets[@]/all/ALL_BUILD}") + build_targets=("${build_targets[@]/#/${BUILD_TARGET_FLAG} }") + + # Xcode can't restart itself if it turns out we need to reconfigure. + # Do an advance build to handle that. + call "${CMAKE_BUILD[@]}" "${build_dir}" $(cmake_config_opt ${product}) + fi + + call "${CMAKE_BUILD[@]}" "${build_dir}" $(cmake_config_opt ${product}) -- "${BUILD_ARGS[@]}" ${build_targets[@]} + + # Copy over the uswift build. + cp -a $(build_directory ${uswift_target_name} uswift) $(build_directory ${host} swift) + done + + # We've already run cmake/build so we can just break out here. + continue + ;; + llvm) if [[ -n "${LLVM_NINJA_TARGETS_FOR_CROSS_COMPILE_HOSTS}" && $(is_cross_tools_host ${host}) ]] ; then build_targets=("${LLVM_NINJA_TARGETS_FOR_CROSS_COMPILE_HOSTS[@]}") @@ -1817,7 +1906,7 @@ for host in "${ALL_HOSTS[@]}"; do "${llvm_cmake_options[@]}" ) - llvm_enable_projects=("clang") + llvm_enable_projects=("clang" "lld") if [[ ! "${SKIP_BUILD_COMPILER_RT}" && ! $(is_cross_tools_host ${host}) ]]; then llvm_enable_projects+=("compiler-rt") @@ -1827,18 +1916,6 @@ for host in "${ALL_HOSTS[@]}"; do llvm_enable_projects+=("clang-tools-extra") fi - # On non-Darwin platforms, build lld so we can always have a - # linker that is compatible with the swift we are using to - # compile the stdlib. - # - # This makes it easier to build target stdlibs on systems that - # have old toolchains without more modern linker features. - if [[ "$(uname -s)" != "Darwin" ]] ; then - if [[ ! "${SKIP_BUILD_LLD}" ]]; then - llvm_enable_projects+=("lld") - fi - fi - cmake_options+=( -DLLVM_ENABLE_PROJECTS="$(join ";" ${llvm_enable_projects[@]})" ) @@ -1898,7 +1975,6 @@ for host in "${ALL_HOSTS[@]}"; do ;; swift) - if [[ "${ANDROID_API_LEVEL}" ]]; then cmake_options=( "${cmake_options[@]}" @@ -2808,6 +2884,9 @@ for host in "${ALL_HOSTS[@]}"; do libcxx) continue # We don't test libc++ ;; + uswift) + continue # We don't test uswift + ;; swift) executable_target= results_targets= @@ -3159,6 +3238,9 @@ for host in "${ALL_HOSTS[@]}"; do fi INSTALL_TARGETS=install-swift-components ;; + uswift) + continue + ;; llbuild) if [[ -z "${INSTALL_LLBUILD}" ]] ; then continue diff --git a/utils/build_swift/build_swift/driver_arguments.py b/utils/build_swift/build_swift/driver_arguments.py index 738042364c5a9..d2565074e04b1 100644 --- a/utils/build_swift/build_swift/driver_arguments.py +++ b/utils/build_swift/build_swift/driver_arguments.py @@ -346,7 +346,7 @@ def create_argument_parser(): help='enable code coverage analysis in Swift (false, not-merged, ' 'merged).') - option('--swift-disable-dead-stripping', toggle_true, + option('--swift-disable-dead-stripping', toggle_true, help="Turn off Darwin-specific dead stripping for Swift host tools") option('--build-subdir', store, @@ -1252,6 +1252,8 @@ def create_argument_parser(): help='skip building llvm') option('--skip-build-swift', toggle_false('build_swift'), help='skip building swift') + option('--skip-build-uswift', toggle_false('build_uswift'), + help='skip building uswift') # We need to list --skip-test-swift explicitly because otherwise argparse # will auto-expand arguments like --skip-test-swift to the only known diff --git a/utils/build_swift/tests/expected_options.py b/utils/build_swift/tests/expected_options.py index 9984cf0c439f3..9d4415fd69f76 100644 --- a/utils/build_swift/tests/expected_options.py +++ b/utils/build_swift/tests/expected_options.py @@ -58,6 +58,7 @@ 'build_foundation': False, 'build_cmark': True, 'build_swift': True, + 'build_uswift': True, 'build_llvm': True, 'build_freebsd': True, 'build_ios': True, @@ -597,6 +598,7 @@ class BuildScriptImplOption(_BaseOption): DisableOption('--skip-build-cmark', dest='build_cmark'), DisableOption('--skip-build-llvm', dest='build_llvm'), DisableOption('--skip-build-swift', dest='build_swift'), + DisableOption('--skip-build-uswift', dest='build_uswift'), DisableOption('--skip-build-android', dest='build_android'), DisableOption('--skip-build-benchmarks', dest='build_benchmarks'), diff --git a/utils/swift_build_support/swift_build_support/build_script_invocation.py b/utils/swift_build_support/swift_build_support/build_script_invocation.py index 3ae3002f5d906..9390eda48060a 100644 --- a/utils/swift_build_support/swift_build_support/build_script_invocation.py +++ b/utils/swift_build_support/swift_build_support/build_script_invocation.py @@ -250,6 +250,7 @@ def convert_to_impl_arguments(self): (args.build_cmark, "cmark"), (args.build_llvm, "llvm"), (args.build_swift, "swift"), + (args.build_uswift, "uswift"), (args.build_foundation, "foundation"), (args.build_xctest, "xctest"), (args.build_lldb, "lldb"), @@ -562,6 +563,8 @@ def compute_product_pipelines(self): is_enabled=self.args.build_libicu) builder.add_impl_product(products.Swift, is_enabled=self.args.build_swift) + builder.add_impl_product(products.USwift, + is_enabled=self.args.build_uswift) builder.add_impl_product(products.LLDB, is_enabled=self.args.build_lldb) diff --git a/utils/swift_build_support/swift_build_support/products/__init__.py b/utils/swift_build_support/swift_build_support/products/__init__.py index 7cdd61fb504fb..8de2336cc8b7d 100644 --- a/utils/swift_build_support/swift_build_support/products/__init__.py +++ b/utils/swift_build_support/swift_build_support/products/__init__.py @@ -14,6 +14,7 @@ from .benchmarks import Benchmarks from .cmark import CMark from .earlyswiftdriver import EarlySwiftDriver +from .uswift import USwift from .foundation import Foundation from .indexstoredb import IndexStoreDB from .libcxx import LibCXX @@ -40,6 +41,7 @@ __all__ = [ 'BackDeployConcurrency', + 'USwift', 'CMark', 'Ninja', 'Foundation', diff --git a/utils/swift_build_support/swift_build_support/products/uswift.py b/utils/swift_build_support/swift_build_support/products/uswift.py new file mode 100644 index 0000000000000..9f37f8696cf3a --- /dev/null +++ b/utils/swift_build_support/swift_build_support/products/uswift.py @@ -0,0 +1,28 @@ +# swift_build_support/products/cmark.py -------------------------*- python -*- +# +# This source file is part of the Swift.org open source project +# +# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See https://swift.org/LICENSE.txt for license information +# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +# +# ---------------------------------------------------------------------------- + +from . import product + + +class USwift(product.Product): + @classmethod + def is_build_script_impl_product(cls): + """is_build_script_impl_product -> bool + + Whether this product is produced by build-script-impl. + """ + return True + + # This is the root of the build-graph, so it doesn't have any dependencies. + @classmethod + def get_dependencies(cls): + return [] diff --git a/utils/update_checkout/update-checkout-config.json b/utils/update_checkout/update-checkout-config.json index 5b3e3b3be5c69..d88d27b4b98cd 100644 --- a/utils/update_checkout/update-checkout-config.json +++ b/utils/update_checkout/update-checkout-config.json @@ -11,7 +11,7 @@ "swift-argument-parser": { "remote": { "id": "apple/swift-argument-parser" } }, "swift-atomics": { - "remote": { "id": "apple/swift-atomics" } }, + "remote": { "id": "apple/swift-atomics" } }, "swift-collections": { "remote": { "id": "apple/swift-collections" } }, "swift-crypto": { @@ -19,7 +19,7 @@ "swift-driver": { "remote": { "id": "apple/swift-driver" } }, "swift-numerics": { - "remote": { "id": "apple/swift-numerics" } }, + "remote": { "id": "apple/swift-numerics" } }, "swift-tools-support-core": { "remote": { "id": "apple/swift-tools-support-core" } }, "swiftpm": { @@ -80,7 +80,9 @@ "swift-experimental-string-processing": { "remote": { "id": "apple/swift-experimental-string-processing" } }, "llvm-project": { - "remote": { "id": "apple/llvm-project" } } + "remote": { "id": "apple/llvm-project" } }, + "uswift": { + "remote": { "id": "compnerd/uswift" } } }, "default-branch-scheme": "main", "branch-schemes": { @@ -123,7 +125,8 @@ "swift-cmark-gfm": "gfm", "swift-nio": "2.31.2", "swift-nio-ssl": "2.15.0", - "swift-experimental-string-processing": "dev/6" + "swift-experimental-string-processing": "dev/6", + "uswift": "main" } }, "rebranch": { @@ -198,7 +201,8 @@ "swift-markdown": "release/5.6", "swift-cmark-gfm": "release/5.6-gfm", "swift-nio": "2.31.2", - "swift-nio-ssl": "2.15.0" + "swift-nio-ssl": "2.15.0", + "uswift": "main" } }, "release/5.5": { @@ -288,12 +292,12 @@ "swiftpm": "main", "swift-argument-parser": "1.0.3", "swift-atomics": "1.0.2", - "swift-collections": "1.0.1", - "swift-crypto": "1.1.5", + "swift-collections": "1.0.1", + "swift-crypto": "1.1.5", "swift-driver": "main", "swift-numerics": "1.0.1", "swift-syntax": "main", - "swift-system": "1.1.1", + "swift-system": "1.1.1", "swift-stress-tester": "main", "swift-corelibs-xctest": "main", "swift-corelibs-foundation": "main", @@ -308,7 +312,8 @@ "sourcekit-lsp": "main", "swift-format": "main", "swift-installer-scripts": "main", - "swift-experimental-string-processing": "dev/6" + "swift-experimental-string-processing": "dev/6", + "uswift": "main" } }, "release/5.4": {