@setlocal
@SET PROMPT=$$$S

pushd "%~dp0"

if exist "%~dp0Misc\version.cmd" call "%~dp0Misc\version.cmd"

if exist goarch.txt for /F %%I in (goarch.txt) do set "GOARCH=%%I"
if "%GOARCH%" == "" for /F "delims=/ tokens=2" %%I in ('go version') do set "GOARCH=%%I"

if not "%1" == "" goto %1

goto build

:release
        for /F %%I in (%~dp0Misc\version.txt) do set "VERSION=%%I"
        set "X_VERSION=-X main.version=%VERSION%"

:build
        call :fmt
        pushd "%~dp0main"
        powershell -ExecutionPolicy RemoteSigned -File makesyso.ps1
        popd
        for /F "delims=" %%V in ('git log -1 --date^=short --pretty^=format:"-X main.stamp=%%ad -X main.commit=%%H"') do go build -o nyagos.exe -ldflags "%%V %X_VERSION%" .\main
        goto end

:fmt
        for /F %%I IN ('dir /s /b /aa *.go') do go fmt "%%I" & attrib -A "%%I"
        exit /b

:status
        nyagos -e "print(nyagos.version or 'Snapshot on '..nyagos.stamp)"
        goto end

:clean
        for %%I in (nyagos.exe main\nyagos.syso version.now) do if exist %%I del %%I
        powershell "ls -R | ?{ $_ -match '\.go$' } | %%{ [System.IO.Path]::GetDirectoryName($_.FullName)} | Sort-Object | Get-Unique | %%{ Write-Host 'go clean on',$_ ;  pushd $_ ; go clean ; popd }"
        for /R %%I in (*~ *.bak) do if exist %%I del %%I
        goto end

:sweep
        for /R %%I in (*~) do del %%I
        goto end

:get
        powershell "Get-ChildItem . -Recurse | ?{ $_.Extension -eq '.go' } | %%{  Get-Content $_.FullName | %%{ $_.Split()[-1] } | ?{ $_ -match 'github.com/' } } | Sort-Object | Get-Unique | %%{ Write-Host $_ ; go get -u $_ }"
        goto end

:const
        for %%I in (conio dos lua) do pushd %%I & gcc makeconst\makeconst.c & a > const.go & go fmt const.go & del a.exe & popd
        goto end

:package
        for /F %%I in ('nyagos -e "print(nyagos.version or (string.gsub(nyagos.stamp,[[/]],[[]])))"') do set VERSION=%%I
        zip -9 "nyagos-%VERSION%-%GOARCH%.zip" nyagos.exe lua53.dll nyole.dll nyagos.lua .nyagos makeicon.cmd nyagos.d\*.lua nyagos.d\catalog\*.lua license.txt readme_ja.md readme.md Doc\*.md
        goto end

:install
        if not "%2" == "" set "INSTALLDIR=%2" & echo @set "INSTALLDIR=%2" > "%~dp0Misc\version.cmd"
        if "%INSTALLDIR%" == "" (
            echo Please %0.cmd install PATH\TO\BIN, once
            goto end
        )
        if not exist "%INSTALLDIR%" (
            echo Please %0.cmd install EXIST\PATH\TO\BIN,  once
            goto end
        )

        robocopy nyagos.d "%INSTALLDIR%\nyagos.d" /E
        if not exist "%INSTALLDIR%\lua53.dll" copy lua53.dll "%INSTALLDIR%\."
        copy nyagos.lua "%INSTALLDIR%\."
        copy nyagos.exe "%INSTALLDIR%\." && copy nyole.dll "%INSTALLDIR%\."
        if errorlevel 1 (start %~0 install_ & exit /b)
        goto end

:install_
        taskkill /F /im nyagos.exe
        copy nyagos.exe "%INSTALLDIR%\."
        copy nyole.dll "%INSTALLDIR%\."
        timeout /T 3
        exit %ERRORLEVEL%

:icon
        makeicon.cmd
        goto end

:help
        echo Usage for make.cmd
        echo  %0          : Equals to '%0 build'
        echo  %0 build    : Build nyagos.exe as snapshot (ignore version.txt)
        echo  %0 release  : Build nyagos.exe as release  (see version.txt)
        echo  %0 fmt      : Format all source files with 'go fmt'
        echo  %0 clean    : Delete nyagos.exe and nyagos.syso
        echo  %0 package  : Make the package zip-file
        echo  %0 get      : Do 'go get' for each github library
        echo  %0 upgrade  : Do 'git pull' for each github library
        echo  %0 help     : Print help
        echo  %0 install INSTALLDIR
        echo     : Copy binaries to INSTALLDIR
        echo  %0 install
        echo     : Copy binaries to last INSTALLDIR
:end
        popd

@setlocal
@SET PROMPT=$$$S

pushd "%~dp0"

if exist "%~dp0Misc\version.cmd" call "%~dp0Misc\version.cmd"

if exist goarch.txt for /F %%I in (goarch.txt) do set "GOARCH=%%I"
if "%GOARCH%" == "" for /F "delims=/ tokens=2" %%I in ('go version') do set "GOARCH=%%I"

if not "%1" == "" goto %1

goto build

:release
        for /F %%I in (%~dp0Misc\version.txt) do set "VERSION=%%I"
        set "X_VERSION=-X main.version=%VERSION%"

:build
        call :fmt
        pushd "%~dp0main"
        powershell -ExecutionPolicy RemoteSigned -File makesyso.ps1
        popd
        for /F "delims=" %%V in ('git log -1 --date^=short --pretty^=format:"-X main.stamp=%%ad -X main.commit=%%H"') do go build -o nyagos.exe -ldflags "%%V %X_VERSION%" .\main
        goto end

:fmt
        for /F %%I IN ('dir /s /b /aa *.go') do go fmt "%%I" & attrib -A "%%I"
        exit /b

:status
        nyagos -e "print(nyagos.version or 'Snapshot on '..nyagos.stamp)"
        goto end

:clean
        for %%I in (nyagos.exe main\nyagos.syso version.now) do if exist %%I del %%I
        powershell "ls -R | ?{ $_ -match '\.go$' } | %%{ [System.IO.Path]::GetDirectoryName($_.FullName)} | Sort-Object | Get-Unique | %%{ Write-Host 'go clean on',$_ ;  pushd $_ ; go clean ; popd }"
        for /R %%I in (*~ *.bak) do if exist %%I del %%I
        goto end

:sweep
        for /R %%I in (*~) do del %%I
        goto end

:get
        powershell "Get-ChildItem . -Recurse | ?{ $_.Extension -eq '.go' } | %%{  Get-Content $_.FullName | %%{ $_.Split()[-1] } | ?{ $_ -match 'github.com/' } } | Sort-Object | Get-Unique | %%{ Write-Host $_ ; go get -u $_ }"
        goto end

:const
        for %%I in (conio dos lua) do pushd %%I & gcc makeconst\makeconst.c & a > const.go & go fmt const.go & del a.exe & popd
        goto end

:package
        for /F %%I in ('nyagos -e "print(nyagos.version or (string.gsub(nyagos.stamp,[[/]],[[]])))"') do set VERSION=%%I
        zip -9 "nyagos-%VERSION%-%GOARCH%.zip" nyagos.exe lua53.dll nyagos.lua .nyagos makeicon.cmd nyagos.d\*.lua nyagos.d\catalog\*.lua license.txt readme_ja.md readme.md Doc\*.md
        goto end

:install
        if not "%2" == "" set "INSTALLDIR=%2" & echo @set "INSTALLDIR=%2" > "%~dp0Misc\version.cmd"
        if "%INSTALLDIR%" == "" (
            echo Please %0.cmd install PATH\TO\BIN, once
            goto end
        )
        if not exist "%INSTALLDIR%" (
            echo Please %0.cmd install EXIST\PATH\TO\BIN,  once
            goto end
        )

        robocopy nyagos.d "%INSTALLDIR%\nyagos.d" /E
        if not exist "%INSTALLDIR%\lua53.dll" copy lua53.dll "%INSTALLDIR%\."
        copy nyagos.lua "%INSTALLDIR%\."
        copy nyagos.exe "%INSTALLDIR%\." && copy nyole.dll "%INSTALLDIR%\."
        if errorlevel 1 (start %~0 install_ & exit /b)
        goto end

:install_
        taskkill /F /im nyagos.exe
        copy nyagos.exe "%INSTALLDIR%\."
        copy nyole.dll "%INSTALLDIR%\."
        timeout /T 3
        exit %ERRORLEVEL%

:icon
        makeicon.cmd
        goto end

:help
        echo Usage for make.cmd
        echo  %0          : Equals to '%0 build'
        echo  %0 build    : Build nyagos.exe as snapshot (ignore version.txt)
        echo  %0 release  : Build nyagos.exe as release  (see version.txt)
        echo  %0 fmt      : Format all source files with 'go fmt'
        echo  %0 clean    : Delete nyagos.exe and nyagos.syso
        echo  %0 package  : Make the package zip-file
        echo  %0 get      : Do 'go get' for each github library
        echo  %0 upgrade  : Do 'git pull' for each github library
        echo  %0 help     : Print help
        echo  %0 install INSTALLDIR
        echo     : Copy binaries to INSTALLDIR
        echo  %0 install
        echo     : Copy binaries to last INSTALLDIR
:end
        popd

Modify make.cmd not to bundle nyole.dll

Modify make.cmd not to bundle nyole.dll


Add run.bat for easy execution

Add run.bat for easy execution


@echo off
rem -------------------------------------------------------------------------
rem JBoss Bootstrap Script for Windows
rem -------------------------------------------------------------------------

rem $Id$

@if not "%ECHO%" == ""  echo %ECHO%
@if "%OS%" == "Windows_NT" setlocal

if "%OS%" == "Windows_NT" (
  set "DIRNAME=%~dp0%"
) else (
  set DIRNAME=.\
)

rem Read an optional configuration file.
if "x%STANDALONE_CONF%" == "x" (
   set "STANDALONE_CONF=%DIRNAME%standalone.conf.bat"
)
if exist "%STANDALONE_CONF%" (
   echo Calling %STANDALONE_CONF%
   call "%STANDALONE_CONF%" %*
) else (
   echo Config file not found %STANDALONE_CONF%
)

pushd %DIRNAME%..
if "x%JBOSS_HOME%" == "x" (
  set "JBOSS_HOME=%CD%"
)
popd

set DIRNAME=

if "%OS%" == "Windows_NT" (
  set "PROGNAME=%~nx0%"
) else (
  set "PROGNAME=standalone.bat"
)

rem Setup JBoss specific properties
set JAVA_OPTS=-Dprogram.name=%PROGNAME% %JAVA_OPTS%

if "x%JAVA_HOME%" == "x" (
  set  JAVA=java
  echo JAVA_HOME is not set. Unexpected results may occur.
  echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
) else (
  set "JAVA=%JAVA_HOME%\bin\java"
)

