Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mac build] Add macros build #845

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/build-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -394,25 +394,25 @@ jobs:
"arch": "amd64",
"cpu": "x86_64",
"triple": "x86_64-unknown-windows-msvc",
"compiler_target": "x86_64-unknown-windows-msvc",
"os": "Windows",
"cc": "cl",
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
"cxx": "cl",
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
"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",
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=AMD64"
},
{
"arch": "arm64",
"cpu": "aarch64",
"triple": "aarch64-unknown-windows-msvc",
"compiler_target": "aarch64-unknown-windows-msvc",
"os": "Windows",
"cc": "cl",
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
"cxx": "cl",
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
"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",
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=ARM64"
}
Expand All @@ -425,7 +425,6 @@ jobs:
"arch": "arm64",
"cpu": "aarch64",
"triple": "aarch64-unknown-windows-msvc",
"compiler_target": "aarch64-unknown-windows-msvc",
"os": "Windows",
"cc": "cl",
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
Expand Down Expand Up @@ -674,22 +673,26 @@ jobs:
{
"arch": "x86_64",
"cpu": "x86_64",
"triple": "x86_64-apple-macosx15.0",
"os": "Darwin",
"cc": "clang",
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
"cxx": "clang++",
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
"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 }}\"",
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=x86_64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=x86_64"
},
{
"arch": "arm64",
"cpu": "arm64",
"triple": "arm64-apple-macosx15.0",
"os": "Darwin",
"cc": "clang",
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
"cxx": "clang++",
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
"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 }}",
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=arm64"
}
Expand Down
79 changes: 49 additions & 30 deletions .github/workflows/swift-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1908,34 +1908,32 @@ jobs:
searchPattern: '**/*.dll'

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

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

name: Windows ${{ matrix.arch }} Macros
name: ${{ matrix.os }} ${{ matrix.arch }} Macros

steps:
- name: Download Compilers
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
with:
name: Windows-${{ inputs.build_arch }}-Asserts-compilers
name: ${{ inputs.build_os }}-${{ inputs.build_arch }}-Asserts-compilers
path: ${{ github.workspace }}/BinaryCache/Library
- name: Download swift-syntax
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
with:
name: Windows-${{ matrix.arch }}-Asserts-swift-syntax
name: ${{ matrix.os }}-${{ matrix.arch }}-Asserts-swift-syntax
path: ${{ github.workspace }}/BinaryCache/swift-syntax
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
with:
name: Windows-${{ matrix.arch }}-stdlib
name: ${{ matrix.os }}-${{ matrix.arch }}-stdlib
path: ${{ github.workspace }}/BinaryCache/Library
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
if: matrix.arch == 'arm64'
if: matrix.os == 'Windows' && matrix.arch == 'arm64'
with:
name: Windows-${{ inputs.build_arch }}-stdlib
path: ${{ github.workspace }}/BinaryCache/Library
Expand Down Expand Up @@ -1966,17 +1964,44 @@ jobs:
arch: ${{ matrix.arch }}
winsdk: ${{ env.WORKAROUND_WINDOWS_SDK_VERSION }}

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

- name: Extract swift-syntax
- name: Setup configuration
id: setup-config
run: |
$bindir = "${{ github.workspace }}/BinaryCache/swift-syntax"
$SWIFTFLAGS = "${{ matrix.swiftflags }} -strict-implicit-module-context"

if ("${{ matrix.os }}" -eq "Windows") {
$SWIFTC = cygpath -m "${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe"
$bindir = cygpath -m $bindir
$SDKRoot = "${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk"
$SWIFTFLAGS += " -resource-dir ${SDKRoot}/usr/lib/swift"
$SWIFTFLAGS += " -L${SDKRoot}/usr/lib/swift/windows"

# Export the path to the runtime libraries. This is only needed for Windows.
$RTLPath = cygpath -w ${SDKRoot}/usr/bin
Write-Output ${RTLPath} | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

# VFS Overlay is only required on Windows.
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
$SWIFTFLAGS += " -vfsoverlay ${WINDOWS_VFS_OVERLAY}"
$SWIFTFLAGS += " -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules"
} else {
$SWIFTC = "${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc"
}

