1@echo off
2set HarvestAppDir=%~1
3set BuildArch=@MSI_BUILD_ARCH@
4
5if "%HarvestAppDir%" == "" (
6    echo "Missing parameter: Please specify file collection source path (HarvestAppDir)."
7    exit 1
8)
9
10if "%WIX%" == "" (
11    echo "WiX Toolset path not set (environment variable 'WIX'). Please install the WiX Toolset."
12    exit 1
13)
14
15Rem Generate collect.wxs
16"%WIX%\bin\heat.exe" dir "%HarvestAppDir%" -dr INSTALLDIR -sreg -srd -sfrag -ag -cg ClientFiles -var var.HarvestAppDir -platform='%BuildArch%' -t collect-transform.xsl -out collect.wxs
17if %ERRORLEVEL% neq 0 exit %ERRORLEVEL%
18
19Rem Compile en-US (https://www.firegiant.com/wix/tutorial/transforms/morphing-installers/)
20"%WIX%\bin\candle.exe" -dcodepage=1252 -dPlatform=%BuildArch% -arch %BuildArch% -dHarvestAppDir="%HarvestAppDir%" -ext WixUtilExtension NCMsiHelper.wxs WinShellExt.wxs collect.wxs Nextcloud.wxs
21if %ERRORLEVEL% neq 0 exit %ERRORLEVEL%
22
23Rem Link MSI package
24"%WIX%\bin\light.exe" -sw1076 -ext WixUIExtension -ext WixUtilExtension -cultures:en-us NCMsiHelper.wixobj WinShellExt.wixobj collect.wixobj Nextcloud.wixobj -out "@MSI_INSTALLER_FILENAME@"
25
26exit %ERRORLEVEL%
27