Skip to content

Commit 8aad843

Browse files
committed
[Mac build] Add macros build
1 parent f771676 commit 8aad843

File tree

2 files changed

+55
-33
lines changed

2 files changed

+55
-33
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,25 +394,25 @@ jobs:
394394
"arch": "amd64",
395395
"cpu": "x86_64",
396396
"triple": "x86_64-unknown-windows-msvc",
397-
"compiler_target": "x86_64-unknown-windows-msvc",
398397
"os": "Windows",
399398
"cc": "cl",
400399
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
401400
"cxx": "cl",
402401
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
402+
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
403403
"cmake_linker_flags": "-D CMAKE_EXE_LINKER_FLAGS=\"${{ steps.context.outputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}\" -D CMAKE_SHARED_LINKER_FLAGS=\"${{ steps.context.outputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}\" -D CMAKE_STATIC_LIBRARY_PREFIX_Swift=lib",
404404
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=AMD64"
405405
},
406406
{
407407
"arch": "arm64",
408408
"cpu": "aarch64",
409409
"triple": "aarch64-unknown-windows-msvc",
410-
"compiler_target": "aarch64-unknown-windows-msvc",
411410
"os": "Windows",
412411
"cc": "cl",
413412
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
414413
"cxx": "cl",
415414
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
415+
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
416416
"cmake_linker_flags": "-D CMAKE_EXE_LINKER_FLAGS=\"${{ steps.context.outputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}\" -D CMAKE_SHARED_LINKER_FLAGS=\"${{ steps.context.outputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}\" -D CMAKE_STATIC_LIBRARY_PREFIX_Swift=lib",
417417
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=ARM64"
418418
}
@@ -425,7 +425,6 @@ jobs:
425425
"arch": "arm64",
426426
"cpu": "aarch64",
427427
"triple": "aarch64-unknown-windows-msvc",
428-
"compiler_target": "aarch64-unknown-windows-msvc",
429428
"os": "Windows",
430429
"cc": "cl",
431430
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
@@ -674,22 +673,26 @@ jobs:
674673
{
675674
"arch": "x86_64",
676675
"cpu": "x86_64",
676+
"triple": "x86_64-apple-macosx15.0",
677677
"os": "Darwin",
678678
"cc": "clang",
679679
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
680680
"cxx": "clang++",
681681
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
682+
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
682683
"cmake_linker_flags": "-D CMAKE_EXE_LINKER_FLAGS=\"${{ steps.context.outputs.DARWIN_CMAKE_EXE_LINKER_FLAGS }}\" -D CMAKE_SHARED_LINKER_FLAGS=\"${{ steps.context.outputs.DARWIN_CMAKE_SHARED_LINKER_FLAGS }}\"",
683684
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=x86_64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=x86_64"
684685
},
685686
{
686687
"arch": "arm64",
687688
"cpu": "arm64",
689+
"triple": "arm64-apple-macosx15.0",
688690
"os": "Darwin",
689691
"cc": "clang",
690692
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
691693
"cxx": "clang++",
692694
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
695+
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
693696
"cmake_linker_flags": "-D CMAKE_EXE_LINKER_FLAGS=${{ steps.context.outputs.DARWIN_CMAKE_EXE_LINKER_FLAGS }} -D CMAKE_SHARED_LINKER_FLAGS=${{ steps.context.outputs.DARWIN_CMAKE_SHARED_LINKER_FLAGS }}",
694697
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=arm64"
695698
}

.github/workflows/swift-toolchain.yml

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,34 +1908,32 @@ jobs:
19081908
searchPattern: '**/*.dll'
19091909

19101910
macros:
1911-
# TODO: Build this on macOS or make an equivalent Mac-only job
1912-
if: inputs.build_os == 'Windows'
19131911
needs: [compilers, cmark_gfm, stdlib]
19141912
runs-on: ${{ inputs.default_build_runner }}
19151913

19161914
strategy:
19171915
fail-fast: false
19181916
matrix: ${{ fromJSON(inputs.host_matrix) }}
19191917

1920-
name: Windows ${{ matrix.arch }} Macros
1918+
name: ${{ matrix.os }} ${{ matrix.arch }} Macros
19211919

