@@ -9,6 +9,60 @@ $SupportsTestResourcesDotenv = $true
99
1010. (Join-Path $EngCommonScriptsDir " Helpers" " PSModule-Helpers.ps1" )
1111
12+ # Channel aliases used throughout scripts to pin channels.
13+ # Lazy-initialized static property accessors cache values on first access.
14+ class Channels {
15+ hidden static [string ] $_repoRoot = $null
16+ hidden static [string ] $_nightly = ' nightly-2026-04-14'
17+ hidden static [string ] $_stable = $null
18+ hidden static [string ] $_msrv = $null
19+
20+ static [string ] Nightly() {
21+ return [Channels ]::_nightly
22+ }
23+
24+ static [string ] Stable() {
25+ if (-not [Channels ]::_stable) {
26+ $path = [System.IO.Path ]::Combine([Channels ]::_repoRoot, ' rust-toolchain.toml' )
27+ [string ] $content = Get-Content - Raw $path
28+ [Channels ]::_stable = if ($content -Match ' channel\s+=\s+"([^"]+)"' ) {
29+ $Matches [1 ]
30+ } else {
31+ Write-Warning " Failed to get stable channel from $path "
32+ ' stable'
33+ }
34+ }
35+ return [Channels ]::_stable
36+ }
37+
38+ static [string ] MSRV() {
39+ if (-not [Channels ]::_msrv) {
40+ $path = [System.IO.Path ]::Combine([Channels ]::_repoRoot, ' Cargo.toml' )
41+ [string ] $content = Get-Content - Raw $path
42+ [Channels ]::_msrv = if ($content -Match ' rust-version\s+=\s+"([^"]+)"' ) {
43+ $Matches [1 ]
44+ } else {
45+ Write-Warning " Failed to get MSRV from $path "
46+ ' stable'
47+ }
48+ }
49+ return [Channels ]::_msrv
50+ }
51+
52+ # Resolves a toolchain alias ('stable', 'nightly', 'msrv') to its pinned version.
53+ # Any other value (e.g. an explicit version) is passed through unchanged.
54+ static [string ] Resolve([string ] $toolchain ) {
55+ $resolved = switch ($toolchain.ToLower ()) {
56+ ' stable' { [Channels ]::Stable() }
57+ ' nightly' { [Channels ]::Nightly() }
58+ ' msrv' { [Channels ]::MSRV() }
59+ default { $toolchain }
60+ }
61+ return $resolved
62+ }
63+ }
64+ [Channels ]::_repoRoot = $RepoRoot
65+
1266function SetPackageVersion ($PackageName , $Version , $ServiceDirectory , $ReleaseDate , $ReplaceLatestEntryTitle = $true ) {
1367 if ($null -eq $ReleaseDate ) {
1468 $ReleaseDate = Get-Date - Format " yyyy-MM-dd"
0 commit comments