rem Add -server to the JVM options, if supported
"%JAVA%" -server -version 2>&1 | findstr /I hotspot > nul
if not errorlevel == 1 (
  set "JAVA_OPTS=%JAVA_OPTS% -server"
)

rem Find run.jar, or we can't continue
if exist "%JBOSS_HOME%\jboss-modules.jar" (
    set "RUNJAR=%JBOSS_HOME%\jboss-modules.jar"
) else (
  echo Could not locate "%JBOSS_HOME%\jboss-modules.jar".
  echo Please check that you are in the bin directory when running this script.
  goto END
)

rem Setup JBoss specific properties

rem Setup the java endorsed dirs
set JBOSS_ENDORSED_DIRS=%JBOSS_HOME%\lib\endorsed

echo ===============================================================================
echo.
echo   JBoss Bootstrap Environment
echo.
echo   JBOSS_HOME: %JBOSS_HOME%
echo.
echo   JAVA: %JAVA%
echo.
echo   JAVA_OPTS: %JAVA_OPTS%
echo.
echo ===============================================================================
echo.

:RESTART
"%JAVA%" %JAVA_OPTS% ^
 -Dorg.jboss.boot.log.file=%JBOSS_HOME%\standalone\log\boot.log ^
 -Dlogging.configuration=file:%JBOSS_HOME%/standalone/configuration/logging.properties ^
    -jar "%JBOSS_HOME%\jboss-modules.jar" ^
    -mp "%JBOSS_HOME%\modules" ^
    -logmodule "org.jboss.logmanager" ^
     org.jboss.as.standalone ^
    -Djboss.home.dir="%JBOSS_HOME%" ^
     %*

if ERRORLEVEL 10 goto RESTART

:END
if "x%NOPAUSE%" == "x" pause

:END_NO_PAUSE

Add windows start support :)

Add windows start support :)


@echo off

REM
REM Verify that we can find the 'makepanda' python script
REM and the python interpreter.  If we can find both, then
REM run 'makepanda'.
REM

set thirdparty=thirdparty
if defined MAKEPANDA_THIRDPARTY set thirdparty=%MAKEPANDA_THIRDPARTY%

if not exist makepanda\makepanda.py goto :missing1
if %PROCESSOR_ARCHITECTURE% == AMD64 goto :AMD64

if not exist %thirdparty%\win-python\python.exe goto :missing2
%thirdparty%\win-python\python.exe makepanda\makepanda.py %*
if errorlevel 1 if x%1 == x--slavebuild exit 1
goto done

:AMD64
if not exist %thirdparty%\win-python-x64\python.exe goto :missing2
%thirdparty%\win-python-x64\python.exe makepanda\makepanda.py %*
if errorlevel 1 if x%1 == x--slavebuild exit 1
goto done

:missing1
  echo You need to change directory to the root of the panda source tree
  echo before invoking makepanda.  For further install instructions, read
  echo the installation instructions in the file doc/INSTALL-MK.
  goto done

:missing2
  echo You seem to be missing the 'thirdparty' directory.  You probably checked
  echo the source code out from sourceforge.  The sourceforge repository is
  echo missing the 'thirdparty' directory.  You will need to supplement the
  echo code by downloading the 'thirdparty' directory from www.panda3d.org
  goto done

:done

@echo off

REM
REM Verify that we can find the 'makepanda' python script
REM and the python interpreter.  If we can find both, then
REM run 'makepanda'.
REM

set thirdparty=thirdparty
if defined MAKEPANDA_THIRDPARTY set thirdparty=%MAKEPANDA_THIRDPARTY%

if not exist makepanda\makepanda.py goto :missing1

if not exist %thirdparty%\win-python\python.exe goto :missing2
%thirdparty%\win-python\python.exe makepanda\makepanda.py %*
if errorlevel 1 if x%1 == x--slavebuild exit 1
goto done

:missing1
  echo You need to change directory to the root of the panda source tree
  echo before invoking makepanda.  For further install instructions, read
  echo the installation instructions in the file doc/INSTALL-MK.
  goto done

:missing2
  echo You seem to be missing the 'thirdparty' directory.  You probably checked
  echo the source code out from sourceforge.  The sourceforge repository is
  echo missing the 'thirdparty' directory.  You will need to supplement the
  echo code by downloading the 'thirdparty' directory from www.panda3d.org
  goto done

:done

remove 64-bits stuff

remove 64-bits stuff


echo off
IF EXIST dist del /Q dist\*.*

if "%1"=="" goto default_value:
set pythonexe="%1"
goto custom_python:

:default_value:
IF NOT EXIST c:\Python34 GOTO checkinstall64:

:checkinstall:
IF EXIST c:\Python34vir GOTO nexta:
mkdir c:\Python34vir

:nexta:
IF EXIST c:\Python34vir\install GOTO fullsetupa:
c:\Python34\Scripts\virtualenv c:\Python34vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%
:fullsetupa:
echo #######################################################
c:\Python34vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:checkinstall64:
IF EXIST c:\Python34_64vir GOTO nextb:
mkdir c:\Python34_64vir
:nextb:
echo #######################################################
c:\Python34_x64\Scripts\virtualenv c:\Python34_64vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:fullsetupb:
echo #######################################################
c:\Python34_64vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup33:
IF NOT EXIST c:\Python33 GOTO setup33_64:
set pythonexe="c:\Python33\python"
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py bdist_wininst
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup33_64:
IF NOT EXIST c:\Python33_x64 GOTO setup34:
set pythonexe="c:\Python33_x64\python"
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py sdist --formats=gztar,zip --verbose
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup34:
IF NOT EXIST c:\Python34 GOTO setup34_x64_msi_wheel:
set pythonexe="c:\Python34\python"
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup34_x64_msi_wheel:
set pythonexe="c:\Python34_x64\python"
:custom_python:
%pythonexe% -u setup.py clean_space
%pythonexe% setup.py clean_pyd
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% -u setup.py unittests
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

%pythonexe% setup.py sdist --formats=gztar,zip --verbose
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_msi
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wheel
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:presentation:
%pythonexe% -u setup.py build_pres
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% -u setup.py build_pres_2A
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% -u setup.py build_pres_3A
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% -u setup.py build_pres_1Ap
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:documentation:
%pythonexe% -u setup.py build_sphinx
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:copyfiles:
if not exist dist\html mkdir dist\html
if not exist dist\html2 mkdir dist\html2
if not exist dist\html3 mkdir dist\html3
if not exist dist\latex mkdir dist\latex
if not exist dist\html_pres mkdir dist\html_pres
if not exist dist\html_pres_2A mkdir dist\html_pres_2A
if not exist dist\html_pres_3A mkdir dist\html_pres_3A
if not exist dist\html_pres_1Ap mkdir dist\html_pres_1Ap

echo #######################################################F

xcopy /E /C /I /Y _doc\presentation_projets\a2015\build\html dist\html_pres_1Ap
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy /E /C /I /Y _doc\presentation_2A\build\html dist\html_pres_2A
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy /E /C /I /Y _doc\presentation_3A\build\html dist\html_pres_3A
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy /E /C /I /Y _doc\presentation\build\html dist\html_pres
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy /E /C /I /Y _doc\sphinxdoc\build\html dist\html
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy /E /C /I /Y _doc\sphinxdoc\build2\html dist\html2
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy /E /C /I /Y _doc\sphinxdoc\build3\html dist\html3
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy /E /C /I /Y _doc\sphinxdoc\build\latex dist\latex
if %errorlevel% neq 0 exit /b %errorlevel%

echo off
IF EXIST dist del /Q dist\*.*

if "%1"=="" goto default_value:
set pythonexe="%1"
goto custom_python:

:default_value:
IF NOT EXIST c:\Python34 GOTO checkinstall64:

:checkinstall:
IF EXIST c:\Python34vir GOTO nexta:
mkdir c:\Python34vir

:nexta:
IF EXIST c:\Python34vir\install GOTO fullsetupa:
c:\Python34\Scripts\virtualenv c:\Python34vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%
:fullsetupa:
echo #######################################################
c:\Python34vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:checkinstall64:
IF EXIST c:\Python34_64vir GOTO nextb:
mkdir c:\Python34_64vir
:nextb:
echo #######################################################
c:\Python34_x64\Scripts\virtualenv c:\Python34_64vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:fullsetupb:
echo #######################################################
c:\Python34_64vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup34:
IF NOT EXIST c:\Python34 GOTO setup34_x64_msi_wheel:
set pythonexe="c:\Python34\python"
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup34_x64_msi_wheel:
set pythonexe="c:\Python34_x64\python"
:custom_python:
%pythonexe% -u setup.py clean_space
%pythonexe% setup.py clean_pyd
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% -u setup.py unittests
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

%pythonexe% setup.py sdist --formats=gztar,zip --verbose
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_msi
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wheel
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:presentation:
%pythonexe% -u setup.py build_pres
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% -u setup.py build_pres_2A
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% -u setup.py build_pres_3A
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% -u setup.py build_pres_1Ap
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:documentation:
%pythonexe% -u setup.py build_sphinx
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:copyfiles:
if not exist dist\html mkdir dist\html
if not exist dist\html2 mkdir dist\html2
if not exist dist\html3 mkdir dist\html3
if not exist dist\latex mkdir dist\latex
if not exist dist\html_pres mkdir dist\html_pres
if not exist dist\html_pres_2A mkdir dist\html_pres_2A
if not exist dist\html_pres_3A mkdir dist\html_pres_3A
if not exist dist\html_pres_1Ap mkdir dist\html_pres_1Ap

echo #######################################################F

xcopy /E /C /I /Y _doc\presentation_projets\a2015\build\html dist\html_pres_1Ap
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy /E /C /I /Y _doc\presentation_2A\build\html dist\html_pres_2A
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy /E /C /I /Y _doc\presentation_3A\build\html dist\html_pres_3A
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy /E /C /I /Y _doc\presentation\build\html dist\html_pres
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy /E /C /I /Y _doc\sphinxdoc\build\html dist\html
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy /E /C /I /Y _doc\sphinxdoc\build2\html dist\html2
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy /E /C /I /Y _doc\sphinxdoc\build3\html dist\html3
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy /E /C /I /Y _doc\sphinxdoc\build\latex dist\latex
if %errorlevel% neq 0 exit /b %errorlevel%

remove building for python 3.3

remove building for python 3.3


echo off
IF EXIST dist del /Q dist\*.*

if "%1"=="" goto default_value:
set pythonexe="%1"
%pythonexe% setup.py write_version
goto custom_python:

:default_value:
IF NOT EXIST c:\Python34 GOTO checkinstall64:

:checkinstall:
IF EXIST c:\Python34vir GOTO nexta:
mkdir c:\Python34vir

:nexta:
IF EXIST c:\Python34vir\install GOTO fullsetupa:
c:\Python34\Scripts\virtualenv c:\Python34vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%

:fullsetupa:
echo #######################################################
c:\Python34vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:checkinstall64:
IF EXIST c:\Python34_64vir GOTO nextb:
mkdir c:\Python34_64vir

