@@ -978,27 +978,28 @@ jobs:
978
978
key : ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-compilers
979
979
variant : sccache
980
980
981
- - name : Configure Compilers
981
+ - name : Setup context
982
+ id : setup-context
982
983
run : |
983
984
$CxxFlags = "${{ matrix.cxxflags }}"
984
985
$SwiftFlags = ""
985
- $EXTRA_FLAGS = @()
986
986
987
+ $ExtraFlags = "${{ matrix.extra_flags }}"
987
988
if ( "${{ matrix.os }}" -eq "Windows" ) {
988
989
$SWIFTC = cygpath -m (Get-Command swiftc).Source
989
990
# Use toolchain clang to avoid broken __prefetch intrinsic on arm64 in Clang 18.
990
991
# TODO: Use llvm-19 when available. See https://github.com/compnerd/swift-build/issues/846
991
992
$CLANG_LOCATION = Split-Path (Get-Command swiftc).Source
992
993
if ( "${{ matrix.arch }}" -eq "arm64" ) {
993
- $EXTRA_FLAGS += "${{ matrix.extra_flags }}".Split()
994
- $EXTRA_FLAGS += @("-D", " CMAKE_SYSTEM_NAME=Windows")
994
+ $ExtraFlags += " ${{ matrix.extra_flags }}"
995
+ $ExtraFlags += " -D CMAKE_SYSTEM_NAME=Windows"
995
996
$CACHE="${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-aarch64.cmake"
996
997
997
998
# FIXME(compnerd) re-enable runtimes after we sort out compiler-rt
998
999
(Get-Content ${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-aarch64.cmake).Replace(' runtimes', '') | Set-Content ${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-aarch64.cmake
999
1000
} else {
1000
1001
# FIXME(steelskin) Setting `CMAKE_SYSTEM_PROCESSOR` and `CMAKE_SYSTEM_NAME` breaks the compiler-rt build.
1001
- $EXTRA_FLAGS += @( "-D", " CMAKE_MT=mt")
1002
+ $ExtraFlags += "-D CMAKE_MT=mt"
1002
1003
$CACHE="${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-x86_64.cmake"
1003
1004
}
1004
1005
$CC = "cl"
@@ -1013,7 +1014,6 @@ jobs:
1013
1014
$LIBPYTHON_PATH = "${env:PYTHON_LOCATION_${{ matrix.arch }}}/libs/python39.lib"
1014
1015
$PYTHON_INCLUDE_DIR = "${env:PYTHON_LOCATION_${{ matrix.arch }}}/include"
1015
1016
$PYTHON_BINARY="python.exe"
1016
- $ExeSuffix = ".exe"
1017
1017
Remove-Item env:\SDKROOT
1018
1018
} elseif ( "${{ matrix.os }}" -eq "Darwin" ) {
1019
1019
# Default swiftc comes from /usr/bin and is not compatible with the toolchain.
@@ -1025,10 +1025,11 @@ jobs:
1025
1025
$CXX = Join-Path $CLANG_LOCATION "clang++"
1026
1026
$CACHE = "${{ github.workspace }}/SourceCache/swift/cmake/caches/Darwin-${{ matrix.arch }}.cmake"
1027
1027
$SDKROOT = xcrun --sdk macosx --show-sdk-path
1028
- $EXTRA_FLAGS += "${{ matrix.extra_flags }}".Split()
1029
- $EXTRA_FLAGS += @("-D", "CMAKE_SYSTEM_NAME=Darwin")
1028
+
1029
+ $ExtraFlags += "${{ matrix.extra_flags }}"
1030
+ $ExtraFlags += " -D CMAKE_SYSTEM_NAME=Darwin"
1030
1031
# TODO: Use early-swift-driver on Windows too.
1031
- $EXTRA_FLAGS += @("-D", " SWIFT_EARLY_SWIFT_DRIVER_BUILD=${{ github.workspace }}/BinaryCache/swift-driver/bin")
1032
+ $ExtraFlags += " -D SWIFT_EARLY_SWIFT_DRIVER_BUILD=${{ github.workspace }}/BinaryCache/swift-driver/bin"
1032
1033
$LIBPYTHON_PATH = "${env:pythonLocation}/lib/python3.9/config-3.9-darwin/libpython3.9.a"
1033
1034
$PYTHON_INCLUDE_DIR = "${env:pythonLocation}/include/python3.9"
1034
1035
$PYTHON_BINARY="python3"
@@ -1037,22 +1038,44 @@ jobs:
1037
1038
1038
1039
$SwiftFlags += " -sdk `"${SDKROOT}`""
1039
1040
1041
+ Write-Output "cc=${CC}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1042
+ Write-Output "cxx=${CXX}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1043
+ Write-Output "swiftc=${SWIFTC}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1044
+ Write-Output "cxxflags=${CxxFlags}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1045
+ Write-Output "swiftflags=${SwiftFlags}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1046
+ Write-Output "extra_flags=${ExtraFlags}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1047
+ Write-Output "cache=${CACHE}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1048
+ Write-Output "clang_location=${CLANG_LOCATION}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1049
+ Write-Output "libpython_path=${LIBPYTHON_PATH}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1050
+ Write-Output "python_include_dir=${PYTHON_INCLUDE_DIR}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1051
+ Write-Output "python_binary=${PYTHON_BINARY}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1052
+
1053
+ - name : Configure Compilers
1054
+ env :
1055
+ NDKPATH : ${{ steps.setup-ndk.outputs.ndk-path }}
1056
+ run : |
1057
+ if ( "${{ matrix.os }}" -eq "Windows" ) {
1058
+ $ExeSuffix = ".exe"
1059
+ Remove-Item env:\SDKROOT
1060
+ } elseif ( "${{ matrix.os }}" -eq "Darwin" ) {
1061
+ $ExeSuffix = ""
1062
+ }
1063
+
1040
1064
cmake -B ${{ github.workspace }}/BinaryCache/1 `
1041
- -C "${CACHE }" `
1065
+ -C "${{ steps.setup-context.outputs.cache } }" `
1042
1066
-D CMAKE_BUILD_TYPE=Release `
1043
- -D CMAKE_C_COMPILER="${CC }" `
1067
+ -D CMAKE_C_COMPILER="${{ steps.setup-context.outputs.cc } }" `
1044
1068
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
1045
1069
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" `
1046
- -D CMAKE_CXX_COMPILER="${CXX }" `
1070
+ -D CMAKE_CXX_COMPILER="${{ steps.setup-context.outputs.cxx } }" `
1047
1071
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
1048
- -D CMAKE_CXX_FLAGS="${CxxFlags }" `
1049
- -D CMAKE_Swift_COMPILER="${SWIFTC }" `
1072
+ -D CMAKE_CXX_FLAGS="${{ steps.setup-context.outputs.cxxflags } }" `
1073
+ -D CMAKE_Swift_COMPILER="${{ steps.setup-context.outputs.swiftc } }" `
1050
1074
-D CMAKE_Swift_COMPILER_WORKS=YES `
1051
- -D CMAKE_Swift_FLAGS="${SwiftFlags }" `
1075
+ -D CMAKE_Swift_FLAGS="${{ steps.setup-context.outputs.swiftlags } }" `
1052
1076
${{ matrix.cmake_linker_flags }} `
1053
- -D CMAKE_FIND_PACKAGE_PREFER_CONFIG=YES `
1054
1077
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr `
1055
- @EXTRA_FLAGS `
1078
+ ${{ steps.setup-context.outputs.extra_flags }} `
1056
1079
-G Ninja `
1057
1080
-S ${{ github.workspace }}/SourceCache/llvm-project/llvm `
1058
1081
-D CLANG_TABLEGEN="${{ github.workspace }}/BinaryCache/0/bin/clang-tblgen${ExeSuffix}" `
@@ -1079,7 +1102,7 @@ jobs:
1079
1102
-D SWIFT_PATH_TO_LIBDISPATCH_SOURCE=${{ github.workspace }}/SourceCache/swift-corelibs-libdispatch `
1080
1103
-D SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE=${{ github.workspace }}/SourceCache/swift-syntax `
1081
1104
-D SWIFT_PATH_TO_STRING_PROCESSING_SOURCE=${{ github.workspace }}/SourceCache/swift-experimental-string-processing `
1082
- -D SWIFT_PATH_TO_SWIFT_SDK="${SDKROOT }" `
1105
+ -D SWIFT_PATH_TO_SWIFT_SDK="${{ steps.setup-context.outputs.sdkroot } }" `
1083
1106
-D CLANG_VENDOR=compnerd.org `
1084
1107
-D CLANG_VENDOR_UTI=org.compnerd.dt `
1085
1108
-D cmark-gfm_DIR=${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake `
@@ -1090,12 +1113,12 @@ jobs:
1090
1113
-D SWIFT_PARALLEL_LINK_JOBS=2 `
1091
1114
-D LLVM_APPEND_VC_REV=NO `
1092
1115
-D LLVM_VERSION_SUFFIX="" `
1093
- -D LLDB_PYTHON_EXE_RELATIVE_PATH=${PYTHON_BINARY } `
1116
+ -D LLDB_PYTHON_EXE_RELATIVE_PATH=${{ steps.setup-context.outputs.python_binary } } `
1094
1117
-D LLDB_PYTHON_EXT_SUFFIX=.pyd `
1095
1118
-D LLDB_PYTHON_RELATIVE_PATH=lib/site-packages `
1096
1119
-D Python3_EXECUTABLE=${{ steps.python.outputs.python-path }} `
1097
- -D Python3_INCLUDE_DIR=$PYTHON_INCLUDE_DIR `
1098
- -D Python3_LIBRARY=$LIBPYTHON_PATH `
1120
+ -D Python3_INCLUDE_DIR=${{ steps.setup-context.outputs.python_include_dir }} `
1121
+ -D Python3_LIBRARY=${{ steps.setup-context.outputs.libpython_path }} `
1099
1122
-D Python3_ROOT_DIR=$env:pythonLocation
1100
1123
1101
1124
- name : Build Compiler Distribution
0 commit comments