@@ -990,25 +990,27 @@ jobs:
990
990
key : ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-compilers
991
991
variant : sccache
992
992
993
- - name : Configure Compilers
993
+ - name : Setup context
994
+ id : setup-context
994
995
run : |
995
996
$CxxFlags = "${{ matrix.cxxflags }}"
996
997
$SwiftFlags = ""
997
- $EXTRA_FLAGS = @()
998
+ $ExtraFlags = "${{ matrix.extra_flags }}"
998
999
999
1000
if ( "${{ matrix.os }}" -eq "Windows" ) {
1000
1001
$SWIFTC = cygpath -m (Get-Command swiftc).Source
1001
1002
# Use toolchain clang to avoid broken __prefetch intrinsic on arm64 in Clang 18.
1002
1003
# TODO: Use llvm-19 when available. See https://github.com/compnerd/swift-build/issues/846
1003
1004
$CLANG_LOCATION = Split-Path (Get-Command swiftc).Source
1004
1005
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"
1007
1007
$CACHE="${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-aarch64.cmake"
1008
1008
1009
1009
# FIXME(compnerd) re-enable runtimes after we sort out compiler-rt
1010
1010
(Get-Content ${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-aarch64.cmake).Replace(' runtimes', '') | Set-Content ${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-aarch64.cmake
1011
1011
} else {
1012
+ # FIXME(steelskin) Setting `CMAKE_SYSTEM_NAME and `CMAKE_SYSTEM_PROCESSOR` breaks the compiler-rt build
1013
+ $ExtraFlags = ""
1012
1014
$CACHE="${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-x86_64.cmake"
1013
1015
}
1014
1016
$CC = "cl"
@@ -1023,7 +1025,6 @@ jobs:
1023
1025
$LIBPYTHON_PATH = "${env:PYTHON_LOCATION_${{ matrix.arch }}}/libs/python39.lib"
1024
1026
$PYTHON_INCLUDE_DIR = "${env:PYTHON_LOCATION_${{ matrix.arch }}}/include"
1025
1027
$PYTHON_BINARY="python.exe"
1026
- $ExeSuffix = ".exe"
1027
1028
Remove-Item env:\SDKROOT
1028
1029
} elseif ( "${{ matrix.os }}" -eq "Darwin" ) {
1029
1030
# Default swiftc comes from /usr/bin and is not compatible with the toolchain.
@@ -1035,10 +1036,10 @@ jobs:
1035
1036
$CXX = Join-Path $CLANG_LOCATION "clang++"
1036
1037
$CACHE = "${{ github.workspace }}/SourceCache/swift/cmake/caches/Darwin-${{ matrix.arch }}.cmake"
1037
1038
$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"
1040
1041
# 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"
1042
1043
$LIBPYTHON_PATH = "${env:pythonLocation}/lib/python3.9/config-3.9-darwin/libpython3.9.a"
1043
1044
$PYTHON_INCLUDE_DIR = "${env:pythonLocation}/include/python3.9"
1044
1045
$PYTHON_BINARY="python3"
@@ -1047,22 +1048,50 @@ jobs:
1047
1048
1048
1049
$SwiftFlags += " -sdk `"${SDKROOT}`""
1049
1050
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
+
1050
1079
cmake -B ${{ github.workspace }}/BinaryCache/1 `
1051
- -C "${CACHE }" `
1080
+ -C "${{ steps.setup-context.outputs.cache } }" `
1052
1081
-D CMAKE_BUILD_TYPE=Release `
1053
- -D CMAKE_C_COMPILER="${CC }" `
1082
+ -D CMAKE_C_COMPILER="${{ steps.setup-context.outputs.cc } }" `
1054
1083
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
1055
1084
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" `
1056
- -D CMAKE_CXX_COMPILER="${CXX }" `
1085
+ -D CMAKE_CXX_COMPILER="${{ steps.setup-context.outputs.cxx } }" `
1057
1086
-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 } }" `
1060
1089
-D CMAKE_Swift_COMPILER_WORKS=YES `
1061
- -D CMAKE_Swift_FLAGS="${SwiftFlags }" `
1090
+ -D CMAKE_Swift_FLAGS="${{ steps.setup-context.outputs.swiftflags } }" `
1062
1091
${{ matrix.cmake_linker_flags }} `
1063
1092
-D CMAKE_FIND_PACKAGE_PREFER_CONFIG=YES `
1064
1093
-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 }} `
1066
1095
-G Ninja `
1067
1096
-S ${{ github.workspace }}/SourceCache/llvm-project/llvm `
1068
1097
-D CLANG_TABLEGEN="${{ github.workspace }}/BinaryCache/0/bin/clang-tblgen${ExeSuffix}" `
@@ -1077,7 +1106,7 @@ jobs:
1077
1106
-D SWIFT_BUILD_DYNAMIC_STDLIB=NO `
1078
1107
-D SWIFT_BUILD_REMOTE_MIRROR=NO `
1079
1108
-D SWIFT_BUILD_SWIFT_SYNTAX=YES `
1080
- -D SWIFT_CLANG_LOCATION=${CLANG_LOCATION} `
1109
+ -D SWIFT_CLANG_LOCATION="${{ steps.setup-context.outputs.clang_location }}" `
1081
1110
-D SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY=YES `
1082
1111
-D SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP=YES `
1083
1112
-D SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED=YES `
@@ -1089,7 +1118,7 @@ jobs:
1089
1118
-D SWIFT_PATH_TO_LIBDISPATCH_SOURCE=${{ github.workspace }}/SourceCache/swift-corelibs-libdispatch `
1090
1119
-D SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE=${{ github.workspace }}/SourceCache/swift-syntax `
1091
1120
-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 } }" `
1093
1122
-D CLANG_VENDOR=compnerd.org `
1094
1123
-D CLANG_VENDOR_UTI=org.compnerd.dt `
1095
1124
-D cmark-gfm_DIR=${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake `
@@ -1100,12 +1129,12 @@ jobs:
1100
1129
-D SWIFT_PARALLEL_LINK_JOBS=2 `
1101
1130
-D LLVM_APPEND_VC_REV=NO `
1102
1131
-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 } } `
1104
1133
-D LLDB_PYTHON_EXT_SUFFIX=.pyd `
1105
1134
-D LLDB_PYTHON_RELATIVE_PATH=lib/site-packages `
1106
1135
-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 }} `
1109
1138
-D Python3_ROOT_DIR=$env:pythonLocation
1110
1139
1111
1140
- name : Build Compiler Distribution
0 commit comments