:nextb:
IF EXIST c:\Python34_64vir\install GOTO fullsetupb:
c:\Python34_x64\Scripts\virtualenv c:\Python34_64vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%

:fullsetupb:
echo #######################################################
c:\Python34_64vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup34:
IF NOT EXIST c:\Python34 GOTO utpy34_64:
set pythonexe="c:\Python34\python"
%pythonexe% setup.py write_version
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:utpy34_64:
set pythonexe="c:\Python34_x64\python"
%pythonexe% setup.py write_version
%pythonexe% -u setup.py clean_space
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% -u setup.py unittests
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup34_x64_msi_wheel:
set pythonexe="c:\Python34_x64\python"
:custom_python:
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py sdist --formats=gztar,zip --verbose
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_msi
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wheel
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:documentation:
%pythonexe% -u setup.py build_sphinx
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:copyfiles:
if not exist dist\html mkdir dist\html
xcopy /E /C /I /Y _doc\sphinxdoc\build\html dist\html
if %errorlevel% neq 0 exit /b %errorlevel%

echo off
IF EXIST dist del /Q dist\*.*

if "%1"=="" goto default_value:
set pythonexe="%1"
%pythonexe% setup.py write_version
goto custom_python:

:default_value:
IF NOT EXIST c:\Python34 GOTO checkinstall64:

:checkinstall:
IF EXIST c:\Python34vir GOTO nexta:
mkdir c:\Python34vir

:nexta:
IF EXIST c:\Python34vir\install GOTO fullsetupa:
c:\Python34\Scripts\virtualenv c:\Python34vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%

:fullsetupa:
echo #######################################################
c:\Python34vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:checkinstall64:
IF EXIST c:\Python34_64vir GOTO nextb:
mkdir c:\Python34_64vir

:nextb:
IF EXIST c:\Python34_64vir\install GOTO fullsetupb:
c:\Python34_x64\Scripts\virtualenv c:\Python34_64vir\install --system-site-packages
if %errorlevel% neq 0 exit /b %errorlevel%

:fullsetupb:
echo #######################################################
c:\Python34_64vir\install\Scripts\python -u setup.py install
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:setup34:
IF NOT EXIST c:\Python34 GOTO utpy34_64:
set pythonexe="c:\Python34\python"
%pythonexe% setup.py write_version
%pythonexe% setup.py clean_pyd
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:utpy34_64:
set pythonexe="c:\Python34_x64\python"
:custom_python:
%pythonexe% setup.py write_version
%pythonexe% -u setup.py clean_space
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% -u setup.py unittests
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

%pythonexe% setup.py clean_pyd
%pythonexe% setup.py sdist --formats=gztar,zip --verbose
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wininst --plat-name=win-amd64
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_msi
if %errorlevel% neq 0 exit /b %errorlevel%
%pythonexe% setup.py bdist_wheel
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:documentation:
%pythonexe% -u setup.py build_sphinx
if %errorlevel% neq 0 exit /b %errorlevel%
echo #######################################################

:copyfiles:
if not exist dist\html mkdir dist\html
xcopy /E /C /I /Y _doc\sphinxdoc\build\html dist\html
if %errorlevel% neq 0 exit /b %errorlevel%

change build_setup_help_on_windows to run unit test on anaconda


