Skip to content

Commit

Permalink
Toolset update: VS 2022 17.11 Preview 1 (#4687)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanTLavavej authored May 23, 2024
1 parent 63354c3 commit 37b793c
Show file tree
Hide file tree
Showing 15 changed files with 121 additions and 195 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-status-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ">=21.7.1"
node-version: ">=22.2.0"
- name: Install Packages
run: |
npm ci
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem

# How To Build With The Visual Studio IDE

1. Install Visual Studio 2022 17.10 Preview 4 or later.
1. Install Visual Studio 2022 17.11 Preview 1 or later.
* Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer.
* We recommend selecting "C++ CMake tools for Windows" in the VS Installer.
This will ensure that you're using supported versions of CMake and Ninja.
Expand All @@ -156,7 +156,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem

# How To Build With A Native Tools Command Prompt

1. Install Visual Studio 2022 17.10 Preview 4 or later.
1. Install Visual Studio 2022 17.11 Preview 1 or later.
* Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer.
* We recommend selecting "C++ CMake tools for Windows" in the VS Installer.
This will ensure that you're using supported versions of CMake and Ninja.
Expand Down
7 changes: 5 additions & 2 deletions azure-devops/checkout-submodule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ steps:
- task: PowerShell@2
displayName: 'Checkout ${{ parameters.path }} Submodule'
condition: and(succeeded(), ${{ parameters.enabled }})
retryCountOnTaskFailure: 4
inputs:
pwsh: true
targetType: inline
script: |
$PSNativeCommandUseErrorActionPreference = $true
$submodule = '${{ parameters.path }}'
$rawStatus = git submodule status --cached $submodule
$sha = $rawStatus -replace '^[ \-+]([0-9a-f]+) .*$', '$1'
$sha = $rawStatus -creplace '^[ \-+]([0-9a-f]+) .*$', '$1'
cd $submodule
git init
if ((git remote) -eq $null) {
git remote add submodule-upstream ${{ parameters.url }}
}
git fetch --filter=tree:0 --depth=1 submodule-upstream $sha
if ($submodule -eq 'llvm-project') {
if ($submodule -ceq 'llvm-project') {
git sparse-checkout set --sparse-index libcxx/test libcxx/utils/libcxx llvm/utils/lit
}
git reset --quiet --hard FETCH_HEAD
Expand Down
5 changes: 4 additions & 1 deletion azure-devops/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

variables:
- name: poolName
value: 'StlBuild-2024-04-17T1257-Pool'
value: 'StlBuild-2024-05-21T1719-Pool'
readonly: true
- name: poolDemands
value: 'EnableSpotVM -equals false'
Expand All @@ -19,6 +19,9 @@ variables:
- name: benchmarkBuildOutputLocation
value: 'D:\benchmark'
readonly: true
- name: validationBuildOutputLocation
value: 'D:\validation'
readonly: true
- name: Codeql.SkipTaskAutoInjection
value: true
readonly: true
Expand Down
88 changes: 29 additions & 59 deletions azure-devops/create-1es-hosted-pool.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -70,36 +70,6 @@ function New-Password {
return $result
}

<#
.SYNOPSIS
Waits for the shutdown of the specified resource.
.DESCRIPTION
Wait-Shutdown takes a VM, and checks if there's a 'PowerState/stopped'
code; if there is, it returns. If there isn't, it waits 10 seconds and
tries again.
.PARAMETER ResourceGroupName
The name of the resource group to look up the VM in.
.PARAMETER Name
The name of the virtual machine to wait on.
#>
function Wait-Shutdown {
[CmdletBinding(PositionalBinding=$false)]
Param(
[Parameter(Mandatory)][string]$ResourceGroupName,
[Parameter(Mandatory)][string]$Name
)

Write-Host "Waiting for $Name to stop..."
$StoppedCode = 'PowerState/stopped'
while ($StoppedCode -notin (Get-AzVM -ResourceGroupName $ResourceGroupName -Name $Name -Status).Statuses.Code) {
Write-Host '... not stopped yet, sleeping for 10 seconds'
Start-Sleep -Seconds 10
}
}

####################################################################################################
Display-ProgressBar -Status 'Silencing breaking change warnings'

Expand Down Expand Up @@ -169,7 +139,7 @@ Display-ProgressBar -Status 'Creating prototype VM'

# Previously: -Priority 'Spot'
$VM = New-AzVMConfig `
-Name $ProtoVMName `
-VMName $ProtoVMName `
-VMSize $VMSize `
-Priority 'Regular'

Expand All @@ -195,79 +165,79 @@ $VM = Set-AzVMBootDiagnostic `
-VM $VM `
-Disable

$VM = Set-AzVMSecurityProfile `
-VM $VM `
-SecurityType 'TrustedLaunch'

$VM = Set-AzVMUefi `
-VM $VM `
-EnableVtpm $true `
-EnableSecureBoot $true

New-AzVm `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
-VM $VM | Out-Null

$VM = Get-AzVM `
-ResourceGroupName $ResourceGroupName `
-Name $ProtoVMName

$PrototypeOSDiskName = $VM.StorageProfile.OsDisk.Name

####################################################################################################
Display-ProgressBar -Status 'Running provision-image.ps1 in VM'

$ProvisionImageResult = Invoke-AzVMRunCommand `
-ResourceGroupName $ResourceGroupName `
-VMName $ProtoVMName `
-ResourceId $VM.ID `
-CommandId 'RunPowerShellScript' `
-ScriptPath "$PSScriptRoot\provision-image.ps1"

Write-Host $ProvisionImageResult.value.Message

if ($ProvisionImageResult.value.Message -cnotmatch 'PROVISION_IMAGE_SUCCEEDED') {
Write-Host 'provision-image.ps1 failed, stopping VM...'

Stop-AzVM `
-Id $VM.ID `
-Force | Out-Null

Write-Error "VM stopped. Remember to delete unusable resource group: $ResourceGroupName"
}

####################################################################################################
Display-ProgressBar -Status 'Restarting VM'

Restart-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName | Out-Null
Restart-AzVM `
-Id $VM.ID | Out-Null

####################################################################################################
Display-ProgressBar -Status 'Sleeping after restart'

# The VM appears to be busy immediately after restarting.
# This workaround waits for a minute before attempting to run sysprep.ps1.
# This workaround waits for a minute before attempting to run sysprep.
Start-Sleep -Seconds 60

####################################################################################################
Display-ProgressBar -Status 'Running sysprep.ps1 in VM'
Display-ProgressBar -Status 'Running sysprep in VM'

Invoke-AzVMRunCommand `
-ResourceGroupName $ResourceGroupName `
-VMName $ProtoVMName `
-ResourceId $VM.ID `
-CommandId 'RunPowerShellScript' `
-ScriptPath "$PSScriptRoot\sysprep.ps1" | Out-Null
-ScriptString 'C:\Windows\system32\sysprep\sysprep.exe /oobe /generalize /mode:vm /shutdown' | Out-Null

####################################################################################################
Display-ProgressBar -Status 'Waiting for VM to shut down'

Wait-Shutdown -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
while ('PowerState/stopped' -notin (Get-AzVM -ResourceId $VM.ID -Status).Statuses.Code) {
Start-Sleep -Seconds 10
}

####################################################################################################
Display-ProgressBar -Status 'Stopping VM'

Stop-AzVM `
-ResourceGroupName $ResourceGroupName `
-Name $ProtoVMName `
-Id $VM.ID `
-Force | Out-Null

####################################################################################################
Display-ProgressBar -Status 'Generalizing VM'

Set-AzVM `
-ResourceGroupName $ResourceGroupName `
-Name $ProtoVMName `
-Id $VM.ID `
-Generalized | Out-Null

$VM = Get-AzVM `
-ResourceGroupName $ResourceGroupName `
-Name $ProtoVMName

$PrototypeOSDiskName = $VM.StorageProfile.OsDisk.Name

####################################################################################################
Display-ProgressBar -Status 'Creating gallery'

Expand Down
37 changes: 0 additions & 37 deletions azure-devops/create-prdiff.ps1

This file was deleted.

47 changes: 42 additions & 5 deletions azure-devops/format-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,67 @@ jobs:
steps:
- template: checkout-self.yml
- script: |
if exist "$(validationBuildOutputLocation)" (
rmdir /S /Q "$(validationBuildOutputLocation)"
)
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=x64 -arch=x64 -no_logo
cmake -G Ninja -S $(Build.SourcesDirectory)/tools -B $(tmpDir)/format-validate-build
cmake --build $(tmpDir)/format-validate-build
cmake -G Ninja -S $(Build.SourcesDirectory)/tools -B "$(validationBuildOutputLocation)"
cmake --build "$(validationBuildOutputLocation)"
displayName: 'Build format and validation'
timeoutInMinutes: 5
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=x64 -arch=x64 -no_logo
cmake --build $(tmpDir)/format-validate-build --target run-format
cmake --build "$(validationBuildOutputLocation)" --target run-format
displayName: 'clang-format Files'
timeoutInMinutes: 5
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=x64 -arch=x64 -no_logo
cmake --build $(tmpDir)/format-validate-build --target run-validate
cmake --build "$(validationBuildOutputLocation)" --target run-validate
displayName: 'Validate Files'
timeoutInMinutes: 2
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- task: PowerShell@2
displayName: 'Create Diff'
inputs:
filePath: azure-devops/create-prdiff.ps1
pwsh: true
targetType: inline
script: |
$TempSubDir = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName())
mkdir $TempSubDir -Force | Out-Null
$DiffFile = Join-Path $TempSubDir 'format.diff'
git diff --ignore-submodules > $DiffFile
if ((Get-Item -LiteralPath $DiffFile).Length -ne 0) {
$message = @(
'##vso[task.logissue type=error]The files in the repo need to be properly formatted.'
''
'##[section]To fix this, you can clang-format the entire repo with:'
' cmake --preset x64'
' cmake --build --preset x64 --target format'
''
'##[section]Please avoid this in the future by configuring your editor to format-on-save.'
''
'##[section]View expected formatting:'
'##[group] >>>>> Click this line to expand the diff: <<<<<'
Get-Content -LiteralPath $DiffFile -Raw
'##[endgroup]'
''
'##[section]You can also download this as format.diff and apply it with `git apply`:'
' 1. Click the failed Validation job (upper left, marked with a red X)'
' 2. Click "1 artifact produced"'
' 3. Click the ">" chevron to the left of "format-artifact"'
' 4. Hover over "format.diff"'
' 5. Click the three dots that appear on the right'
' 6. Click "Download artifacts"'
''
"##vso[artifact.upload artifactname=format-artifact]$DiffFile"
'##vso[task.complete result=Failed]'
)
Write-Host ($message -join "`n")
}
condition: succeededOrFailed()
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
Loading

0 comments on commit 37b793c

Please sign in to comment.