Skip to content

Commit d80dfe0

Browse files
Steelskincompnerd
andauthored
[Mac Build] Build early_swift_driver (#851)
* Install the early_swift_driver build in BuildRoot for consistency. * Use gha-upload-tar-artifact to upload the artifact. Co-authored-by: Saleem Abdulrasool <[email protected]>
1 parent bae8314 commit d80dfe0

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

.github/workflows/build-toolchain.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ jobs:
454454
"cc": "clang",
455455
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
456456
"cxx": "clang++",
457-
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}"
457+
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
458458
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
459459
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=\"10.15\" -D CMAKE_OSX_ARCHITECTURES=arm64"
460460
}

.github/workflows/swift-toolchain.yml

+31-11
Original file line numberDiff line numberDiff line change
@@ -762,25 +762,45 @@ jobs:
762762
- name: Build early swift-driver
763763
run: |
764764
$env:SWIFTCI_USE_LOCAL_DEPS=1
765+
$LinkerFlags = if ("${{ matrix.os }}" -eq "Windows") {
766+
@("-Xlinker", "${env:SDKROOT}/usr/lib/swift/windows/x86_64/swiftCore.lib")
767+
} else {
768+
@()
769+
}
765770
766771
swift build `
767772
--configuration release `
768773
--package-path ${{ github.workspace }}/SourceCache/swift-driver `
769774
--build-path ${{ github.workspace }}/BinaryCache/swift-driver `
770-
-Xlinker "${env:SDKROOT}/usr/lib/swift/windows/x86_64/swiftCore.lib"
775+
@LinkerFlags
771776
772-
- id: export-binary-paths
777+
- name: Copy binaries
773778
run: |
774-
$Suffix = if ("${{ matrix.os }}" -eq "Windows") { ".exe" } else { "" }
775-
echo "swift_driver=${{ github.workspace }}/BinaryCache/swift-driver/x86_64-unknown-windows-msvc/release/swift-driver${Suffix}" >> $env:GITHUB_OUTPUT
776-
echo "swift_help=${{ github.workspace }}/BinaryCache/swift-driver/x86_64-unknown-windows-msvc/release/swift-help${Suffix}" >> $env:GITHUB_OUTPUT
779+
if ("${{ matrix.os }}" -eq "Windows") {
780+
$ExeSuffix = ".exe"
781+
$Cpu = if ("${{ matrix.arch }}" -eq "arm64") { "aarch64" } else { "x86_64" }
782+
$SourceBinDir = Join-Path "${{ github.workspace }}" "BinaryCache" "swift-driver" "${Cpu}-unknown-windows-msvc" "release"
783+
} else {
784+
$ExeSuffix = ""
785+
$Cpu = "${{ matrix.arch }}"
786+
$SourceBinDir = Join-Path "${{ github.workspace }}" "BinaryCache" "swift-driver" "${Cpu}-apple-macosx" "release"
787+
}
788+
$InstallBinDir = Join-Path "${{ github.workspace }}" "BuildRoot" "bin"
777789
778-
- uses: actions/upload-artifact@v4
790+
# Create the target folder.
791+
New-Item -ItemType Directory -Path $InstallBinDir -Force
792+
793+
# Copy binaries.
794+
foreach ($bin in @("swift-driver", "swift-help")) {
795+
$binName = "${bin}${ExeSuffix}"
796+
$binPath = Join-Path $InstallBinDir $binName
797+
Copy-Item -Path "${SourceBinDir}/${binName}" -Destination $binPath -Force
798+
}
799+
800+
- uses: thebrowsercompany/gha-upload-tar-artifact@d8f9b9d463a319b5b65b273db0a4e12ab0b10e72 # main
779801
with:
780802
name: early-swift-driver-${{ matrix.os }}-${{ matrix.arch }}
781-
path: |
782-
${{ steps.export-binary-paths.outputs.swift_driver }}
783-
${{ steps.export-binary-paths.outputs.swift_help }}
803+
path: ${{ github.workspace }}/BuildRoot
784804

785805
compilers:
786806
# TODO: Build this on macOS or make an equivalent Mac-only job
@@ -815,10 +835,10 @@ jobs:
815835
with:
816836
name: cmark-gfm-Windows-${{ matrix.arch }}-${{ inputs.swift_cmark_version }}
817837
path: ${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr
818-
- uses: actions/download-artifact@v4
838+
- uses: thebrowsercompany/gha-download-tar-artifact@717214c9da2a52b3407a5b0a1f31c00b8fde5681 # main
819839
with:
820840
name: early-swift-driver-Windows-amd64
821-
path: ${{ github.workspace }}/BinaryCache/swift-driver/release
841+
path: ${{ github.workspace }}/BinaryCache
822842

823843
- uses: actions/checkout@v4
824844
with:

0 commit comments

Comments
 (0)