Skip to content

Commit f4e33da

Browse files
committed
GHA: add swift-build to the build
Prepare to build swift-build in the toolchain build as it is about to the packaged up into the installer.
1 parent 15b3e71 commit f4e33da

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/swift-toolchain.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,6 +2878,12 @@ jobs:
28782878
ref: ${{ inputs.swift_markdown_revision }}
28792879
path: ${{ github.workspace }}/SourceCache/swift-markdown
28802880
show-progress: false
2881+
- uses: actions/[email protected]
2882+
with:
2883+
repository: swiftlang/swift-build
2884+
ref: ${{ inputs.swift_build_revision }}
2885+
path: ${{ github.workspace }}/SourceCache/swift-build
2886+
show-progress: false
28812887
- uses: actions/[email protected]
28822888
with:
28832889
repository: swiftlang/swift-package-manager
@@ -3239,6 +3245,56 @@ jobs:
32393245
- name: Build swift-certificates
32403246
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-certificates
32413247

3248+
- name: Configure swift-build
3249+
run: |
3250+
# Workaround CMake 3.20 issue
3251+
$CLANG_CL = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/clang-cl.exe
3252+
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe
3253+
if ("${{ matrix.arch }}" -eq "arm64") {
3254+
# We use the lld linker to work around erratum 843419 on Cortex-A53
3255+
# CPUs. Otherwise, this causes link.exe to fail with LNK1322.
3256+
# See https://github.com/swiftlang/swift/issues/79740 for details.
3257+
$ArchSpecificFlags = "-use-ld=lld-link"
3258+
}
3259+
3260+
# `CMAKE_SHARED_LINKER_FLAGS` and `CMAKE_SHARED_LINKER_FLAGS_RELEASE`
3261+
# are set to empty string here to work around the fact that this
3262+
# project uses either swift.exe or link.exe as the linker.
3263+
# swift.exe cannot properly parse the link.exe flags directly.
3264+
# This should be fixed with CMake 4.0 by passing the linker flags with
3265+
# a `LINKER:` prefix, while setting `CMP0181` to `NEW`.
3266+
cmake -B ${{ github.workspace }}/BinaryCache/swift-build `
3267+
-D BUILD_SHARED_LIBS=YES `
3268+
-D BUILD_TESTING=NO `
3269+
-D CMAKE_BUILD_TYPE=Release `
3270+
-D CMAKE_C_COMPILER=${CLANG_CL} `
3271+
-D CMAKE_C_COMPILER_TARGET=${{ matrix.triple }} `
3272+
-D CMAKE_C_FLAGS="${{ inputs.WINDOWS_CMAKE_C_FLAGS }}" `
3273+
-D CMAKE_CXX_COMPILER=${CLANG_CL} `
3274+
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.triple }} `
3275+
-D CMAKE_CXX_FLAGS="${{ inputs.WINDOWS_CMAKE_CXX_FLAGS }}" `
3276+
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr `
3277+
-D CMAKE_Swift_COMPILER=${SWIFTC} `
3278+
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
3279+
-D CMAKE_Swift_COMPILER_WORKS=YES `
3280+
-D CMAKE_Swift_FLAGS="-sdk ${env:SDKROOT} ${ArchSpecificFlags} ${{ inputs.CMAKE_Swift_FLAGS }}" `
3281+
-D CMAKE_Swift_FLAGS_RELEASE="-O" `
3282+
-D CMAKE_SYSTEM_NAME=Windows `
3283+
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
3284+
-D CMAKE_SHARED_LINKER_FLAGS="" `
3285+
-D CMAKE_SHARED_LINKER_FLAGS_RELEASE="" `
3286+
-G Ninja `
3287+
-S ${{ github.workspace }}/SourceCache/swift-build `
3288+
-D ArgumentParser_DIR=${{ github.workspace }}/BinaryCache/swift-argument-parser/cmake/modules `
3289+
-D LLBuild_DIR=${{ github.workspace }}/BinaryCache/swift-llbuild/cmake/modules `
3290+
-D SwiftDriver_DIR=${{ github.workspace }}/BinaryCache/swift-driver/cmake/modules `
3291+
-D SwiftSystem_DIR=${{ github.workspace }}/BinaryCache/swift-system/cmake/modules `
3292+
-D TSC_DIR=${{ github.workspace }}/BinaryCache/swift-tools-support-core/cmake/modules `
3293+
-D SQLite3_INCLUDE_DIR=${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr/include `
3294+
-D SQLite3_LIBRARY=${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr/lib/SQLite3.lib
3295+
- name: Build swift-build
3296+
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-build
3297+
32423298
- name: extract swift-syntax
32433299
run: |
32443300
$module = "${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules/SwiftSyntaxConfig.cmake"
@@ -3277,6 +3333,7 @@ jobs:
32773333
-D SQLite3_INCLUDE_DIR=${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr/include `
32783334
-D SQLite3_LIBRARY=${{ github.workspace }}/BinaryCache/Library/sqlite-${{ inputs.swift_toolchain_sqlite_version }}/usr/lib/SQLite3.lib `
32793335
-D SwiftASN1_DIR=${{ github.workspace }}/BinaryCache/swift-asn1/cmake/modules `
3336+
-D SwiftBuild_DIR=${{ github.workspace }}/BinaryCache/swift-build/cmake/modules `
32803337
-D SwiftCertificates_DIR=${{ github.workspace }}/BinaryCache/swift-certificates/cmake/modules `
32813338
-D SwiftCollections_DIR=${{ github.workspace }}/BinaryCache/swift-collections/cmake/modules `
32823339
-D SwiftCrypto_DIR=${{ github.workspace }}/BinaryCache/swift-crypto/cmake/modules `
@@ -3453,6 +3510,8 @@ jobs:
34533510
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-tools-support-core --target install
34543511
- name: Install swift-driver
34553512
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-driver --target install
3513+
- name: Install swift-build
3514+
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-build --target install
34563515
- name: Install swift-package-manager
34573516
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-package-manager --target install
34583517
- name: Install SourceKit-LSP

0 commit comments

Comments
 (0)