Skip to content

Commit 992ea9b

Browse files
committed
[Mac build] Add macros build
1 parent 130980b commit 992ea9b

File tree

2 files changed

+91
-64
lines changed

2 files changed

+91
-64
lines changed

.github/workflows/build-toolchain.yml

+12
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,10 @@ jobs:
312312
"include": [
313313
{
314314
"arch": "amd64",
315+
"cpu": "x86_64",
315316
"os": "Windows",
317+
"platform": "Windows",
318+
"triple": "x86_64-unknown-windows-msvc",
316319
"cc": "cl",
317320
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
318321
"cxx": "cl",
@@ -323,7 +326,10 @@ jobs:
323326
},
324327
{
325328
"arch": "arm64",
329+
"cpu": "aarch64",
326330
"os": "Windows",
331+
"platform": "Windows",
332+
"triple": "aarch64-unknown-windows-msvc",
327333
"cc": "cl",
328334
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
329335
"cxx": "cl",
@@ -471,7 +477,10 @@ jobs:
471477
"include": [
472478
{
473479
"arch": "x86_64",
480+
"cpu": "x86_64",
474481
"os": "Darwin",
482+
"platform": "MacOSX",
483+
"triple": "x86_64-apple-macosx15.0",
475484
"cc": "clang",
476485
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
477486
"cxx": "clang++",
@@ -482,7 +491,10 @@ jobs:
482491
},
483492
{
484493
"arch": "arm64",
494+
"cpu": "aarch64",
485495
"os": "Darwin",
496+
"platform": "MacOSX",
497+
"triple": "aarch64-apple-macosx15.0",
486498
"cc": "clang",
487499
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
488500
"cxx": "clang++",

.github/workflows/swift-toolchain.yml

+79-64
Original file line numberDiff line numberDiff line change
@@ -1703,9 +1703,9 @@ jobs:
17031703
}
17041704
cmake --build ${{ github.workspace }}/BinaryCache/swift --target install
17051705
1706-
- uses: actions/upload-artifact@v4
1706+
- uses: thebrowsercompany/gha-upload-tar-artifact@d8f9b9d463a319b5b65b273db0a4e12ab0b10e72
17071707
with:
1708-
name: ${{ matrix.os }}-stdlib-${{ matrix.arch }}
1708+
name: stdlib-${{ matrix.os}}-${{ matrix.arch }}
17091709
path: ${{ github.workspace }}/BuildRoot/Library
17101710

17111711
- uses: actions/upload-artifact@v4
@@ -1733,46 +1733,38 @@ jobs:
17331733
searchPattern: '**/*.dll'
17341734

17351735
macros:
1736-
# TODO: Build this on macOS or make an equivalent Mac-only job
1737-
if: always() && inputs.build_os == 'Windows' && needs.stdlib.result == 'success'
1736+
if: always() && needs.stdlib.result == 'success'
17381737
needs: [compilers, cmark_gfm, stdlib]
17391738
runs-on: ${{ inputs.default_build_runner }}
17401739

17411740
strategy:
17421741
fail-fast: false
1743-
matrix:
1744-
include:
1745-
- arch: 'amd64'
1746-
cpu: 'x86_64'
1747-
triple: 'x86_64-unknown-windows-msvc'
1748-
1749-
- arch: 'arm64'
1750-
cpu: 'aarch64'
1751-
triple: 'aarch64-unknown-windows-msvc'
1742+
matrix: ${{ fromJSON(inputs.host_matrix) }}
17521743

1753-
name: Windows ${{ matrix.arch }} Macros
1744+
name: ${{ matrix.os }} ${{ matrix.arch }} Macros
17541745

17551746
steps:
17561747
- name: Download Compilers
17571748
uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
17581749
with:
1759-
name: compilers-Windows-${{ inputs.build_arch }}
1750+
name: compilers-${{ inputs.build_os }}-${{ inputs.build_arch }}
17601751
path: ${{ github.workspace }}/BinaryCache/Library
17611752
- name: Download swift-syntax
17621753
uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
17631754
with:
1764-
name: swift-syntax-Windows-${{ matrix.arch }}
1755+
name: swift-syntax-${{ matrix.os }}-${{ matrix.arch }}
17651756
path: ${{ github.workspace }}/BinaryCache/swift-syntax
1766-
- uses: actions/download-artifact@v4
1757+
- uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
17671758
with:
1768-
name: Windows-stdlib-${{ matrix.arch }}
1759+
name: stdlib-${{ matrix.os }}-${{ matrix.arch }}
17691760
path: ${{ github.workspace }}/BinaryCache/Library
1770-
- uses: actions/download-artifact@v4
1771-
if: matrix.arch == 'arm64'
1761+
- uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
1762+
if: matrix.os == 'Windows' && matrix.arch == 'arm64'
17721763
with:
1773-
name: Windows-stdlib-amd64
1764+
name: stdlib-Windows-amd64
17741765
path: ${{ github.workspace }}/BinaryCache/Library
17751766
- uses: actions/download-artifact@v4
1767+
if: matrix.os == 'Windows'
17761768
with:
17771769
name: windows-vfs-overlay-${{ matrix.arch }}
17781770
path: ${{ github.workspace }}/BinaryCache/swift/stdlib
@@ -1802,29 +1794,53 @@ jobs:
18021794
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
18031795
arch: ${{ matrix.arch }}
18041796

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

1809-
- name: extract swift-syntax
1800+
- name: Setup configuration
1801+
id: setup-config
18101802
run: |
1803+
$PlatformLower = "${{ matrix.platform }}".ToLower()
1804+
$bindir = "${{ github.workspace }}/BinaryCache/swift-syntax"
1805+
1806+
$SwiftFlags = "${{ matrix.swiftflags }} -strict-implicit-module-context"
1807+
1808+
if ("${{ matrix.os }}" -eq "Windows") {
1809+
$SwiftC = cygpath -m "${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe"
1810+
$bindir = cygpath -m $bindir
1811+
$SDKRoot = "${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.platform }}.platform/Developer/SDKs/${{ matrix.platform }}.sdk"
1812+
$SwiftFlags += " -resource-dir ${SDKRoot}/usr/lib/swift"
1813+
$SwiftFlags += " -L${SDKRoot}/usr/lib/swift/${PlatformLower}"
1814+
1815+
# Export the path to the runtime libraries. This is only needed for Windows.
1816+
$RTLPath = cygpath -w ${SDKRoot}/usr/bin
1817+
Write-Output ${RTLPath} | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
1818+
1819+
# VFS Overlay is only required on Windows.
1820+
$SwiftFlags += " -vfsoverlay ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml"
1821+
$SwiftFlags += " -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules"
1822+
} else {
1823+
$SwiftC = "${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc"
1824+
}
1825+
1826+
# Configure swift-syntax.
18111827
$module = "${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules/SwiftSyntaxConfig.cmake"
1812-
$bindir = cygpath -m ${{ github.workspace }}/BinaryCache/swift-syntax
18131828
(Get-Content $module).Replace('<BINARY_DIR>', "${bindir}") | Set-Content $module
18141829
1830+
# Export the configuration.
1831+
Write-Output "swiftc=${SwiftC}" | Out-File -FilePath ${env:GITHUB_OUTPUT} -Encoding utf8 -Append
1832+
Write-Output "swift-flags=${SwiftFlags}" | Out-File -FilePath ${env:GITHUB_OUTPUT} -Encoding utf8 -Append
1833+
18151834
- name: Configure Foundation Macros
18161835
run: |
1817-
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
1818-
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
1819-
18201836
cmake -B ${{ github.workspace }}/BinaryCache/swift-foundation-macros `
18211837
-D CMAKE_BUILD_TYPE=Release `
18221838
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr `
1823-
-D CMAKE_Swift_COMPILER=${SWIFTC} `
1839+
-D CMAKE_Swift_COMPILER=${{ steps.setup-config.outputs.swiftc }} `
18241840
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
1825-
-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 }}" `
1841+
-D CMAKE_Swift_FLAGS="${{ steps.setup-config.outputs.swift-flags }}" `
18261842
-D CMAKE_Swift_FLAGS_RELEASE="-O" `
1827-
-D CMAKE_SYSTEM_NAME=Windows `
1843+
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
18281844
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
18291845
-G Ninja `
18301846
-S ${{ github.workspace }}/SourceCache/swift-foundation/Sources/FoundationMacros `
@@ -1834,16 +1850,13 @@ jobs:
18341850

18351851
- name: Configure Testing Macros
18361852
run: |
1837-
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
1838-
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
1839-
18401853
cmake -B ${{ github.workspace }}/BinaryCache/swift-testing-macros `
18411854
-D CMAKE_BUILD_TYPE=Release `
18421855
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr `
1843-
-D CMAKE_Swift_COMPILER=${SWIFTC} `
1856+
-D CMAKE_Swift_COMPILER=${{ steps.setup-config.outputs.swiftc }} `
18441857
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
1845-
-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 }}" `
1846-
-D CMAKE_SYSTEM_NAME=Windows `
1858+
-D CMAKE_Swift_FLAGS="${{ steps.setup-config.outputs.swift-flags }}" `
1859+
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
18471860
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
18481861
-G Ninja `
18491862
-S ${{ github.workspace }}/SourceCache/swift-testing/Sources/TestingMacros `
@@ -1857,14 +1870,14 @@ jobs:
18571870
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-testing-macros --target install
18581871

18591872
- name: Upload macros
1860-
uses: actions/upload-artifact@v4
1873+
uses: thebrowsercompany/gha-upload-tar-artifact@d8f9b9d463a319b5b65b273db0a4e12ab0b10e72
18611874
with:
1862-
name: macros-${{ matrix.arch }}
1875+
name: macros-${{ matrix.os }}-${{ matrix.arch }}
18631876
path: ${{ github.workspace }}/BuildRoot/Library
18641877

18651878
- name: Upload PDBs to Azure
18661879
uses: microsoft/action-publish-symbols@v2.1.6
1867-
if: ${{ inputs.debug_info }}
1880+
if: ${{ inputs.debug_info && matrix.os == 'Windows' }}
18681881
with:
18691882
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }}
18701883
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
@@ -1873,7 +1886,7 @@ jobs:
18731886

