@echo off

:: Init Script for cmd.exe
:: Created as part of cmder project

:: !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
:: !!! Use "%CMDER_ROOT%\config\user-profile.cmd" to add your own startup commands

:: Set to > 0 for verbose output to aid in debugging.
set verbose-output=0

:: Find root dir
if not defined CMDER_ROOT (
    for /f "delims=" %%i in ("%ConEmuDir%\..\..") do set "CMDER_ROOT=%%~fi"
)

:: Remove trailing '\'
if "%CMDER_ROOT:~-1%" == "\" SET "CMDER_ROOT=%CMDER_ROOT:~0,-1%"

:: Change the prompt style
:: Mmm tasty lamb
prompt $E[1;32;40m$P$S{git}{hg}$S$_$E[1;30;40m{lamb}$S$E[0m

:: Pick right version of clink
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
    set architecture=86
) else (
    set architecture=64
)

:: Tell the user about the clink config files...
if not exist "%CMDER_ROOT%\config\settings" (
    echo Generating clink initial settings in "%CMDER_ROOT%\config\settings"
    echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup.
)

:: Run clink
"%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor"

:: Prepare for git-for-windows

:: I do not even know, copypasted from their .bat
set PLINK_PROTOCOL=ssh
if not defined TERM set TERM=cygwin

:: The idea:
:: * if the users points as to a specific git, use that
:: * test if a git is in path and if yes, use that
:: * last, use our vendored git
:: also check that we have a recent enough version of git (e.g. test for GIT\cmd\git.exe)
if defined GIT_INSTALL_ROOT (
    if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" (goto :FOUND_GIT)
)

:: check if git is in path...
setlocal enabledelayedexpansion
for /F "delims=" %%F in ('where git.exe 2^>nul') do @(
    pushd %%~dpF
    cd ..
    set "test_dir=!CD!"
    popd
    if exist "!test_dir!\cmd\git.exe" (
        set "GIT_INSTALL_ROOT=!test_dir!"
        set test_dir=
        goto :FOUND_GIT
    ) else (
        echo Found old git version in "!test_dir!", but not using...
        set test_dir=
    )
)

:: our last hope: our own git...
:VENDORED_GIT
if exist "%CMDER_ROOT%\vendor\git-for-windows" (
    set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows"
    call :verbose-output Add the minimal git commands to the front of the path
    set "PATH=!GIT_INSTALL_ROOT!\cmd;%PATH%"
) else (
    goto :NO_GIT
)

:FOUND_GIT
:: Add git to the path
if defined GIT_INSTALL_ROOT (
    rem add the unix commands at the end to not shadow windows commands like more
    call :verbose-output Enhancing PATH with unix commands from git in "%GIT_INSTALL_ROOT%\usr\bin"
    set "PATH=%PATH%;%GIT_INSTALL_ROOT%\usr\bin;%GIT_INSTALL_ROOT%\usr\share\vim\vim74"
    :: define SVN_SSH so we can use git svn with ssh svn repositories
    if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"
)

:NO_GIT
endlocal & set "PATH=%PATH%" & set "SVN_SSH=%SVN_SSH%" & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%"

:: Enhance Path
set "PATH=%CMDER_ROOT%\bin;%PATH%;%CMDER_ROOT%\"

:: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d"
:: to run them at startup.
if not exist "%CMDER_ROOT%\config\profile.d" (
  mkdir "%CMDER_ROOT%\config\profile.d"
)

pushd "%CMDER_ROOT%\config\profile.d"
for /f "usebackq" %%x in ( `dir /b *.bat *.cmd 2^>nul` ) do (
  call :verbose-output Calling "%CMDER_ROOT%\config\profile.d\%%x"...
  call "%CMDER_ROOT%\config\profile.d\%%x"
)
popd

:: Allows user to override default aliases store using profile.d
:: scripts run above by setting the 'alaises' env variable.
::
:: Note: If overriding default aliases store file the aliases
:: must also be self executing, see '.\user-aliases.cmd.example',
:: and be in profile.d folder.
set "user-aliases=%CMDER_ROOT%\config\user-aliases.cmd"

:: The aliases environment variable is used by alias.bat to id
:: the default file to store new aliases in.
if not defined aliases (
  set "aliases=%user-aliases%"
)

:: Make sure we have a self-extracting user-aliases.cmd file
setlocal enabledelayedexpansion
if not exist "%user-aliases%" (
    echo Creating intial user-aliases store in "%user-aliases%"...
    copy "%CMDER_ROOT%\vendor\user-aliases.cmd.example" "%user-aliases%"
) else (
    type "%user-aliases%" | findstr /i ";= Add aliases below here" >nul
    if "!errorlevel!" == "1" (
        echo Creating intial user-aliases store in "%user-aliases%"...
        copy "%CMDER_ROOT%\%user-aliases%" "%user-aliases%.old_format"
        copy "%CMDER_ROOT%\vendor\user-aliases.cmd.example" "%user-aliases%"
    )
)

:: Update old 'user-aliases' to new self executing 'user-aliases.cmd'
if exist "%CMDER_ROOT%\config\aliases" (
  echo Updating old "%CMDER_ROOT%\config\aliases" to new format...
  type "%CMDER_ROOT%\config\aliases" >> "%user-aliases%" && del "%CMDER_ROOT%\config\aliases"
) else if exist "%user-aliases%.old_format" (
  echo Updating old "%user-aliases%" to new format...
  type "%user-aliases%.old_format" >> "%user-aliases%" && del "%user-aliases%.old_format"
)
endlocal
:: Add aliases to the environment
call "%user-aliases%"

:: See vendor\git-for-windows\README.portable for why we do this
:: Basically we need to execute this post-install.bat because we are
:: manually extracting the archive rather than executing the 7z sfx
if exist "%CMDER_ROOT%\vendor\git-for-windows\post-install.bat" (
    call :verbose-output Running Git for Windows one time Post Install....
    cd /d "%CMDER_ROOT%\vendor\git-for-windows\"
    "%CMDER_ROOT%\vendor\git-for-windows\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat
    cd /d %USERPROFILE%
)

:: Set home path
if not defined HOME set "HOME=%USERPROFILE%"

:: This is either a env variable set by the user or the result of
:: cmder.exe setting this variable due to a commandline argument or a "cmder here"
if defined CMDER_START (
    cd /d "%CMDER_START%"
)

if exist "%CMDER_ROOT%\config\user-profile.cmd" (
    REM Create this file and place your own command in there
    call "%CMDER_ROOT%\config\user-profile.cmd"
) else (
    echo Creating user startup file: "%CMDER_ROOT%\config\user-profile.cmd"
    (
    echo :: use this file to run your own startup commands
    echo :: use  in front of the command to prevent printing the command
    echo.
    echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd"
    echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%"
    echo.
    ) > "%CMDER_ROOT%\config\user-profile.cmd"
)

exit /b

::
:: sub-routines below here
::
:verbose-output
    if %verbose-output% gtr 0 echo %*
    exit /b

@echo off

:: Init Script for cmd.exe
:: Created as part of cmder project

:: !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
:: !!! Use "%CMDER_ROOT%\config\user-profile.cmd" to add your own startup commands

:: Set to > 0 for verbose output to aid in debugging.
if not defined verbose-output ( set verbose-output=0 )

:: Find root dir
if not defined CMDER_ROOT (
    for /f "delims=" %%i in ("%ConEmuDir%\..\..") do set "CMDER_ROOT=%%~fi"
)

:: Remove trailing '\'
if "%CMDER_ROOT:~-1%" == "\" SET "CMDER_ROOT=%CMDER_ROOT:~0,-1%"

:: Change the prompt style
:: Mmm tasty lamb
prompt $E[1;32;40m$P$S{git}{hg}$S$_$E[1;30;40m{lamb}$S$E[0m

:: Pick right version of clink
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
    set architecture=86
) else (
    set architecture=64
)

:: Tell the user about the clink config files...
if not exist "%CMDER_ROOT%\config\settings" (
    echo Generating clink initial settings in "%CMDER_ROOT%\config\settings"
    echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup.
)

:: Run clink
"%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor"

:: Prepare for git-for-windows

:: I do not even know, copypasted from their .bat
set PLINK_PROTOCOL=ssh
if not defined TERM set TERM=cygwin

:: The idea:
:: * if the users points as to a specific git, use that
:: * test if a git is in path and if yes, use that
:: * last, use our vendored git
:: also check that we have a recent enough version of git (e.g. test for GIT\cmd\git.exe)
if defined GIT_INSTALL_ROOT (
    if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" (goto :FOUND_GIT)
)

:: check if git is in path...
setlocal enabledelayedexpansion
for /F "delims=" %%F in ('where git.exe 2^>nul') do @(
    pushd %%~dpF
    cd ..
    set "test_dir=!CD!"
    popd
    if exist "!test_dir!\cmd\git.exe" (
        set "GIT_INSTALL_ROOT=!test_dir!"
        set test_dir=
        goto :FOUND_GIT
    ) else (
        echo Found old git version in "!test_dir!", but not using...
        set test_dir=
    )
)

:: our last hope: our own git...
:VENDORED_GIT
if exist "%CMDER_ROOT%\vendor\git-for-windows" (
    set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows"
    call :verbose-output Add the minimal git commands to the front of the path
    set "PATH=!GIT_INSTALL_ROOT!\cmd;%PATH%"
) else (
    goto :NO_GIT
)

:FOUND_GIT
:: Add git to the path
if defined GIT_INSTALL_ROOT (
    rem add the unix commands at the end to not shadow windows commands like more
    call :verbose-output Enhancing PATH with unix commands from git in "%GIT_INSTALL_ROOT%\usr\bin"
    set "PATH=%PATH%;%GIT_INSTALL_ROOT%\usr\bin;%GIT_INSTALL_ROOT%\usr\share\vim\vim74"
    :: define SVN_SSH so we can use git svn with ssh svn repositories
    if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"
)

:NO_GIT
endlocal & set "PATH=%PATH%" & set "SVN_SSH=%SVN_SSH%" & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%"

:: Enhance Path
set "PATH=%CMDER_ROOT%\bin;%PATH%;%CMDER_ROOT%\"

:: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d"
:: to run them at startup.
if not exist "%CMDER_ROOT%\config\profile.d" (
  mkdir "%CMDER_ROOT%\config\profile.d"
)

pushd "%CMDER_ROOT%\config\profile.d"
for /f "usebackq" %%x in ( `dir /b *.bat *.cmd 2^>nul` ) do (
  call :verbose-output Calling "%CMDER_ROOT%\config\profile.d\%%x"...
  call "%CMDER_ROOT%\config\profile.d\%%x"
)
popd

:: Allows user to override default aliases store using profile.d
:: scripts run above by setting the 'aliases' env variable.
::
:: Note: If overriding default aliases store file the aliases
:: must also be self executing, see '.\user-aliases.cmd.example',
:: and be in profile.d folder.
set "user-aliases=%CMDER_ROOT%\config\user-aliases.cmd"

:: The aliases environment variable is used by alias.bat to id
:: the default file to store new aliases in.
if not defined aliases (
  set "aliases=%user-aliases%"
)

:: Make sure we have a self-extracting user-aliases.cmd file
setlocal enabledelayedexpansion
if not exist "%user-aliases%" (
    echo Creating intial user-aliases store in "%user-aliases%"...
    copy "%CMDER_ROOT%\vendor\user-aliases.cmd.example" "%user-aliases%"
) else (
    type "%user-aliases%" | findstr /i ";= Add aliases below here" >nul
    if "!errorlevel!" == "1" (
        echo Creating intial user-aliases store in "%user-aliases%"...
        copy "%CMDER_ROOT%\%user-aliases%" "%user-aliases%.old_format"
        copy "%CMDER_ROOT%\vendor\user-aliases.cmd.example" "%user-aliases%"
    )
)

:: Update old 'user-aliases' to new self executing 'user-aliases.cmd'
if exist "%CMDER_ROOT%\config\aliases" (
  echo Updating old "%CMDER_ROOT%\config\aliases" to new format...
  type "%CMDER_ROOT%\config\aliases" >> "%user-aliases%" && del "%CMDER_ROOT%\config\aliases"
) else if exist "%user-aliases%.old_format" (
  echo Updating old "%user-aliases%" to new format...
  type "%user-aliases%.old_format" >> "%user-aliases%" && del "%user-aliases%.old_format"
)
endlocal
:: Add aliases to the environment
call "%user-aliases%"

:: See vendor\git-for-windows\README.portable for why we do this
:: Basically we need to execute this post-install.bat because we are
:: manually extracting the archive rather than executing the 7z sfx
if exist "%CMDER_ROOT%\vendor\git-for-windows\post-install.bat" (
    call :verbose-output Running Git for Windows one time Post Install....
    cd /d "%CMDER_ROOT%\vendor\git-for-windows\"
    "%CMDER_ROOT%\vendor\git-for-windows\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat
    cd /d %USERPROFILE%
)

:: Set home path
if not defined HOME set "HOME=%USERPROFILE%"

:: This is either a env variable set by the user or the result of
:: cmder.exe setting this variable due to a commandline argument or a "cmder here"
if defined CMDER_START (
    cd /d "%CMDER_START%"
)

if exist "%CMDER_ROOT%\config\user-profile.cmd" (
    REM Create this file and place your own command in there
    call "%CMDER_ROOT%\config\user-profile.cmd"
) else (
    echo Creating user startup file: "%CMDER_ROOT%\config\user-profile.cmd"
    (
    echo :: use this file to run your own startup commands
    echo :: use  in front of the command to prevent printing the command
    echo.
    echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd"
    echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%"
    echo.
    ) > "%CMDER_ROOT%\config\user-profile.cmd"
)

exit /b

::
:: sub-routines below here
::
:verbose-output
    if %verbose-output% gtr 0 echo %*
    exit /b

allow setting verbose-output variable outside init.bat


Create test.bat

Create test.bat


@echo off
SET ROOT=%~dp0..\..
SET JARDIR=%ROOT%\lib

SET JDBC_CONFIG=%ROOT%\pg.properties
SET JDBC_URL=jdbc:postgresql:test
SET ENV=fi.tnie.db.env.pg.PGImplementation

REM Build java classpath:
SET META_GEN_CP=%ROOT%\classes
SET META_GEN_CP=%META_GEN_CP%;%JARDIR%\postgresql-8.4-701.jdbc3.jar
SET META_GEN_CP=%META_GEN_CP%;%JARDIR%\util.jar
SET META_GEN_CP=%META_GEN_CP%;%JARDIR%\log4j.jar

REM read to go:
java -classpath %META_GEN_CP% fi.tnie.dbmeta.tools.KeyGenerationInfo -j %JDBC_CONFIG% -e %ENV% -u %JDBC_URL%
@echo on

@echo off
SET ROOT=%~dp0..\..
SET JARDIR=%ROOT%\lib

SET JDBC_CONFIG=%ROOT%\pg.properties
SET JDBC_URL=jdbc:postgresql:test

REM Build java classpath:
SET META_GEN_CP=%ROOT%\classes
SET META_GEN_CP=%META_GEN_CP%;%JARDIR%\postgresql-8.4-701.jdbc3.jar
SET META_GEN_CP=%META_GEN_CP%;%JARDIR%\util.jar
SET META_GEN_CP=%META_GEN_CP%;%JARDIR%\log4j.jar

REM read to go:
java -classpath %META_GEN_CP% fi.tnie.dbmeta.tools.KeyGenerationInfo -j %JDBC_CONFIG% -u %JDBC_URL%
@echo on

Remove -e option

Remove -e option

Implementation to pick is deterimined based on JDBC URL subprotocol.


@ECHO OFF
SETLOCAL
SET EL=0

ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

IF /I "%msvs_toolset%"=="" ECHO msvs_toolset unset, defaulting to 12 && SET msvs_toolset=12
IF %NODE_MAJOR% GTR 4 ECHO detected node v5, forcing msvs_toolset 14 && SET msvs_toolset=14

SET PATH=%CD%;%PATH%
SET msvs_version=2013
IF "%msvs_toolset%"=="14" SET msvs_version=2015

ECHO APPVEYOR^: %APPVEYOR%
ECHO nodejs_version^: %nodejs_version%
ECHO platform^: %platform%
ECHO msvs_toolset^: %msvs_toolset%
ECHO msvs_version^: %msvs_version%
ECHO TOOLSET_ARGS^: %TOOLSET_ARGS%

ECHO activating VS command prompt
:: NOTE this call makes the x64 -> X64
IF /I "%platform%"=="x64" ECHO x64 && CALL "C:\Program Files (x86)\Microsoft Visual Studio %msvs_toolset%.0\VC\vcvarsall.bat" amd64
IF /I "%platform%"=="x86" ECHO x86 && CALL "C:\Program Files (x86)\Microsoft Visual Studio %msvs_toolset%.0\VC\vcvarsall.bat" x86
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO using compiler^: && CALL cl
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO using MSBuild^: && CALL msbuild /version && ECHO.
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO downloading/installing node
::only use Install-Product when using VS2013
::IF /I "%APPVEYOR%"=="True" IF /I "%msvs_toolset%"=="12" powershell Install-Product node $env:nodejs_version $env:Platform
::TESTING:
::always install (get npm matching node), but delete installed programfiles node.exe afterwards for VS2015 (using custom node.exe)
IF /I "%APPVEYOR%"=="True" GOTO APPVEYOR_INSTALL
GOTO SKIP_APPVEYOR_INSTALL

:APPVEYOR_INSTALL
IF /I "%platform%"=="x64" powershell Install-Product node $env:nodejs_version x64
IF /I "%platform%"=="x86" powershell Install-Product node $env:nodejs_version x86
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET NODE_MAJOR=%nodejs_version:~0,1%
ECHO node major version^: %NODE_MAJOR%
IF %NODE_MAJOR% GTR 0 ECHO node version greater than zero, not updating npm && GOTO SKIP_APPVEYOR_INSTALL

powershell Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

:SKIP_APPVEYOR_INSTALL
IF /I "%msvs_toolset%"=="12" GOTO NODE_INSTALLED
IF %NODE_MAJOR% GTR 4 GOTO NODE_INSTALLED

::custom node for VS2015
SET ARCHPATH=
IF "%platform%"=="X64" (SET ARCHPATH=x64/)
IF "%platform%"=="x64" (SET ARCHPATH=x64/)
SET NODE_URL=https://mapbox.s3.amazonaws.com/node-cpp11/v%nodejs_version%/%ARCHPATH%node.exe
ECHO downloading node^: %NODE_URL%
powershell Invoke-WebRequest "${env:NODE_URL}" -OutFile node.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO deleting node ...
SET NODE_EXE_PRG=%ProgramFiles%\nodejs\node.exe
IF EXIST "%NODE_EXE_PRG%" ECHO found %NODE_EXE_PRG%, deleting... && DEL /F "%NODE_EXE_PRG%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF EXIST "%ProgramFiles%\nodejs" ECHO copy custom node.exe to %ProgramFiles%\nodejs\ && COPY node.exe "%ProgramFiles%\nodejs\"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET NODE_EXE_PRG=%ProgramFiles(x86)%\nodejs\node.exe
IF EXIST "%NODE_EXE_PRG%" ECHO found %NODE_EXE_PRG%, deleting... && DEL /F "%NODE_EXE_PRG%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF EXIST "%ProgramFiles(x86)%\nodejs" ECHO copy custom node.exe to %ProgramFiles(x86)%\nodejs\ && COPY node.exe "%ProgramFiles(x86)%\nodejs\"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO delete node.exe in current directory && DEL node.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

:NODE_INSTALLED

ECHO available node.exe^:
call where node
ECHO available npm^:
call where npm

ECHO node^: && call node -v
call node -e "console.log('  - arch:',process.arch,'\n  - argv:',process.argv,'\n  - execPath:',process.execPath)"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO npm^: && CALL npm -v
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO ===== where npm puts stuff START ============
ECHO npm root && CALL npm root
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO npm root -g && CALL npm root -g
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO npm bin && CALL npm bin
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO npm bin -g && CALL npm bin -g
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET NPM_BIN_DIR=
FOR /F "tokens=*" %%i in ('CALL npm bin -g') DO SET NPM_BIN_DIR=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF /I "%NPM_BIN_DIR%"=="%CD%" ECHO ERROR npm bin -g equals local directory && SET ERRORLEVEL=1 && GOTO ERROR
ECHO ===== where npm puts stuff END ============

IF "%nodejs_version:~0,1%"=="0" npm install https://github.com/springmeyer/node-gyp/tarball/v3.x
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF "%nodejs_version:~0,1%"=="4" npm install node-gyp@3.x
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

CALL npm install --build-from-source --msvs_version=%msvs_version% %TOOLSET_ARGS% --loglevel=http
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

FOR /F "tokens=*" %%i in ('CALL node_modules\.bin\node-pre-gyp reveal module --silent') DO SET MODULE=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
FOR /F "tokens=*" %%i in ('node -e "console.log(process.execPath)"') DO SET NODE_EXE=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

dumpbin /DEPENDENTS "%NODE_EXE%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
dumpbin /DEPENDENTS "%MODULE%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

::skipping check for errorlevel npm test result when using io.js
::@springmeyer: how to proceed?
IF NOT "%nodejs_version%"=="1.8.1" IF NOT "%nodejs_version%"=="2.0.0" GOTO CHECK_NPM_TEST_ERRORLEVEL

ECHO calling npm test
CALL npm test
ECHO ==========================================
ECHO ==========================================
ECHO ==========================================
ECHO using iojs, not checking test result!!!!!!!!!
ECHO ==========================================
ECHO ==========================================
ECHO ==========================================

GOTO NPM_TEST_FINISHED

:CHECK_NPM_TEST_ERRORLEVEL
ECHO calling npm test
CALL npm test
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

:NPM_TEST_FINISHED

CALL node_modules\.bin\node-pre-gyp package %TOOLSET_ARGS%
::make commit message env var shorter
SET CM=%APPVEYOR_REPO_COMMIT_MESSAGE%
IF NOT "%CM%" == "%CM:[publish binary]=%" (ECHO publishing && CALL node_modules\.bin\node-pre-gyp --msvs_version=%msvs_version% publish %TOOLSET_ARGS%) ELSE (ECHO not publishing)
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

GOTO DONE

:ERROR
ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ECHO ERRORLEVEL^: %ERRORLEVEL%
SET EL=%ERRORLEVEL%

:DONE
ECHO ~~~~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

EXIT /b %EL%

@ECHO OFF
SETLOCAL
SET EL=0

ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

IF /I "%msvs_toolset%"=="" ECHO msvs_toolset unset, defaulting to 12 && SET msvs_toolset=12
SET NODE_MAJOR=%nodejs_version:~0,1%
IF %NODE_MAJOR% GTR 4 ECHO detected node v5, forcing msvs_toolset 14 && SET msvs_toolset=14

SET PATH=%CD%;%PATH%
SET msvs_version=2013
IF "%msvs_toolset%"=="14" SET msvs_version=2015

ECHO APPVEYOR^: %APPVEYOR%
ECHO nodejs_version^: %nodejs_version%
ECHO platform^: %platform%
ECHO msvs_toolset^: %msvs_toolset%
ECHO msvs_version^: %msvs_version%
ECHO TOOLSET_ARGS^: %TOOLSET_ARGS%

ECHO activating VS command prompt
:: NOTE this call makes the x64 -> X64
IF /I "%platform%"=="x64" ECHO x64 && CALL "C:\Program Files (x86)\Microsoft Visual Studio %msvs_toolset%.0\VC\vcvarsall.bat" amd64
IF /I "%platform%"=="x86" ECHO x86 && CALL "C:\Program Files (x86)\Microsoft Visual Studio %msvs_toolset%.0\VC\vcvarsall.bat" x86
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO using compiler^: && CALL cl
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO using MSBuild^: && CALL msbuild /version && ECHO.
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO downloading/installing node
::only use Install-Product when using VS2013
::IF /I "%APPVEYOR%"=="True" IF /I "%msvs_toolset%"=="12" powershell Install-Product node $env:nodejs_version $env:Platform
::TESTING:
::always install (get npm matching node), but delete installed programfiles node.exe afterwards for VS2015 (using custom node.exe)
IF /I "%APPVEYOR%"=="True" GOTO APPVEYOR_INSTALL
GOTO SKIP_APPVEYOR_INSTALL

:APPVEYOR_INSTALL
IF /I "%platform%"=="x64" powershell Install-Product node $env:nodejs_version x64
IF /I "%platform%"=="x86" powershell Install-Product node $env:nodejs_version x86
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO node major version^: %NODE_MAJOR%
IF %NODE_MAJOR% GTR 0 ECHO node version greater than zero, not updating npm && GOTO SKIP_APPVEYOR_INSTALL

powershell Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

:SKIP_APPVEYOR_INSTALL
IF /I "%msvs_toolset%"=="12" GOTO NODE_INSTALLED
IF %NODE_MAJOR% GTR 4 GOTO NODE_INSTALLED

::custom node for VS2015
SET ARCHPATH=
IF "%platform%"=="X64" (SET ARCHPATH=x64/)
IF "%platform%"=="x64" (SET ARCHPATH=x64/)
SET NODE_URL=https://mapbox.s3.amazonaws.com/node-cpp11/v%nodejs_version%/%ARCHPATH%node.exe
ECHO downloading node^: %NODE_URL%
powershell Invoke-WebRequest "${env:NODE_URL}" -OutFile node.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO deleting node ...
SET NODE_EXE_PRG=%ProgramFiles%\nodejs\node.exe
IF EXIST "%NODE_EXE_PRG%" ECHO found %NODE_EXE_PRG%, deleting... && DEL /F "%NODE_EXE_PRG%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF EXIST "%ProgramFiles%\nodejs" ECHO copy custom node.exe to %ProgramFiles%\nodejs\ && COPY node.exe "%ProgramFiles%\nodejs\"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET NODE_EXE_PRG=%ProgramFiles(x86)%\nodejs\node.exe
IF EXIST "%NODE_EXE_PRG%" ECHO found %NODE_EXE_PRG%, deleting... && DEL /F "%NODE_EXE_PRG%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF EXIST "%ProgramFiles(x86)%\nodejs" ECHO copy custom node.exe to %ProgramFiles(x86)%\nodejs\ && COPY node.exe "%ProgramFiles(x86)%\nodejs\"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO delete node.exe in current directory && DEL node.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

:NODE_INSTALLED

ECHO available node.exe^:
call where node
ECHO available npm^:
call where npm

ECHO node^: && call node -v
call node -e "console.log('  - arch:',process.arch,'\n  - argv:',process.argv,'\n  - execPath:',process.execPath)"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO npm^: && CALL npm -v
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO ===== where npm puts stuff START ============
ECHO npm root && CALL npm root
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO npm root -g && CALL npm root -g
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO npm bin && CALL npm bin
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO npm bin -g && CALL npm bin -g
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET NPM_BIN_DIR=
FOR /F "tokens=*" %%i in ('CALL npm bin -g') DO SET NPM_BIN_DIR=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF /I "%NPM_BIN_DIR%"=="%CD%" ECHO ERROR npm bin -g equals local directory && SET ERRORLEVEL=1 && GOTO ERROR
ECHO ===== where npm puts stuff END ============

IF "%nodejs_version:~0,1%"=="0" npm install https://github.com/springmeyer/node-gyp/tarball/v3.x
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF "%nodejs_version:~0,1%"=="4" npm install node-gyp@3.x
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

CALL npm install --build-from-source --msvs_version=%msvs_version% %TOOLSET_ARGS% --loglevel=http
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

FOR /F "tokens=*" %%i in ('CALL node_modules\.bin\node-pre-gyp reveal module --silent') DO SET MODULE=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
FOR /F "tokens=*" %%i in ('node -e "console.log(process.execPath)"') DO SET NODE_EXE=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

dumpbin /DEPENDENTS "%NODE_EXE%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
dumpbin /DEPENDENTS "%MODULE%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

::skipping check for errorlevel npm test result when using io.js
::@springmeyer: how to proceed?
IF NOT "%nodejs_version%"=="1.8.1" IF NOT "%nodejs_version%"=="2.0.0" GOTO CHECK_NPM_TEST_ERRORLEVEL

ECHO calling npm test
CALL npm test
ECHO ==========================================
ECHO ==========================================
ECHO ==========================================
ECHO using iojs, not checking test result!!!!!!!!!
ECHO ==========================================
ECHO ==========================================
ECHO ==========================================

GOTO NPM_TEST_FINISHED

:CHECK_NPM_TEST_ERRORLEVEL
ECHO calling npm test
CALL npm test
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

:NPM_TEST_FINISHED

CALL node_modules\.bin\node-pre-gyp package %TOOLSET_ARGS%
::make commit message env var shorter
SET CM=%APPVEYOR_REPO_COMMIT_MESSAGE%
IF NOT "%CM%" == "%CM:[publish binary]=%" (ECHO publishing && CALL node_modules\.bin\node-pre-gyp --msvs_version=%msvs_version% publish %TOOLSET_ARGS%) ELSE (ECHO not publishing)
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

GOTO DONE

:ERROR
ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ECHO ERRORLEVEL^: %ERRORLEVEL%
SET EL=%ERRORLEVEL%

:DONE
ECHO ~~~~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

EXIT /b %EL%

set NODE_MAJOR variable

set NODE_MAJOR variable


@echo off

SETLOCAL EnableExtensions EnableDelayedExpansion

set _f=UsbDk
if [%1] EQU [MSIONLY] goto BUILD_MSI
if [%2] EQU [NOSIGN] (SET DEBUG_CFG=Debug_NoSign) ELSE (SET DEBUG_CFG=Debug)

del *.log

for %%x in (Win7, Win8, Win8.1, Win10, XP) do (
  for %%y in (%DEBUG_CFG%, Release) do (
    for %%z in (win32, x64) do (
      call tools\vs_run.bat UsbDk.sln /Rebuild "%%x %%y|%%z" /Out build%%y_%%x_%%z.log
      if !ERRORLEVEL! NEQ 0 exit /B 1
    )
  )
)

pushd Install
call :maketmf Release
if !ERRORLEVEL! NEQ 0 exit /B 1
popd

pushd Install_Debug
call :maketmf Debug
if !ERRORLEVEL! NEQ 0 exit /B 1
popd

if [%1] EQU [NOMSI] goto NOMSI
goto BUILD_MSI

:maketmf
del *.tmf *.mof
call :make1tmf x64\Win10%1
call :make1tmf x86\Win10%1
call :make1tmf x64\Win8.1%1
call :make1tmf x86\Win8.1%1
call :make1tmf x64\Win8%1
call :make1tmf x86\Win8%1
call :make1tmf x64\Win7%1
call :make1tmf x86\Win7%1
call :make1tmf x64\XP%1
call :make1tmf x86\XP%1
goto :eof

:make1tmf
pushd %1
echo Making TMF in %1
"C:\Program Files (x86)\Windows Kits\10\bin\x86\tracepdb.exe" -s -o .\%_f%.tmf
popd
type %1\%_f%.tmf >> %_f%.tmf
del %1\%_f%.??f
goto :eof

:BUILD_MSI

pushd Tools\Installer

SET UsbDkVersion="%USBDK_MAJOR_VERSION%.%USBDK_MINOR_VERSION%.%USBDK_BUILD_NUMBER%"
buildmsi.bat %2

popd

:NOMSI

ENDLOCAL

@echo off

SETLOCAL EnableExtensions EnableDelayedExpansion

set _f=UsbDk
if [%1] EQU [MSIONLY] goto BUILD_MSI
if [%2] EQU [NOSIGN] (SET DEBUG_CFG=Debug_NoSign) ELSE (SET DEBUG_CFG=Debug)

del *.log

for %%x in (Win7, Win8, Win8.1, Win10, XP) do (
  for %%y in (%DEBUG_CFG%, Release) do (
    for %%z in (win32, x64) do (
      call tools\vs_run.bat UsbDk.sln /Rebuild "%%x %%y|%%z" /Out build%%y_%%x_%%z.log
      if !ERRORLEVEL! NEQ 0 exit /B 1
    )
  )
)

pushd Install
call :maketmf Release
if !ERRORLEVEL! NEQ 0 exit /B 1
popd

pushd Install_Debug
call :maketmf %DEBUG_CFG%
if !ERRORLEVEL! NEQ 0 exit /B 1
popd

if [%1] EQU [NOMSI] goto NOMSI
goto BUILD_MSI

:maketmf
del *.tmf *.mof
call :make1tmf x64\Win10%1
call :make1tmf x86\Win10%1
call :make1tmf x64\Win8.1%1
call :make1tmf x86\Win8.1%1
call :make1tmf x64\Win8%1
call :make1tmf x86\Win8%1
call :make1tmf x64\Win7%1
call :make1tmf x86\Win7%1
call :make1tmf x64\XP%1
call :make1tmf x86\XP%1
goto :eof

:make1tmf
pushd %1
echo Making TMF in %1
"C:\Program Files (x86)\Windows Kits\10\bin\x86\tracepdb.exe" -s -o .\%_f%.tmf
popd
type %1\%_f%.tmf >> %_f%.tmf
del %1\%_f%.??f
goto :eof

:BUILD_MSI

pushd Tools\Installer

SET UsbDkVersion="%USBDK_MAJOR_VERSION%.%USBDK_MINOR_VERSION%.%USBDK_BUILD_NUMBER%"
buildmsi.bat %2

popd

:NOMSI

ENDLOCAL

fix build of Debug_NoSign

build: fix build of Debug_NoSign

Signed-off-by: Yuri Benditovich <9668326cb042de5d91fd7679dac7ca5ea402812c@daynix.com>


@REM
@REM  Copyright 2014-2016 CyberVision, Inc.
@REM
@REM  Licensed under the Apache License, Version 2.0 (the "License");
@REM  you may not use this file except in compliance with the License.
@REM  You may obtain a copy of the License at
@REM
@REM       http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM  Unless required by applicable law or agreed to in writing, software
@REM  distributed under the License is distributed on an "AS IS" BASIS,
@REM  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM  See the License for the specific language governing permissions and
@REM  limitations under the License.
@REM

@echo off

setlocal

call env.bat
SET BUILD_HOME=%CD%
SET BUILD_TYPE=debug

if "%1" == "" goto startBuild
if /i %1 == release call :setRelease

:startBuild

call :buildKaaThirdparty
goto :eof

:setRelease
  SET BUILD_TYPE=release
goto :eof

:buildKaaThirdparty
   echo Building Kaa thirdparty components...
   call :buildAvro
   call :buildBotan
goto :eof

:buildAvro
 echo Building Avro...

 SET AVRO_SRC=avro-src-1.7.5

 IF EXIST %AVRO_SRC%\NUL (
   call :deleteDir %AVRO_SRC%
 )

 7z x -y %AVRO_SRC%.tar.gz
 7z x -y %AVRO_SRC%.tar

 md %AVRO_SRC%\lang\c++\build.win
 cd %AVRO_SRC%\lang\c++\build.win

 if %BUILD_TYPE%==debug (
    cmake .. -DCMAKE_INSTALL_PREFIX:PATH=%AVRO_ROOT_DIR% -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug
 ) else (
    cmake .. -DCMAKE_INSTALL_PREFIX:PATH=%AVRO_ROOT_DIR% -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release
 )
 nmake install

 cd %BUILD_HOME%

goto :eof

:buildBotan

 echo Building Botan...

 SET BOTAN_SRC=botan-1.11.28

 IF EXIST %BOTAN_SRC%\NUL (
   call :deleteDir %BOTAN_SRC%
 )

 7z x -y -obotan_archive botan-1.11.28.tar.gz
 7z x -y -o. botan_archive\botan-1.11.28.tar.gz

 cd %BOTAN_SRC%

 if %BUILD_TYPE%==debug (
   python configure.py --cc=msvc --cpu=i386 --prefix=%BOTAN_ROOT% --with-debug-info --no-optimizations
 ) else (
   python configure.py --cc=msvc --cpu=i386 --prefix=%BOTAN_ROOT%
 )

 nmake install

 move %BOTAN_ROOT%/include/botan-1.11/botan %BOTAN_ROOT%/include

 cd %BUILD_HOME%

goto :eof

:deleteDir
 del /s /f /q %1\*.*
 for /f %%f in ('dir /ad /b %1\') do rd /s /q %1\%%f
 rd /s /q %1
goto :eof

endlocal

@REM
@REM  Copyright 2014-2016 CyberVision, Inc.
@REM
@REM  Licensed under the Apache License, Version 2.0 (the "License");
@REM  you may not use this file except in compliance with the License.
@REM  You may obtain a copy of the License at
@REM
@REM       http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM  Unless required by applicable law or agreed to in writing, software
@REM  distributed under the License is distributed on an "AS IS" BASIS,
@REM  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM  See the License for the specific language governing permissions and
@REM  limitations under the License.
@REM

@echo off

setlocal

call env.bat
SET BUILD_HOME=%CD%
SET BUILD_TYPE=debug

if "%1" == "" goto startBuild
if /i %1 == release call :setRelease

:startBuild

call :buildKaaThirdparty
goto :eof

:setRelease
  SET BUILD_TYPE=release
goto :eof

:buildKaaThirdparty
   echo Building Kaa thirdparty components...
   call :buildAvro
   call :buildBotan
goto :eof

:buildAvro
 echo Building Avro...

 SET AVRO_SRC=avro-src-1.7.5

 IF EXIST %AVRO_SRC%\NUL (
   call :deleteDir %AVRO_SRC%
 )

 7z x -y %AVRO_SRC%.tar.gz
 7z x -y %AVRO_SRC%.tar

 md %AVRO_SRC%\lang\c++\build.win
 cd %AVRO_SRC%\lang\c++\build.win

 if %BUILD_TYPE%==debug (
    cmake .. -DCMAKE_INSTALL_PREFIX:PATH=%AVRO_ROOT_DIR% -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug
 ) else (
    cmake .. -DCMAKE_INSTALL_PREFIX:PATH=%AVRO_ROOT_DIR% -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release
 )
 nmake install

 cd %BUILD_HOME%

goto :eof

:buildBotan

 echo Building Botan...

 SET BOTAN_SRC=botan-1.11.28

 IF EXIST %BOTAN_SRC%\NUL (
   call :deleteDir %BOTAN_SRC%
 )

 7z x -y -obotan_archive botan-1.11.28.tar.gz
 7z x -y -o. botan_archive\botan-1.11.28.tar

 cd %BOTAN_SRC%

 if %BUILD_TYPE%==debug (
   python configure.py --cc=msvc --cpu=i386 --prefix=%BOTAN_ROOT% --with-debug-info --no-optimizations
 ) else (
   python configure.py --cc=msvc --cpu=i386 --prefix=%BOTAN_ROOT%
 )

 nmake install

 move %BOTAN_ROOT%/include/botan-1.11/botan %BOTAN_ROOT%/include

 cd %BUILD_HOME%

goto :eof

:deleteDir
 del /s /f /q %1\*.*
 for /f %%f in ('dir /ad /b %1\') do rd /s /q %1\%%f
 rd /s /q %1
goto :eof

endlocal

Fix build_sdk_thirdparty.bat

KAA-980: Fix build_sdk_thirdparty.bat


@ECHO OFF
REM archive-branch.bat
REM Usage: archive-branch <your-branch-name>

:TopOfScript
ECHO.
ECHO Starting...

ECHO.
ECHO * 1. Get local branch from remote, if needed
ECHO.
git checkout %1
IF %ERRORLEVEL% neq 0 GOTO :Err

ECHO.
ECHO * 2. Go back to master
ECHO.
git checkout master
IF %ERRORLEVEL% neq 0 GOTO :Err

ECHO.
ECHO * 3. Create local tag
ECHO.
git tag archive/%1 %1
IF %ERRORLEVEL% neq 0 GOTO :Err

ECHO.
ECHO * 4. Create remote tag
ECHO.
git push origin archive/%1
IF %ERRORLEVEL% neq 0 GOTO :Err

ECHO.
ECHO * 5. Delete local branch
ECHO.
git branch -d %1
IF %ERRORLEVEL% neq 0 GOTO :Err

ECHO.
ECHO * 6. Delete remote branch
ECHO.
git push origin --delete %1
IF %ERRORLEVEL% neq 0 GOTO :Err

GOTO :EndOfScript

:Err
ECHO Errors encountered during execution.  Last command exited with status: %ERRORLEVEL%.

:EndOfScript
ECHO.
ECHO Finished

@ECHO OFF
REM archive-branch.bat
REM Usage: archive-branch <your-branch-name>
REM NOTE: Run this script from a copy outside of working repository.

:TopOfScript
ECHO.
ECHO Starting...

ECHO.
ECHO * 1/7. Get local branch from remote, if needed
ECHO.
git checkout %1
IF %ERRORLEVEL% NEQ 0 GOTO :Err

ECHO.
ECHO * 2/7. Log head commit
ECHO.
git log -1
IF %ERRORLEVEL% NEQ 0 GOTO :Err

ECHO.
ECHO * 3/7. Go back to master
ECHO.
git checkout master
IF %ERRORLEVEL% NEQ 0 GOTO :Err

ECHO.
ECHO * 4/7. Create local tag
ECHO.
git tag archive/%1 %1
git tag -l archive/%1
IF %ERRORLEVEL% NEQ 0 GOTO :Err

ECHO.
ECHO * 5/7. Create remote tag
ECHO.
git push origin archive/%1
IF %ERRORLEVEL% NEQ 0 GOTO :Err

ECHO.
ECHO * 6/7. Delete local branch
ECHO.
git branch -d %1
IF %ERRORLEVEL% NEQ 0 GOTO :Err

ECHO.
ECHO * 7/7. Delete remote branch
ECHO.
git push origin --delete %1
IF %ERRORLEVEL% NEQ 0 GOTO :Err

GOTO :EndOfScript

:Err
ECHO Errors encountered during execution.  Last command exited with status: %ERRORLEVEL%.

:EndOfScript
ECHO.
ECHO Finished

Clarify usage and progress in archive-branch maintenance script


if not exist "C:\Windows\Temp\7z920-x64.msi" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware
if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels
goto :done

:vmware

if exist "C:\Users\vagrant\windows.iso" (
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\windows.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.5.0/4352439/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
    rd /S /Q "C:\Program Files (x86)\VMWare"
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"

goto :done

:virtualbox

:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer

if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (
    move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.0.26/VBoxGuestAdditions_5.0.26.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
rd /S /Q "C:\Windows\Temp\virtualbox"
goto :done

:parallels
if exist "C:\Users\vagrant\prl-tools-win.iso" (
	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
	cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels
	cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
	rd /S /Q "C:\Windows\Temp\parallels"
)

:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi

if not exist "C:\Windows\Temp\7z920-x64.msi" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware
if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels
goto :done

:vmware

if exist "C:\Users\vagrant\windows.iso" (
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\windows.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.5.1/4542065/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
    rd /S /Q "C:\Program Files (x86)\VMWare"
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"

goto :done

:virtualbox

:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer

if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (
    move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.0.26/VBoxGuestAdditions_5.0.26.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
rd /S /Q "C:\Windows\Temp\virtualbox"
goto :done

:parallels
if exist "C:\Users\vagrant\prl-tools-win.iso" (
	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
	cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels
	cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
	rd /S /Q "C:\Windows\Temp\parallels"
)

:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi

Update VMware tools 12.5.1

Update VMware tools 12.5.1


::===================================
::
:: generate test apps
::
:: usage:
::			gen				creates/syncs all the folders, skipping web.config
::			gen	config		creates/syncs all the folders, including web.config
::
::===================================

@echo off
set local
cls

set config=/XF *.config
if "%1"=="config" set config=

rem backend
call :gen_server 9000 %config%

rem rem servers
call :gen_server 9001 %config%
call :gen_server 9002 %config%
call :gen_server 9003 %config%

rem rem dashboards
call :gen_dashboard 8001 %config%
call :gen_dashboard 8002 %config%
call :gen_dashboard 8003 %config%

rem rem error sources
call :gen_source 7001 %config%
call :gen_source 7002 %config%
call :gen_source 7003 %config%

goto :end

:gen
set local
robocopy ../src/Samples/RElmah.%2 %3%1 *.* /MIR %4
echo "%programfiles(x86)%\IIS Express\iisexpress.exe" /path:%cd%\%3%1 /port:%1 > run_%1.cmd
goto :eof

:gen_server
set local
call :gen %1 Server s %2
goto :eof

:gen_dashboard
set local
call :gen %1 Dashboard.Basic s %2
goto :eof

:gen_source
set local
call :gen %1 Source s %2
goto :eof

:end

test apps generator

test apps generator


@ECHO OFF
setlocal
call "%~dp0vars.cmd"
bundle exec ruhoh publish github

Add ruby variables to path

Add ruby variables to path


if not exist "C:\Windows\Temp\7z920-x64.msi" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware
if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels
goto :done

:vmware

if exist "C:\Users\vagrant\windows.iso" (
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\windows.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.0.1/3160714/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
    rd /S /Q "C:\Program Files (x86)\VMWare"
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"

goto :done

:virtualbox

:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer

if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (
    move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.0.6/VBoxGuestAdditions_5.0.6.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
rd /S /Q "C:\Windows\Temp\virtualbox"
goto :done

:parallels
if exist "C:\Users\vagrant\prl-tools-win.iso" (
	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
	cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels
	cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
	rd /S /Q "C:\Windows\Temp\parallels"
)

:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi

if not exist "C:\Windows\Temp\7z920-x64.msi" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware
if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels
goto :done

:vmware

if exist "C:\Users\vagrant\windows.iso" (
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\windows.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.0.1/3160714/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
    rd /S /Q "C:\Program Files (x86)\VMWare"
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"

goto :done

:virtualbox

:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer

if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (
    move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.0.14/VBoxGuestAdditions_5.0.14.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
rd /S /Q "C:\Windows\Temp\virtualbox"
goto :done

:parallels
if exist "C:\Users\vagrant\prl-tools-win.iso" (
	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
	cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels
	cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
	rd /S /Q "C:\Windows\Temp\parallels"
)

:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi

Use VBoxGuestAdditions.iso 5.0.14

Use VBoxGuestAdditions.iso 5.0.14


@echo off
setlocal

rem /*
rem  *           cal.bat
rem  *
rem  * J_[\R}h
rem  * @(UNIXcalR}h̃N[)
rem  */

rem
rem ========== wv̕\ ==========
if "%1"=="-h" goto Help
if "%1"=="--help" goto Help
if "%1"=="/?" goto Help
goto noHelp
rem ---------------------
:Help
echo  ============ R}hCIvV ============
echo @-h, --help, /?@cc@wv̕\
echo.
echo @[-Opt] [[Month] Year]
echo @@-3@cc@RJ_[̕\(OAA)
echo @@-y@cc@PNJ_[̕\
echo @@Month@pœ(FApril)
echo @@Year @NSœ(yyyy)
echo @@@@@@@@@@@1752NȑO͕\܂
echo.
echo  IvVŎsƁAÑJ_[\܂
goto :EOF
rem ---------------------
:noHelp

rem ============ t̐ݒ ============
rem tf[^̒o
 rem Mnc
set /a thisMn=%date:~5,2%
 rem YrcN
set /a thisYr=%date:~0,4%

rem ̃VtgȂ
set Opt=0
if "%1"=="-3" set Opt=-3
if "%1"=="-y" set Opt=-y
:hikisu
 rem ̓
 if /i "%1"=="January" set Mn=1
 if /i "%1"=="February" set Mn=2
 if /i "%1"=="March" set Mn=3
 if /i "%1"=="April" set Mn=4
 if /i "%1"=="May" set Mn=5
 if /i "%1"=="June" set Mn=6
 if /i "%1"=="July" set Mn=7
 if /i "%1"=="August" set Mn=8
 if /i "%1"=="September" set Mn=9
 if /i "%1"=="October" set Mn=10
 if /i "%1"=="November" set Mn=11
 if /i "%1"=="December" set Mn=12
 rem N̓
 set /a Yr=%1+0
 shift
if not "%1"=="" goto hikisu

rem l̒
if %Yr% LEQ 1752 set /a Yr=thisYr

rem ---ɓt܂܂ȂƂ
if not defined Yr set Yr=%thisYr%
if not defined Mn set Mn=%thisMn%

rem ========== C̏ ========
rem 1NIvV
if %Opt%==-y goto 1nen

rem 3IvV
if %Opt%==-3 (
	rem 挎
	set /a Yr1=Yr
	set /a Mn1=Mn-1
	rem
	set /a Yr2=Yr
	set /a Mn2=Mn
	rem
	set /a Yr3=Yr
	set /a Mn3=Mn+1
	rem ----------
	goto 3kagetu
)

rem 1IvV
goto 1kagetu

rem ========== IvVʂ̓ ==========
rem -----1NJ_[̕\
:1nen
echo                                 %Yr%
echo.
set Mn=0

:1nenCal
 set /a Mn=%Mn%+1
 set /a Mn1=%Mn%
 set /a Mn2=%Mn%+1
 set /a Mn3=%Mn%+2
 call :subDate %Yr% %Mn1% 1
 call :subDate %Yr% %Mn2% 2
 call :subDate %Yr% %Mn3% 3
 rem `
 echo       %Month1%              %Month2%              %Month3%
 call :sub3calender
 echo.
 rem --------
if %Mn% LSS 12 goto 1nenCal

rem ---I
goto :EOF

rem -----3J_[̕\
:3kagetu
 rem Nz̏
if %Mn1%==0 (
	set /a Yr1=%Yr1%-1
	set Mn1=12
)
if %Mn3%==13 (
	set /a Yr3=%Yr3%+1
	set Mn3=1
)
call :subDate %Yr1% %Mn1% 1
call :subDate %Yr2% %Mn2% 2
call :subDate %Yr3% %Mn3% 3

rem 3\̏
echo    %Month1% %Yr1%         %Month2% %Yr2%         %Month3% %Yr3%
rem `
call :sub3calender

rem ---I
goto :EOF

rem -----1J_[̕\
:1kagetu
call :subDate %Yr% %Mn%
call :sub1calender
rem ---I
goto :EOF

rem ===========================================================================
rem =======================                          ==========================
rem =======================       Tu[`       ==========================
rem =======================  ==========================

rem ===========================================================================
rem ================== `̂߂̓tf[^̐ݒ ===========================
:subDate
rem ===========================================================================
rem ̎󂯎
set Yr=%1
set Mn=%2
 rem 3\̍ۂɗp
 set Number=%3

rem ̖O̕\ɂ(MonthɊi[)
if %Mn%==1 set Month= January
if %Mn%==2 set Month=February
if %Mn%==3 set Month=  March
if %Mn%==4 set Month=  April
if %Mn%==5 set Month=   May
if %Mn%==6 set Month=  June
if %Mn%==7 set Month=  July
if %Mn%==8 set Month= August
if %Mn%==9 set Month=September
if %Mn%==10 set Month= October
if %Mn%==11 set Month=Noveember
if %Mn%==12 set Month=December

rem =========== ߂ ============
if %Mn%==1 set Getumatu=31

rem 2vZ̏(if̊OɏȂƃG[ɂȂ)
 set Urr=Yes
 set /a UrrAmari = %Yr% %%4
 set /a UrrAmari2 = %Yr% %%400
if %Mn%==2 (
	rem N4Ŋ؂ƁA邤NB
	if %UrrAmari% NEQ 0 set Urr=No
	rem N100Ŋ؂āA400Ŋ؂ȂƁA邤Nł͂ȂB
	if %Yr:~-2%==00 (
		if %UrrAmari2% NEQ 0 set Urr=No
	)
)
if %Mn%==2 (
	if %Urr%==Yes set Getumatu=29
	if %Urr%==No set Getumatu=28
)
if %Mn%==3 set Getumatu=31
if %Mn%==4 set Getumatu=30
if %Mn%==5 set Getumatu=31
if %Mn%==6 set Getumatu=30
if %Mn%==7 set Getumatu=31
if %Mn%==8 set Getumatu=31
if %Mn%==9 set Getumatu=30
if %Mn%==10 set Getumatu=31
if %Mn%==11 set Getumatu=30
if %Mn%==12 set Getumatu=31

rem =========== 1ڂ̗j𔻒 ===========
rem 12́Aꂼ13A14ŌvZ
set Yr1=%Yr%
if %Mn%==1 (
	set M=13
	set /a Yr1=Yr-1
) else if %Mn%==2 (
	set /a Yr1=Yr-1
	set M=14
) else (
	set M=%Mn%
)
rem C=N̏2AY=N̉2
set /a C=%Yr1:~0,2%
set /a Y=%Yr1% - C*100

rem ǰvZ(Zelleř𗘗p)
set /a Wk= (( 21 * %C% / 4 ) + ( 5 * %Y% / 4 ) + ( 26 * ( %M% + 1 ) / 10 )) %%7 + 1

if not defined Number exit /b
  rem ========== ߂l̐ݒ ==========
  set Month%Number%=%Month%
  set Wk%Number%=%Wk%
  set Getumatu%Number%=%Getumatu%

rem ===== ߂
exit /b

rem ===========================================================================
rem ====================== 1`̃Tu[` ============================
:sub1Calender
rem ===========================================================================
rem 1\
echo    %Month% %Yr%
echo  Su Mo Tu We Th Fr Sa

rem ---1T
set i=1
rem 1sڂ̋󔒕\
:LoopBlank
if %i% LSS %Wk% (
	set WeekStr=%WeekStr%
	set /a i=i+1
	goto LoopBlank
)
rem 1sڂ̐쐬
set Dy=1
:LoopNumber
set WeekStr=%WeekStr%  %Dy%
set /a Dy=Dy+1
set /a i=i+1
if %i% LEQ 7 goto LoopNumber

echo %WeekStr%

rem ---2Tڈȍ~
:LoopMonth
set WeekStr=
set i=1
:LoopWeek
if %Dy% LSS 10 (
	set WeekStr=%WeekStr%  %Dy%
) else (
	set WeekStr=%WeekStr% %Dy%
)
set /a Dy=Dy+1
rem zƁAT\sA[vo
if %Dy% GTR %Getumatu% (
	echo %WeekStr%
	goto Break
	)
set /a i=i+1
if %i% LEQ 7 goto LoopWeek
echo %WeekStr%

rem ---3Tڈȍ~
rem %Dy%̒l݈̂p
if %Dy% LEQ %Getumatu% goto LoopMonth

:Break

rem ===== ߂
exit /b

rem ===========================================================================
rem ====================== 3`̃Tu[` ============================
:sub3Calender
rem ===========================================================================
rem 3\
echo  Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
set WeekStr=

rem ------1T
 rem ̃JEg
set j=0
:Week1
set /a j=j+1
 rem j̃JEg
set i=1

rem 1sڂ̋󔒕쐬
:LoopBlank3
 set /a Wk=Wk%j%
 if %i% LSS %Wk% (
	set WeekStr=%WeekStr%
	set /a i=i+1
	goto LoopBlank3
)
rem 1sڂ̐쐬
set Dy=1
:LoopNumber3
 set WeekStr=%WeekStr%  %Dy%
 set /a Dy=Dy+1
 set /a i=i+1
if %i% LEQ 7 goto LoopNumber3

rem R
set /a Dy%j%=Dy
if %j% LSS 3 (
	set WeekStr=%WeekStr%
	goto Week1
)

echo %WeekStr%
set WeekStr=

rem ------2Tڈȍ~
set j=1
 rem ̃JEg
:LoopMonth3
 rem [vIĂƂ̏
set /a Dy=Dy%j%
set /a Getumatu=Getumatu%j%
if %Dy% GTR %Getumatu% (
	set WeekStr=%WeekStr%
	goto :Break3
)

set i=1

set /a Dy=Dy%j%
set /a Getumatu=Getumatu%j%

:LoopDay3
if %Dy% LSS 10 (
	set WeekStr=%WeekStr%  %Dy%
) else (
	set WeekStr=%WeekStr% %Dy%
)
set /a Dy=Dy+1
rem zƁAc𖄂߁A[vo
if %Dy% GTR %Getumatu% goto LoopLast3
set /a i=i+1
if %i% LEQ 7 (
	goto LoopDay3
)
goto Break3
rem c̖ߗ
:LoopLast3
 set /a i=i+1
 if %i% GEQ 8 goto Break3
 set WeekStr=%WeekStr%
goto LoopLast3

:Break3

rem ʃ[v
set WeekStr=%WeekStr%
set /a Dy%j%=Dy
set /a j=j+1
if %j% LEQ 3 goto LoopMonth3

echo %WeekStr%
set WeekStr=

rem T̃[v
set j=1

if %Dy1% LEQ %Getumatu1% goto LoopMonth3
if %Dy2% LEQ %Getumatu2% goto LoopMonth3
if %Dy3% LEQ %Getumatu3% goto LoopMonth3

rem ===== ߂
exit /b

add cal command (ver 2009)

add cal command (ver 2009)


@rem Convenience script to build gRPC C# from command line

setlocal
@rem Set VS variables (uses Visual Studio 2013)
@call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" x86

@rem Build the C# native extension
msbuild ..\..\vsprojects\grpc.sln /t:grpc_csharp_ext || goto :error

msbuild Grpc.sln /p:Configuration=Debug || goto :error
msbuild Grpc.sln /p:Configuration=Release || goto :error
endlocal

goto :EOF

:error
echo Failed!
exit /b %errorlevel%

@rem Convenience script to build gRPC C# from command line

setlocal
@rem Set VS variables (uses Visual Studio 2013)
@call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" x86

@rem Build the C# native extension
msbuild ..\..\vsprojects\grpc.sln /t:grpc_csharp_ext /p:PlatformToolset=v120 || goto :error

msbuild Grpc.sln /p:Configuration=Debug || goto :error
msbuild Grpc.sln /p:Configuration=Release || goto :error
endlocal

goto :EOF

:error
echo Failed!
exit /b %errorlevel%

fix buildall.bat script

fix buildall.bat script


@echo off
call "%~dp0\elixir.bat" "%~dp0\mix" %*

@echo off
call "%~dp0\elixir.bat" "%~dps0\mix" %*

Use short filenames to handle spaces in path to bin\mix


@echo off
rem Create fileslist
echo Creating Filelist...

rem create cwd pattern for sed
set CWD_PATTERN=%cd%
for /f "delims=" %%a in ('echo %cd%^|sed "s,\\,\\\\,g"') do (
    set CWD_PATTERN=%%a
)

rem process
echo   ^|- generate %TMP%
if /I "%USE_FOLDERS%"=="0" (
    dir /s /b %FILE_SUFFIXS%|sed "s,\(%CWD_PATTERN%\)\(.*\),.\2,gI" >> "%TMP%"
) else (
    dir /b %FILE_SUFFIXS%|sed "s,\(.*\),.\\\1,gI" >> "%TMP%"
    for %%G in (%FOLDERS%) do (
        cd %%G
        dir /s /b %FILE_SUFFIXS%|sed "s,\(%CWD_PATTERN%\)\(.*\),.\2,gI" >> "%TMP%"
        cd ..
    )
)

echo   ^|- filter out invalid files
rem NOTE: dir /s /b *.cpp will list xxx.cpp~, too. So use gawk here to filter out thoes things.
gawk -v filter_pattern=%FILE_FILTER_PATTERN% -f "%TOOLS%\gawk\file-filter.awk" "%TMP%">"%TMP2%"
del "%TMP%" > nul
if exist "%TMP2%" (
    echo   ^|- move %TMP2% to %TARGET%
    move /Y "%TMP2%" "%TARGET%" > nul
)
echo   ^|- done!

@echo off
rem Create fileslist
echo Creating Filelist...

rem create cwd pattern for sed
set CWD_PATTERN=%cd%
for /f "delims=" %%a in ('echo %cd%^|sed "s,\\,\\\\,g"') do (
    set CWD_PATTERN=%%a
)

rem process
echo   ^|- generate %TMP%
if /I "%USE_FOLDERS%"=="0" (
    dir /s /b %FILE_SUFFIXS%|sed "s,\(%CWD_PATTERN%\)\(.*\),.\2,gI" >> "%TMP%"
) else (
    dir /b %FILE_SUFFIXS%|sed "s,\(.*\),.\\\1,gI" >> "%TMP%"
    for %%G in (%FOLDERS%) do (
        dir %%G /s /b %FILE_SUFFIXS%|sed "s,\(%CWD_PATTERN%\)\(.*\),.\2,gI" >> "%TMP%"
    )
)

echo   ^|- filter out invalid files
rem NOTE: dir /s /b *.cpp will list xxx.cpp~, too. So use gawk here to filter out thoes things.
gawk -v filter_pattern=%FILE_FILTER_PATTERN% -f "%TOOLS%\gawk\file-filter.awk" "%TMP%">"%TMP2%"
del "%TMP%" > nul
if exist "%TMP2%" (
    echo   ^|- move %TMP2% to %TARGET%
    move /Y "%TMP2%" "%TARGET%" > nul
)
echo   ^|- done!

fix Issue #33 in Windows

fix Issue #33 in Windows


:: Copyright (c) Facebook, Inc. and its affiliates.
::
:: This source code is licensed under the MIT license found in the
:: LICENSE file in the root directory of this source tree.

@echo off
title Metro Bundler
call .packager.bat
node "%~dp0..\cli.js" --reactNativePath ../ start
pause
exit

:: Copyright (c) Facebook, Inc. and its affiliates.
::
:: This source code is licensed under the MIT license found in the
:: LICENSE file in the root directory of this source tree.

@echo off
title Metro Bundler
call .packager.bat
node "%~dp0..\cli.js" --reactNativePath ../ --projectRoot ../../../ start
pause
exit

Update projectRoot in launchPackager.bat (#24115)

Summary:
`launchPackager.bat` starts metro server but does not pass projectRoot to it. So metro server starts in the wrong directory, It is because `startServerInNewWindow` pass `react-native` directory instead of `projectRoot` in the third argument of `spawn()` in `runAndroid.js`

Its working for people
See https://github.com/facebook/react-native/issues/23908#issuecomment-475889443

[Android] [Fixed] - projectRoot in launchPackager.bat
Pull Request resolved: https://github.com/facebook/react-native/pull/24115

Differential Revision: D14597101

Pulled By: cpojer

fbshipit-source-id: fb4155b72e35062cfb41fe1b3ecca0e2b4e849ce


@ECHO OFF

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
	set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
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.  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" == "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\bugzscout.qhcp
	echo.To view the help file:
	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\bugzscout.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=-W -d %BUILDDIR%/doctrees %SPHINXOPTS% .
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.  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" == "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\bugzscout.qhcp
	echo.To view the help file:
	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\bugzscout.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

Add -W flag to make.bat

Add -W flag to make.bat


echo off
IF %1.==. GOTO Build
IF %1==clean (
	GOTO Clean
) ELSE (
	GOTO Build
)
:Build
	for /f %%b IN ('msbuildpath.exe') do %%bMSBuild.exe libuv\msvs\libuv.sln
	call "%VS100COMNTOOLS%vsvars32.bat"
	FOR /F %%a IN ('msbuildpath.exe') DO %%aMSBuild.exe webserver.csproj
	"%VCINSTALLDIR%bin\cl.exe" uv_wrap.c /o build/uvwrap.dll libuv/build/Win32/Debug/libuv.lib ws2_32.lib advapi32.lib /link /DLL /EXPORT:uv_init /EXPORT:uv_tcp_init /EXPORT:uv_tcp_listen /EXPORT:uv_accept /EXPORT:manos_uv_read_start /EXPORT:uv_run /EXPORT:manos_uv_tcp_bind /EXPORT:manos_uv_tcp_t_create /EXPORT:manos_uv_tcp_t_destroy /EXPORT:manos_uv_write
GOTO :EOF
:Clean
	rmdir /S /Q build
	rmdir /S /Q libuv\build
	del /Q uv_wrap.obj
GOTO :EOF

echo off
IF %1.==. GOTO Build
IF %1==clean (
	GOTO Clean
) ELSE (
	GOTO Build
)
:Build
	del uv_wrap.def
	echo LIBRARY UVWRAP >> uv_wrap.def
	echo EXPORTS >> uv_wrap.def
	set count=0
	setlocal ENABLEDELAYEDEXPANSION
	for /f "tokens=1,2,3,4,5 delims=( " %%a in ('findstr "extern" webserver.cs') do (
		set /a count=count+1
		echo %%e @!count! >> uv_wrap.def
	)
	for /f %%b IN ('msbuildpath.exe') do %%bMSBuild.exe libuv\msvs\libuv.sln
	call "%VS100COMNTOOLS%vsvars32.bat"
	FOR /F %%a IN ('msbuildpath.exe') DO %%aMSBuild.exe webserver.csproj
	"%VCINSTALLDIR%bin\cl.exe" uv_wrap.c /o build/uvwrap.dll libuv/build/Win32/Debug/libuv.lib ws2_32.lib advapi32.lib /link /DLL /DEF:uv_wrap.def
GOTO Done
:Clean
	rmdir /S /Q build
	rmdir /S /Q libuv\build
	del /Q uv_wrap.obj
	del /Q uv_wrap.def
GOTO Done
:Done
echo on

use some batch file magic to do exports automatically


echo %* | "C:\Program Files (x86)\BigFix Enterprise\BES Client\qna" -t -showtypes

@echo off
Set Relevance=%*

REM https://stackoverflow.com/a/23328830/861745
for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\BigFix\EnterpriseClient" /v EnterpriseClientFolder 2^>^&1^|find "REG_"') do @set sPath=%%b

echo %sPath%

echo %Relevance% | "%sPath%qna" -t -showtypes

Update EvalRelevance.bat

Update EvalRelevance.bat


cl server.cpp mysecurity.cpp /link Secur32.lib Advapi32.lib

Create build.bat

Create build.bat


.paket\paket.bootstrapper.exe
if errorlevel 1 (
  exit "There was an error with paket.bootstrapper"
)

IF EXIST paket.lock (
    .paket\paket.exe restore
    if errorlevel 1 (
      exit "There was an error restoring packages from paket.lock"
    )
)

IF EXIST init.fsx (
  .paket\paket.exe install
  packages\FAKE\tools\FAKE.exe init.fsx
)
packages\FAKE\tools\FAKE.exe build.fsx

IF NOT EXIST .paket\paket.exe (
    .paket\paket.bootstrapper.exe
    if errorlevel 1 (
      exit "There was an error with paket.bootstrapper"
    )
)

IF EXIST paket.lock (
    .paket\paket.exe restore
    if errorlevel 1 (
      exit "There was an error restoring packages from paket.lock"
    )
)

IF EXIST init.fsx (
  .paket\paket.exe install
  packages\FAKE\tools\FAKE.exe init.fsx
)
packages\FAKE\tools\FAKE.exe build.fsx

Check first if paket.exe is already downloaded in ..paket folder


@echo off
cd %~dp0

SETLOCAL
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe

IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"

:copynuget
IF EXIST .nuget\nuget.exe goto restore
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul

:restore
IF EXIST packages\KoreBuild goto run
.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
.nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion

IF "%SKIP_DNX_INSTALL%"=="1" goto run
CALL packages\KoreBuild\build\dnvm upgrade -runtime CLR -arch x86
CALL packages\KoreBuild\build\dnvm install default -runtime CLR -arch x64
CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -arch x86
CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -arch x64

:run
CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86
packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*

@echo off
cd %~dp0

SETLOCAL
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe

IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"

:copynuget
IF EXIST .nuget\nuget.exe goto restore
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul

:restore
IF EXIST packages\KoreBuild goto run
.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
.nuget\NuGet.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages

IF "%SKIP_DNX_INSTALL%"=="1" goto run
CALL packages\KoreBuild\build\dnvm upgrade -runtime CLR -arch x86
CALL packages\KoreBuild\build\dnvm install default -runtime CLR -arch x64
CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -arch x86
CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -arch x64

:run
CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86
packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*

Update 'build.cmd' to pull Sake from v2 NuGet feed.


@echo off
powershell.exe .\build.ps1 "%*"

@echo off
powershell.exe -NoProfile .\build.ps1 "%*"

Fix build.cmd to launch powershell with '-NoProfile' flag


docker build --tag sss-build .
docker run --rm --name sss-build ^
 -v /var/run/docker.sock:/var/run/docker.sock ^
 -v %cd%/artifacts:/artifacts ^
 -v %cd%/.git:/.git ^
 --network host ^
 sss-build ^
 dotnet run -p /repo/build/build.csproj -- %*

docker build --tag sss-build .
docker run --rm -it --name sss-build ^
 -v /var/run/docker.sock:/var/run/docker.sock ^
 -v %cd%/artifacts:/artifacts ^
 -v %cd%/.git:/.git ^
 --network host ^
 sss-build ^
 dotnet run -p /repo/build/build.csproj -- %*

Make `docker run` interactive This enables CTRL-C to work correctly when building in a console


@echo Off
rem Trigger build process for NFluent
rem usage build [Target] [Configuration]. Configuration is Release by default
Rem target is either 'nightly' (default) for nightly build, 'RC' for release candidate, 'release' for release package
Rem those targets build a tested packaged and pushed it on nuget (assuming a publishing key has been setup)
Rem other targets (e.G. CI) build 'alpha package'
cls
set target=%1
if "%target%"=="" (
	set target=%NFLUENT_STREAM%
)
if "%target%"=="" (
	set target=CI
)
set config=%2
if "%config%" == "" (
   set config=Release
)
msbuild .build\Build.proj /t:%target% /p:Configuration="%config%" /fl /v:m /flp:LogFile=msbuild.log;Verbosity=Diagnostic /nr:false

@echo Off
rem Trigger build process for NFluent
rem usage build [Target] [Configuration]. Configuration is Release by default
Rem target is either 'nightly' (default) for nightly build, 'RC' for release candidate, 'release' for release package
Rem those targets build a tested packaged and pushed it on nuget (assuming a publishing key has been setup)
Rem other targets (e.G. CI) build 'alpha package'
cls
set target=%1
if "%target%"=="" (
	set target=%NFLUENT_STREAM%
)
if "%target%"=="" (
	set target=CI
)
set config=%2
if "%config%" == "" (
   set config=Release
)
msbuild .build\Build.proj /t:%target% /p:Configuration="%config%" /fl /v:diag /flp:LogFile=msbuild.log;Verbosity=Diagnostic /nr:false

Dbg: change MSBuild verbosity level to diagnostic


@echo off
setlocal enableDelayedExpansion

set KRUGERDIR=%APPDATA%\Krugercoin\blocks
for /F %%x in ('dir /B/D/ON %KRUGERDIR%\blk*.*') do (
  IF NOT [!B!] == [] set B=!B!+
  set FILENAME=%KRUGERDIR%\%%x
  set B=!B!"!FILENAME!"
)
copy /b %B% bootstrap.dat

Add Windows batch file for creating a boostrap.dat for Krugercoin


::
:: Copyright 2016 Bernard Ladenthin bernard.ladenthin@gmail.com
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
::    http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
::

:: example usage
:: @call powercfgtweakcpuminmax 0 0
::

@IF "%1"=="" (
    @set valuemin=0
) ELSE (
	@set valuemin=%1
)

@IF "%2"=="" (
    set valuemax=100
) ELSE (
	set valuemax=%2
)

@echo min: %valuemin%
@echo max: %valuemax%

:: http://stackoverflow.com/questions/1173291/using-powercfg-to-duplicate-the-currently-active-power-scheme
:: save it in a variable:
@for /f "tokens=2 delims=:(" %%x in ('powercfg -getactivescheme') do @set guid=%%x
:: remove whitespace
@set guid=%guid: =%

:: https://technet.microsoft.com/en-us/library/hh824902.aspx
:: <SCHEME_GUID> <SUB_GUID> <SETTING_GUID> <SETTING_INDEX>

@set SUBGUID=SUB_PROCESSOR
@set SETTINGGUID=PROCTHROTTLEMIN
@POWERCFG /SETACVALUEINDEX %guid% %SUBGUID% %SETTINGGUID% %valuemin%
@POWERCFG /SETDCVALUEINDEX %guid% %SUBGUID% %SETTINGGUID% %valuemin%

@set SUBGUID=SUB_PROCESSOR
@set SETTINGGUID=PROCTHROTTLEMAX
@POWERCFG /SETACVALUEINDEX %guid% %SUBGUID% %SETTINGGUID% %valuemax%
@POWERCFG /SETDCVALUEINDEX %guid% %SUBGUID% %SETTINGGUID% %valuemax%

:: force reload
@POWERCFG -setactive %guid%

add powercfgtweakcpuminmax

add powercfgtweakcpuminmax


copy "%RECIPE_DIR%\build.sh" .
set PREFIX=%PREFIX:\=/%
set LIBRARY_PREFIX=%LIBRARY_PREFIX:\=/%
set SRC_DIR=%SRC_DIR:\=/%
set MSYSTEM=MINGW%ARCH%
set MSYS2_PATH_TYPE=inherit
set CHERE_INVOKING=1

set CC=clang
set RANLIB=echo

copy %LIBRARY_LIB%\pthreads.lib %LIBRARY_LIB%\pthread.lib
copy %LIBRARY_LIB%\pthreads.lib %LIBRARY_LIB%\m.lib
copy %BUILD_PREFIX%\Library\llvm-ar.exe %BUILD_PREFIX%\Library\ar.exe
copy %BUILD_PREFIX%\Library\llvm-as.exe %BUILD_PREFIX%\Library\as.exe

bash -lc "./build.sh"
if errorlevel 1 exit 1

del %LIBRARY_LIB%\pthread.lib
del %LIBRARY_LIB%\m.lib

copy "%RECIPE_DIR%\build.sh" .
set PREFIX=%PREFIX:\=/%
set LIBRARY_PREFIX=%LIBRARY_PREFIX:\=/%
set SRC_DIR=%SRC_DIR:\=/%
set MSYSTEM=MINGW%ARCH%
set MSYS2_PATH_TYPE=inherit
set CHERE_INVOKING=1

set CC=clang
set RANLIB=echo

copy %LIBRARY_LIB%\pthreads.lib %LIBRARY_LIB%\pthread.lib
copy %LIBRARY_LIB%\pthreads.lib %LIBRARY_LIB%\m.lib
copy %BUILD_PREFIX%\Library\bin\llvm-ar.exe %BUILD_PREFIX%\Library\bin\ar.exe
copy %BUILD_PREFIX%\Library\bin\llvm-as.exe %BUILD_PREFIX%\Library\bin\as.exe

bash -lc "./build.sh"
if errorlevel 1 exit 1

del %LIBRARY_LIB%\pthread.lib
del %LIBRARY_LIB%\m.lib

Fix location of ar

Fix location of ar


@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem  Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega

Convert line endings from CRLF to LF.

Convert line endings from CRLF to LF.

+ This commit does not introduce any code change.
+ Please only commit files with Unix line endings to the repository.


"C:\Program Files (x86)\Java\jre7\bin\java.exe" -jar compiler.jar ^
--js=misc.js ^
--js=siggy.js ^
--js=siggy.helpers.js ^
--js=siggy.static.js ^
--js=siggy.intel.dscan.js ^
--js=siggy.intel.poses.js ^
--js=siggy.charactersettings.js ^
--js=siggy.timer.js ^
--js=siggy.sigtable.js ^
--js=siggy.globalnotes.js ^
--js=siggy.map.connection.js ^
--js=siggy.hotkeyhelper.js ^
--js=siggy.map.js ^
--js=siggy.activity.thera.js ^
--source_map_format=V3 ^
--create_source_map siggy.compiled.js.map ^
--js_output_file=siggy.compiled.js

echo //# sourceMappingURL=siggy.compiled.js.map >> siggy.compiled.js

@pause

"C:\Program Files (x86)\Java\jre7\bin\java.exe" -jar compiler.jar ^
--js=misc.js ^
--js=siggy.js ^
--js=siggy.helpers.js ^
--js=siggy.static.js ^
--js=siggy.intel.dscan.js ^
--js=siggy.intel.poses.js ^
--js=siggy.charactersettings.js ^
--js=siggy.timer.js ^
--js=siggy.sigtable.js ^
--js=siggy.globalnotes.js ^
--js=siggy.map.connection.js ^
--js=siggy.hotkeyhelper.js ^
--js=siggy.map.js ^
--js=siggy.activity.siggy.js ^
--js=siggy.activity.search.js ^
--js=siggy.activity.thera.js ^
--source_map_format=V3 ^
--create_source_map siggy.compiled.js.map ^
--js_output_file=siggy.compiled.js

echo //# sourceMappingURL=siggy.compiled.js.map >> siggy.compiled.js

@pause

Add siggy and search activities to build.


set JAVA_OPTS=%JAVA_OPTS% -Dsolr.solr.home="%CATALINA_HOME%\solr" -Dfess.log.file="%CATALINA_HOME%\webapps\fess\WEB-INF\logs\fess.out"  -Dsolr.log.file="%CATALINA_HOME%\logs\solr.log" -Djava.awt.headless=true -server -Xmx1g -XX:MaxPermSize=128m -XX:-UseGCOverheadLimit -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:CMSIncrementalDutyCycleMin=0 -XX:+UseParNewGC -XX:+UseStringCache -XX:+UseTLAB -XX:+DisableExplicitGC
rem -XX:+UseCompressedOops
rem -XX:+UseCompressedStrings if java6u20 or above
rem -XX:+OptimizeStringConcat if java6u21 or above

set JAVA_OPTS=%JAVA_OPTS% -Dsolr.solr.home="%CATALINA_HOME%\solr" -Dfess.log.file="%CATALINA_HOME%\webapps\fess\WEB-INF\logs\fess.out" -Dsolr.log.file="%CATALINA_HOME%\logs\solr.log" -Djava.awt.headless=true -server -Xmx1g -XX:+UseTLAB -XX:+DisableExplicitGC

for /f tokens^=2-5^ delims^=.-_^" %%j in ('java -fullversion 2^>^&1') do set "jver=%%j%%k"
if %jver% GTR "17" (~
set JAVA_OPTS=%JAVA_OPTS% -XX:MaxMetaspaceSize=128m -XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=45 -XX:MaxGCPauseMillis=200
 ) else (~
set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=128m -XX:-UseGCOverheadLimit -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:CMSIncrementalDutyCycleMin=0 -XX:+UseParNewGC -XX:+UseStringCache -XX:+UseCompressedOops
rem -XX:+UseCompressedStrings if java6u20 or above
rem -XX:+OptimizeStringConcat if java6u21 or above
 )

fix #35

fix #35


if not exist "C:\Windows\Temp\7z920-x64.msi" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if exist "C:\Users\vagrant\windows.iso" (
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\windows.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.5.5/5234757/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
    rd /S /Q "C:\Program Files (x86)\VMWare"
)

mkdir "C:\Windows\Temp\VMware"
pushd "C:\Windows\Temp\VMware"
cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso""
start /wait C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"
popd

rd /Q "C:\Windows\Temp\vmware-tools.tar"
rd /Q "C:\Windows\Temp\windows.iso"
::rd /S /Q "C:\Windows\Temp\VMware"

if not exist "C:\Windows\Temp\7z920-x64.msi" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if exist "C:\Users\vagrant\windows.iso" (
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\windows.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.5.5/5234757/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
    rd /S /Q "C:\Program Files (x86)\VMWare"
)

mkdir "C:\Windows\Temp\VMware"
pushd "C:\Windows\Temp\VMware"
cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso""
start /wait .\setup.exe /S /v"/qn REBOOT=R\"
popd

rd /Q "C:\Windows\Temp\vmware-tools.tar"
rd /Q "C:\Windows\Temp\windows.iso"
::rd /S /Q "C:\Windows\Temp\VMware"

Fix path when calling setup

Fix path when calling setup


@echo off

if DEFINED JAVA_HOME goto cont

:err
ECHO JAVA_HOME environment variable must be set! 1>&2
EXIT /B 1

:cont
set SCRIPT_DIR=%~dp0
for %%I in ("%SCRIPT_DIR%..") do set ES_HOME=%%~dpfI

REM ***** JAVA options *****

if "%ES_MIN_MEM%" == "" (
set ES_MIN_MEM=${packaging.elasticsearch.heap.min}
)

if "%ES_MAX_MEM%" == "" (
set ES_MAX_MEM=${packaging.elasticsearch.heap.max}
)

if NOT "%ES_HEAP_SIZE%" == "" (
set ES_MIN_MEM=%ES_HEAP_SIZE%
set ES_MAX_MEM=%ES_HEAP_SIZE%
)

REM min and max heap sizes should be set to the same value to avoid
REM stop-the-world GC pauses during resize, and so that we can lock the
REM heap in memory on startup to prevent any of it from being swapped
REM out.
set JAVA_OPTS=%JAVA_OPTS% -Xms%ES_MIN_MEM% -Xmx%ES_MAX_MEM%

REM new generation
if NOT "%ES_HEAP_NEWSIZE%" == "" (
set JAVA_OPTS=%JAVA_OPTS% -Xmn%ES_HEAP_NEWSIZE%
)

REM max direct memory
if NOT "%ES_DIRECT_SIZE%" == "" (
set JAVA_OPTS=%JAVA_OPTS% -XX:MaxDirectMemorySize=%ES_DIRECT_SIZE%
)

REM set to headless, just in case
set JAVA_OPTS=%JAVA_OPTS% -Djava.awt.headless=true

REM Force the JVM to use IPv4 stack
if NOT "%ES_USE_IPV4%" == "" (
set JAVA_OPTS=%JAVA_OPTS% -Djava.net.preferIPv4Stack=true
)

REM Add gc options. ES_GC_OPTS is unsupported, for internal testing
if "%ES_GC_OPTS%" == "" (
set ES_GC_OPTS=%ES_GC_OPTS% -XX:+UseParNewGC
set ES_GC_OPTS=%ES_GC_OPTS% -XX:+UseConcMarkSweepGC
set ES_GC_OPTS=%ES_GC_OPTS% -XX:CMSInitiatingOccupancyFraction=75
set ES_GC_OPTS=%ES_GC_OPTS% -XX:+UseCMSInitiatingOccupancyOnly
REM When running under Java 7
REM JAVA_OPTS=%JAVA_OPTS% -XX:+UseCondCardMark
)
set JAVA_OPTS=%JAVA_OPTS% %ES_GC_OPTS

if "%ES_GC_LOG_FILE%" == "" goto nogclog

:gclog
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDetails
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCTimeStamps
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDateStamps
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintClassHistogram
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintTenuringDistribution
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCApplicationStoppedTime
set JAVA_OPTS=%JAVA_OPTS% -Xloggc:%ES_GC_LOG_FILE%
for %%F in ("%ES_GC_LOG_FILE%") do set ES_GC_LOG_FILE_DIRECTORY=%%~dpF
if NOT EXIST "%ES_GC_LOG_FILE_DIRECTORY%\." mkdir "%ES_GC_LOG_FILE_DIRECTORY%"

:nogclog

REM Causes the JVM to dump its heap on OutOfMemory.
set JAVA_OPTS=%JAVA_OPTS% -XX:+HeapDumpOnOutOfMemoryError
REM The path to the heap dump location, note directory must exists and have enough
REM space for a full heap dump.
REM JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof

REM Disables explicit GC
set JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC

REM Ensure UTF-8 encoding by default (e.g. filenames)
set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8

REM Use our provided JNA always versus the system one
set JAVA_OPTS=%JAVA_OPTS% -Djna.nosys=true

set CORE_CLASSPATH=%ES_HOME%/lib/${project.build.finalName}.jar;%ES_HOME%/lib/*
if "%ES_CLASSPATH%" == "" (
set ES_CLASSPATH=%CORE_CLASSPATH%
) else (
set ES_CLASSPATH=%ES_CLASSPATH%;%CORE_CLASSPATH%
)
set ES_PARAMS=-Delasticsearch -Des-foreground=yes -Des.path.home="%ES_HOME%"

@echo off

if DEFINED JAVA_HOME goto cont

:err
ECHO JAVA_HOME environment variable must be set! 1>&2
EXIT /B 1

:cont
set SCRIPT_DIR=%~dp0
for %%I in ("%SCRIPT_DIR%..") do set ES_HOME=%%~dpfI

REM ***** JAVA options *****

if "%ES_MIN_MEM%" == "" (
set ES_MIN_MEM=${packaging.elasticsearch.heap.min}
)

if "%ES_MAX_MEM%" == "" (
set ES_MAX_MEM=${packaging.elasticsearch.heap.max}
)

if NOT "%ES_HEAP_SIZE%" == "" (
set ES_MIN_MEM=%ES_HEAP_SIZE%
set ES_MAX_MEM=%ES_HEAP_SIZE%
)

REM min and max heap sizes should be set to the same value to avoid
REM stop-the-world GC pauses during resize, and so that we can lock the
REM heap in memory on startup to prevent any of it from being swapped
REM out.
set JAVA_OPTS=%JAVA_OPTS% -Xms%ES_MIN_MEM% -Xmx%ES_MAX_MEM%

REM new generation
if NOT "%ES_HEAP_NEWSIZE%" == "" (
set JAVA_OPTS=%JAVA_OPTS% -Xmn%ES_HEAP_NEWSIZE%
)

REM max direct memory
if NOT "%ES_DIRECT_SIZE%" == "" (
set JAVA_OPTS=%JAVA_OPTS% -XX:MaxDirectMemorySize=%ES_DIRECT_SIZE%
)

REM set to headless, just in case
set JAVA_OPTS=%JAVA_OPTS% -Djava.awt.headless=true

REM Force the JVM to use IPv4 stack
if NOT "%ES_USE_IPV4%" == "" (
set JAVA_OPTS=%JAVA_OPTS% -Djava.net.preferIPv4Stack=true
)

REM Add gc options. ES_GC_OPTS is unsupported, for internal testing
if "%ES_GC_OPTS%" == "" (
set ES_GC_OPTS=%ES_GC_OPTS% -XX:+UseParNewGC
set ES_GC_OPTS=%ES_GC_OPTS% -XX:+UseConcMarkSweepGC
set ES_GC_OPTS=%ES_GC_OPTS% -XX:CMSInitiatingOccupancyFraction=75
set ES_GC_OPTS=%ES_GC_OPTS% -XX:+UseCMSInitiatingOccupancyOnly
REM When running under Java 7
REM JAVA_OPTS=%JAVA_OPTS% -XX:+UseCondCardMark
)
set JAVA_OPTS=%JAVA_OPTS% %ES_GC_OPTS%

if "%ES_GC_LOG_FILE%" == "" goto nogclog

:gclog
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDetails
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCTimeStamps
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDateStamps
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintClassHistogram
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintTenuringDistribution
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCApplicationStoppedTime
set JAVA_OPTS=%JAVA_OPTS% -Xloggc:%ES_GC_LOG_FILE%
for %%F in ("%ES_GC_LOG_FILE%") do set ES_GC_LOG_FILE_DIRECTORY=%%~dpF
if NOT EXIST "%ES_GC_LOG_FILE_DIRECTORY%\." mkdir "%ES_GC_LOG_FILE_DIRECTORY%"

:nogclog

REM Causes the JVM to dump its heap on OutOfMemory.
set JAVA_OPTS=%JAVA_OPTS% -XX:+HeapDumpOnOutOfMemoryError
REM The path to the heap dump location, note directory must exists and have enough
REM space for a full heap dump.
REM JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof

REM Disables explicit GC
set JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC

REM Ensure UTF-8 encoding by default (e.g. filenames)
set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8

REM Use our provided JNA always versus the system one
set JAVA_OPTS=%JAVA_OPTS% -Djna.nosys=true

set CORE_CLASSPATH=%ES_HOME%/lib/${project.build.finalName}.jar;%ES_HOME%/lib/*
if "%ES_CLASSPATH%" == "" (
set ES_CLASSPATH=%CORE_CLASSPATH%
) else (
set ES_CLASSPATH=%ES_CLASSPATH%;%CORE_CLASSPATH%
)
set ES_PARAMS=-Delasticsearch -Des-foreground=yes -Des.path.home="%ES_HOME%"

fix totally broken batch file. thank you jenkins. windows you still suck.