19221920
steps:
19231921
- name: Download Compilers
19241922
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
19251923
with:
1926-
name: Windows-${{ inputs.build_arch }}-Asserts-compilers
1924+
name: ${{ inputs.build_os }}-${{ inputs.build_arch }}-Asserts-compilers
19271925
path: ${{ github.workspace }}/BinaryCache/Library
19281926
- name: Download swift-syntax
19291927
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
19301928
with:
1931-
name: Windows-${{ matrix.arch }}-Asserts-swift-syntax
1929+
name: ${{ matrix.os }}-${{ matrix.arch }}-Asserts-swift-syntax
19321930
path: ${{ github.workspace }}/BinaryCache/swift-syntax
19331931
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
19341932
with:
1935-
name: Windows-${{ matrix.arch }}-stdlib
1933+
name: ${{ matrix.os }}-${{ matrix.arch }}-stdlib
19361934
path: ${{ github.workspace }}/BinaryCache/Library
19371935
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
1938-
if: matrix.arch == 'arm64'
1936+
if: matrix.os == 'Windows' && matrix.arch == 'arm64'
19391937
with:
19401938
name: Windows-${{ inputs.build_arch }}-stdlib
19411939
path: ${{ github.workspace }}/BinaryCache/Library
@@ -1966,17 +1964,44 @@ jobs:
19661964
arch: ${{ matrix.arch }}
19671965
winsdk: ${{ env.WORKAROUND_WINDOWS_SDK_VERSION }}
19681966

1969-
- run: |
1970-
$RTLPath = cygpath -w ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/bin
1971-
echo ${RTLPath} | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
1967+
- uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401
1968+
if: inputs.build_os == 'Darwin'
19721969

