feat: complete 2.0.7.12 platform overhaul
This commit is contained in:
+40
-7
@@ -43,7 +43,6 @@ $ToolStateRoot = Join-Path $Root '.cache\tool_state'
|
||||
$NuGetRoot = Join-Path $Root '.cache\nuget'
|
||||
$LocalNuGetFeedRoot = Join-Path $NuGetRoot 'feed'
|
||||
$AppDataRoot = Join-Path $ToolStateRoot 'appdata'
|
||||
$HomeRoot = Join-Path $ToolStateRoot 'home'
|
||||
|
||||
$PackageIdentityName = 'YMhut.Box'
|
||||
$PackagePublisher = 'CN=YMhut'
|
||||
@@ -1259,10 +1258,46 @@ function Build-InstallerBootstrap([object] $VersionInfo, [string] $SignTool) {
|
||||
Invoke-ToolQuiet $setupPath @('/SELFTEST') 'WinUI installer bootstrap self-test failed' " Installer self-test: $setupPath"
|
||||
Invoke-ToolQuiet $setupPath @('/WINDOWSELFTEST') 'WinUI installer window navigation self-test failed' " Installer window self-test: $setupPath"
|
||||
}
|
||||
|
||||
function Wait-FileWritable([string] $Path, [int] $Attempts = 20, [int] $DelayMilliseconds = 250) {
|
||||
for ($attempt = 1; $attempt -le $Attempts; $attempt++) {
|
||||
$stream = $null
|
||||
try {
|
||||
$stream = [IO.File]::Open($Path, [IO.FileMode]::Open, [IO.FileAccess]::ReadWrite, [IO.FileShare]::None)
|
||||
return
|
||||
} catch {
|
||||
if ($attempt -eq $Attempts) {
|
||||
throw "File remained locked after $Attempts attempts: $Path"
|
||||
}
|
||||
Start-Sleep -Milliseconds $DelayMilliseconds
|
||||
} finally {
|
||||
if ($stream) {
|
||||
$stream.Dispose()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Sign-Artifact([string] $SignTool, [string] $Path) {
|
||||
Ensure-LocalDeveloperCertificate
|
||||
Invoke-ToolQuiet $SignTool @('sign', '/fd', 'SHA256', '/f', $PfxPath, '/p', $PfxPassword, $Path) "Signing failed for $Path" " Signed: $Path"
|
||||
Assert-ArtifactSignatureMatchesCertificate $Path
|
||||
$lastError = $null
|
||||
for ($attempt = 1; $attempt -le 5; $attempt++) {
|
||||
try {
|
||||
Wait-FileWritable $Path
|
||||
Invoke-ToolQuiet $SignTool @('sign', '/fd', 'SHA256', '/f', $PfxPath, '/p', $PfxPassword, $Path) "Signing failed for $Path" " Signed: $Path"
|
||||
Assert-ArtifactSignatureMatchesCertificate $Path
|
||||
return
|
||||
} catch {
|
||||
$lastError = $_
|
||||
if ($attempt -eq 5) {
|
||||
throw
|
||||
}
|
||||
Write-Warning "Signing attempt $attempt failed for '$Path'; retrying after Windows releases the file handle."
|
||||
Start-Sleep -Milliseconds (500 * $attempt)
|
||||
}
|
||||
}
|
||||
|
||||
throw $lastError
|
||||
}
|
||||
|
||||
function Clear-PeCertificateDirectory([string] $Path) {
|
||||
@@ -1432,13 +1467,11 @@ pause
|
||||
}
|
||||
|
||||
New-Directory $AppDataRoot
|
||||
New-Directory $HomeRoot
|
||||
New-Directory $NuGetRoot
|
||||
New-Directory $LocalNuGetFeedRoot
|
||||
New-Directory $OutputRoot
|
||||
$env:APPDATA = $AppDataRoot
|
||||
$env:LOCALAPPDATA = $AppDataRoot
|
||||
$env:HOME = $HomeRoot
|
||||
$env:DOTNET_CLI_HOME = Join-Path $ToolStateRoot 'dotnet'
|
||||
$env:NUGET_PACKAGES = $NuGetRoot
|
||||
$env:DOTNET_CLI_TELEMETRY_OPTOUT = '1'
|
||||
@@ -1456,7 +1489,7 @@ Ensure-MsixAssets
|
||||
Invoke-DotNet @(
|
||||
'restore',
|
||||
$Solution,
|
||||
'--source', $LocalNuGetFeedRoot,
|
||||
'--configfile', $NuGetConfig,
|
||||
'--ignore-failed-sources',
|
||||
'--disable-parallel'
|
||||
)
|
||||
@@ -1465,7 +1498,7 @@ foreach ($ridProject in @($Project, $InstallerBootstrapProject)) {
|
||||
'restore',
|
||||
$ridProject,
|
||||
'-r', 'win-x64',
|
||||
'--source', $LocalNuGetFeedRoot,
|
||||
'--configfile', $NuGetConfig,
|
||||
'--ignore-failed-sources',
|
||||
'--disable-parallel'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user