annotate deploy/win64/generate-wxs.ps1 @ 2490:588947e96515 sensible-delimited-data-strings

Test quoting in CSV export
author Chris Cannam
date Mon, 06 Apr 2020 11:00:37 +0100
parents 692cd6d3144d
children 8ac67c315afa
rev   line source
Chris@2448 1
Chris@2448 2 Set-StrictMode -Version 2.0
Chris@2448 3 $ErrorActionPreference = "Stop"
Chris@2448 4
Chris@2485 5 $redist_parent_dir = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\"
Chris@2485 6
Chris@2485 7 $redists = (Get-ChildItem -Path $redist_parent_dir -Name -Include 14.* -Attributes Directory)
Chris@2485 8
Chris@2485 9 if (!$redists) {
Chris@2485 10 echo "ERROR: No 14.x redistributable directories found under $redist_parent_dir"
Chris@2485 11 exit 1
Chris@2485 12 }
Chris@2485 13
Chris@2485 14 $redist_ver = $redists[-1]
Chris@2485 15
Chris@2448 16 $version = (Get-Content version.h) -replace '#define SV_VERSION ','' -replace '"',''
Chris@2448 17 $wxs = "deploy\win64\sonic-visualiser.wxs"
Chris@2448 18
Chris@2448 19 $in = "$wxs.in"
Chris@2448 20
Chris@2485 21 $redist_dir="$redist_parent_dir\$redist_ver\x64\Microsoft.VC142.CRT"
Chris@2448 22
Chris@2448 23 echo "Generating $wxs..."
Chris@2448 24 echo " ...for SV version $version"
Chris@2448 25 echo " ...for redist version $redist_ver"
Chris@2448 26 echo " ...from $in"
Chris@2448 27 echo ""
Chris@2448 28
Chris@2448 29 if (!(Test-Path -Path $redist_dir -PathType Container)) {
Chris@2448 30 echo "ERROR: Redistributable directory $redist_dir not found"
Chris@2448 31 exit 1
Chris@2448 32 }
Chris@2448 33
Chris@2448 34 if (!(Test-Path -Path $in -PathType Leaf)) {
Chris@2448 35 echo "ERROR: Input file $in not found"
Chris@2448 36 exit 1
Chris@2448 37 }
Chris@2448 38
Chris@2448 39 (Get-Content $in) -replace '@VERSION@', $version -replace '@REDIST_VER@', $redist_ver -replace '@W@', '<!-- DO NOT EDIT THIS FILE: it is auto-generated -->' | Out-File -encoding ASCII $wxs
Chris@2448 40
Chris@2448 41 echo "Done"