• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1@echo off
2setlocal
3set D=%~dp0
4set PCBUILD=%D%..\..\PCbuild\
5
6set BUILDX86=
7set BUILDX64=
8set BUILDDOC=
9set BUILDTEST=--test-marker
10set BUILDPACK=
11set REBUILD=
12
13:CheckOpts
14if "%~1" EQU "-h" goto Help
15if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts
16if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts
17if "%~1" EQU "--doc" (set BUILDDOC=1) && shift && goto CheckOpts
18if "%~1" EQU "--no-test-marker" (set BUILDTEST=) && shift && goto CheckOpts
19if "%~1" EQU "--pack" (set BUILDPACK=1) && shift && goto CheckOpts
20if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts
21
22if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1)
23
24call "%D%get_externals.bat"
25call "%PCBUILD%find_msbuild.bat" %MSBUILD%
26if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
27
28if defined BUILDX86 (
29    call "%PCBUILD%build.bat" -d -e %REBUILD% %BUILDTEST%
30    if errorlevel 1 goto :eof
31    call "%PCBUILD%build.bat" -e %REBUILD% %BUILDTEST%
32    if errorlevel 1 goto :eof
33)
34if defined BUILDX64 (
35    call "%PCBUILD%build.bat" -p x64 -d -e %REBUILD% %BUILDTEST%
36    if errorlevel 1 goto :eof
37    call "%PCBUILD%build.bat" -p x64 -e %REBUILD% %BUILDTEST%
38    if errorlevel 1 goto :eof
39)
40
41if defined BUILDDOC (
42    call "%PCBUILD%..\Doc\make.bat" htmlhelp
43    if errorlevel 1 goto :eof
44)
45
46rem Build the launcher MSI separately
47%MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86
48
49set BUILD_CMD="%D%bundle\snapshot.wixproj"
50if defined BUILDTEST (
51    set BUILD_CMD=%BUILD_CMD% /p:UseTestMarker=true
52)
53if defined BUILDPACK (
54    set BUILD_CMD=%BUILD_CMD% /p:Pack=true
55)
56if defined REBUILD (
57    set BUILD_CMD=%BUILD_CMD% /t:Rebuild
58)
59
60if defined BUILDX86 (
61    %MSBUILD% %BUILD_CMD%
62    if errorlevel 1 goto :eof
63)
64if defined BUILDX64 (
65    %MSBUILD% /p:Platform=x64 %BUILD_CMD%
66    if errorlevel 1 goto :eof
67)
68
69exit /B 0
70
71:Help
72echo build.bat [-x86] [-x64] [--doc] [-h] [--no-test-marker] [--pack] [-r]
73echo.
74echo    -x86                Build x86 installers
75echo    -x64                Build x64 installers
76echo    --doc               Build CHM documentation
77echo    --no-test-marker    Build without test markers
78echo    --pack              Embed core MSIs into installer
79echo    -r                  Rebuild rather than incremental build
80