From fd02760d898da7fb76f85678b374dc391a36ce86 Mon Sep 17 00:00:00 2001 From: L4ZZA Date: Sun, 12 Jul 2020 18:22:27 +0100 Subject: [PATCH] Handled batch parameters better and fixed error in appveyor config file --- appveyor.yml | 4 ++-- scripts/create_installer.bat | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 568f4ab..7b08f4c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -90,7 +90,7 @@ install: before_build: # Generate VS2019 solution -- cmd: '%SCRIPTS%\generate_solution_vs2019.bat %CONFIG_PARTIAL% -s' +- cmd: '%SCRIPTS%\generate_solution_vs2019.bat -s' #---------------------------------# @@ -112,7 +112,7 @@ after_build: # show content of test dir to see if report is created. - cmd: 'dir bin\%CONFIG_PARTIAL%-%OS_PARTIAL%-%PLAT_PARTIAL%\tests' # Create installer [it works because appveyor image comes with NSIS installed] -- cmd: '%SCRIPTS%\create_installer.bat -s' +- cmd: '%SCRIPTS%\create_installer.bat %CONFIG_PARTIAL% -s' # Renaming installer to include version in its name - cmd: 'ren %OUTPUT_FOLDER%\installers\%PRODUCT_NAME%Setup.exe "%PRODUCT_NAME%-%FILE_VERSION%-setup.exe"' diff --git a/scripts/create_installer.bat b/scripts/create_installer.bat index a5258cd..730aa1c 100644 --- a/scripts/create_installer.bat +++ b/scripts/create_installer.bat @@ -5,18 +5,26 @@ @rem Prevent env variables to escape to the calling environment SETLOCAL +@rem redefine variables in case already defined in the calling environment SET CONFIG=%~1 SET DEFAULT_CONFIG=Release +SET SILENT_MODE=false IF "%CONFIG%" == "" ( SET CONFIG=%DEFAULT_CONFIG% echo No Configuration passed. Defaulted to %CONFIG% echo Usage: create_installer.bat ^ [-s] +) ELSE IF "%CONFIG%" == "-s" ( + SET SILENT_MODE=true + SET CONFIG=%DEFAULT_CONFIG% + echo No Configuration passed. Defaulted to %CONFIG% + echo Usage: create_installer.bat ^ [-s] +) ELSE IF "%CONFIG:~0,1%" == "-" ( + SET CONFIG=%DEFAULT_CONFIG% + echo No Configuration passed. Defaulted to %CONFIG% + echo Usage: create_installer.bat ^ [-s] ) -@rem redefine variables in case already defined in the calling environment -SET SILENT_MODE=false - SHIFT :args SET PARAM=%~1