@rem Copyright 2016, Google Inc.
@rem All rights reserved.
@rem
@rem Redistribution and use in source and binary forms, with or without
@rem modification, are permitted provided that the following conditions are
@rem met:
@rem
@rem     * Redistributions of source code must retain the above copyright
@rem notice, this list of conditions and the following disclaimer.
@rem     * Redistributions in binary form must reproduce the above
@rem copyright notice, this list of conditions and the following disclaimer
@rem in the documentation and/or other materials provided with the
@rem distribution.
@rem     * Neither the name of Google Inc. nor the names of its
@rem contributors may be used to endorse or promote products derived from
@rem this software without specific prior written permission.
@rem
@rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@rem A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
@rem OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
@rem SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
@rem LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@rem DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
@rem THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
@rem (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
@rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

@rem Performs nuget restore step for C#.

setlocal

@rem enter repo root
cd /d %~dp0\..\..

@rem Location of nuget.exe
@rem TODO: change this before submitting. This is only for migrating nuget
set NUGET=C:\nuget_temp\nuget.exe

if exist %NUGET% (
  @rem Restore Grpc packages by packages since Nuget client 3.4.4 doesnt support restore
  @rem by solution
  @rem Moving into each directory to let the restores work with both nuget 3.4 and 2.8
  %NUGET% restore vsprojects/grpc_csharp_ext.sln || goto :error

  cd src/csharp

  cd Grpc.Auth || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.Core || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.Core.Tests || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.Examples.MathClient || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.Examples.MathServer || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.Examples || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.HealthCheck.Tests || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.HealthCheck || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.IntegrationTesting.Client || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.IntegrationTesting.QpsWorker || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.IntegrationTesting.StressClient || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.IntegrationTesting || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error

  cd /d %~dp0\..\.. || goto :error
)

endlocal

goto :EOF

:error
echo Failed!
exit /b %errorlevel%

@rem Copyright 2016, Google Inc.
@rem All rights reserved.
@rem
@rem Redistribution and use in source and binary forms, with or without
@rem modification, are permitted provided that the following conditions are
@rem met:
@rem
@rem     * Redistributions of source code must retain the above copyright
@rem notice, this list of conditions and the following disclaimer.
@rem     * Redistributions in binary form must reproduce the above
@rem copyright notice, this list of conditions and the following disclaimer
@rem in the documentation and/or other materials provided with the
@rem distribution.
@rem     * Neither the name of Google Inc. nor the names of its
@rem contributors may be used to endorse or promote products derived from
@rem this software without specific prior written permission.
@rem
@rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@rem A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
@rem OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
@rem SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
@rem LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@rem DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
@rem THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
@rem (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
@rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

@rem Performs nuget restore step for C#.

setlocal

@rem enter repo root
cd /d %~dp0\..\..

@rem Location of nuget.exe
set NUGET=C:\nuget\nuget.exe

if exist %NUGET% (
  @rem Restore Grpc packages by packages since Nuget client 3.4.4 doesnt support restore
  @rem by solution
  @rem Moving into each directory to let the restores work with both nuget 3.4 and 2.8
  %NUGET% restore vsprojects/grpc_csharp_ext.sln || goto :error

  cd src/csharp

  cd Grpc.Auth || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.Core || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.Core.Tests || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.Examples.MathClient || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.Examples.MathServer || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.Examples || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.HealthCheck.Tests || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.HealthCheck || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.IntegrationTesting.Client || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.IntegrationTesting.QpsWorker || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.IntegrationTesting.StressClient || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error
  cd ..

  cd Grpc.IntegrationTesting || goto :error
  %NUGET% restore -PackagesDirectory ../packages || goto :error

  cd /d %~dp0\..\.. || goto :error
)

endlocal

goto :EOF

:error
echo Failed!
exit /b %errorlevel%

change location of nuget back to normal

change location of nuget back to normal


REM @file    CI/appveyor/install_dependencies.bat
REM @date    nov. 2015
REM @author  PhRG / opticalp.fr
REM @license MIT

REM Install dependencies:
REM  - build POCO from latest git release.

set CURRENT_DIR=%CD%
REM echo "current dir is %CURRENT_DIR%"

REM set POCO_INSTALL_PREFIX=%PROGRAMFILES%\Poco
REM echo "Poco install destination directory: %POCO_INSTALL_PREFIX%"

REM get last poco via github
echo "getting the last poco release from github"
mkdir dependencies
cd dependencies
git clone https://github.com/pocoproject/poco.git
echo "Poco is now cloned. "
cd poco

REM now using msys to make things easier (getting last release)
%SH_COMMAND% -c "POCO_TAG_NAME=$(git describe --tags) ; git checkout $POCO_TAG_NAME"

REM build using cmake
echo "building poco with cmake, configuration: %CONFIGURATION%"
cd ..
mkdir poco-build
cd poco-build

echo "Preparing to install POCO into %POCO_INSTALL_PREFIX%"
echo "CMake generator is: %GENERATOR%"
cmake ../poco -DENABLE_XML=ON -DENABLE_JSON=ON -DENABLE_MONGODB=OFF -DENABLE_PDF=OFF ^
    -DENABLE_UTIL=ON -DENABLE_NET=OFF -DENABLE_NETSSL=OFF -DENABLE_NETSSL_WIN=OFF -DENABLE_CRYPTO=OFF ^
    -DENABLE_DATA=OFF -DENABLE_DATA_SQLITE=OFF -DENABLE_DATA_MYSQL=OFF -DENABLE_DATA_ODBC=OFF ^
    -DENABLE_SEVENZIP=OFF -DENABLE_ZIP=OFF -DENABLE_APACHECONNECTOR=OFF -DENABLE_CPPPARSER=OFF ^
    -DENABLE_POCODOC=OFF -DENABLE_PAGECOMPILER=OFF -DENABLE_PAGECOMPILER_FILE2PAGE=OFF ^
    -DENABLE_REDIS=OFF ^
    -DCMAKE_INSTALL_PREFIX="%POCO_INSTALL_PREFIX%" -G"%GENERATOR%"
cmake --build . --config %CONFIGURATION%
REM echo "Poco build done. "
cmake --build . --target install --config %CONFIGURATION%
REM echo "Poco install done. "

REM %PATH% has to be modified to take into account poco .dlls
cd %CURRENT_DIR%

REM fix python configuration for 2.7.11
if "%ARCH%"=="Win64" (
  set PYTHONHOME=C:\Python27-x64
) else (
  set PYTHONHOME=C:\Python27
)

echo Install OpenCV using curl and 7zip
curl -fSL -o opencv.exe -m 300 http://downloads.sourceforge.net/project/opencvlibrary/opencv-win/%OPENCV_VERSION%/opencv-%OPENCV_VERSION%.exe
echo Downloading from sourceforge done.
REM opencv.exe -y -o"%OPENCV_BASE_DIR"
call 7z x opencv.exe -o"%OPENCV_BASE_DIR%"
dir "%OPENCV_DIR%"
echo OpenCV installed

REM @file    CI/appveyor/install_dependencies.bat
REM @date    nov. 2015
REM @author  PhRG / opticalp.fr
REM @license MIT

REM Install dependencies:
REM  - build POCO from latest git release.

set CURRENT_DIR=%CD%
REM echo "current dir is %CURRENT_DIR%"

REM set POCO_INSTALL_PREFIX=%PROGRAMFILES%\Poco
REM echo "Poco install destination directory: %POCO_INSTALL_PREFIX%"

REM get last poco via github
echo "getting the last poco release from github"
mkdir dependencies
cd dependencies
git clone https://github.com/pocoproject/poco.git
echo "Poco is now cloned. "
cd poco

REM now using msys to make things easier (getting last release)
%SH_COMMAND% -c "POCO_TAG_NAME=$(git describe --tags) ; git checkout $POCO_TAG_NAME"

REM build using cmake
echo "building poco with cmake, configuration: %CONFIGURATION%"
cd ..
mkdir poco-build
cd poco-build

echo "Preparing to install POCO into %POCO_INSTALL_PREFIX%"
echo "CMake generator is: %GENERATOR%"
cmake ../poco -DENABLE_XML=ON -DENABLE_JSON=ON -DENABLE_MONGODB=OFF -DENABLE_PDF=OFF ^
    -DENABLE_UTIL=ON -DENABLE_NET=OFF -DENABLE_NETSSL=OFF -DENABLE_NETSSL_WIN=OFF -DENABLE_CRYPTO=OFF ^
    -DENABLE_DATA=OFF -DENABLE_DATA_SQLITE=OFF -DENABLE_DATA_MYSQL=OFF -DENABLE_DATA_ODBC=OFF ^
    -DENABLE_SEVENZIP=OFF -DENABLE_ZIP=OFF -DENABLE_APACHECONNECTOR=OFF -DENABLE_CPPPARSER=OFF ^
    -DENABLE_POCODOC=OFF -DENABLE_PAGECOMPILER=OFF -DENABLE_PAGECOMPILER_FILE2PAGE=OFF ^
    -DENABLE_REDIS=OFF ^
    -DCMAKE_INSTALL_PREFIX="%POCO_INSTALL_PREFIX%" -G"%GENERATOR%"
cmake --build . --config %CONFIGURATION%
REM echo "Poco build done. "
cmake --build . --target install --config %CONFIGURATION%
REM echo "Poco install done. "

REM %PATH% has to be modified to take into account poco .dlls
cd %CURRENT_DIR%

REM fix python configuration for 2.7.11
if "%ARCH%"=="Win64" (
  set PYTHONHOME=C:\Python27-x64
) else (
  set PYTHONHOME=C:\Python27
)

echo Install OpenCV using curl and 7zip
curl -fSL -o opencv.exe -m 600 http://downloads.sourceforge.net/project/opencvlibrary/opencv-win/%OPENCV_VERSION%/opencv-%OPENCV_VERSION%.exe
echo Downloading from sourceforge done.
REM opencv.exe -y -o"%OPENCV_BASE_DIR"
call 7z x opencv.exe -o"%OPENCV_BASE_DIR%"
dir "%OPENCV_DIR%"
echo OpenCV installed

Change appveyor curl timeout value

Change appveyor curl timeout value

for opencv download


REM work in progress
REM Setup a non-production BigFix Eval Server with SQL Developer Edition.

REM http://software.bigfix.com/download/bes/95/BigFix-BES-9.5.9.62.exe
REM http://download.microsoft.com/download/2/5/0/2508F7B4-6DDE-4C3E-B1FA-E1EB66F2F79F/SQLServer2016-SSEI-Dev.exe

SET BASEFOLDER=C:\tmp

REM Make folder if not existing:  https://stackoverflow.com/questions/4165387/create-folder-with-batch-but-only-if-it-doesnt-already-exist
if not exist "%BASEFOLDER%" mkdir %BASEFOLDER%

REM Open folder:
start "" %BASEFOLDER%

REM https://github.com/jgstew/bigfix-content/blob/master/fixlet/Install%20SQL%20Server%20Management%20Studio%2016.5.1%20-%20Windows.bes
REM Download SQL Server Management Studio:
start "" powershell -command "& { (New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/f/e/b/feb0e6be-21ce-4f98-abee-d74065e32d0a/SSMS-Setup-ENU.exe', '%BASEFOLDER%\SSMS-Setup-ENU.exe') }" -ExecutionPolicy Bypass

REM Download BigFix Root Server:
start "" powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://software.bigfix.com/download/bes/100/BigFix-BES-10.0.0.133.exe', '%BASEFOLDER%\BigFix-BES.exe') }" -ExecutionPolicy Bypass

REM Download BigFix Fixlet Debugger:
REM http://software.bigfix.com/download/bes/100/util/QNA10.0.0.133.zip
start "" powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://software.bigfix.com/download/bes/100/util/QNA10.0.0.133.zip', '%BASEFOLDER%\BigFix-FixletDebugger.zip') }" -ExecutionPolicy Bypass

REM Download SQLServer Developer Edition:
powershell -command "& { (New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/5/A/7/5A7065A2-C81C-4A31-9972-8A31AC9388C1/SQLServer2017-SSEI-Dev.exe', '%BASEFOLDER%\SQLServer-SSEI-Dev.exe') }" -ExecutionPolicy Bypass
REM Install SQLServer Developer Edition:
REM https://docs.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt?view=sql-server-2017
REM Download Commnad:
%BASEFOLDER%\SQLServer-SSEI-Dev.exe /MEDIAPATH="%BASEFOLDER%" /ACTION=Download /LANGUAGE=en-US /MEDIATYPE=CAB /QUIET

REM Install Command: (interactive)
%BASEFOLDER%\SQLServer-SSEI-Dev.exe /ACTION=Install /MEDIAPATH=C:\tmp /IACCEPTSQLSERVERLICENSETERMS /LANGUAGE=en-US

REM https://download.microsoft.com/download/0/5/B/05B2AF8F-906F-4C57-A58E-5780F64F9D62/SSMS-Setup-ENU.exe
REM Install SQL Server Management Studio:
%BASEFOLDER%\SSMS-Setup-ENU.exe /install /quiet /norestart

REM press any key to continue....
pause

REM  TODO: configure SQL SA account?
REM  TODO: configure SQL login from AD account / local win admin account?
REM  TODO: open firewall for MSSQL to local subnet ?
REM  TODO: open firewall for BigFix to local subnet+ ?
REM  TODO: create local MO account
REM  TODO: BES Admin: create BES Admin Password
REM  TODO: BES Admin: set recommended BES Admin Settings
REM  TODO: BES Admin: create encryption keys for client encryption in BES Admin
REM  TODO: BES Admin: schedule BES Property ID Mapper
REM  TODO: configure REST API creds - Web Reports - etc
REM  TODO: enable sites, subscribe computers
REM  TODO: setup download plugins (deploy Enable Encryption for Clients for root/relays, enable analyses)
REM  TODO: deploy actions to configure default client settings
REM  TODO: Activate Analyses: Wake-on-LAN Analysis, Download Plug-in Versions, BES Health Checks Analysis, BES Relay Status
REM  TODO: create custom site(s) `Shared` `Dashboards` `Private`
REM  TODO: create roles
REM  TODO: install adobe flash for IE for root or console systems (DISM)
REM  TODO:

REM work in progress
REM Setup a non-production BigFix Eval Server with SQL Developer Edition.

REM http://software.bigfix.com/download/bes/95/BigFix-BES-9.5.9.62.exe
REM http://download.microsoft.com/download/2/5/0/2508F7B4-6DDE-4C3E-B1FA-E1EB66F2F79F/SQLServer2016-SSEI-Dev.exe

SET BASEFOLDER=C:\tmp

REM Make folder if not existing:  https://stackoverflow.com/questions/4165387/create-folder-with-batch-but-only-if-it-doesnt-already-exist
if not exist "%BASEFOLDER%" mkdir %BASEFOLDER%

REM Open folder:
start "" %BASEFOLDER%

REM https://github.com/jgstew/bigfix-content/blob/master/fixlet/Install%20SQL%20Server%20Management%20Studio%2016.5.1%20-%20Windows.bes
REM Download SQL Server Management Studio:
start "" powershell -command "& { (New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/f/e/b/feb0e6be-21ce-4f98-abee-d74065e32d0a/SSMS-Setup-ENU.exe', '%BASEFOLDER%\SSMS-Setup-ENU.exe') }" -ExecutionPolicy Bypass

REM Download BigFix Root Server:
start "" powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://software.bigfix.com/download/bes/100/BigFix-BES-10.0.0.133.exe', '%BASEFOLDER%\BigFix-BES.exe') }" -ExecutionPolicy Bypass

REM Download BigFix Fixlet Debugger:
REM http://software.bigfix.com/download/bes/100/util/QNA10.0.0.133.zip
start "" powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://software.bigfix.com/download/bes/100/util/QNA10.0.0.133.zip', '%BASEFOLDER%\BigFix-FixletDebugger.zip') }" -ExecutionPolicy Bypass

REM Download SQLServer Developer Edition:
powershell -command "& { (New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/5/A/7/5A7065A2-C81C-4A31-9972-8A31AC9388C1/SQLServer2017-SSEI-Dev.exe', '%BASEFOLDER%\SQLServer-SSEI-Dev.exe') }" -ExecutionPolicy Bypass
REM Install SQLServer Developer Edition:
REM https://docs.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt?view=sql-server-2017
REM Download Commnad:
%BASEFOLDER%\SQLServer-SSEI-Dev.exe /MEDIAPATH="%BASEFOLDER%" /ACTION=Download /LANGUAGE=en-US /MEDIATYPE=CAB /QUIET

REM Install Command: (interactive)
%BASEFOLDER%\SQLServer-SSEI-Dev.exe /ACTION=Install /MEDIAPATH=C:\tmp /IACCEPTSQLSERVERLICENSETERMS /LANGUAGE=en-US

REM https://download.microsoft.com/download/0/5/B/05B2AF8F-906F-4C57-A58E-5780F64F9D62/SSMS-Setup-ENU.exe
REM Install SQL Server Management Studio:
%BASEFOLDER%\SSMS-Setup-ENU.exe /install /quiet /norestart

REM press any key to continue....
pause

REM  TODO: configure SQL SA account?
REM  TODO: configure SQL login from AD account / local win admin account?
REM  TODO: open firewall for MSSQL to local subnet ?
REM  TODO: open firewall for BigFix to local subnet+ ?
REM  TODO: create local MO account
REM  TODO: BES Admin: create BES Admin Password
REM  TODO: BES Admin: set recommended BES Admin Settings
REM  TODO: BES Admin: create encryption keys for client encryption in BES Admin
REM  TODO: BES Admin: schedule BES Property ID Mapper
REM  TODO: configure REST API creds - Web Reports - etc
REM  TODO: enable sites, subscribe computers
REM  TODO: setup download plugins (deploy Enable Encryption for Clients for root/relays, enable analyses)
REM  TODO: Install BES Server Plugin Service, Configure SOAP API creds, Configure REST API creds
REM  TODO: deploy actions to configure default client settings
REM  TODO: Activate Analyses: Wake-on-LAN Analysis, Download Plug-in Versions, BES Health Checks Analysis, BES Relay Status
REM  TODO: create custom site(s) `Shared` `Dashboards` `Private`
REM  TODO: create roles
REM  TODO: install adobe flash for IE for root or console systems (DISM)
REM  TODO:

Update bigfix_setup_root_eval.bat

Update bigfix_setup_root_eval.bat


@echo off

setlocal enabledelayedexpansion
setlocal enableextensions

set NOJAVA=nojava
if /i "%1" == "install" set NOJAVA=

call "%~dp0elasticsearch-env.bat" %NOJAVA% || exit /b 1

set EXECUTABLE=%ES_HOME%\bin\elasticsearch-service-x64.exe
if "%SERVICE_ID%" == "" set SERVICE_ID=elasticsearch-service-x64
set ARCH=64-bit

if EXIST "%EXECUTABLE%" goto okExe
echo elasticsearch-service-x64.exe was not found...
exit /B 1

:okExe
set ES_VERSION=${project.version}

if "%SERVICE_LOG_DIR%" == "" set SERVICE_LOG_DIR=%ES_HOME%\logs

if "x%1x" == "xx" goto displayUsage
set SERVICE_CMD=%1
shift
if "x%1x" == "xx" goto checkServiceCmd
set SERVICE_ID=%1

:checkServiceCmd

if "%LOG_OPTS%" == "" set LOG_OPTS=--LogPath "%SERVICE_LOG_DIR%" --LogPrefix "%SERVICE_ID%" --StdError auto --StdOutput auto

if /i %SERVICE_CMD% == install goto doInstall
if /i %SERVICE_CMD% == remove goto doRemove
if /i %SERVICE_CMD% == start goto doStart
if /i %SERVICE_CMD% == stop goto doStop
if /i %SERVICE_CMD% == manager goto doManagment
echo Unknown option "%SERVICE_CMD%"
exit /B 1

:displayUsage
echo.
echo Usage: elasticsearch-service.bat install^|remove^|start^|stop^|manager [SERVICE_ID]
goto:eof

:doStart
"%EXECUTABLE%" //ES//%SERVICE_ID% %LOG_OPTS%
if not errorlevel 1 goto started
echo Failed starting '%SERVICE_ID%' service
exit /B 1
goto:eof
:started
echo The service '%SERVICE_ID%' has been started
goto:eof

:doStop
"%EXECUTABLE%" //SS//%SERVICE_ID% %LOG_OPTS%
if not errorlevel 1 goto stopped
echo Failed stopping '%SERVICE_ID%' service
exit /B 1
goto:eof
:stopped
echo The service '%SERVICE_ID%' has been stopped
goto:eof

:doManagment
set EXECUTABLE_MGR=%ES_HOME%\bin\elasticsearch-service-mgr
"%EXECUTABLE_MGR%" //ES//%SERVICE_ID%
if not errorlevel 1 goto managed
echo Failed starting service manager for '%SERVICE_ID%'
exit /B 1
goto:eof
:managed
echo Successfully started service manager for '%SERVICE_ID%'.
goto:eof

:doRemove
rem Remove the service
"%EXECUTABLE%" //DS//%SERVICE_ID% %LOG_OPTS%
if not errorlevel 1 goto removed
echo Failed removing '%SERVICE_ID%' service
exit /B 1
goto:eof
:removed
echo The service '%SERVICE_ID%' has been removed
goto:eof

:doInstall
echo Installing service      :  "%SERVICE_ID%"
echo Using JAVA_HOME (%ARCH%):  "%JAVA_HOME%"

rem Check JVM server dll first
if exist "%JAVA_HOME%\jre\bin\server\jvm.dll" (
	set JVM_DLL=\jre\bin\server\jvm.dll
	goto foundJVM
)

rem Check 'server' JRE (JRE installed on Windows Server)
if exist "%JAVA_HOME%\bin\server\jvm.dll" (
	set JVM_DLL=\bin\server\jvm.dll
	goto foundJVM
) else (
  	echo JAVA_HOME ("%JAVA_HOME%"^) points to an invalid Java installation (no jvm.dll found in "%JAVA_HOME%\jre\bin\server" or "%JAVA_HOME%\bin\server"^). Exiting...
  	goto:eof
)

:foundJVM
if not defined ES_TMPDIR (
  for /f "tokens=* usebackq" %%a in (`CALL %JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.TempDirectory"`) do set ES_TMPDIR=%%a
)

set ES_JVM_OPTIONS=%ES_PATH_CONF%\jvm.options

if not "%ES_JAVA_OPTS%" == "" set ES_JAVA_OPTS=%ES_JAVA_OPTS: =;%

@setlocal
for /F "usebackq delims=" %%a in (`"%JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.JvmOptionsParser" "!ES_JVM_OPTIONS!" || echo jvm_options_parser_failed"`) do set ES_JAVA_OPTS=%%a
@endlocal & set "MAYBE_JVM_OPTIONS_PARSER_FAILED=%ES_JAVA_OPTS%" & set ES_JAVA_OPTS=%ES_JAVA_OPTS%

if "%MAYBE_JVM_OPTIONS_PARSER_FAILED%" == "jvm_options_parser_failed" (
  exit /b 1
)

if not "%ES_JAVA_OPTS%" == "" set ES_JAVA_OPTS=%ES_JAVA_OPTS: =;%

if "%ES_JAVA_OPTS:~-1%"==";" set ES_JAVA_OPTS=%ES_JAVA_OPTS:~0,-1%

echo %ES_JAVA_OPTS%

@setlocal EnableDelayedExpansion
for %%a in ("%ES_JAVA_OPTS:;=","%") do (
  set var=%%a
  if "!var:~1,4!" == "-Xms" (
    set XMS=!var:~5,-1!
    call:convertxm !XMS! JVM_MS
  )
  if "!var:~1,16!" == "-XX:MinHeapSize=" (
    set XMS=!var:~17,-1!
    call:convertxm !XMS! JVM_MS
  )
  if "!var:~1,4!" == "-Xmx" (
    set XMX=!var:~5,-1!
    call:convertxm !XMX! JVM_MX
  )
  if "!var:~1,16!" == "-XX:MaxHeapSize=" (
    set XMX=!var:~17,-1!
    call:convertxm !XMX! JVM_MX
  )
  if "!var:~1,4!" == "-Xss" (
    set XSS=!var:~5,-1!
    call:convertxk !XSS! JVM_SS
  )
  if "!var:~1,20!" == "-XX:ThreadStackSize=" (
    set XSS=!var:~21,-1!
    call:convertxk !XSS! JVM_SS
  )
)
@endlocal & set JVM_MS=%JVM_MS% & set JVM_MX=%JVM_MX% & set JVM_SS=%JVM_SS%

if "%JVM_MS%" == "" (
  echo minimum heap size not set; configure using -Xms via "%ES_JVM_OPTIONS%" or ES_JAVA_OPTS
  goto:eof
)
if "%JVM_MX%" == "" (
  echo maximum heap size not set; configure using -Xmx via "%ES_JVM_OPTIONS%" or ES_JAVA_OPTS
  goto:eof
)
if "%JVM_SS%" == "" (
  echo thread stack size not set; configure using -Xss via "%ES_JVM_OPTIONS%" or ES_JAVA_OPTS
  goto:eof
)

set ES_PARAMS=-Delasticsearch;-Des.path.home="%ES_HOME%";-Des.path.conf="%ES_PATH_CONF%";-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%";-Des.distribution.type="%ES_DISTRIBUTION_TYPE%";-Des.bundled_jdk="%ES_BUNDLED_JDK%"

if "%ES_START_TYPE%" == "" set ES_START_TYPE=manual
if "%ES_STOP_TIMEOUT%" == "" set ES_STOP_TIMEOUT=0

if "%SERVICE_DISPLAY_NAME%" == "" set SERVICE_DISPLAY_NAME=Elasticsearch %ES_VERSION% (%SERVICE_ID%)
if "%SERVICE_DESCRIPTION%" == "" set SERVICE_DESCRIPTION=Elasticsearch %ES_VERSION% Windows Service - https://elastic.co

if not "%SERVICE_USERNAME%" == "" (
	if not "%SERVICE_PASSWORD%" == "" (
		set SERVICE_PARAMS=%SERVICE_PARAMS% --ServiceUser "%SERVICE_USERNAME%" --ServicePassword "%SERVICE_PASSWORD%"
	)
)
"%EXECUTABLE%" //IS//%SERVICE_ID% --Startup %ES_START_TYPE% --StopTimeout %ES_STOP_TIMEOUT% --StartClass org.elasticsearch.bootstrap.Elasticsearch --StartMethod main ++StartParams --quiet --StopClass org.elasticsearch.bootstrap.Elasticsearch --StopMethod close --Classpath "%ES_CLASSPATH%" --JvmMs %JVM_MS% --JvmMx %JVM_MX% --JvmSs %JVM_SS% --JvmOptions %ES_JAVA_OPTS% ++JvmOptions %ES_PARAMS% %LOG_OPTS% --PidFile "%SERVICE_ID%.pid" --DisplayName "%SERVICE_DISPLAY_NAME%" --Description "%SERVICE_DESCRIPTION%" --Jvm "%JAVA_HOME%%JVM_DLL%" --StartMode jvm --StopMode jvm --StartPath "%ES_HOME%" %SERVICE_PARAMS% ++Environment HOSTNAME="%%COMPUTERNAME%%"

if not errorlevel 1 goto installed
echo Failed installing '%SERVICE_ID%' service
exit /B 1
goto:eof

:installed
echo The service '%SERVICE_ID%' has been installed.
goto:eof

:err
echo JAVA_HOME environment variable must be set!
pause
goto:eof

rem ---
rem Function for converting Xm[s|x] values into MB which Commons Daemon accepts
rem ---
:convertxm
set value=%~1
rem extract last char (unit)
set unit=%value:~-1%
rem assume the unit is specified
set conv=%value:~0,-1%

if "%unit%" == "k" goto kilo
if "%unit%" == "K" goto kilo
if "%unit%" == "m" goto mega
if "%unit%" == "M" goto mega
if "%unit%" == "g" goto giga
if "%unit%" == "G" goto giga

rem no unit found, must be bytes; consider the whole value
set conv=%value%
rem convert to KB
set /a conv=%conv% / 1024
:kilo
rem convert to MB
set /a conv=%conv% / 1024
goto mega
:giga
rem convert to MB
set /a conv=%conv% * 1024
:mega
set "%~2=%conv%"
goto:eof

:convertxk
set value=%~1
rem extract last char (unit)
set unit=%value:~-1%
rem assume the unit is specified
set conv=%value:~0,-1%

if "%unit%" == "k" goto kilo
if "%unit%" == "K" goto kilo
if "%unit%" == "m" goto mega
if "%unit%" == "M" goto mega
if "%unit%" == "g" goto giga
if "%unit%" == "G" goto giga

rem no unit found, must be bytes; consider the whole value
set conv=%value%
rem convert to KB
set /a conv=%conv% / 1024
goto kilo
:mega
rem convert to KB
set /a conv=%conv% * 1024
goto kilo
:giga
rem convert to KB
set /a conv=%conv% * 1024 * 1024
:kilo
set "%~2=%conv%"
goto:eof

endlocal
endlocal

exit /b %ERRORLEVEL%

@echo off

setlocal enabledelayedexpansion
setlocal enableextensions

set NOJAVA=nojava
if /i "%1" == "install" set NOJAVA=

call "%~dp0elasticsearch-env.bat" %NOJAVA% || exit /b 1

set EXECUTABLE=%ES_HOME%\bin\elasticsearch-service-x64.exe
if "%SERVICE_ID%" == "" set SERVICE_ID=elasticsearch-service-x64
set ARCH=64-bit

if EXIST "%EXECUTABLE%" goto okExe
echo elasticsearch-service-x64.exe was not found...
exit /B 1

:okExe
set ES_VERSION=${project.version}

if "%SERVICE_LOG_DIR%" == "" set SERVICE_LOG_DIR=%ES_HOME%\logs

if "x%1x" == "xx" goto displayUsage
set SERVICE_CMD=%1
shift
if "x%1x" == "xx" goto checkServiceCmd
set SERVICE_ID=%1

:checkServiceCmd

if "%LOG_OPTS%" == "" set LOG_OPTS=--LogPath "%SERVICE_LOG_DIR%" --LogPrefix "%SERVICE_ID%" --StdError auto --StdOutput auto

if /i %SERVICE_CMD% == install goto doInstall
if /i %SERVICE_CMD% == remove goto doRemove
if /i %SERVICE_CMD% == start goto doStart
if /i %SERVICE_CMD% == stop goto doStop
if /i %SERVICE_CMD% == manager goto doManagment
echo Unknown option "%SERVICE_CMD%"
exit /B 1

:displayUsage
echo.
echo Usage: elasticsearch-service.bat install^|remove^|start^|stop^|manager [SERVICE_ID]
goto:eof

:doStart
"%EXECUTABLE%" //ES//%SERVICE_ID% %LOG_OPTS%
if not errorlevel 1 goto started
echo Failed starting '%SERVICE_ID%' service
exit /B 1
goto:eof
:started
echo The service '%SERVICE_ID%' has been started
goto:eof

:doStop
"%EXECUTABLE%" //SS//%SERVICE_ID% %LOG_OPTS%
if not errorlevel 1 goto stopped
echo Failed stopping '%SERVICE_ID%' service
exit /B 1
goto:eof
:stopped
echo The service '%SERVICE_ID%' has been stopped
goto:eof

:doManagment
set EXECUTABLE_MGR=%ES_HOME%\bin\elasticsearch-service-mgr
"%EXECUTABLE_MGR%" //ES//%SERVICE_ID%
if not errorlevel 1 goto managed
echo Failed starting service manager for '%SERVICE_ID%'
exit /B 1
goto:eof
:managed
echo Successfully started service manager for '%SERVICE_ID%'.
goto:eof

:doRemove
rem Remove the service
"%EXECUTABLE%" //DS//%SERVICE_ID% %LOG_OPTS%
if not errorlevel 1 goto removed
echo Failed removing '%SERVICE_ID%' service
exit /B 1
goto:eof
:removed
echo The service '%SERVICE_ID%' has been removed
goto:eof

:doInstall
echo Installing service      :  "%SERVICE_ID%"
echo Using JAVA_HOME (%ARCH%):  "%JAVA_HOME%"

rem Check JVM server dll first
if exist "%JAVA_HOME%\jre\bin\server\jvm.dll" (
	set JVM_DLL=\jre\bin\server\jvm.dll
	goto foundJVM
)

rem Check 'server' JRE (JRE installed on Windows Server)
if exist "%JAVA_HOME%\bin\server\jvm.dll" (
	set JVM_DLL=\bin\server\jvm.dll
	goto foundJVM
) else (
  	echo JAVA_HOME ("%JAVA_HOME%"^) points to an invalid Java installation (no jvm.dll found in "%JAVA_HOME%\jre\bin\server" or "%JAVA_HOME%\bin\server"^). Exiting...
  	goto:eof
)

:foundJVM
if not defined ES_TMPDIR (
  for /f "tokens=* usebackq" %%a in (`CALL %JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.TempDirectory"`) do set ES_TMPDIR=%%a
)

set ES_JVM_OPTIONS=%ES_PATH_CONF%\jvm.options

if not "%ES_JAVA_OPTS%" == "" set ES_JAVA_OPTS=%ES_JAVA_OPTS: =;%

@setlocal
for /F "usebackq delims=" %%a in (`"%JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.JvmOptionsParser" "!ES_JVM_OPTIONS!" || echo jvm_options_parser_failed"`) do set ES_JAVA_OPTS=%%a
@endlocal & set "MAYBE_JVM_OPTIONS_PARSER_FAILED=%ES_JAVA_OPTS%" & set ES_JAVA_OPTS=%ES_JAVA_OPTS%

if "%MAYBE_JVM_OPTIONS_PARSER_FAILED%" == "jvm_options_parser_failed" (
  exit /b 1
)

if not "%ES_JAVA_OPTS%" == "" set ES_JAVA_OPTS=%ES_JAVA_OPTS: =;%

if "%ES_JAVA_OPTS:~-1%"==";" set ES_JAVA_OPTS=%ES_JAVA_OPTS:~0,-1%

echo %ES_JAVA_OPTS%

@setlocal EnableDelayedExpansion
for %%a in ("%ES_JAVA_OPTS:;=","%") do (
  set var=%%a
  set other_opt=true
  if "!var:~1,4!" == "-Xms" (
    set XMS=!var:~5,-1!
    set other_opt=false
    call:convertxm !XMS! JVM_MS
  )
  if "!var:~1,16!" == "-XX:MinHeapSize=" (
    set XMS=!var:~17,-1!
    set other_opt=false
    call:convertxm !XMS! JVM_MS
  )
  if "!var:~1,4!" == "-Xmx" (
    set XMX=!var:~5,-1!
    set other_opt=false
    call:convertxm !XMX! JVM_MX
  )
  if "!var:~1,16!" == "-XX:MaxHeapSize=" (
    set XMX=!var:~17,-1!
    set other_opt=false
    call:convertxm !XMX! JVM_MX
  )
  if "!var:~1,4!" == "-Xss" (
    set XSS=!var:~5,-1!
    set other_opt=false
    call:convertxk !XSS! JVM_SS
  )
  if "!var:~1,20!" == "-XX:ThreadStackSize=" (
    set XSS=!var:~21,-1!
    set other_opt=false
    call:convertxk !XSS! JVM_SS
  )
  if "!other_opt!" == "true" set OTHER_JAVA_OPTS=!OTHER_JAVA_OPTS!;!var!
)
@endlocal & set JVM_MS=%JVM_MS% & set JVM_MX=%JVM_MX% & set JVM_SS=%JVM_SS% & set OTHER_JAVA_OPTS=%OTHER_JAVA_OPTS%

if "%JVM_MS%" == "" (
  echo minimum heap size not set; configure using -Xms via "%ES_JVM_OPTIONS%" or ES_JAVA_OPTS
  goto:eof
)
if "%JVM_MX%" == "" (
  echo maximum heap size not set; configure using -Xmx via "%ES_JVM_OPTIONS%" or ES_JAVA_OPTS
  goto:eof
)
if "%JVM_SS%" == "" (
  echo thread stack size not set; configure using -Xss via "%ES_JVM_OPTIONS%" or ES_JAVA_OPTS
  goto:eof
)
set OTHER_JAVA_OPTS=%OTHER_JAVA_OPTS:"=%
set OTHER_JAVA_OPTS=%OTHER_JAVA_OPTS:~1%

set ES_PARAMS=-Delasticsearch;-Des.path.home="%ES_HOME%";-Des.path.conf="%ES_PATH_CONF%";-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%";-Des.distribution.type="%ES_DISTRIBUTION_TYPE%";-Des.bundled_jdk="%ES_BUNDLED_JDK%"

if "%ES_START_TYPE%" == "" set ES_START_TYPE=manual
if "%ES_STOP_TIMEOUT%" == "" set ES_STOP_TIMEOUT=0

if "%SERVICE_DISPLAY_NAME%" == "" set SERVICE_DISPLAY_NAME=Elasticsearch %ES_VERSION% (%SERVICE_ID%)
if "%SERVICE_DESCRIPTION%" == "" set SERVICE_DESCRIPTION=Elasticsearch %ES_VERSION% Windows Service - https://elastic.co

if not "%SERVICE_USERNAME%" == "" (
	if not "%SERVICE_PASSWORD%" == "" (
		set SERVICE_PARAMS=%SERVICE_PARAMS% --ServiceUser "%SERVICE_USERNAME%" --ServicePassword "%SERVICE_PASSWORD%"
	)
)
"%EXECUTABLE%" //IS//%SERVICE_ID% --Startup %ES_START_TYPE% --StopTimeout %ES_STOP_TIMEOUT% --StartClass org.elasticsearch.bootstrap.Elasticsearch --StartMethod main ++StartParams --quiet --StopClass org.elasticsearch.bootstrap.Elasticsearch --StopMethod close --Classpath "%ES_CLASSPATH%" --JvmMs %JVM_MS% --JvmMx %JVM_MX% --JvmSs %JVM_SS% --JvmOptions %OTHER_JAVA_OPTS% ++JvmOptions %ES_PARAMS% %LOG_OPTS% --PidFile "%SERVICE_ID%.pid" --DisplayName "%SERVICE_DISPLAY_NAME%" --Description "%SERVICE_DESCRIPTION%" --Jvm "%JAVA_HOME%%JVM_DLL%" --StartMode jvm --StopMode jvm --StartPath "%ES_HOME%" %SERVICE_PARAMS% ++Environment HOSTNAME="%%COMPUTERNAME%%"

if not errorlevel 1 goto installed
echo Failed installing '%SERVICE_ID%' service
exit /B 1
goto:eof

:installed
echo The service '%SERVICE_ID%' has been installed.
goto:eof

:err
echo JAVA_HOME environment variable must be set!
pause
goto:eof

rem ---
rem Function for converting Xm[s|x] values into MB which Commons Daemon accepts
rem ---
:convertxm
set value=%~1
rem extract last char (unit)
set unit=%value:~-1%
rem assume the unit is specified
set conv=%value:~0,-1%

if "%unit%" == "k" goto kilo
if "%unit%" == "K" goto kilo
if "%unit%" == "m" goto mega
if "%unit%" == "M" goto mega
if "%unit%" == "g" goto giga
if "%unit%" == "G" goto giga

rem no unit found, must be bytes; consider the whole value
set conv=%value%
rem convert to KB
set /a conv=%conv% / 1024
:kilo
rem convert to MB
set /a conv=%conv% / 1024
goto mega
:giga
rem convert to MB
set /a conv=%conv% * 1024
:mega
set "%~2=%conv%"
goto:eof

:convertxk
set value=%~1
rem extract last char (unit)
set unit=%value:~-1%
rem assume the unit is specified
set conv=%value:~0,-1%

if "%unit%" == "k" goto kilo
if "%unit%" == "K" goto kilo
if "%unit%" == "m" goto mega
if "%unit%" == "M" goto mega
if "%unit%" == "g" goto giga
if "%unit%" == "G" goto giga

rem no unit found, must be bytes; consider the whole value
set conv=%value%
rem convert to KB
set /a conv=%conv% / 1024
goto kilo
:mega
rem convert to KB
set /a conv=%conv% * 1024
goto kilo
:giga
rem convert to KB
set /a conv=%conv% * 1024 * 1024
:kilo
set "%~2=%conv%"
goto:eof

endlocal
endlocal

exit /b %ERRORLEVEL%

Remove parsed JVM settings from general settings (#49061)

The Apache Commons Daemon has some helpful features for Java
applications, like nice little next boxes for min heap, max heap, and
thread stack size. Our elasticsearch-service.bat script parses those
values out of the ES_JAVA_OPTS environment variable and provides them to
the Apache Commons Daemon invocation command in order to provide
sensible defaults. However, we failed to remove those values from the
ES_JAVA_OPTS environment variable, which meant they ended up in the
"Java Options" text box and would, from there, override whatever the
user put in the specific boxes for heap size or thread stack size.

This commit modifies the loop that parses ES_JAVA_OPTS to construct a
new enviroment variable containing only the values that aren't parsed
out for heap size or thread stack size, then uses that new enviroment
variable in the commons daemon invocation command.


@echo off

:: Set up Visual Studio command line environment variables given a
:: machine type, e.g., amd64 or x86.

:: Visual Studio 2017 Enterprise
set BATDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build
if exist "%BATDIR%\vcvarsall.bat" goto found

:: Visual Studio 2017 Professional
set BATDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build
if exist "%BATDIR%\vcvarsall.bat" goto found

:: Visual Studio 2017 Community
set BATDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
if exist "%BATDIR%\vcvarsall.bat" goto found

:: Visual Studio 2017 BuildTools
set BATDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build
if exist "%BATDIR%\vcvarsall.bat" goto found

:: Visual Studio 2015
set BATDIR=%VS140COMNTOOLS%..\..\VC
if exist "%BATDIR%\vcvarsall.bat" goto found

echo Visual Studio 2017 or 2015 must be installed.
exit 1

:found

:: Clear environment variables that we might otherwise inherit
set INCLUDE=
set LIB=
set LIBPATH=

:: Visual Studio 2017's vcvarsall.bat changes the directory to %USERPROFILE%\Source if the directory exists. See https://developercommunity.visualstudio.com/content/problem/26780/vsdevcmdbat-changes-the-current-working-directory.html
set VSCMD_START_DIR=%CD%
"%BATDIR%\vcvarsall.bat" %1

@echo off
set Applications=%ProgramFiles(x86)%
if not "%Applications%" == "" goto win64
set Applications=%ProgramFiles%
:win64

:: Set up Visual Studio command line environment variables given a
:: machine type, e.g., amd64 or x86.

:: Visual Studio 2017 Enterprise
set BATDIR=%Applications%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build
if exist "%BATDIR%\vcvarsall.bat" goto found

:: Visual Studio 2017 Professional
set BATDIR=%Applications%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build
if exist "%BATDIR%\vcvarsall.bat" goto found

:: Visual Studio 2017 Community
set BATDIR=%Applications%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
if exist "%BATDIR%\vcvarsall.bat" goto found

:: Visual Studio 2017 BuildTools
set BATDIR=%Applications%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build
if exist "%BATDIR%\vcvarsall.bat" goto found

:: Visual Studio 2015
set BATDIR=%VS140COMNTOOLS%..\..\VC
if exist "%BATDIR%\vcvarsall.bat" goto found

echo Visual Studio 2017 or 2015 must be installed.
exit 1

:found

:: Clear environment variables that we might otherwise inherit
set INCLUDE=
set LIB=
set LIBPATH=

:: Visual Studio 2017's vcvarsall.bat changes the directory to %USERPROFILE%\Source if the directory exists. See https://developercommunity.visualstudio.com/content/problem/26780/vsdevcmdbat-changes-the-current-working-directory.html
set VSCMD_START_DIR=%CD%
"%BATDIR%\vcvarsall.bat" %1

fix c/vs.bat to work on 32-bit Windows

fix c/vs.bat to work on 32-bit Windows


@ECHO OFF

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
	set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
	set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)

if "%1" == "" goto help

if "%1" == "help" (
	:help
	echo.Please use `make ^<target^>` where ^<target^> is one of
	echo.  all               to make standalone HTML files
	echo.  html              to make standalone HTML files
	echo.  dirhtml           to make HTML files named index.html in directories
	echo.  singlehtml        to make a single large HTML file
	echo.  pickle            to make pickle files
	echo.  json              to make JSON files
	echo.  htmlhelp          to make HTML files and a HTML help project
	echo.  qthelp            to make HTML files and a qthelp project
	echo.  devhelp           to make HTML files and a Devhelp project
	echo.  epub              to make an epub
	echo.  latex             to make LaTeX files, you can set PAPER=a4 or PAPER=letter
	echo.  text              to make text files
	echo.  man               to make manual pages
	echo.  texinfo           to make Texinfo files
	echo.  gettext           to make PO message catalogs
	echo.  changes           to make an overview over all changed/added/deprecated items
	echo.  linkcheck         to check all external links for integrity
	echo.  doctest           to run all doctests embedded in the documentation if enabled

	goto end
)

if "%1" == "clean" (
	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
	del /q /s %BUILDDIR%\*
	goto end
)

if "%1" == "all" (
    make html
)

if "%1" == "html" (
	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%\html

	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
	goto end
)

if "%1" == "dirhtml" (
	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
	goto end
)

if "%1" == "singlehtml" (
	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
	goto end
)

if "%1" == "pickle" (
	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can process the pickle files.
	goto end
)

if "%1" == "json" (
	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can process the JSON files.
	goto end
)

if "%1" == "htmlhelp" (
	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
	goto end
)

if "%1" == "qthelp" (
	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Bokeh.qhcp
	echo.To view the help file:
	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Bokeh.ghc
	goto end
)

if "%1" == "devhelp" (
	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished.
	goto end
)

if "%1" == "epub" (
	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The epub file is in %BUILDDIR%/epub.
	goto end
)

if "%1" == "latex" (
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "text" (
	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The text files are in %BUILDDIR%/text.
	goto end
)

if "%1" == "man" (
	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The manual pages are in %BUILDDIR%/man.
	goto end
)

if "%1" == "texinfo" (
	%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
	goto end
)

if "%1" == "gettext" (
	%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
	goto end
)

if "%1" == "changes" (
	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
	if errorlevel 1 exit /b 1
	echo.
	echo.The overview file is in %BUILDDIR%/changes.
	goto end
)

if "%1" == "linkcheck" (
	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
	if errorlevel 1 exit /b 1
	echo.
	echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
	goto end
)

if "%1" == "doctest" (
	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
	if errorlevel 1 exit /b 1
	echo.
	echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
	goto end
)

:end

@ECHO OFF

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
	set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
	set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)

if "%1" == "" goto help

if "%1" == "help" (
	:help
	echo.Please use `make ^<target^>` where ^<target^> is one of
	echo.  all               to make standalone HTML files
	echo.  html              to make standalone HTML files
	echo.  dirhtml           to make HTML files named index.html in directories
	echo.  singlehtml        to make a single large HTML file
	echo.  pickle            to make pickle files
	echo.  json              to make JSON files
	echo.  htmlhelp          to make HTML files and a HTML help project
	echo.  qthelp            to make HTML files and a qthelp project
	echo.  devhelp           to make HTML files and a Devhelp project
	echo.  epub              to make an epub
	echo.  latex             to make LaTeX files, you can set PAPER=a4 or PAPER=letter
	echo.  text              to make text files
	echo.  man               to make manual pages
	echo.  texinfo           to make Texinfo files
	echo.  gettext           to make PO message catalogs
	echo.  changes           to make an overview over all changed/added/deprecated items
	echo.  linkcheck         to check all external links for integrity
	echo.  doctest           to run all doctests embedded in the documentation if enabled

	goto end
)

if "%1" == "clean" (
	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
	del /q /s %BUILDDIR%\*
	goto end
)

if "%1" == "all" (
    make html
)

if "%1" == "html" (
	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%\html

	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
	goto end
)

if "%1" == "dirhtml" (
	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
	goto end
)

if "%1" == "singlehtml" (
	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
	goto end
)

if "%1" == "pickle" (
	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can process the pickle files.
	goto end
)

if "%1" == "json" (
	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can process the JSON files.
	goto end
)

if "%1" == "htmlhelp" (
	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
	goto end
)

if "%1" == "qthelp" (
	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Bokeh.qhcp
	echo.To view the help file:
	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Bokeh.ghc
	goto end
)

if "%1" == "devhelp" (
	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished.
	goto end
)

if "%1" == "epub" (
	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The epub file is in %BUILDDIR%/epub.
	goto end
)

if "%1" == "latex" (
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "text" (
	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The text files are in %BUILDDIR%/text.
	goto end
)

if "%1" == "man" (
	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The manual pages are in %BUILDDIR%/man.
	goto end
)

if "%1" == "texinfo" (
	%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
	goto end
)

if "%1" == "gettext" (
	%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
	goto end
)

if "%1" == "changes" (
	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
	if errorlevel 1 exit /b 1
	echo.
	echo.The overview file is in %BUILDDIR%/changes.
	goto end
)

if "%1" == "linkcheck" (
	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
	if errorlevel 1 exit /b 1
	echo.
	echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
	goto end
)

if "%1" == "doctest" (
	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
	if errorlevel 1 exit /b 1
	echo.
	echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
	goto end
)

if "%1" == "serve" (
	python docserver.py
	if errorlevel 1 exit /b 1
	goto end
)

:end

add serve subcommand to make.bat in Sphinx docs


start javaw -Xmx400m -jar failchat-${project.version}.jar

start javaw -Xmx300m -jar failchat-${project.version}.jar

Change heap size to 300mb in failchat.bat


@echo off

if "%1" == "/wait" (
 set MAYBE_WAIT=/wait
 shift
) else (
 set MAYBE_WAIT=
)

call Set_Environment_Vars

rem If the lisp files used to build specware are missing, recover them.
if not exist "%SPECWARE4%/Applications/Specware/lisp/Specware4.lisp" (
 cd "%SPECWARE4%/Applications/Specware/"
 tar -xvf SpecwareLispFiles.tgz
 cd "%SPECWARE4%"
)

rem  Start Emacs or XEmacs, loading various files and performing the action given as argument (i.e. '%1'):

echo start "ignore, do not kill" %MAYBE_WAIT% "%EMACS_EXECUTABLE%" %EMACS_INIT% -f '%1'

start "ignore, do not kill" %MAYBE_WAIT% "%EMACS_EXECUTABLE%" %EMACS_INIT% -f '%1'

@echo off

if "%1" == "/wait" (
 set MAYBE_WAIT=/wait
 shift
) else (
 set MAYBE_WAIT=
)

call Set_Environment_Vars

rem If the lisp files used to build specware are missing, recover them.
if not exist "%SPECWARE4%/Applications/Specware/lisp/Specware4.lisp" (
 cd "%SPECWARE4%/Applications/Specware/"
 tar -xvf SpecwareLispFiles.tgz
 cd "%SPECWARE4%"
)

rem  Start Emacs or XEmacs, loading various files and performing the action given as argument (i.e. '%1'):

echo start "ignore, do not kill" %MAYBE_WAIT% "%EMACS_EXECUTABLE%" %EMACS_INIT% -f %1

start "ignore, do not kill" %MAYBE_WAIT% "%EMACS_EXECUTABLE%" %EMACS_INIT% -f %1

Remove excessive ''s

Remove excessive ''s

git-svn-id: 9ecf60ce9baff443e30a0472d3fd222fcb8117cf@7592 7b97033b-253e-4a5c-9b07-e25f9089a9fd


@echo off
set tools_version=2.0.0-preview20201108002
set appcast_path=%UserProfile%\.nuget\packages\netsparkleupdater.tools\%tools_version%\tools\windows\generate_appcast.exe
set appcast_output=%cd%\UnrealBinaryBuilderUpdater
set appcast_binary=%cd%\Output
set appcast_mainexe=%appcast_binary%\UnrealBinaryBuilder.exe
set appcast_release=https://github.com/ryanjon2040/UE4-Binary-Builder/releases/download/3.1.2/UnrealBinaryBuilder.v3.1.2.zip
set appcast_changelog=https://raw.githubusercontent.com/ryanjon2040/UE4-Binary-Builder/master/CHANGELOG.md
set appcast_default_key_path=%localappdata%\netsparkle

set default_option=0
echo 1 for export-keys
echo 2 for force generate keys
echo 3 for verifying
echo 4 for generating appcast
set /p option=What would you like to do?:

echo %option%
if %option% == 1 (
    %appcast_path% --export true
) else if %option% == 2 (
    %appcast_path% --generate-keys --force true
    %SystemRoot%\explorer.exe appcast_default_key_path
    %appcast_path% --export true
) else if %option% == 3 (
    set /p input_signature=Input your signature
    %appcast_path% --verify "%appcast_mainexe%" --signature %input_signature%
) else if %option% == 4 (
    if exist %appcast_path% (
        echo Generating appcast.xml...
    	%appcast_path% -a "%appcast_output%" -b "%appcast_binary%" -e exe -o windows -u %appcast_release% -l %appcast_changelog% -n "Unreal Binary Builder" --key-path "%appcast_output%\keys"
    	echo Done.
    ) else (
    	echo generate_appcast.exe was not found.
    )
)

pause

@echo off
set tools_version=2.0.0-preview20201108002
set appcast_path=%UserProfile%\.nuget\packages\netsparkleupdater.tools\%tools_version%\tools\windows\generate_appcast.exe
set appcast_output=%cd%\UnrealBinaryBuilderUpdater
set appcast_binary=%cd%\Output
set appcast_mainexe=%appcast_binary%\UnrealBinaryBuilder.exe
set appcast_version=3.1.3
set appcast_release=https://github.com/ryanjon2040/UE4-Binary-Builder/releases/download/%appcast_version%/UnrealBinaryBuilder.v%appcast_version%.zip
set appcast_changelog=https://raw.githubusercontent.com/ryanjon2040/UE4-Binary-Builder/master/CHANGELOG.md
set appcast_default_key_path=%localappdata%\netsparkle

set default_option=0
echo 1 for export-keys
echo 2 for force generate keys
echo 3 for verifying
echo 4 for generating appcast
set /p option=What would you like to do?:

echo %option%
if %option% == 1 (
    %appcast_path% --export true
) else if %option% == 2 (
    %appcast_path% --generate-keys --force true
    %SystemRoot%\explorer.exe appcast_default_key_path
    %appcast_path% --export true
) else if %option% == 3 (
    set /p input_signature=Input your signature
    %appcast_path% --verify "%appcast_mainexe%" --signature %input_signature%
) else if %option% == 4 (
    if exist %appcast_path% (
        echo Generating appcast.xml...
    	%appcast_path% -a "%appcast_output%" -b "%appcast_binary%" -e exe -o windows -u %appcast_release% -l %appcast_changelog% -n "Unreal Binary Builder" --key-path "%appcast_output%\keys"
    	echo Done.
    ) else (
    	echo generate_appcast.exe was not found.
    )
)

pause

Update generate_appcast bat file

Update generate_appcast bat file


@echo off
setlocal

md build_MSI
cd build_MSI

set VIEWER_BUILDDIR=%1
set PROGRAM_NAME=Firestorm_x64
set CHANNEL_NAME=%2
set SETTINGS_FILE=%4
set PROGRAM_FILE=Firestorm-bin.exe
set PROGRAM_VERSION=%2
set PLUGIN_SOURCEDIR=%VIEWER_BUILDDIR%
set OUTPUT_FILE=%5

set MAJOR=%6
set MINOR=%7
set HGCHANGE=%9

set PATH=%PATH%;%1\..\..\packages\bin\wix

heat dir %VIEWER_BUILDDIR%\character -gg -cg fs_character -var var.BUILDDIR -dr INSTALLDIR -out character.wxs
heat dir %VIEWER_BUILDDIR%\fonts -gg -cg fs_fonts -var var.BUILDDIR -dr INSTALLDIR -out fonts.wxs
heat dir %VIEWER_BUILDDIR%\fs_resources -gg -cg fs_fsres -var var.BUILDDIR -dr INSTALLDIR -out fs_resources.wxs

python %~dp0\compress_assets.py %VIEWER_BUILDDIR%\skins %VIEWER_BUILDDIR%\skins
python %~dp0\compress_assets.py %VIEWER_BUILDDIR%\app_settings %VIEWER_BUILDDIR%\app_settings

candle -dBUILDDIR=%VIEWER_BUILDDIR%\character character.wxs
candle -dBUILDDIR=%VIEWER_BUILDDIR%\fonts fonts.wxs
candle -dBUILDDIR=%VIEWER_BUILDDIR%\fs_resources fs_resources.wxs

candle -dPLUGIN_SOURCEDIR=%PLUGIN_SOURCEDIR% %~dp0\llplugin.wxs
candle -dPROGRAM_FILE=%PROGRAM_FILE% -dMAJOR=%MAJOR% -dMINOR=%MINOR% -dHGCHANGE=%HGCHANGE% -dBUILDDIR=%VIEWER_BUILDDIR%\ -dWIX_SOURCEDIR=%~dp0 %~dp0\firestorm.wxs
candle -dPROGRAM_FILE=%PROGRAM_FILE% -dPROGRAM_VERSION=%PROGRAM_VERSION% -dCHANNEL_NAME=%CHANNEL_NAME% -dSETTINGS_FILE=%SETTINGS_FILE% -dPROGRAM_NAME=%PROGRAM_NAME% -dBUILDDIR=%VIEWER_BUILDDIR%\ %~dp0\registry.wxs

light -sval -ext WixUIExtension -cultures:en-us -out %VIEWER_BUILDDIR%\%OUTPUT_FILE% firestorm.wixobj app_settings.wixobj character.wixobj fonts.wixobj fs_resources.wixobj llplugin.wixobj registry.wixobj

@echo off
setlocal

md build_MSI
cd build_MSI

set VIEWER_BUILDDIR=%1
set PROGRAM_NAME=Firestorm_x64
set CHANNEL_NAME=%2
set SETTINGS_FILE=%4
set PROGRAM_FILE=Firestorm-bin.exe
set PROGRAM_VERSION=%2
set PLUGIN_SOURCEDIR=%VIEWER_BUILDDIR%
set OUTPUT_FILE=%5

set MAJOR=%6
set MINOR=%7
set HGCHANGE=%9

set PATH=%PATH%;%1\..\..\packages\bin\wix

heat dir %VIEWER_BUILDDIR%\character -gg -cg fs_character -var var.BUILDDIR -dr INSTALLDIR -out character.wxs
heat dir %VIEWER_BUILDDIR%\fonts -gg -cg fs_fonts -var var.BUILDDIR -dr INSTALLDIR -out fonts.wxs
heat dir %VIEWER_BUILDDIR%\fs_resources -gg -cg fs_fsres -var var.BUILDDIR -dr INSTALLDIR -out fs_resources.wxs

python %~dp0\compress_assets.py %VIEWER_BUILDDIR%\skins %VIEWER_BUILDDIR%\skins
python %~dp0\compress_assets.py %VIEWER_BUILDDIR%\app_settings %VIEWER_BUILDDIR%\app_settings

candle -dBUILDDIR=%VIEWER_BUILDDIR%\character character.wxs
candle -dBUILDDIR=%VIEWER_BUILDDIR%\fonts fonts.wxs
candle -dBUILDDIR=%VIEWER_BUILDDIR%\fs_resources fs_resources.wxs

candle -dPLUGIN_SOURCEDIR=%PLUGIN_SOURCEDIR% %~dp0\llplugin.wxs
candle -dPROGRAM_FILE=%PROGRAM_FILE% -dMAJOR=%MAJOR% -dMINOR=%MINOR% -dHGCHANGE=%HGCHANGE% -dBUILDDIR=%VIEWER_BUILDDIR%\ -dWIX_SOURCEDIR=%~dp0 %~dp0\firestorm.wxs
candle -dPROGRAM_FILE=%PROGRAM_FILE% -dPROGRAM_VERSION=%PROGRAM_VERSION% -dCHANNEL_NAME=%CHANNEL_NAME% -dSETTINGS_FILE=%SETTINGS_FILE% -dPROGRAM_NAME=%PROGRAM_NAME% -dBUILDDIR=%VIEWER_BUILDDIR%\ %~dp0\registry.wxs

light -sval -ext WixUIExtension -cultures:en-us -out %VIEWER_BUILDDIR%\%OUTPUT_FILE% firestorm.wixobj character.wixobj fonts.wixobj fs_resources.wixobj llplugin.wixobj registry.wixobj

remove app_settings from light call.

remove app_settings from light call.


java -cp javax.mail.jar;sigar.jar;jna.jar;jna-plat.jar;rserver.jar com.ea.rserver.RServer

Create Run.bat

Create Run.bat


echo off

set PATH=%1
set PORT=%2

%PATH%/JWBLoader.exe --verbose dfu serial --package=%PATH%/JWB_update_1_01a.zip --port=%PORT% --baudrate=38400
%PATH%/JWBLoader.exe --verbose dfu serial --package=%PATH%/JWB_update_1_01b.zip --port=%PORT% --baudrate=38400

echo off

set PATH=%1
set PORT=%2

%PATH%/JWBLoader.exe  dfu serial --package=%PATH%/JWB_update_1_01a.zip --port=%PORT% --baudrate=38400
%PATH%/JWBLoader.exe  dfu serial --package=%PATH%/JWB_update_1_01b.zip --port=%PORT% --baudrate=38400

test without verbose on

test without verbose on