Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ jobs:
key: zig-0.16.0-x86_64-windows

- name: Build Explorer menu extension
timeout-minutes: 30
shell: pwsh
run: ./build/build-explorer-menu.ps1

Expand Down Expand Up @@ -249,6 +250,7 @@ jobs:
key: zig-0.16.0-x86_64-windows

- name: Build Explorer menu extension
timeout-minutes: 30
run: ./build/build-explorer-menu.ps1 -Architecture arm64

- name: Test UI on its own
Expand Down
29 changes: 24 additions & 5 deletions build/build-explorer-menu.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,30 @@ Write-Host "build FileeExplorerMenu.dll $Version ($Architecture)"
$dll = Join-Path $obj 'FileeExplorerMenu.dll'
$target = @{ 'x64' = 'x86_64-windows-gnu'; 'arm64' = 'aarch64-windows-gnu' }[$Architecture]
# -nostdlib: no C runtime inside explorer.exe; the entry point is DllMain itself. -s strips symbols.
& $zig cc -target $target -shared -O2 -s -nostdlib -Wall -Wextra -Werror `
-isystem (Join-Path (Split-Path $zig) 'lib\libc\include\any-windows-any') `
(Join-Path $source 'FileeExplorerMenu.c') (Join-Path $source 'FileeExplorerMenu.def') $rc `
-lkernel32 -luser32 -lole32 -lshell32 -lshlwapi '-Wl,--entry=DllMain' -o $dll
if ($LASTEXITCODE -ne 0) { throw "zig cc failed with exit code $LASTEXITCODE" }
$zigArgs = @('cc', '-target', $target, '-shared', '-O2', '-s', '-nostdlib', '-Wall', '-Wextra', '-Werror',
'-isystem', (Join-Path (Split-Path $zig) 'lib\libc\include\any-windows-any'),
(Join-Path $source 'FileeExplorerMenu.c'), (Join-Path $source 'FileeExplorerMenu.def'), $rc,
'-lkernel32', '-luser32', '-lole32', '-lshell32', '-lshlwapi', '-Wl,--entry=DllMain', '-o', $dll)
# Under x64 emulation on Windows on ARM, zig cc now and then never finishes (it normally takes a minute or two there,
# seconds on x64), which held CI until its two-hour limit. A run that takes far longer is stopped and tried again with
# a cache of its own.
$zigMinutes = 8
for ($attempt = 1; ; $attempt++) {
$start = [System.Diagnostics.ProcessStartInfo]::new($zig)
foreach ($argument in $zigArgs) { $start.ArgumentList.Add($argument) }
$start.UseShellExecute = $false
$process = [System.Diagnostics.Process]::Start($start)
if ($process.WaitForExit($zigMinutes * 60 * 1000)) {
$process.WaitForExit() # lets its output finish
if ($process.ExitCode -ne 0) { throw "zig cc failed with exit code $($process.ExitCode)" }
break
}
$process.Kill($true)
$process.WaitForExit()
if ($attempt -ge 3) { throw "zig cc did not finish in $zigMinutes minutes, $attempt times" }
Write-Warning "zig cc did not finish in $zigMinutes minutes; trying again ($($attempt + 1) of 3)"
$env:ZIG_GLOBAL_CACHE_DIR = $env:ZIG_LOCAL_CACHE_DIR = Join-Path $cache "zig-cache-$($attempt + 1)"
}
Copy-Item $dll $Destination -Force

Write-Host "pack FileeExplorerMenu.msix"
Expand Down
Loading