18741887
- name: Upload DLLs to Azure
18751888
uses: microsoft/action-publish-symbols@v2.1.6
1876-
if: ${{ inputs.debug_info }}
1889+
if: ${{ inputs.debug_info && matrix.os == 'Windows' }}
18771890
with:
18781891
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }}
18791892
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
@@ -2002,23 +2015,25 @@ jobs:
20022015
with:
20032016
name: compilers-Windows-${{ inputs.build_arch }}
20042017
path: ${{ github.workspace }}/BinaryCache/Library
2005-
- uses: actions/download-artifact@v4
2018+
2019+
- uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
20062020
with:
2007-
name: ${{ matrix.os }}-stdlib-${{ matrix.arch }}
2021+
name: stdlib-${{ matrix.os }}-${{ matrix.arch }}
20082022
path: ${{ github.workspace }}/BinaryCache/Library
2009-
- uses: actions/download-artifact@v4
2023+
- uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
20102024
with:
2011-
name: Windows-stdlib-amd64
2025+
name: stdlib-Windows-amd64
20122026
path: ${{ github.workspace }}/BinaryCache/Library
20132027
- uses: actions/download-artifact@v4
20142028
if: matrix.os == 'Windows'
20152029
with:
20162030
name: windows-vfs-overlay-${{ matrix.arch }}
20172031
path: ${{ github.workspace }}/BinaryCache/swift/stdlib
2018-
- uses: actions/download-artifact@v4
2032+
- uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
20192033
with:
2020-
name: macros-amd64
2034+
name: macros-Windows-amd64
20212035
path: ${{ github.workspace }}/BinaryCache/Library
2036+
20222037
- uses: actions/checkout@v4
20232038
with:
20242039
repository: apple/swift-corelibs-libdispatch
@@ -2397,17 +2412,17 @@ jobs:
23972412
with:
23982413
name: compilers-Windows-${{ inputs.build_arch }}
23992414
path: ${{ github.workspace }}/BinaryCache/Library
2400-
- uses: actions/download-artifact@v4
2415+
- uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
24012416
with:
2402-
name: Windows-stdlib-${{ matrix.arch }}
2417+
name: stdlib-Windows-${{ matrix.arch }}
24032418
path: ${{ github.workspace }}/BinaryCache/Library
24042419
- uses: actions/download-artifact@v4
24052420
with:
24062421
name: Windows-sdk-${{ matrix.arch }}
24072422
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform
2408-
- uses: actions/download-artifact@v4
2423+
- uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
24092424
with:
2410-
name: macros-amd64
2425+
name: macros-Windows-amd64
24112426
path: ${{ github.workspace }}/BinaryCache/Library
24122427
- uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
24132428
with:
@@ -2546,9 +2561,9 @@ jobs:
25462561
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/FoundationInternationalization.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/
25472562
25482563
# Download host libraries for the windows amd64 host, after moving the target libraries to the target-specific directory.
2549-
- uses: actions/download-artifact@v4
2564+
- uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
25502565
with:
2551-
name: Windows-stdlib-amd64
2566+
name: stdlib-Windows-amd64
25522567
path: ${{ github.workspace }}/BinaryCache/Library
25532568
- uses: actions/download-artifact@v4
25542569
with:
@@ -3108,9 +3123,9 @@ jobs:
31083123
name: devtools-amd64
31093124
path: ${{ github.workspace }}/BuildRoot/Library
31103125
- name: Download stdlib
3111-
uses: actions/download-artifact@v4
3126+
uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
31123127
with:
3113-
name: Windows-stdlib-${{ matrix.arch }}
3128+
name: stdlib-Windows-${{ matrix.arch }}
31143129
path: ${{ github.workspace }}/BuildRoot/Library
31153130
- name: Download SDK
31163131
uses: actions/download-artifact@v4
@@ -3148,9 +3163,9 @@ jobs:
31483163
Move-Item ${env:SDKROOT}/usr/lib/swift/windows/FoundationInternationalization.lib ${env:SDKROOT}/usr/lib/swift/windows/${{ matrix.cpu }}/
31493164
31503165
# Download host SDK on top of the target SDK, so that the runtime DLLs are the host ones.
3151-
- uses: actions/download-artifact@v4
3166+
- uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
31523167
with:
3153-
name: Windows-stdlib-amd64
3168+
name: stdlib-Windows-amd64
31543169
path: ${{ github.workspace }}/BuildRoot/Library
31553170
- uses: actions/download-artifact@v4
31563171
with:
@@ -3248,9 +3263,9 @@ jobs:
32483263
path: ${{ github.workspace }}/BuildRoot/Library
32493264