1973-
- name: Extract swift-syntax
1970+
- name: Setup configuration
1971+
id: setup-config
19741972
run: |
1973+
$bindir = "${{ github.workspace }}/BinaryCache/swift-syntax"
1974+
$SWIFTFLAGS = "${{ matrix.swiftflags }} -strict-implicit-module-context"
1975+
1976+
if ("${{ matrix.os }}" -eq "Windows") {
1977+
$SWIFTC = cygpath -m "${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe"
1978+
$bindir = cygpath -m $bindir
1979+
$SDKRoot = "${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk"
1980+
$SWIFTFLAGS += " -resource-dir ${SDKRoot}/usr/lib/swift"
1981+
$SWIFTFLAGS += " -L${SDKRoot}/usr/lib/swift/windows"
1982+
1983+
# Export the path to the runtime libraries. This is only needed for Windows.
1984+
$RTLPath = cygpath -w ${SDKRoot}/usr/bin
1985+
Write-Output ${RTLPath} | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
1986+
1987+
# VFS Overlay is only required on Windows.
1988+
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
1989+
$SWIFTFLAGS += " -vfsoverlay ${WINDOWS_VFS_OVERLAY}"
1990+
$SWIFTFLAGS += " -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules"
1991+
} else {
1992+
$SWIFTC = "${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc"
1993+
}
1994+
1995+
# Configure swift-syntax.
19751996
$module = "${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules/SwiftSyntaxConfig.cmake"
1976-
$bindir = cygpath -m ${{ github.workspace }}/BinaryCache/swift-syntax
19771997
(Get-Content $module).Replace('<BINARY_DIR>', "${bindir}") | Set-Content $module
19781998
1999+
# Export the configuration.
2000+
Write-Output "swiftc=${SWIFTC}" | Out-File -FilePath ${env:GITHUB_OUTPUT} -Encoding utf8 -Append
2001+
Write-Output "swift-flags=${SWIFTFLAGS}" | Out-File -FilePath ${env:GITHUB_OUTPUT} -Encoding utf8 -Append
2002+
19792003
- name: Create vfs-overlay
2004+
if: matrix.os == 'Windows'
19802005
run: |
19812006
$VfsOverlay = "${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml"
19822007
$ModuleMapDir = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/share
@@ -2022,17 +2047,14 @@ jobs:
20222047
20232048
- name: Configure Foundation Macros
20242049
run: |
2025-
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
2026-
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe
2027-
20282050
cmake -B ${{ github.workspace }}/BinaryCache/swift-foundation-macros `
20292051
-D CMAKE_BUILD_TYPE=Release `
20302052
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr `
2031-
-D CMAKE_Swift_COMPILER=${SWIFTC} `
2053+
-D CMAKE_Swift_COMPILER=${{ steps.setup-config.outputs.swiftc }} `
20322054
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
2033-
-D CMAKE_Swift_FLAGS="-resource-dir ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/lib/swift -L${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/lib/swift/windows -vfsoverlay ${WINDOWS_VFS_OVERLAY} -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules ${{ inputs.CMAKE_Swift_FLAGS }}" `
2055+
-D CMAKE_Swift_FLAGS="${{ steps.setup-config.outputs.swift-flags }}" `
20342056
-D CMAKE_Swift_FLAGS_RELEASE="-O" `
2035-
-D CMAKE_SYSTEM_NAME=Windows `
2057+
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
20362058
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
20372059
-G Ninja `
20382060
-S ${{ github.workspace }}/SourceCache/swift-foundation/Sources/FoundationMacros `
@@ -2042,16 +2064,13 @@ jobs:
20422064

20432065
- name: Configure Testing Macros
20442066
run: |
2045-
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
2046-
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe
2047-
20482067
cmake -B ${{ github.workspace }}/BinaryCache/swift-testing-macros `
20492068
-D CMAKE_BUILD_TYPE=Release `
20502069
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr `
2051-
-D CMAKE_Swift_COMPILER=${SWIFTC} `
2070+
-D CMAKE_Swift_COMPILER=${{ steps.setup-config.outputs.swiftc }} `
20522071
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
2053-
-D CMAKE_Swift_FLAGS="-resource-dir ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/lib/swift -L${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/lib/swift/windows -vfsoverlay ${WINDOWS_VFS_OVERLAY} -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules ${{ inputs.CMAKE_Swift_FLAGS }}" `
2054-
-D CMAKE_SYSTEM_NAME=Windows `
2072+
-D CMAKE_Swift_FLAGS="${{ steps.setup-config.outputs.swift-flags }}" `
2073+
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
20552074
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
20562075
-G Ninja `
20572076
-S ${{ github.workspace }}/SourceCache/swift-testing/Sources/TestingMacros `
@@ -2065,14 +2084,14 @@ jobs:
20652084
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-testing-macros --target install
20662085

20672086
- name: Upload macros
2068-
uses: actions/upload-artifact@v4
2087+
uses: thebrowsercompany/gha-upload-tar-artifact@e18c33b1cd416d0d96a91dc6dce06219f98e4e27 # main
20692088
with:
20702089
name: ${{ matrix.os }}-${{ matrix.arch }}-macros
20712090
path: ${{ github.workspace }}/BuildRoot/Library
20722091

20732092
- name: Upload PDBs to Azure
20742093
uses: microsoft/action-publish-symbols@v2.1.6
2075-
if: ${{ inputs.debug_info }}
2094+
if: ${{ inputs.debug_info && matrix.os == 'Windows' }}
20762095
with:
20772096
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }}
20782097
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
@@ -2081,7 +2100,7 @@ jobs:
20812100

20822101
- name: Upload DLLs to Azure
20832102
uses: microsoft/action-publish-symbols@v2.1.6
2084-
if: ${{ inputs.debug_info }}
2103+
if: ${{ inputs.debug_info && matrix.os == 'Windows' }}
20852104
with:
20862105
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }}
20872106
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
@@ -2224,7 +2243,7 @@ jobs:
22242243
with:
22252244
name: Windows-${{ inputs.build_arch }}-stdlib
22262245
path: ${{ github.workspace }}/BinaryCache/Library
2227-
- uses: actions/download-artifact@v4
2246+
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
22282247
if: matrix.os != 'Android' || inputs.build_android
22292248
with:
22302249
name: Windows-${{ inputs.build_arch }}-macros
@@ -2786,7 +2805,7 @@ jobs:
27862805
with:
27872806
name: Windows-${{ matrix.arch }}-sdk
27882807
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform
2789-
- uses: actions/download-artifact@v4
2808+
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
27902809
with:
27912810
name: Windows-${{ inputs.build_arch }}-macros
27922811
path: ${{ github.workspace }}/BinaryCache/Library
@@ -3660,7 +3679,7 @@ jobs:
36603679
path: ${{ github.workspace }}/BuildRoot/Library
36613680

36623681
- name: Download Macros
3663-
uses: actions/download-artifact@v4
3682+
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
36643683
with:
36653684
name: Windows-${{ matrix.arch }}-macros
36663685
path: ${{ github.workspace }}/BuildRoot/Library

0 commit comments

Comments
 (0)