# Configure swift-syntax.
$module = "${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules/SwiftSyntaxConfig.cmake"
$bindir = cygpath -m ${{ github.workspace }}/BinaryCache/swift-syntax
(Get-Content $module).Replace('<BINARY_DIR>', "${bindir}") | Set-Content $module

# Export the configuration.
Write-Output "swiftc=${SWIFTC}" | Out-File -FilePath ${env:GITHUB_OUTPUT} -Encoding utf8 -Append
Write-Output "swift-flags=${SWIFTFLAGS}" | Out-File -FilePath ${env:GITHUB_OUTPUT} -Encoding utf8 -Append

- name: Create vfs-overlay
if: matrix.os == 'Windows'
run: |
$VfsOverlay = "${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml"
$ModuleMapDir = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/share
Expand Down Expand Up @@ -2022,17 +2047,14 @@ jobs:

- name: Configure Foundation Macros
run: |
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe

cmake -B ${{ github.workspace }}/BinaryCache/swift-foundation-macros `
-D CMAKE_BUILD_TYPE=Release `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr `
-D CMAKE_Swift_COMPILER=${SWIFTC} `
-D CMAKE_Swift_COMPILER=${{ steps.setup-config.outputs.swiftc }} `
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
-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 }}" `
-D CMAKE_Swift_FLAGS="${{ steps.setup-config.outputs.swift-flags }}" `
-D CMAKE_Swift_FLAGS_RELEASE="-O" `
-D CMAKE_SYSTEM_NAME=Windows `
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
-G Ninja `
-S ${{ github.workspace }}/SourceCache/swift-foundation/Sources/FoundationMacros `
Expand All @@ -2042,16 +2064,13 @@ jobs:

- name: Configure Testing Macros
run: |
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe

cmake -B ${{ github.workspace }}/BinaryCache/swift-testing-macros `
-D CMAKE_BUILD_TYPE=Release `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr `
-D CMAKE_Swift_COMPILER=${SWIFTC} `
-D CMAKE_Swift_COMPILER=${{ steps.setup-config.outputs.swiftc }} `
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
-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 }}" `
-D CMAKE_SYSTEM_NAME=Windows `
-D CMAKE_Swift_FLAGS="${{ steps.setup-config.outputs.swift-flags }}" `
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
-G Ninja `
-S ${{ github.workspace }}/SourceCache/swift-testing/Sources/TestingMacros `
Expand All @@ -2065,14 +2084,14 @@ jobs:
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-testing-macros --target install

- name: Upload macros
uses: actions/upload-artifact@v4
uses: thebrowsercompany/gha-upload-tar-artifact@e18c33b1cd416d0d96a91dc6dce06219f98e4e27 # main
with:
name: ${{ matrix.os }}-${{ matrix.arch }}-macros
path: ${{ github.workspace }}/BuildRoot/Library

- name: Upload PDBs to Azure
uses: microsoft/[email protected]
if: ${{ inputs.debug_info }}
if: ${{ inputs.debug_info && matrix.os == 'Windows' }}
with:
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }}
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
Expand All @@ -2081,7 +2100,7 @@ jobs:

- name: Upload DLLs to Azure
uses: microsoft/[email protected]
if: ${{ inputs.debug_info }}
if: ${{ inputs.debug_info && matrix.os == 'Windows' }}
with:
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }}
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
Expand Down Expand Up @@ -2224,7 +2243,7 @@ jobs:
with:
name: Windows-${{ inputs.build_arch }}-stdlib
path: ${{ github.workspace }}/BinaryCache/Library
- uses: actions/download-artifact@v4
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
if: matrix.os != 'Android' || inputs.build_android
with:
name: Windows-${{ inputs.build_arch }}-macros
Expand Down Expand Up @@ -2757,7 +2776,7 @@ jobs:
with:
name: Windows-${{ matrix.arch }}-sdk
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform
- uses: actions/download-artifact@v4
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
with:
name: Windows-${{ inputs.build_arch }}-macros
path: ${{ github.workspace }}/BinaryCache/Library
Expand Down Expand Up @@ -3631,7 +3650,7 @@ jobs:
path: ${{ github.workspace }}/BuildRoot/Library

- name: Download Macros
uses: actions/download-artifact@v4
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
with:
name: Windows-${{ matrix.arch }}-macros
path: ${{ github.workspace }}/BuildRoot/Library
Expand Down