Skip to content

Commit 3e9ba22

Browse files
committed
[Mac build] Add macros build
1 parent 5463e17 commit 3e9ba22

File tree

2 files changed

+54
-32
lines changed

2 files changed

+54
-32
lines changed

.github/workflows/build-toolchain.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -396,25 +396,25 @@ jobs:
396396
"arch": "amd64",
397397
"cpu": "x86_64",
398398
"triple": "x86_64-unknown-windows-msvc",
399-
"compiler_target": "x86_64-unknown-windows-msvc",
400399
"os": "Windows",
401400
"cc": "cl",
402401
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
403402
"cxx": "cl",
404403
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
404+
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
405405
"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",
406406
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=AMD64"
407407
},
408408
{
409409
"arch": "arm64",
410410
"cpu": "aarch64",
411411
"triple": "aarch64-unknown-windows-msvc",
412-
"compiler_target": "aarch64-unknown-windows-msvc",
413412
"os": "Windows",
414413
"cc": "cl",
415414
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
416415
"cxx": "cl",
417416
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
417+
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
418418
"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",
419419
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=ARM64"
420420
}
@@ -427,7 +427,6 @@ jobs:
427427
"arch": "arm64",
428428
"cpu": "aarch64",
429429
"triple": "aarch64-unknown-windows-msvc",
430-
"compiler_target": "aarch64-unknown-windows-msvc",
431430
"os": "Windows",
432431
"cc": "cl",
433432
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
@@ -676,22 +675,26 @@ jobs:
676675
{
677676
"arch": "x86_64",
678677
"cpu": "x86_64",
678+
"triple": "x86_64-apple-macosx15.0",
679679
"os": "Darwin",
680680
"cc": "clang",
681681
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
682682
"cxx": "clang++",
683683
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
684+
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
684685
"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 }}\"",
685686
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=x86_64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=x86_64"
686687
},
687688
{
688689
"arch": "arm64",
689690
"cpu": "arm64",
691+
"triple": "arm64-apple-macosx15.0",
690692
"os": "Darwin",
691693
"cc": "clang",
692694
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
693695
"cxx": "clang++",
694696
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
697+
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
695698
"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 }}",
696699
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=arm64"
697700
}

.github/workflows/swift-toolchain.yml

+48-29
Original file line numberDiff line numberDiff line change
@@ -1872,38 +1872,37 @@ jobs:
18721872
searchPattern: '**/*.dll'
18731873

18741874
macros:
1875-
# TODO: Build this on macOS or make an equivalent Mac-only job
1876-
if: inputs.build_os == 'Windows'
18771875
needs: [compilers, cmark_gfm, stdlib]
18781876
runs-on: ${{ inputs.default_build_runner }}
18791877

18801878
strategy:
18811879
fail-fast: false
18821880
matrix: ${{ fromJSON(inputs.host_matrix) }}
18831881

1884-
name: Windows ${{ matrix.arch }} Macros
1882+
name: ${{ matrix.os }} ${{ matrix.arch }} Macros
18851883

18861884
steps:
18871885
- name: Download Compilers
18881886
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
18891887
with:
1890-
name: Windows-${{ inputs.build_arch }}-Asserts-compilers
1888+
name: ${{ inputs.build_os }}-${{ inputs.build_arch }}-Asserts-compilers
18911889
path: ${{ github.workspace }}/BinaryCache/Library
18921890
- name: Download swift-syntax
18931891
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
18941892
with:
1895-
name: Windows-${{ matrix.arch }}-Asserts-swift-syntax
1893+
name: ${{ matrix.os }}-${{ matrix.arch }}-Asserts-swift-syntax
18961894
path: ${{ github.workspace }}/BinaryCache/swift-syntax
18971895
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
18981896
with:
1899-
name: Windows-${{ matrix.arch }}-stdlib
1897+
name: ${{ matrix.os }}-${{ matrix.arch }}-stdlib
19001898
path: ${{ github.workspace }}/BinaryCache/Library
19011899
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
1902-
if: matrix.arch == 'arm64'
1900+
if: matrix.os == 'Windows' && matrix.arch == 'arm64'
19031901
with:
19041902
name: Windows-${{ inputs.build_arch }}-stdlib
19051903
path: ${{ github.workspace }}/BinaryCache/Library
19061904
- uses: actions/download-artifact@v4
1905+
if: matrix.os == 'Windows'
19071906
with:
19081907
name: Windows-${{ matrix.arch }}-vfs-overlay
19091908
path: ${{ github.workspace }}/BinaryCache/swift/stdlib
@@ -1934,29 +1933,52 @@ jobs:
19341933
arch: ${{ matrix.arch }}
19351934
winsdk: ${{ env.WORKAROUND_WINDOWS_SDK_VERSION }}
19361935

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