32503265
- name: Download Macros
3251-
uses: actions/download-artifact@v4
3266+
uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
32523267
with:
3253-
name: macros-${{ matrix.arch }}
3268+
name: macros-Windows-${{ matrix.arch }}
32543269
path: ${{ github.workspace }}/BuildRoot/Library
32553270

32563271
- uses: actions/checkout@v4
@@ -3421,9 +3436,9 @@ jobs:
34213436
platform: x86
34223437

34233438
steps:
3424-
- uses: actions/download-artifact@v4
3439+
- uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
34253440
with:
3426-
name: Windows-stdlib-${{ matrix.arch }}
3441+
name: stdlib-Windows-${{ matrix.arch }}
34273442
path: ${{ github.workspace }}/BuildRoot/Library
34283443
- uses: actions/download-artifact@v4
34293444
with:
@@ -3530,9 +3545,9 @@ jobs:
35303545
triple_no_api_level: x86_64-unknown-linux-android
35313546

35323547
steps:
3533-
- uses: actions/download-artifact@v4
3548+
- uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681
35343549
with:
3535-
name: Android-stdlib-${{ matrix.arch }}
3550+
name: stdlib-Android-${{ matrix.arch }}
35363551
path: ${{ github.workspace }}/BuildRoot/Library
35373552
- uses: actions/download-artifact@v4
35383553
with:

0 commit comments

Comments
 (0)