annotate deploy/win64/generate-wxs.ps1 @ 696:19b1ab2b24f8

Subrepo update
author Chris Cannam
date Tue, 12 May 2020 09:24:29 +0100
parents 4bf2fd246c09
children
rev   line source
Chris@687 1
Chris@687 2 Set-StrictMode -Version 2.0
Chris@687 3 $ErrorActionPreference = "Stop"
Chris@687 4
Chris@689 5 $redist_parent_dir = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\"
Chris@689 6
Chris@689 7 $redists = (Get-ChildItem -Path $redist_parent_dir -Name -Include 14.* -Attributes Directory)
Chris@689 8
Chris@689 9 if (!$redists) {
Chris@689 10 echo "ERROR: No 14.x redistributable directories found under $redist_parent_dir"
Chris@689 11 exit 1
Chris@689 12 }
Chris@689 13
Chris@689 14 $redist_ver = $redists[-1]
Chris@689 15
Chris@687 16 $version = (Get-Content version.h) -replace '#define TONY_VERSION ','' -replace '"',''
Chris@687 17 $wxs = "deploy\win64\tony.wxs"
Chris@687 18
Chris@687 19 $in = "$wxs.in"
Chris@687 20
Chris@689 21 $redist_dir="$redist_parent_dir\$redist_ver\x64\Microsoft.VC142.CRT"
Chris@687 22
Chris@687 23 echo "Generating $wxs..."
Chris@687 24 echo " ...for Tony version $version"
Chris@687 25 echo " ...for redist version $redist_ver"
Chris@687 26 echo " ...from $in"
Chris@687 27 echo ""
Chris@687 28
Chris@687 29 if (!(Test-Path -Path $redist_dir -PathType Container)) {
Chris@687 30 echo "ERROR: Redistributable directory $redist_dir not found"
Chris@687 31 exit 1
Chris@687 32 }
Chris@687 33
Chris@687 34 if (!(Test-Path -Path $in -PathType Leaf)) {
Chris@687 35 echo "ERROR: Input file $in not found"
Chris@687 36 exit 1
Chris@687 37 }
Chris@687 38
Chris@687 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@687 40
Chris@687 41 echo "Done"