Skip to content

Commit ff39455

Browse files
committed
[Mac build] Add macros build
1 parent 409d1d9 commit ff39455

File tree

2 files changed

+54
-32
lines changed

2 files changed

+54
-32
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,25 +385,25 @@ jobs:
385385
"arch": "amd64",
386386
"cpu": "x86_64",
387387
"triple": "x86_64-unknown-windows-msvc",
388-
"compiler_target": "x86_64-unknown-windows-msvc",
389388
"os": "Windows",
390389
"cc": "cl",
391390
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
392391
"cxx": "cl",
393392
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
393+
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
394394
"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",
395395
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=AMD64"
396396
},
397397
{
398398
"arch": "arm64",
399399
"cpu": "aarch64",
400400
"triple": "aarch64-unknown-windows-msvc",
401-
"compiler_target": "aarch64-unknown-windows-msvc",
402401
"os": "Windows",
403402
"cc": "cl",
404403
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
405404
"cxx": "cl",
406405
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
406+
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
407407
"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",
408408
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=ARM64"
409409
}
@@ -416,7 +416,6 @@ jobs:
416416
"arch": "arm64",
417417
"cpu": "aarch64",
418418
"triple": "aarch64-unknown-windows-msvc",
419-
"compiler_target": "aarch64-unknown-windows-msvc",
420419
"os": "Windows",
421420
"cc": "cl",
422421
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
@@ -665,22 +664,26 @@ jobs:
665664
{
666665
"arch": "x86_64",
667666
"cpu": "x86_64",
667+
"triple": "x86_64-apple-macosx15.0",
668668
"os": "Darwin",
669669
"cc": "clang",
670670
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
671671
"cxx": "clang++",
672672
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
673+
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
673674
"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 }}\"",
674675
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=x86_64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=x86_64"
675676
},
676677
{
677678
"arch": "arm64",
678679
"cpu": "arm64",
680+
"triple": "arm64-apple-macosx15.0",
679681
"os": "Darwin",
680682
"cc": "clang",
681683
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
682684
"cxx": "clang++",
683685
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
686+
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
684687
"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 }}",
685688
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=arm64"
686689
}

.github/workflows/swift-toolchain.yml

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,38 +1775,37 @@ jobs:
17751775
searchPattern: '**/*.dll'
17761776

17771777
macros:
1778-
# TODO: Build this on macOS or make an equivalent Mac-only job
1779-
if: inputs.build_os == 'Windows'
17801778
needs: [compilers, cmark_gfm, stdlib]
17811779
runs-on: ${{ inputs.default_build_runner }}
17821780

17831781
strategy:
17841782
fail-fast: false
17851783
matrix: ${{ fromJSON(inputs.host_matrix) }}
17861784

1787-
name: Windows ${{ matrix.arch }} Macros
1785+
name: ${{ matrix.os }} ${{ matrix.arch }} Macros
17881786

17891787
steps:
17901788
- name: Download Compilers
17911789
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
17921790
with:
1793-
name: Windows-${{ inputs.build_arch }}-compilers
1791+
name: ${{ inputs.build_os }}-${{ inputs.build_arch }}-compilers
17941792
path: ${{ github.workspace }}/BinaryCache/Library
17951793
- name: Download swift-syntax
17961794
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
17971795
with:
1798-
name: Windows-${{ matrix.arch }}-swift-syntax
1796+
name: ${{ matrix.os }}-${{ matrix.arch }}-swift-syntax
17991797
path: ${{ github.workspace }}/BinaryCache/swift-syntax
18001798
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
18011799
with:
1802-
name: Windows-${{ matrix.arch }}-stdlib
1800+
name: ${{ matrix.os }}-${{ matrix.arch }}-stdlib
18031801
path: ${{ github.workspace }}/BinaryCache/Library
18041802
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
1805-
if: matrix.arch == 'arm64'
1803+
if: matrix.os == 'Windows' && matrix.arch == 'arm64'
18061804
with:
18071805
name: Windows-${{ inputs.build_arch }}-stdlib
18081806
path: ${{ github.workspace }}/BinaryCache/Library
18091807
- uses: actions/download-artifact@v4
1808+
if: matrix.os == 'Windows'
18101809
with:
18111810
name: Windows-${{ matrix.arch }}-vfs-overlay
18121811
path: ${{ github.workspace }}/BinaryCache/swift/stdlib
@@ -1836,29 +1835,52 @@ jobs:
18361835
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
18371836
arch: ${{ matrix.arch }}
18381837

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

