param([switch]$UpdateLock)
$ErrorActionPreference = 'Stop'
$taskRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../..'))
Push-Location $taskRoot
try {
$patcherDirectory = Join-Path $taskRoot '.tools/CSharpBoot/Tools-3.0.94'
$installed = & dotnet tool list --tool-path $patcherDirectory
if ($LASTEXITCODE -ne 0) { throw 'Cannot inspect the project-local Cosmos patcher.' }
if ($installed -match 'cosmos.patcher\s+3\.0\.94\s') {
Write-Host 'Cosmos.Patcher 3.0.94 is already available in the project tool directory.'
} elseif ($installed -match 'cosmos.patcher') {
throw 'The project-local Cosmos patcher has an unexpected version.'
} else {
& dotnet tool install Cosmos.Patcher --version 3.0.94 --tool-path $patcherDirectory --configfile Tools/CSharpBoot/NuGet.Config
if ($LASTEXITCODE -ne 0) { throw 'Project-local Cosmos patcher installation failed.' }
}
$restoreArguments = @('restore', 'Source/XFESystem.Kernel/XFESystem.Kernel.csproj', '--configfile', 'Tools/CSharpBoot/NuGet.Config')
if ($UpdateLock) { $restoreArguments += '--force-evaluate' } else { $restoreArguments += '--locked-mode' }
& dotnet @restoreArguments
if ($LASTEXITCODE -ne 0) { throw 'Kernel dependency restore failed.' }
& dotnet build Source/XFESystem.Kernel/XFESystem.Kernel.csproj --no-restore -c Release
if ($LASTEXITCODE -ne 0) { throw 'NativeAOT kernel compilation or ELF linking failed.' }
} finally { Pop-Location }
param([switch]$UpdateLock)
$ErrorActionPreference = 'Stop'
$taskRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../..'))
Push-Location $taskRoot
try {
$patcherDirectory = Join-Path $taskRoot '.tools/CSharpBoot/Tools-3.0.94'
$installed = & dotnet tool list --tool-path $patcherDirectory
if ($LASTEXITCODE -ne 0) { throw 'Cannot inspect the project-local Cosmos patcher.' }
if ($installed -match 'cosmos.patcher\s+3\.0\.94\s') {
Write-Host 'Cosmos.Patcher 3.0.94 is already available in the project tool directory.'
} elseif ($installed -match 'cosmos.patcher') {
throw 'The project-local Cosmos patcher has an unexpected version.'
} else {
& dotnet tool install Cosmos.Patcher --version 3.0.94 --tool-path $patcherDirectory --configfile Tools/CSharpBoot/NuGet.Config
if ($LASTEXITCODE -ne 0) { throw 'Project-local Cosmos patcher installation failed.' }
}
$restoreArguments = @('restore', 'Source/XFESystem.Kernel/XFESystem.Kernel.csproj', '--configfile', 'Tools/CSharpBoot/NuGet.Config')
if ($UpdateLock) { $restoreArguments += '--force-evaluate' } else { $restoreArguments += '--locked-mode' }
& dotnet @restoreArguments
if ($LASTEXITCODE -ne 0) { throw 'Kernel dependency restore failed.' }
& dotnet build Source/XFESystem.Kernel/XFESystem.Kernel.csproj --no-restore -c Release
if ($LASTEXITCODE -ne 0) { throw 'NativeAOT kernel compilation or ELF linking failed.' }
} finally { Pop-Location }