param([string]$Revision = 'b93f3e61223e7572588b67c0d3935073817f0da6') $ErrorActionPreference = 'Stop' $root = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../../..')) $destination = Join-Path $root 'Artifacts/AgentSupport/BaselineContext' New-Item -ItemType Directory -Force -Path $destination | Out-Null $module = Join-Path $root 'Assets/Modules/ShrinkContext.Core' $files = git -C $module ls-tree -r --name-only $Revision Runtime foreach ($file in $files) { if (-not $file.EndsWith('.cs')) { continue } $target = Join-Path $destination $file New-Item -ItemType Directory -Force -Path ([IO.Path]::GetDirectoryName($target)) | Out-Null $source = (git -C $module show "${Revision}:$file") -join "`n" [IO.File]::WriteAllText($target, $source.Replace('ShrinkContext', 'BaselineContext'), [Text.UTF8Encoding]::new($false)) } git -C $module rev-parse $Revision | Set-Content -Encoding utf8 (Join-Path $destination 'revision.txt')