-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprocess.bat
57 lines (53 loc) · 2.63 KB
/
process.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@echo off
cls
SET PATH=%PATH%;.\wix
:: Check that the files and directories exist
if not exist "archives" mkdir "archives"
if not exist "output" mkdir "output"
if not exist "archives\dolt-windows-amd64.zip" echo Could not find "dolt-windows-amd64.zip" in archives & exit /B
:: Cleanup any previous output files
del /F /Q "output\dolt-windows-386.msi" 2> nul
del /F /Q "output\dolt-windows-amd64.msi" 2> nul
echo ------------------------- Checking Dolt Version --------------------------
:: Extract to a top-level dolt directory
7z.exe x -oarchives archives/dolt-windows-amd64.zip > nul
ren "archives\dolt-windows-amd64" dolt > nul
move "archives\dolt" dolt > nul
:: Get the first line of the command `dolt version`
dolt\bin\dolt.exe version > out
powershell -Command "Get-Content -Path .\out | Select-Object -First 1 | Set-Content -Path .\out2"
for /f "tokens=*" %%i in (out2) do set PROCESSED_DOLT_VERSION=%%i
set PROCESSED_DOLT_VERSION=%PROCESSED_DOLT_VERSION:dolt version =%
echo Dolt version is '%PROCESSED_DOLT_VERSION%'
powershell -Command "(gc dolt-windows-386.wxs) -replace 'PROCESSED_DOLT_VERSION', '%PROCESSED_DOLT_VERSION%' | Out-File -encoding ASCII dolt-windows-386-proc.wxs"
powershell -Command "(gc dolt-windows-amd64.wxs) -replace 'PROCESSED_DOLT_VERSION', '%PROCESSED_DOLT_VERSION%' | Out-File -encoding ASCII dolt-windows-amd64-proc.wxs"
echo.
echo ---------------------------- Creating x64 MSI ----------------------------
:: Compile the MSI
candle dolt-windows-amd64-proc.wxs > nul
light -ext WixUIExtension -cultures:en-us dolt-windows-amd64-proc.wixobj
ren dolt-windows-amd64-proc.msi dolt-windows-amd64.msi > nul
move dolt-windows-amd64.msi output > nul
:: Cleanup
del /F /Q dolt-windows-amd64-proc.wxs 2> nul
del /F /Q dolt-windows-amd64-proc.wixpdb 2> nul
del /F /Q dolt-windows-amd64-proc.wixobj 2> nul
rmdir /Q /S dolt > nul
:: Skip x86 if it does not exist
if not exist "archives\dolt-windows-386.zip" del /F /Q dolt-windows-386-proc.wxs 2> nul & exit /B
echo.
echo ---------------------------- Creating x86 MSI ----------------------------
:: Extract to a top-level dolt directory
7z.exe x -oarchives archives/dolt-windows-386.zip > nul
ren "archives\dolt-windows-386" dolt > nul
move "archives\dolt" dolt > nul
:: Compile the MSI
candle dolt-windows-386-proc.wxs > nul
light -ext WixUIExtension -cultures:en-us dolt-windows-386-proc.wixobj
ren dolt-windows-386-proc.msi dolt-windows-386.msi > nul
move dolt-windows-386.msi output > nul
:: Cleanup
del /F /Q dolt-windows-386-proc.wxs 2> nul
del /F /Q dolt-windows-386-proc.wixpdb 2> nul
del /F /Q dolt-windows-386-proc.wixobj 2> nul
rmdir /Q /S dolt > nul