@@ -990,25 +990,27 @@ jobs:
990990 key : ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-compilers
991991 variant : sccache
992992
993- - name : Configure Compilers
993+ - name : Setup context
994+ id : setup-context
994995 run : |
995996 $CxxFlags = "${{ matrix.cxxflags }}"
996997 $SwiftFlags = ""
997- $EXTRA_FLAGS = @()
998+ $ExtraFlags = "${{ matrix.extra_flags }}"
998999
9991000 if ( "${{ matrix.os }}" -eq "Windows" ) {
10001001 $SWIFTC = cygpath -m (Get-Command swiftc).Source
10011002 # Use toolchain clang to avoid broken __prefetch intrinsic on arm64 in Clang 18.
10021003 # TODO: Use llvm-19 when available. See https://github.com/compnerd/swift-build/issues/846
10031004 $CLANG_LOCATION = Split-Path (Get-Command swiftc).Source
10041005 if ( "${{ matrix.arch }}" -eq "arm64" ) {
1005- $EXTRA_FLAGS += "${{ matrix.extra_flags }}".Split()
1006- $EXTRA_FLAGS += @("-D", "CMAKE_SYSTEM_NAME=Windows")
1006+ $ExtraFlags += " -D CMAKE_SYSTEM_NAME=Windows"
10071007 $CACHE="${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-aarch64.cmake"
10081008
10091009 # FIXME(compnerd) re-enable runtimes after we sort out compiler-rt
10101010 (Get-Content ${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-aarch64.cmake).Replace(' runtimes', '') | Set-Content ${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-aarch64.cmake
10111011 } else {
1012+ # FIXME(steelskin) Setting `CMAKE_SYSTEM_NAME and `CMAKE_SYSTEM_PROCESSOR` breaks the compiler-rt build
1013+ $ExtraFlags = ""
10121014 $CACHE="${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-x86_64.cmake"
10131015 }
10141016 $CC = "cl"
@@ -1023,7 +1025,6 @@ jobs:
10231025 $LIBPYTHON_PATH = "${env:PYTHON_LOCATION_${{ matrix.arch }}}/libs/python39.lib"
10241026 $PYTHON_INCLUDE_DIR = "${env:PYTHON_LOCATION_${{ matrix.arch }}}/include"
10251027 $PYTHON_BINARY="python.exe"
1026- $ExeSuffix = ".exe"
10271028 Remove-Item env:\SDKROOT
10281029 } elseif ( "${{ matrix.os }}" -eq "Darwin" ) {
10291030 # Default swiftc comes from /usr/bin and is not compatible with the toolchain.
@@ -1035,10 +1036,10 @@ jobs:
10351036 $CXX = Join-Path $CLANG_LOCATION "clang++"
10361037 $CACHE = "${{ github.workspace }}/SourceCache/swift/cmake/caches/Darwin-${{ matrix.arch }}.cmake"
10371038 $SDKROOT = xcrun --sdk macosx --show-sdk-path
1038- $EXTRA_FLAGS += "${{ matrix.extra_flags }}".Split()
1039- $EXTRA_FLAGS += @("-D", " CMAKE_SYSTEM_NAME=Darwin")
1039+
1040+ $ExtraFlags += " -D CMAKE_SYSTEM_NAME=Darwin"
10401041 # TODO: Use early-swift-driver on Windows too.
1041- $EXTRA_FLAGS += @("-D", " SWIFT_EARLY_SWIFT_DRIVER_BUILD=${{ github.workspace }}/BinaryCache/swift-driver/bin")
1042+ $ExtraFlags += " -D SWIFT_EARLY_SWIFT_DRIVER_BUILD=${{ github.workspace }}/BinaryCache/swift-driver/bin"
10421043 $LIBPYTHON_PATH = "${env:pythonLocation}/lib/python3.9/config-3.9-darwin/libpython3.9.a"
10431044 $PYTHON_INCLUDE_DIR = "${env:pythonLocation}/include/python3.9"
10441045 $PYTHON_BINARY="python3"
@@ -1047,22 +1048,50 @@ jobs:
10471048
10481049 $SwiftFlags += " -sdk `"${SDKROOT}`""
10491050
1051+ # Output the context for the configure task.
1052+ $Context = @"
1053+ cc=${CC}
1054+ cxx=${CXX}
1055+ swiftc=${SWIFTC}
1056+ cxxflags=${CxxFlags}
1057+ swiftflags=${SwiftFlags}
1058+ extra_flags=${ExtraFlags}
1059+ cache=${CACHE}
1060+ clang_location=${CLANG_LOCATION}
1061+ libpython_path=${LIBPYTHON_PATH}
1062+ python_include_dir=${PYTHON_INCLUDE_DIR}
1063+ python_binary=${PYTHON_BINARY}
1064+ sdkroot=${SDKROOT}
1065+ "@
1066+ Write-Output $Context | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1067+
1068+ - name : Configure Compilers
1069+ env :
1070+ NDKPATH : ${{ steps.setup-ndk.outputs.ndk-path }}
1071+ run : |
1072+ if ( "${{ matrix.os }}" -eq "Windows" ) {
1073+ $ExeSuffix = ".exe"
1074+ Remove-Item env:\SDKROOT
1075+ } elseif ( "${{ matrix.os }}" -eq "Darwin" ) {
1076+ $ExeSuffix = ""
1077+ }
1078+
10501079 cmake -B ${{ github.workspace }}/BinaryCache/1 `
1051- -C "${CACHE }" `
1080+ -C "${{ steps.setup-context.outputs.cache } }" `
10521081 -D CMAKE_BUILD_TYPE=Release `
1053- -D CMAKE_C_COMPILER="${CC }" `
1082+ -D CMAKE_C_COMPILER="${{ steps.setup-context.outputs.cc } }" `
10541083 -D CMAKE_C_COMPILER_LAUNCHER=sccache `
10551084 -D CMAKE_C_FLAGS="${{ matrix.cflags }}" `
1056- -D CMAKE_CXX_COMPILER="${CXX }" `
1085+ -D CMAKE_CXX_COMPILER="${{ steps.setup-context.outputs.cxx } }" `
10571086 -D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
1058- -D CMAKE_CXX_FLAGS="${CxxFlags }" `
1059- -D CMAKE_Swift_COMPILER="${SWIFTC }" `
1087+ -D CMAKE_CXX_FLAGS="${{ steps.setup-context.outputs.cxxflags } }" `
1088+ -D CMAKE_Swift_COMPILER="${{ steps.setup-context.outputs.swiftc } }" `
10601089 -D CMAKE_Swift_COMPILER_WORKS=YES `
1061- -D CMAKE_Swift_FLAGS="${SwiftFlags }" `
1090+ -D CMAKE_Swift_FLAGS="${{ steps.setup-context.outputs.swiftflags } }" `
10621091 ${{ matrix.cmake_linker_flags }} `
10631092 -D CMAKE_FIND_PACKAGE_PREFER_CONFIG=YES `
10641093 -D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr `
1065- @EXTRA_FLAGS `
1094+ ${{ steps.setup-context.outputs.extra_flags }} `
10661095 -G Ninja `
10671096 -S ${{ github.workspace }}/SourceCache/llvm-project/llvm `
10681097 -D CLANG_TABLEGEN="${{ github.workspace }}/BinaryCache/0/bin/clang-tblgen${ExeSuffix}" `
@@ -1077,7 +1106,7 @@ jobs:
10771106 -D SWIFT_BUILD_DYNAMIC_STDLIB=NO `
10781107 -D SWIFT_BUILD_REMOTE_MIRROR=NO `
10791108 -D SWIFT_BUILD_SWIFT_SYNTAX=YES `
1080- -D SWIFT_CLANG_LOCATION=${CLANG_LOCATION} `
1109+ -D SWIFT_CLANG_LOCATION="${{ steps.setup-context.outputs.clang_location }}" `
10811110 -D SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY=YES `
10821111 -D SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP=YES `
10831112 -D SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED=YES `
@@ -1089,7 +1118,7 @@ jobs:
10891118 -D SWIFT_PATH_TO_LIBDISPATCH_SOURCE=${{ github.workspace }}/SourceCache/swift-corelibs-libdispatch `
10901119 -D SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE=${{ github.workspace }}/SourceCache/swift-syntax `
10911120 -D SWIFT_PATH_TO_STRING_PROCESSING_SOURCE=${{ github.workspace }}/SourceCache/swift-experimental-string-processing `
1092- -D SWIFT_PATH_TO_SWIFT_SDK="${SDKROOT }" `
1121+ -D SWIFT_PATH_TO_SWIFT_SDK="${{ steps.setup-context.outputs.sdkroot } }" `
10931122 -D CLANG_VENDOR=compnerd.org `
10941123 -D CLANG_VENDOR_UTI=org.compnerd.dt `
10951124 -D cmark-gfm_DIR=${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake `
@@ -1100,12 +1129,12 @@ jobs:
11001129 -D SWIFT_PARALLEL_LINK_JOBS=2 `
11011130 -D LLVM_APPEND_VC_REV=NO `
11021131 -D LLVM_VERSION_SUFFIX="" `
1103- -D LLDB_PYTHON_EXE_RELATIVE_PATH=${PYTHON_BINARY } `
1132+ -D LLDB_PYTHON_EXE_RELATIVE_PATH=${{ steps.setup-context.outputs.python_binary } } `
11041133 -D LLDB_PYTHON_EXT_SUFFIX=.pyd `
11051134 -D LLDB_PYTHON_RELATIVE_PATH=lib/site-packages `
11061135 -D Python3_EXECUTABLE=${{ steps.python.outputs.python-path }} `
1107- -D Python3_INCLUDE_DIR=$PYTHON_INCLUDE_DIR `
1108- -D Python3_LIBRARY=$LIBPYTHON_PATH `
1136+ -D Python3_INCLUDE_DIR=${{ steps.setup-context.outputs.python_include_dir }} `
1137+ -D Python3_LIBRARY=${{ steps.setup-context.outputs.libpython_path }} `
11091138 -D Python3_ROOT_DIR=$env:pythonLocation
11101139
11111140 - name : Build Compiler Distribution
0 commit comments