Skip to content

Commit

Permalink
build: Extract units for installer into a separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
vasylskorych committed Dec 30, 2024
1 parent 0676208 commit 90bc1fd
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,4 @@ Dyssol.VC.VC.opendb
/Documentation/_build
/Documentation/conf.py
/install/
/DyssolInstallers/Scripts/UnitsList.iss
5 changes: 4 additions & 1 deletion DyssolInstallers/Installer/Installer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@
</ImportGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Release|x64'">
<CustomBuildStep>
<Command>run_create_installer.bat $(SolutionDir) $(SolutionPath) $(QtInstallDir) $(InstallerDocumentation) $(InstallerSDK) $(InstallerSDKLibs) $(InstallerPreBuild) $(InstallerPreDocs)</Command>
<Command>
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)
</Command>
<Message>Building required projects and packing the installer...</Message>
<Outputs>Fake</Outputs>
</CustomBuildStep>
Expand Down
25 changes: 25 additions & 0 deletions DyssolInstallers/Installer/generate_units_list.ps1
Original file line number Diff line number Diff line change
@@ -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!"
1 change: 1 addition & 0 deletions DyssolInstallers/Installer/run_generate_units_list.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
powershell -executionpolicy bypass -File %~dp0\generate_units_list.ps1 %1 %2
21 changes: 1 addition & 20 deletions DyssolInstallers/Scripts/Units.iss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions DyssolInstallers/Scripts/_UnitsToAddToInstaller.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Agglomerator
Bunker
Crusher
CrusherPBMTM
CycloneMuschelknautz
Granulator
GranulatorSimpleBatch
HeatExchanger
Inlet
Mixer
Mixer3
Outlet
Screen
ScreenMultideck
Splitter
Splitter3
TimeDelay

0 comments on commit 90bc1fd

Please sign in to comment.