57 lines
3.1 KiB
PowerShell
57 lines
3.1 KiB
PowerShell
[CmdletBinding()]
|
|
param(
|
|
[string]$QtKit = 'C:/Qt/6.12.0/mingw_64',
|
|
[string]$CompilerBin = 'C:/Qt/Tools/mingw1310_64/bin',
|
|
[string]$CMakeBin = 'C:/Qt/Tools/CMake_64/bin',
|
|
[string]$NinjaBin = 'C:/Qt/Tools/Ninja',
|
|
[string]$DeliveryVersion = '1.0.0',
|
|
[string]$OutputDirectory = 'build/demo-windows',
|
|
[string]$BuildDirectory,
|
|
[string]$PythonExecutable = 'python'
|
|
)
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = 'Stop'
|
|
$PSNativeCommandUseErrorActionPreference = $true
|
|
$repository = (Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
|
|
if ($DeliveryVersion -notmatch '^\d+\.\d+\.\d+$') { throw 'Use major.minor.changelist' }
|
|
Push-Location $repository
|
|
try {
|
|
& $PythonExecutable demo/ci/verify-snapshot.py
|
|
$output = (New-Item -ItemType Directory -Force $OutputDirectory).FullName
|
|
$build = if ($BuildDirectory) { [IO.Path]::GetFullPath($BuildDirectory) } else { Join-Path $output 'build' }
|
|
$package = Join-Path $output "TikZRefinery-windows-$DeliveryVersion"
|
|
if (Test-Path $package) { throw "Preserve existing package; choose another output directory: $package" }
|
|
$env:Path = "$QtKit/bin;$CompilerBin;$NinjaBin;" + $env:Path
|
|
$cmake = Join-Path $CMakeBin 'cmake.exe'
|
|
& $cmake -S demo/tikzrefinery/code -B $build -G Ninja -DCMAKE_BUILD_TYPE=Release `
|
|
"-DCMAKE_PREFIX_PATH=$QtKit" "-DCMAKE_CXX_COMPILER=$CompilerBin/g++.exe" `
|
|
"-DCMAKE_MAKE_PROGRAM=$NinjaBin/ninja.exe"
|
|
& $cmake --build $build --parallel 4
|
|
& (Join-Path $CMakeBin 'ctest.exe') --test-dir $build --output-on-failure `
|
|
--output-junit (Join-Path $output 'tests.xml')
|
|
New-Item -ItemType Directory -Path "$package/shape-plugins" -Force | Out-Null
|
|
Copy-Item "$build/TikZRefinery.exe" $package
|
|
Copy-Item "$build/shape-plugins/tkr_rectangle.dll" "$package/shape-plugins"
|
|
& "$QtKit/bin/windeployqt.exe" --release --compiler-runtime --no-translations `
|
|
--no-opengl-sw --no-system-d3d-compiler "$package/TikZRefinery.exe"
|
|
# windeployqt selects qwindows for normal desktop use. Include the matching
|
|
# offscreen plugin as well so package smoke checks need no visible window.
|
|
Copy-Item "$QtKit/plugins/platforms/qoffscreen.dll" "$package/platforms"
|
|
Copy-Item "$build/build-info.json" $package
|
|
Copy-Item demo/snapshot.json "$package/upstream-snapshot.json"
|
|
Copy-Item demo/tikzrefinery/code/examples "$package/examples" -Recurse
|
|
$downstream = (& git rev-parse HEAD).Trim()
|
|
$state = (& git status --porcelain --untracked-files=normal) -join "`n"
|
|
[ordered]@{
|
|
delivery_version = $DeliveryVersion
|
|
upstream_commit = 'f4e3193d49a98efcf2f16c2aa22d6085ebe70f36'
|
|
application_baseline = '0.1.4-alpha'
|
|
downstream_commit = $downstream
|
|
downstream_modified = [bool]$state
|
|
execution = 'Windows command-line rehearsal; not a Jenkins run'
|
|
} | ConvertTo-Json | Set-Content "$package/delivery-info.json" -Encoding utf8
|
|
& $PythonExecutable demo/ci/verify-snapshot.py
|
|
Compress-Archive -LiteralPath $package -DestinationPath "$package.zip"
|
|
Get-FileHash "$package.zip" -Algorithm SHA256 | Format-List
|
|
} finally { Pop-Location }
|