Skip to content

Commit 34ed2c2

Browse files
authored
Build: use configure-cmake-project action in macros job (#1016)
* Use new configure action for macros * Use CMake 3.29 * Remove irrelevant configs
1 parent 38553e7 commit 34ed2c2

File tree

1 file changed

+43
-73
lines changed

1 file changed

+43
-73
lines changed

.github/workflows/swift-toolchain.yml

Lines changed: 43 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,6 +1830,11 @@ jobs:
18301830
with:
18311831
setup-vs-dev-env: true
18321832
host-arch: ${{ matrix.arch }}
1833+
# FIXME(compnerd): workaround CMake 3.30+ issue
1834+
- uses: lukka/get-cmake@aa1df13cce8c30d2cb58efa871271c5a764623f8 # main
1835+
with:
1836+
cmakeVersion: 3.29.9
1837+
18331838

18341839
- name: Download Compilers
18351840
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
@@ -1879,86 +1884,51 @@ jobs:
18791884
$bindir = cygpath -m ${{ github.workspace }}/BinaryCache/swift-syntax
18801885
(Get-Content $module).Replace('<BINARY_DIR>', "${bindir}") | Set-Content $module
18811886
1882-
- name: Create vfs-overlay
1883-
run: |
1884-
$VfsOverlay = "${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml"
1885-
$ModuleMapDir = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/share
1886-
$Win10SdkRoot = Get-ItemPropertyValue `
1887-
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots" `
1888-
-Name "KitsRoot10"
1889-
$Win10SdkRoot = cygpath -m ${Win10SdkRoot}
1890-
$InstallerLocation = Join-Path "${env:ProgramFiles(x86)}" "Microsoft Visual Studio" "Installer"
1891-
$VsWhere = Join-Path "${InstallerLocation}" "vswhere.exe"
1892-
$VsInstallPath = (& "$VsWhere" -latest -products * -format json | ConvertFrom-Json).installationPath
1893-
$VsInstallPath = cygpath -m ${VsInstallPath}
1894-
1895-
$ModuleMap = @"
1896-
version: 0
1897-
use-external-names: false
1898-
case-sensitive: false
1899-
roots:
1900-
- name: "${Win10SdkRoot}/Include/${env:UCRTVersion}/um"
1901-
type: directory
1902-
contents:
1903-
- name: module.modulemap
1904-
type: file
1905-
external-contents: "${ModuleMapDir}/winsdk.modulemap"
1906-
- name: "${Win10SdkRoot}/Include/${env:UCRTVersion}/ucrt"
1907-
type: directory
1908-
contents:
1909-
- name: module.modulemap
1910-
type: file
1911-
external-contents: "${ModuleMapDir}/ucrt.modulemap"
1912-
- name: "${VsInstallPath}/VC/Tools/MSVC/${env:VCToolsVersion}/include"
1913-
type: directory
1914-
contents:
1915-
- name: module.modulemap
1916-
type: file
1917-
external-contents: "${ModuleMapDir}/vcruntime.modulemap"
1918-
- name: vcruntime.apinotes
1919-
type: file
1920-
external-contents: "${ModuleMapDir}/vcruntime.apinotes"
1921-
"@
1922-
$VfsOverlayDir = Split-Path -Parent $VfsOverlay
1923-
New-Item -ItemType Directory -Path $VfsOverlayDir
1924-
Write-Output $ModuleMap | Out-File -FilePath $VfsOverlay -Encoding utf8
1925-
19261887
- name: Configure Foundation Macros
1927-
run: |
1928-
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
1929-
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe
1888+
uses: ./SourceCache/ci-build/.github/actions/configure-cmake-project
1889+
with:
1890+
project-name: swift-foundation-macros
1891+
swift-version: ${{ inputs.swift_version }}
1892+
enable-caching: true
1893+
debug-info: ${{ inputs.debug_info }}
1894+
build-os: ${{ inputs.build_os }}
1895+
build-arch: ${{ inputs.build_arch }}
1896+
os: ${{ matrix.os }}
1897+
arch: ${{ matrix.arch }}
1898+
src-dir: ${{ github.workspace }}/SourceCache/swift-foundation/Sources/FoundationMacros
1899+
bin-dir: ${{ github.workspace }}/BinaryCache/swift-foundation-macros
1900+
install-dir: ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr
1901+
swift-sdk-path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk
1902+
built-compilers: '@("Swift")'
1903+
cmake-defines: |
1904+
@{
1905+
'SwiftSyntax_DIR' = "${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules";
1906+
}
19301907
1931-
cmake -B ${{ github.workspace }}/BinaryCache/swift-foundation-macros `
1932-
-D CMAKE_BUILD_TYPE=Release `
1933-
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr `
1934-
-D CMAKE_Swift_COMPILER=${SWIFTC} `
1935-
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
1936-
-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 }}" `
1937-
-D CMAKE_Swift_FLAGS_RELEASE="-O" `
1938-
-D CMAKE_SYSTEM_NAME=Windows `
1939-
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
1940-
-G Ninja `
1941-
-S ${{ github.workspace }}/SourceCache/swift-foundation/Sources/FoundationMacros `
1942-
-D SwiftSyntax_DIR=${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules
19431908
- name: Build Foundation Macros
19441909
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-foundation-macros
19451910

19461911
- name: Configure Testing Macros
1947-
run: |
1948-
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
1949-
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe
1912+
uses: ./SourceCache/ci-build/.github/actions/configure-cmake-project
1913+
with:
1914+
project-name: swift-testing-macros
1915+
swift-version: ${{ inputs.swift_version }}
1916+
enable-caching: true
1917+
debug-info: ${{ inputs.debug_info }}
1918+
build-os: ${{ inputs.build_os }}
1919+
build-arch: ${{ inputs.build_arch }}
1920+
os: ${{ matrix.os }}
1921+
arch: ${{ matrix.arch }}
1922+
src-dir: ${{ github.workspace }}/SourceCache/swift-testing/Sources/TestingMacros
1923+
bin-dir: ${{ github.workspace }}/BinaryCache/swift-testing-macros
1924+
install-dir: ${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr
1925+
swift-sdk-path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/${{ matrix.os }}.platform/Developer/SDKs/${{ matrix.os }}.sdk
1926+
built-compilers: '@("Swift")'
1927+
cmake-defines: |
1928+
@{
1929+
'SwiftSyntax_DIR' = "${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules";
1930+
}
19501931
1951-
cmake -B ${{ github.workspace }}/BinaryCache/swift-testing-macros `
1952-
-D CMAKE_BUILD_TYPE=Release `
1953-
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr `
1954-
-D CMAKE_Swift_COMPILER=${SWIFTC} `
1955-
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
1956-
-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 }}" `
1957-
-D CMAKE_SYSTEM_NAME=Windows `
1958-
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
1959-
-G Ninja `
1960-
-S ${{ github.workspace }}/SourceCache/swift-testing/Sources/TestingMacros `
1961-
-D SwiftSyntax_DIR=${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules
19621932
- name: Build Testing Macros
19631933
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-testing-macros
19641934

0 commit comments

Comments
 (0)