param([string]$PackagesRoot)
$ErrorActionPreference='Stop'
if (!$PackagesRoot) { $PackagesRoot=if($env:NUGET_PACKAGES){$env:NUGET_PACKAGES}else{Join-Path ([Environment]::GetFolderPath('UserProfile')) '.nuget/packages'} }
$lock=Get-Content -LiteralPath (Join-Path $PSScriptRoot 'NativeToolchain.json') -Raw -Encoding UTF8 | ConvertFrom-Json
if($lock.Kind -cne 'XfeIndependentNativeToolchainLock' -or $lock.Version -cne '10.0.12'){throw 'Unsupported NativeAOT toolchain lock.'}
foreach($package in $lock.Packages.PSObject.Properties) {
$directory=[IO.Path]::GetFullPath((Join-Path $PackagesRoot ($package.Name+'/'+$lock.Version)))
foreach($file in $package.Value.FilesSha256.PSObject.Properties) {
$path=[IO.Path]::GetFullPath((Join-Path $directory $file.Name))
if(!$path.StartsWith($directory+[IO.Path]::DirectorySeparatorChar,[StringComparison]::OrdinalIgnoreCase) -or
(Get-FileHash -LiteralPath $path -Algorithm SHA256).Hash.ToLowerInvariant() -cne $file.Value) {
throw ('Locked Microsoft compiler/runtime input differs: '+$package.Name+'/'+$file.Name)
}
}
$archive=Join-Path $directory ($package.Name+'.'+$lock.Version+'.nupkg')
if((Get-FileHash -LiteralPath $archive -Algorithm SHA256).Hash.ToLowerInvariant() -cne $package.Value.NupkgSha256){throw ('Locked NuGet archive differs: '+$package.Name)}
}
Write-Output 'Independent Microsoft NativeAOT 10.0.12 compiler/runtime package hashes verified.'
param([string]$PackagesRoot)
$ErrorActionPreference='Stop'
if (!$PackagesRoot) { $PackagesRoot=if($env:NUGET_PACKAGES){$env:NUGET_PACKAGES}else{Join-Path ([Environment]::GetFolderPath('UserProfile')) '.nuget/packages'} }
$lock=Get-Content -LiteralPath (Join-Path $PSScriptRoot 'NativeToolchain.json') -Raw -Encoding UTF8 | ConvertFrom-Json
if($lock.Kind -cne 'XfeIndependentNativeToolchainLock' -or $lock.Version -cne '10.0.12'){throw 'Unsupported NativeAOT toolchain lock.'}
foreach($package in $lock.Packages.PSObject.Properties) {
$directory=[IO.Path]::GetFullPath((Join-Path $PackagesRoot ($package.Name+'/'+$lock.Version)))
foreach($file in $package.Value.FilesSha256.PSObject.Properties) {
$path=[IO.Path]::GetFullPath((Join-Path $directory $file.Name))
if(!$path.StartsWith($directory+[IO.Path]::DirectorySeparatorChar,[StringComparison]::OrdinalIgnoreCase) -or
(Get-FileHash -LiteralPath $path -Algorithm SHA256).Hash.ToLowerInvariant() -cne $file.Value) {
throw ('Locked Microsoft compiler/runtime input differs: '+$package.Name+'/'+$file.Name)
}
}
$archive=Join-Path $directory ($package.Name+'.'+$lock.Version+'.nupkg')
if((Get-FileHash -LiteralPath $archive -Algorithm SHA256).Hash.ToLowerInvariant() -cne $package.Value.NupkgSha256){throw ('Locked NuGet archive differs: '+$package.Name)}
}
Write-Output 'Independent Microsoft NativeAOT 10.0.12 compiler/runtime package hashes verified.'