From 382e68f83d4b01b22cda91bcee5529bc992fe7a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20CORTIER?= Date: Fri, 12 Sep 2025 23:14:23 +0900 Subject: [PATCH 1/2] ci: find mc.exe for Windows builds --- .github/workflows/ci.yml | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9665f32b9..18051100a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -610,6 +610,51 @@ jobs: # We need to add the NASM binary folder to the PATH manually. Write-Output "$Env:ProgramFiles\NASM" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Find mc.exe + id: find_mc + if: matrix.os == 'windows' + run: | + $arch = @{'x86_64'='x64';'arm64'='arm64'}['${{ matrix.arch }}'] + + # Candidate roots (most SDK installs are in Program Files (x86)) + $roots = @() + if (${env:ProgramFiles(x86)}) { + $roots += (Join-Path -Path ${env:ProgramFiles(x86)} -ChildPath 'Windows Kits\10\bin') + $roots += (Join-Path -Path ${env:ProgramFiles(x86)} -ChildPath 'Windows Kits\11\bin') + } + if (${env:ProgramFiles}) { + $roots += (Join-Path -Path ${env:ProgramFiles} -ChildPath 'Windows Kits\10\bin') + $roots += (Join-Path -Path ${env:ProgramFiles} -ChildPath 'Windows Kits\11\bin') + } + $roots = $roots | Where-Object { Test-Path $_ } | Select-Object -Unique + + $matches = foreach ($root in $roots) { + Get-ChildItem -Path $root -Directory -ErrorAction SilentlyContinue | ForEach-Object { + $ver = $null + if ([Version]::TryParse($_.Name, [ref]$ver)) { + $archDir = Join-Path $_.FullName $arch + $mcPath = Join-Path $archDir 'mc.exe' + if (Test-Path $mcPath) { + [pscustomobject]@{ + Version = $ver + Parent = $archDir + McExe = $mcPath + } + } + } + } + } + + if (-not $matches) { + Write-Error "mc.exe not found under 'Windows Kits\10\bin'/'Windows Kits\11\bin' for arch '$arch'. Is the Windows 10/11 SDK installed?" + exit 1 + } + + $latest = $matches | Sort-Object Version -Descending | Select-Object -First 1 + + # Output just the parent folder path (the directory containing mc.exe, e.g. ...\x64) + Write-Output "windows_sdk_ver_bin_path=$($latest.Parent)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 + - name: Build shell: pwsh env: @@ -625,6 +670,11 @@ jobs: . "$HOME/.cargo/cbake/${RustTarget}-enter.ps1" $Env:AWS_LC_SYS_CMAKE_BUILDER="true" } + + if ($Env:RUNNER_OS -eq "Windows") { + $Env:WindowsSdkVerBinPath = '${{ steps.find_mc.outputs.windows_sdk_ver_bin_path }}' + } + ./ci/tlk.ps1 build -Product gateway -Platform ${{ matrix.os }} -Architecture ${{ matrix.arch }} -CargoProfile ${{ needs.preflight.outputs.rust-profile }} - name: Add msbuild to PATH From 66685826fbfa1a1a2246ea9baaa7bcb341c0628c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20CORTIER?= Date: Fri, 12 Sep 2025 23:32:08 +0900 Subject: [PATCH 2/2] . --- .github/workflows/ci.yml | 46 ++++++---------------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18051100a..7c48dfcb0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -607,6 +607,9 @@ jobs: # NASM is required by aws-lc-rs (used as rustls crypto backend) choco install nasm + # Install Visual Studio Developer PowerShell Module for cmdlets such as Enter-VsDevShell + Install-Module VsDevShell -Force + # We need to add the NASM binary folder to the PATH manually. Write-Output "$Env:ProgramFiles\NASM" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append @@ -614,46 +617,9 @@ jobs: id: find_mc if: matrix.os == 'windows' run: | - $arch = @{'x86_64'='x64';'arm64'='arm64'}['${{ matrix.arch }}'] - - # Candidate roots (most SDK installs are in Program Files (x86)) - $roots = @() - if (${env:ProgramFiles(x86)}) { - $roots += (Join-Path -Path ${env:ProgramFiles(x86)} -ChildPath 'Windows Kits\10\bin') - $roots += (Join-Path -Path ${env:ProgramFiles(x86)} -ChildPath 'Windows Kits\11\bin') - } - if (${env:ProgramFiles}) { - $roots += (Join-Path -Path ${env:ProgramFiles} -ChildPath 'Windows Kits\10\bin') - $roots += (Join-Path -Path ${env:ProgramFiles} -ChildPath 'Windows Kits\11\bin') - } - $roots = $roots | Where-Object { Test-Path $_ } | Select-Object -Unique - - $matches = foreach ($root in $roots) { - Get-ChildItem -Path $root -Directory -ErrorAction SilentlyContinue | ForEach-Object { - $ver = $null - if ([Version]::TryParse($_.Name, [ref]$ver)) { - $archDir = Join-Path $_.FullName $arch - $mcPath = Join-Path $archDir 'mc.exe' - if (Test-Path $mcPath) { - [pscustomobject]@{ - Version = $ver - Parent = $archDir - McExe = $mcPath - } - } - } - } - } - - if (-not $matches) { - Write-Error "mc.exe not found under 'Windows Kits\10\bin'/'Windows Kits\11\bin' for arch '$arch'. Is the Windows 10/11 SDK installed?" - exit 1 - } - - $latest = $matches | Sort-Object Version -Descending | Select-Object -First 1 - - # Output just the parent folder path (the directory containing mc.exe, e.g. ...\x64) - Write-Output "windows_sdk_ver_bin_path=$($latest.Parent)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 + Enter-VsDevShell + $path = (Get-Command -Type Application mc).Source | Split-Path -Parent + Write-Output "windows_sdk_ver_bin_path=$path" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - name: Build shell: pwsh