1843-
- name: extract swift-syntax
1841+
- name: Setup configuration
1842+
id: setup-config
18441843
run: |
1844+
$bindir = "${{ github.workspace }}/BinaryCache/swift-syntax"
1845+
$SWIFTFLAGS = "${{ matrix.swiftflags }} -strict-implicit-module-context"
1846+
1847+
if ("${{ matrix.os }}" -eq "Windows") {
1848+
$SWIFTC = cygpath -m "${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe"
1849+
$bindir = cygpath -m $bindir
1850+
$SDKRoot = "${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk"
1851+
$SWIFTFLAGS += " -resource-dir ${SDKRoot}/usr/lib/swift"
1852+
$SWIFTFLAGS += " -L${SDKRoot}/usr/lib/swift/windows"
1853+
1854+
# Export the path to the runtime libraries. This is only needed for Windows.
1855+
$RTLPath = cygpath -w ${SDKRoot}/usr/bin
1856+
Write-Output ${RTLPath} | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
1857+
1858+
# VFS Overlay is only required on Windows.
1859+
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
1860+
$SWIFTFLAGS += " -vfsoverlay ${WINDOWS_VFS_OVERLAY}"
1861+
$SWIFTFLAGS += " -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules"
1862+
} else {
1863+
$SWIFTC = "${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc"
1864+
}
1865+
1866+
# Configure swift-syntax.
18451867
$module = "${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules/SwiftSyntaxConfig.cmake"
1846-
$bindir = cygpath -m ${{ github.workspace }}/BinaryCache/swift-syntax
18471868
(Get-Content $module).Replace('<BINARY_DIR>', "${bindir}") | Set-Content $module
18481869
1870+
# Export the configuration.
1871+
Write-Output "swiftc=${SWIFTC}" | Out-File -FilePath ${env:GITHUB_OUTPUT} -Encoding utf8 -Append
1872+
Write-Output "swift-flags=${SWIFTFLAGS}" | Out-File -FilePath ${env:GITHUB_OUTPUT} -Encoding utf8 -Append
1873+
18491874
- name: Configure Foundation Macros
18501875
run: |
1851-
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
1852-
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe
1853-
18541876
cmake -B ${{ github.workspace }}/BinaryCache/swift-foundation-macros `
18551877
-D CMAKE_BUILD_TYPE=Release `
18561878
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr `
1857-
-D CMAKE_Swift_COMPILER=${SWIFTC} `
1879+
-D CMAKE_Swift_COMPILER=${{ steps.setup-config.outputs.swiftc }} `
18581880
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
1859-
-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 }}" `
1881+
-D CMAKE_Swift_FLAGS="${{ steps.setup-config.outputs.swift-flags }}" `
18601882
-D CMAKE_Swift_FLAGS_RELEASE="-O" `
1861-
-D CMAKE_SYSTEM_NAME=Windows `
1883+
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
18621884
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
18631885
-G Ninja `
18641886
-S ${{ github.workspace }}/SourceCache/swift-foundation/Sources/FoundationMacros `
@@ -1868,16 +1890,13 @@ jobs:
18681890

18691891
- name: Configure Testing Macros
18701892
run: |
1871-
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
1872-
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe
1873-
18741893
cmake -B ${{ github.workspace }}/BinaryCache/swift-testing-macros `
18751894
-D CMAKE_BUILD_TYPE=Release `
18761895
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr `
1877-
-D CMAKE_Swift_COMPILER=${SWIFTC} `
1896+
-D CMAKE_Swift_COMPILER=${{ steps.setup-config.outputs.swiftc }} `
18781897
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
1879-
-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 }}" `
1880-
-D CMAKE_SYSTEM_NAME=Windows `
1898+
-D CMAKE_Swift_FLAGS="${{ steps.setup-config.outputs.swift-flags }}" `
1899+
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
18811900
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
18821901
-G Ninja `
18831902
-S ${{ github.workspace }}/SourceCache/swift-testing/Sources/TestingMacros `
@@ -1891,14 +1910,14 @@ jobs:
18911910
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-testing-macros --target install
18921911

18931912
- name: Upload macros
1894-
uses: actions/upload-artifact@v4
1913+
uses: thebrowsercompany/gha-upload-tar-artifact@e18c33b1cd416d0d96a91dc6dce06219f98e4e27 # main
18951914
with:
18961915
name: ${{ matrix.os }}-${{ matrix.arch }}-macros
18971916
path: ${{ github.workspace }}/BuildRoot/Library
18981917

18991918
- name: Upload PDBs to Azure
19001919
uses: microsoft/action-publish-symbols@v2.1.6
1901-
if: ${{ inputs.debug_info }}
1920+
if: ${{ inputs.debug_info && matrix.os == 'Windows' }}
19021921
with:
19031922
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }}
19041923
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
@@ -1907,7 +1926,7 @@ jobs:
19071926

19081927
- name: Upload DLLs to Azure
19091928
uses: microsoft/action-publish-symbols@v2.1.6
1910-
if: ${{ inputs.debug_info }}
1929+
if: ${{ inputs.debug_info && matrix.os == 'Windows' }}
19111930
with:
19121931
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }}
19131932
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
@@ -2525,7 +2544,7 @@ jobs:
25252544
with:
25262545
name: Windows-${{ matrix.arch }}-sdk
25272546
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform
2528-
- uses: actions/download-artifact@v4
2547+
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
25292548
with:
25302549
name: Windows-${{ inputs.build_arch }}-macros
25312550
path: ${{ github.workspace }}/BinaryCache/Library
@@ -3341,7 +3360,7 @@ jobs:
33413360
path: ${{ github.workspace }}/BuildRoot/Library
33423361

33433362
- name: Download Macros
3344-
uses: actions/download-artifact@v4
3363+
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
33453364
with:
33463365
name: Windows-${{ matrix.arch }}-macros
33473366
path: ${{ github.workspace }}/BuildRoot/Library

0 commit comments

Comments
 (0)