From 5749e48c310a644c2a084132d644ee15f850a284 Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Thu, 27 Aug 2020 22:10:55 -0400 Subject: [PATCH] packaging: only run deployment script when the client hash changes Change-Id: I24a54bd832b910a524fb7be1e91c8d6387d6bcb9 --- .gitignore | 2 ++ copy-runtime-files.ps1 | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 022e26698..508b45076 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ build-local/ *.vcxproj *.vcxproj.filters *qmlcache.qrc + +.deploy.stamp diff --git a/copy-runtime-files.ps1 b/copy-runtime-files.ps1 index 150f292dd..09afa56ac 100644 --- a/copy-runtime-files.ps1 +++ b/copy-runtime-files.ps1 @@ -7,7 +7,18 @@ param ( [string]$outDir ); -write-host "Copying deployment files..." -ForegroundColor Green +$clientDir = split-path -parent $MyInvocation.MyCommand.Definition +$stamp = (git rev-parse HEAD).Substring(0, 8) +$stampFile = $clientDir + "\.deploy.stamp" +If (test-path $stampFile) { + if($stamp = (Get-Content -Path $stampFile)) { + write-host "deployment stamp up-to-date" $outDir -ForegroundColor Cyan + exit 0 + } +} + +if (!$outDir) { $outDir = $clientDir + "\x64\" + $mode } +If (!(test-path $outDir)) { New-Item -ItemType directory -Path $outDir -Force } # default values $qtver = If ($qtver) { $qtver } Else { "5.15.0" } @@ -18,15 +29,11 @@ $qtMsvcDir = "msvc2019_64" $QtDir = "C:\Qt\$qtver\$qtMsvcDir" -$clientDir = split-path -parent $MyInvocation.MyCommand.Definition - -if (!$outDir) { $outDir = $clientDir + "\x64\" + $mode } -If (!(test-path $outDir)) { New-Item -ItemType directory -Path $outDir -Force } - if (!$daemonDir) { $daemonDir = $clientDir + '\..\daemon' } if (!$lrcDir) { $lrcDir = $clientDir + '\..\lrc' } write-host "********************************************************************************" -ForegroundColor Magenta +write-host "copying deployment files..." -ForegroundColor Green write-host "using daemonDir: " $daemonDir -ForegroundColor Magenta write-host "using lrcDir: " $lrcDir -ForegroundColor Magenta write-host "using QtDir: " $QtDir -ForegroundColor Magenta @@ -99,4 +106,5 @@ Get-ChildItem -Path $clientTSPath -Include *.qm -Recurse | ForEach-Object { Copy-Item -Path $_.FullName -Destination $CopyDir -Force –Recurse } +New-Item -Path $stampFile -ItemType "file" -Value $stamp -Force write-host "copy completed" -NoNewline -ForegroundColor Green -- GitLab