diff --git a/.gitignore b/.gitignore index 4e44b11a..c8c4d2ec 100644 --- a/.gitignore +++ b/.gitignore @@ -239,3 +239,4 @@ Dyssol.VC.VC.opendb /Documentation/_build /Documentation/conf.py /install/ +/DyssolInstallers/Scripts/UnitsList.iss diff --git a/DyssolInstallers/Installer/Installer.vcxproj b/DyssolInstallers/Installer/Installer.vcxproj index 61b5c796..442baecd 100644 --- a/DyssolInstallers/Installer/Installer.vcxproj +++ b/DyssolInstallers/Installer/Installer.vcxproj @@ -52,7 +52,10 @@ - run_create_installer.bat $(SolutionDir) $(SolutionPath) $(QtInstallDir) $(InstallerDocumentation) $(InstallerSDK) $(InstallerSDKLibs) $(InstallerPreBuild) $(InstallerPreDocs) + + call run_generate_units_list.bat $(SolutionDir)\DyssolInstallers\Scripts\_UnitsToAddToInstaller.txt $(SolutionDir)\DyssolInstallers\Scripts\UnitsList.iss + call run_create_installer.bat $(SolutionDir) $(SolutionPath) $(QtInstallDir) $(InstallerDocumentation) $(InstallerSDK) $(InstallerSDKLibs) $(InstallerPreBuild) $(InstallerPreDocs) + Building required projects and packing the installer... Fake diff --git a/DyssolInstallers/Installer/generate_units_list.ps1 b/DyssolInstallers/Installer/generate_units_list.ps1 new file mode 100644 index 00000000..e393d422 --- /dev/null +++ b/DyssolInstallers/Installer/generate_units_list.ps1 @@ -0,0 +1,25 @@ +# paths to files +$inputFilePath = $args[0] +$outputFilePath = $args[1] + +# read the list of units from the input file +$units = Get-Content -Path $inputFilePath | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne "" } + +# initialize the output content +$outputContent = @() +# add comments +$outputContent += "; This file was generated by the Installer project." +$outputContent += "; All manual changes will be reverted after the next project build." +# add header +$outputContent += "#dim UnitsDll[$($units.Count)]" +# iterate through units +for ($i = 0; $i -lt $units.Count; $i++) { + $outputContent += "#define UnitsDll[$i] `"$($units[$i])`"" +} +# add footer +$outputContent += "#define I" + +# write the content to the output file +Set-Content -Path $outputFilePath -Value $outputContent -Encoding UTF8 + +Write-Host $outputFilePath " file generated successfully!" diff --git a/DyssolInstallers/Installer/run_generate_units_list.bat b/DyssolInstallers/Installer/run_generate_units_list.bat new file mode 100644 index 00000000..043f7ecb --- /dev/null +++ b/DyssolInstallers/Installer/run_generate_units_list.bat @@ -0,0 +1 @@ +powershell -executionpolicy bypass -File %~dp0\generate_units_list.ps1 %1 %2 \ No newline at end of file diff --git a/DyssolInstallers/Scripts/Units.iss b/DyssolInstallers/Scripts/Units.iss index b845fe51..aafe296c 100644 --- a/DyssolInstallers/Scripts/Units.iss +++ b/DyssolInstallers/Scripts/Units.iss @@ -3,26 +3,7 @@ ; All rights reserved. This file is part of Dyssol. See LICENSE file for license information. #include "CommonConstants.iss" - -#dim UnitsDll[17] -#define UnitsDll[ 0] "Agglomerator" -#define UnitsDll[ 1] "Bunker" -#define UnitsDll[ 2] "Crusher" -#define UnitsDll[ 3] "CrusherPBMTM" -#define UnitsDll[ 4] "CycloneMuschelknautz" -#define UnitsDll[ 5] "Granulator" -#define UnitsDll[ 6] "HeatExchanger" -#define UnitsDll[ 7] "Inlet" -#define UnitsDll[ 8] "Mixer" -#define UnitsDll[ 9] "Mixer3" -#define UnitsDll[10] "Outlet" -#define UnitsDll[11] "Screen" -#define UnitsDll[12] "ScreenMultideck" -#define UnitsDll[13] "Splitter" -#define UnitsDll[14] "Splitter3" -#define UnitsDll[15] "TimeDelay" -#define UnitsDll[16] "GranulatorSimpleBatch" -#define I +#include "UnitsList.iss" [Files] #sub UnitsDllFileEntry diff --git a/DyssolInstallers/Scripts/_UnitsToAddToInstaller.txt b/DyssolInstallers/Scripts/_UnitsToAddToInstaller.txt new file mode 100644 index 00000000..a7f5d76a --- /dev/null +++ b/DyssolInstallers/Scripts/_UnitsToAddToInstaller.txt @@ -0,0 +1,17 @@ +Agglomerator +Bunker +Crusher +CrusherPBMTM +CycloneMuschelknautz +Granulator +GranulatorSimpleBatch +HeatExchanger +Inlet +Mixer +Mixer3 +Outlet +Screen +ScreenMultideck +Splitter +Splitter3 +TimeDelay \ No newline at end of file