1941-
- name: extract swift-syntax
1939+
- name: Setup configuration
1940+
id: setup-config
19421941
run: |
1942+
$bindir = "${{ github.workspace }}/BinaryCache/swift-syntax"
1943+
$SWIFTFLAGS = "${{ matrix.swiftflags }} -strict-implicit-module-context"
1944+
1945+
if ("${{ matrix.os }}" -eq "Windows") {
1946+
$SWIFTC = cygpath -m "${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe"
1947+
$bindir = cygpath -m $bindir
1948+
$SDKRoot = "${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk"
1949+
$SWIFTFLAGS += " -resource-dir ${SDKRoot}/usr/lib/swift"
1950+
$SWIFTFLAGS += " -L${SDKRoot}/usr/lib/swift/windows"
1951+
1952+
# Export the path to the runtime libraries. This is only needed for Windows.
1953+
$RTLPath = cygpath -w ${SDKRoot}/usr/bin
1954+
Write-Output ${RTLPath} | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
1955+
1956+
# VFS Overlay is only required on Windows.
1957+
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
1958+
$SWIFTFLAGS += " -vfsoverlay ${WINDOWS_VFS_OVERLAY}"
1959+
$SWIFTFLAGS += " -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules"
1960+
} else {
1961+
$SWIFTC = "${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc"
1962+
}
1963+
1964+
# Configure swift-syntax.
19431965
$module = "${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules/SwiftSyntaxConfig.cmake"
1944-
$bindir = cygpath -m ${{ github.workspace }}/BinaryCache/swift-syntax
19451966
(Get-Content $module).Replace('<BINARY_DIR>', "${bindir}") | Set-Content $module
19461967
1968+
# Export the configuration.
1969+
Write-Output "swiftc=${SWIFTC}" | Out-File -FilePath ${env:GITHUB_OUTPUT} -Encoding utf8 -Append
1970+
Write-Output "swift-flags=${SWIFTFLAGS}" | Out-File -FilePath ${env:GITHUB_OUTPUT} -Encoding utf8 -Append
1971+
19471972
- name: Configure Foundation Macros
19481973
run: |
1949-
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
1950-
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe
1951-
19521974
cmake -B ${{ github.workspace }}/BinaryCache/swift-foundation-macros `
19531975
-D CMAKE_BUILD_TYPE=Release `
19541976
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr `
1955-
-D CMAKE_Swift_COMPILER=${SWIFTC} `
1977+
-D CMAKE_Swift_COMPILER=${{ steps.setup-config.outputs.swiftc }} `
19561978
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
1957-
-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 }}" `
1979+
-D CMAKE_Swift_FLAGS="${{ steps.setup-config.outputs.swift-flags }}" `
19581980
-D CMAKE_Swift_FLAGS_RELEASE="-O" `
1959-
-D CMAKE_SYSTEM_NAME=Windows `
1981+
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
19601982
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
19611983
-G Ninja `
19621984
-S ${{ github.workspace }}/SourceCache/swift-foundation/Sources/FoundationMacros `
@@ -1966,16 +1988,13 @@ jobs:
19661988

19671989
- name: Configure Testing Macros
19681990
run: |
1969-
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
1970-
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe
1971-
19721991
cmake -B ${{ github.workspace }}/BinaryCache/swift-testing-macros `
19731992
-D CMAKE_BUILD_TYPE=Release `
19741993
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr `
1975-
-D CMAKE_Swift_COMPILER=${SWIFTC} `
1994+
-D CMAKE_Swift_COMPILER=${{ steps.setup-config.outputs.swiftc }} `
19761995
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
1977-
-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 }}" `
1978-
-D CMAKE_SYSTEM_NAME=Windows `
1996+
-D CMAKE_Swift_FLAGS="${{ steps.setup-config.outputs.swift-flags }}" `
1997+
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
19791998
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
19801999
-G Ninja `
19812000
-S ${{ github.workspace }}/SourceCache/swift-testing/Sources/TestingMacros `
@@ -1989,14 +2008,14 @@ jobs:
19892008
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-testing-macros --target install
19902009

19912010
- name: Upload macros
1992-
uses: actions/upload-artifact@v4
2011+
uses: thebrowsercompany/gha-upload-tar-artifact@e18c33b1cd416d0d96a91dc6dce06219f98e4e27 # main
19932012
with:
19942013
name: ${{ matrix.os }}-${{ matrix.arch }}-macros
19952014
path: ${{ github.workspace }}/BuildRoot/Library
19962015

19972016
- name: Upload PDBs to Azure
19982017
uses: microsoft/[email protected]
1999-
if: ${{ inputs.debug_info }}
2018+
if: ${{ inputs.debug_info && matrix.os == 'Windows' }}
20002019
with:
20012020
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }}
20022021
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
@@ -2005,7 +2024,7 @@ jobs:
20052024

20062025
- name: Upload DLLs to Azure
20072026
uses: microsoft/[email protected]
2008-
if: ${{ inputs.debug_info }}
2027+
if: ${{ inputs.debug_info && matrix.os == 'Windows' }}
20092028
with:
20102029
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }}
20112030
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
@@ -2640,7 +2659,7 @@ jobs:
26402659
with:
26412660
name: Windows-${{ matrix.arch }}-sdk
26422661
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform
2643-
- uses: actions/download-artifact@v4
2662+
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
26442663
with:
26452664
name: Windows-${{ inputs.build_arch }}-macros
26462665
path: ${{ github.workspace }}/BinaryCache/Library
@@ -3514,7 +3533,7 @@ jobs:
35143533
path: ${{ github.workspace }}/BuildRoot/Library
35153534

35163535
- name: Download Macros
3517-
uses: actions/download-artifact@v4
3536+
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
35183537
with:
35193538
name: Windows-${{ matrix.arch }}-macros
35203539
path: ${{ github.workspace }}/BuildRoot/Library

0 commit comments

Comments
 (0)