@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

@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 Windows 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

MINOR: Update gradlew.bat as per latest gradle release

When invoking `gradle` on a recent version, it updates `gradlew.bat` to fix a typo. It's an annoyance at development time as it causes a diff on whatever branch one is working on.

Author: Ismael Juma <ismael@juma.me.uk>

Reviewers: Grant Henke <granthenke@gmail.com>, Ewen Cheslack-Postava <ewen@confluent.io>

Closes #1034 from ijuma/update-gradlew.bat


set PIP_FIND_LINKS="https://whls.blob.core.windows.net/unstable/index.html"
pip install lytest simphony sax jax sklearn klayout devsim
pip install "jaxlib[cuda111]" -f https://whls.blob.core.windows.net/unstable/index.html --use-deprecated legacy-resolver
pip install gdsfactory==5.54.0
gf tool install

call ..\condabin\conda activate
call ..\conda install -c conda-forge git -y
if exist "%USERPROFILE%\Desktop\gdsfactory" (goto SKIP_INSTALL)
cd %USERPROFILE%\Desktop
call git clone https://github.com/gdsfactory/gdsfactory.git

cd gdsfactory
python shortcuts.py

:SKIP_INSTALL
echo gdsfactory installed

set PIP_FIND_LINKS="https://whls.blob.core.windows.net/unstable/index.html"
pip install lytest simphony sax jax sklearn klayout devsim
pip install "jaxlib[cuda111]" -f https://whls.blob.core.windows.net/unstable/index.html --use-deprecated legacy-resolver
pip install gdsfactory==5.54.0
gf tool install

cd ..\condabin
call conda activate
call conda install -c conda-forge git -y
if exist "%USERPROFILE%\Desktop\gdsfactory" (goto SKIP_INSTALL)
cd %USERPROFILE%\Desktop
call git clone https://github.com/SkandanC/gdsfactory.git

cd gdsfactory
python shortcuts.py

:SKIP_INSTALL
echo gdsfactory installed

Fix conda statements

Fix conda statements


SET CURRENT_PATH_PREINSTALL=%CD%
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
choco install visualstudio2013professional git mingw openssl.light gnuwin
setx PATH "%PATH%;C:\turbo.lua;C:\turbo.lua\luarocks\2.2" /M
SET PATH=%PATH%;C:\Program Files (x86)\Git\cmd;C:\GnuWin\bin;C:\tools\mingw64\bin;C:\Program Files (x86)\Windows Kits\8.1\bin\x64;C:\turbo.lua;C:\turbo.lua\luarocks\2.2
SET VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
rm -rf C:\turbo.lua
mkdir C:\turbo.lua
cd C:\turbo.lua
mkdir src
cd src

git clone https://github.com/kernelsauce/turbo.git
cd C:\turbo.lua\src\turbo
git checkout luasocket
mingw32-make SSL=none
mv libtffi_wrap.so libtffi_wrap.dll
setx TURBO_LIB_TFFI "C:\turbo.lua\src\turbo\libtffi_wrap.dll" /M
SET TURBO_LIBTFFI=C:\turbo.lua\src\turbo\libtffi_wrap.dll

cd C:\turbo.lua\src
git clone http://luajit.org/git/luajit-2.0.git
cd C:\turbo.lua\src\luajit-2.0\src
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64
call msvcbuild
cp luajit.exe C:\turbo.lua
cp lua51.dll C:\turbo.lua

cd C:\turbo.lua\src
git clone https://github.com/keplerproject/luarocks.git
cd C:\turbo.lua\src\luarocks
SET LUA_PATH=C:\turbo.lua\rocks\share\lua\5.1\?.lua;C:\turbo.lua\rocks\share\lua\5.1\?\init.lua;C:\turbo.lua\src\turbo\?.lua;C:\turbo.lua\src\turbo\turbo\?.lua
SET LUA_CPATH=C:\turbo.lua\rocks\lib\lua\5.1\?.dll
call install.bat /TREE C:\turbo.lua\rocks\ /P C:\turbo.lua\luarocks\ /INC C:\turbo.lua\src\luajit-2.0\src /LIB C:\turbo.lua\src\luajit-2.0\src /LUA C:\turbo.lua /Q
luarocks install luasocket

cd %CURRENT_PATH_PREINSTALL%

SET CURRENT_PATH_PREINSTALL=%CD%
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
choco install visualstudio2013professional git mingw openssl.light gnuwin
setx PATH "%PATH%;C:\turbo.lua;C:\turbo.lua\luarocks\2.2" /M
SET PATH=%PATH%;C:\Program Files (x86)\Git\cmd;C:\GnuWin\bin;C:\tools\mingw64\bin;C:\Program Files (x86)\Windows Kits\8.1\bin\x64;C:\turbo.lua;C:\turbo.lua\luarocks\2.2
SET VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
rm -rf C:\turbo.lua
mkdir C:\turbo.lua
cd C:\turbo.lua
mkdir src
cd src

git clone https://github.com/kernelsauce/turbo.git
cd C:\turbo.lua\src\turbo
git checkout luasocket
mingw32-make SSL=none
mv libtffi_wrap.so libtffi_wrap.dll
setx TURBO_LIBTFFI "C:\turbo.lua\src\turbo\libtffi_wrap.dll" /M
SET TURBO_LIBTFFI=C:\turbo.lua\src\turbo\libtffi_wrap.dll

cd C:\turbo.lua\src
git clone http://luajit.org/git/luajit-2.0.git
cd C:\turbo.lua\src\luajit-2.0\src
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64
call msvcbuild
cp luajit.exe C:\turbo.lua
cp lua51.dll C:\turbo.lua

cd C:\turbo.lua\src
git clone https://github.com/keplerproject/luarocks.git
cd C:\turbo.lua\src\luarocks
SET LUA_PATH=C:\turbo.lua\rocks\share\lua\5.1\?.lua;C:\turbo.lua\rocks\share\lua\5.1\?\init.lua;C:\turbo.lua\src\turbo\?.lua;C:\turbo.lua\src\turbo\turbo\?.lua
SET LUA_CPATH=C:\turbo.lua\rocks\lib\lua\5.1\?.dll
setx LUA_PATH "%LUA_PATH%" /M
setx LUA_CPATH "%LUA_CPATH%" /M
call install.bat /TREE C:\turbo.lua\rocks\ /P C:\turbo.lua\luarocks\ /INC C:\turbo.lua\src\luajit-2.0\src /LIB C:\turbo.lua\src\luajit-2.0\src /LUA C:\turbo.lua /Q
call luarocks install luasocket

cd %CURRENT_PATH_PREINSTALL%
echo ===========================
echo Turbo is now installed. Try it by running 'luajit C:\turbo.lua\src\turbo\examples\helloworld.lua' and point your browser to http://localhost:8888.
echo Have a nice day!
echo ===========================

Set LUA_PATH and LUA_CPATH in global env.


cl -EHsc -I../include/ -Dgsl_THROW_ON_FAILURE gsl-lite.t.cpp owner.t.cpp not_null.t.cpp && gsl-lite.t.exe --pass

cl -EHsc -I../include/ -Dgsl_FEATURE_THROW_ON_FAILURE gsl-lite.t.cpp owner.t.cpp not_null.t.cpp && gsl-lite.t.exe --pass

Fix define to throw

Fix define to throw


@setlocal

@echo Creating a package of files for easy use of ETW/WPT.

set UIforETW=%~dp0
set destdir=%UIforETW%etwpackage
set symboldir=%UIforETW%etwsymbols

rmdir %destdir% /s/q
rmdir %symboldir% /s/q
@if exist %destdir%\bin\UIforETW.exe goto pleasecloseUIforETW
@if exist %destdir%\bin\ETWProviders.dll goto pleasecloseSomething
mkdir %destdir%\bin
mkdir %destdir%\include
mkdir %destdir%\lib
mkdir %destdir%\third_party
mkdir %symboldir%

set wptredistmsi=Windows Performance Toolkit\Redistributables\WPTx64-x86_en-us.msi
set oldwptredistmsi=Windows Performance Toolkit\OldRedistributables\WPTx64-x86_en-us.msi

set wpt10=c:\Program Files (x86)\Windows Kits\10\
if not exist "%wpt10%%wptredistmsi%" goto nowpt10
if not exist "%wpt10%%oldwptredistmsi%" goto nooldwpt10
mkdir %destdir%\third_party\wpt10
mkdir %destdir%\third_party\oldwpt10
xcopy "%wpt10%%wptredistmsi%" %destdir%\third_party\wpt10
@if errorlevel 1 goto copyfailure
xcopy "%wpt10%%oldwptredistmsi%" %destdir%\third_party\oldwpt10
@if errorlevel 1 goto copyfailure
xcopy "%wpt10%Licenses\10.0.15063.0\sdk_license.rtf" %destdir%\third_party\wpt10
@if errorlevel 1 goto copyfailure
ren %destdir%\third_party\wpt10\sdk_license.rtf LICENSE.rtf

@rem Add VS tools to the path. Also adds signtool.exe to the path.
set vcvars32="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"
if exist %vcvars32% goto community_installed
set vcvars32="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars32.bat"
:community_installed
call %vcvars32%

cd /d %UIforETW%ETWInsights
devenv /rebuild "release|Win32" ETWInsights.sln
@if ERRORLEVEL 1 goto BuildFailure
xcopy Release\flame_graph.exe %UIforETW%\bin /y

cd /d %UIforETW%UIforETW
@rem Modify the UIforETW project to be statically linked and build that version
@rem so that it will run without any extra install requirements.
sed "s/UIforETW.vcxproj/UIforETWStatic.vcxproj/" <UIforETW.sln >UIforETWStatic.sln
@echo First do a test build with ETW marks disabled to test the inline functions.
sed "s/_WINDOWS/_WINDOWS;DISABLE_ETW_MARKS/" <UIforETW.vcxproj >UIforETWStatic.vcxproj
devenv /rebuild "release|Win32" UIforETWStatic.sln
@if ERRORLEVEL 1 goto BuildFailure

@rem Now prepare for the real builds
sed "s/UseOfMfc>Dynamic/UseOfMfc>Static/" <UIforETW.vcxproj >UIforETWStatic.vcxproj
if exist Release rmdir Release /s/q
if exist x64\Release rmdir x64\Release /s/q
devenv /rebuild "release|Win32" UIforETWStatic.sln
@if ERRORLEVEL 1 goto BuildFailure
devenv /rebuild "release|x64" UIforETWStatic.sln
@if ERRORLEVEL 1 goto BuildFailure
@rem Clean up after building the static version.
rmdir Release /s/q
rmdir x64\Release /s/q
del UIforETWStatic.vcxproj
del UIforETWStatic.sln

cd %UIforETW%\EventEmitter
devenv /rebuild "Release|x86" EventEmitter.sln
@if ERRORLEVEL 1 goto BuildFailure
devenv /rebuild "Release|x64" EventEmitter.sln
@if ERRORLEVEL 1 goto BuildFailure

xcopy %UIforETW%CONTRIBUTING %destdir%
xcopy %UIforETW%CONTRIBUTORS %destdir%
xcopy %UIforETW%AUTHORS %destdir%
xcopy %UIforETW%LICENSE %destdir%
xcopy %UIforETW%README %destdir%

xcopy /exclude:%UIforETW%excludecopy.txt %UIforETW%bin %destdir%\bin /s
xcopy %UIforETW%ETWProviders\etwproviders.man %destdir%\bin /y
xcopy /exclude:%UIforETW%excludecopy.txt %UIforETW%include %destdir%\include /s
xcopy /exclude:%UIforETW%excludecopy.txt %UIforETW%lib %destdir%\lib /s
xcopy /exclude:%UIforETW%excludecopy.txt %UIforETW%third_party %destdir%\third_party /s
@rem Get the destinations to exist so that the xcopy proceeds without a question.
echo >%destdir%\bin\UIforETW.exe
echo >%destdir%\bin\UIforETW32.exe
xcopy %UIforETW%bin\UIforETWStatic_devrel32.exe %destdir%\bin\UIforETW32.exe /y
xcopy %UIforETW%bin\UIforETWStatic_devrel.exe %destdir%\bin\UIforETW.exe /y
xcopy %UIforETW%bin\EventEmitter.exe %destdir%\bin /y
xcopy %UIforETW%bin\EventEmitter64.exe %destdir%\bin /y

@rem Sign the important (requiring elevation) binaries
set bindir=%~dp0etwpackage\bin
signtool sign /d "UIforETW" /du "https://github.com/google/UIforETW/releases" /n "Bruce Dawson" /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 %bindir%\UIforETW.exe %bindir%\UIforETW32.exe %bindir%\EventEmitter.exe %bindir%\EventEmitter64.exe %bindir%\flame_graph.exe %bindir%\RetrieveSymbols.exe %bindir%\DummyChrome.dll %bindir%\ETWProviders.dll %bindir%\ETWProviders64.dll
@if not %errorlevel% equ 0 goto signing_failure

@rem Copy the official binaries back to the local copy, for development purposes.
xcopy /exclude:%UIforETW%excludecopy.txt %destdir%\bin\UIforETW*.exe %UIforETW%bin /y
@if ERRORLEVEL 1 goto BuildFailure

@rem Grab all of the lab scripts
xcopy /exclude:%UIforETW%excludecopy.txt %UIforETW%LabScripts %destdir%\LabScripts /y /i /s
@if ERRORLEVEL 1 goto BuildFailure

xcopy %UIforETW%\bin\UIforETWStatic_devrel*.pdb %symboldir%

cd /d %UIforETW%

@rem Source indexing as described here:
@rem http://hamishgraham.net/post/GitHub-Source-Symbol-Indexer.aspx
@rem The next steps assume that you have cloned https://github.com/Haemoglobin/GitHub-Source-Indexer.git
@rem into the parent directory of the UIforETW repo.
@rem You also have to enable execution of power-shell scripts, by running something
@rem like this from an administrator command prompt:
@rem powershell Set-ExecutionPolicy Unrestricted
@rem Note that -dbgToolsPath and -verifyLocalRepo had to be added to the command line
@rem to get the script to behave. -dbgToolsPath is tricky because the default path has
@rem spaces and the script can't handle that, so I copy it to %temp%. God help you if
@rem that has spaces.
@rem verifyLocalRepo comes with its own challenges since github-sourceindexer.ps1 does
@rem a weak job of looking for git.exe. I had to edit FindGitExe to tell it exactly where
@rem to look - something like this:
@rem function FindGitExe {
@rem  	$gitexe = "c:\src\chromium\depot_tools\git-2.8.3-64_bin\cmd\git.exe"
@rem     if (Test-Path $gitexe) {
@rem         return $gitexe
@rem     }
if not exist ..\GitHub-Source-Indexer\github-sourceindexer.ps1 goto NoSourceIndexing
if exist %temp%\srcsrv rmdir %temp%\srcsrv /s/q
mkdir %temp%\srcsrv
xcopy /s /y "c:\Program Files (x86)\Windows Kits\10\Debuggers\x64\srcsrv" %temp%\srcsrv

@rem Crazy gymnastics to get the current git hash into an environment variable:
echo|set /p="set hash=">sethash.bat
call git log -1 --pretty=%%%%H >>sethash.bat
call sethash.bat
del sethash.bat

@rem We need to create this sort of URL:
@rem https://raw.githubusercontent.com/google/UIforETW/ea1129d25ba58efd03ef649829348ca553f82383/.gitignore
@rem From this template:
@rem HTTP_EXTRACT_TARGET=%HTTP_ALIAS%/%var2%/%var3%/raw/%var4%/%var5%
@rem With these sort of arguments:
@rem c:\github\uiforetw\uiforetw\utility.h*google*UIforETW*master*UIforETW/utility.h

powershell ..\GitHub-Source-Indexer\github-sourceindexer.ps1 -symbolsFolder etwsymbols -userID "google" ^
    -repository UIforETW -branch %hash% -sourcesRoot %UIforETW% -dbgToolsPath %temp%\srcsrv ^
    -verifyLocalRepo -gitHubUrl https://raw.githubusercontent.com -serverIsRaw
@echo Run these commands if you want to verify what has been indexed:
@echo %temp%\srcsrv\pdbstr -r -p:etwsymbols\UIforETWStatic_devrel.pdb -s:srcsrv
@echo %temp%\srcsrv\pdbstr -r -p:etwsymbols\UIforETWStatic_devrel32.pdb -s:srcsrv
:NoSourceIndexing

del *.zip 2>nul
call python make_zip_file.py etwpackage.zip etwpackage
@echo on
call python make_zip_file.py etwsymbols.zip etwsymbols
@echo on
call python rename_to_version.py UIforETW\Version.h
@echo on

@echo Now upload the new etwpackage*.zip and etwsymbols*.zip
@echo But make sure that the PersistedPresets section from startup10.wpaProfile
@echo been deleted to avoid shipping modified presets and bloating the file.
@exit /b

:pleasecloseUIforETW
@echo UIforETW is running. Please close it and try again.
@exit /b

:pleasecloseSomething
@echo Something is running with ETWProviders.dll loaded. Please close it and try again.
@exit /b

:nowpt10
@echo WPT 10 redistributables not found. Aborting.
@exit /b

:nooldwpt10
@echo Old WPT 10 redistributables not found. Aborting.
@exit /b

:BuildFailure
@echo Build failure of some sort. Aborting.
@exit /b

:copyfailure
@echo Failed to copy file. Aborting.
@exit /b

:signing_failure
@echo Failed to sign files. Aborting.
@exit /b

@setlocal

@echo Creating a package of files for easy use of ETW/WPT.

set UIforETW=%~dp0
set destdir=%UIforETW%etwpackage
set symboldir=%UIforETW%etwsymbols

rmdir %destdir% /s/q
rmdir %symboldir% /s/q
@if exist %destdir%\bin\UIforETW.exe goto pleasecloseUIforETW
@if exist %destdir%\bin\ETWProviders.dll goto pleasecloseSomething
mkdir %destdir%\bin
mkdir %destdir%\include
mkdir %destdir%\lib
mkdir %destdir%\third_party
mkdir %symboldir%

set wptredistmsi=Windows Performance Toolkit\Redistributables\WPTx64-x86_en-us.msi
set oldwptredistmsi=Windows Performance Toolkit\OldRedistributables\WPTx64-x86_en-us.msi

set wpt10=c:\Program Files (x86)\Windows Kits\10\
if not exist "%wpt10%%wptredistmsi%" goto nowpt10
if not exist "%wpt10%%oldwptredistmsi%" goto nooldwpt10
mkdir %destdir%\third_party\wpt10
mkdir %destdir%\third_party\oldwpt10
xcopy "%wpt10%%wptredistmsi%" %destdir%\third_party\wpt10
@if errorlevel 1 goto copyfailure
xcopy "%wpt10%%oldwptredistmsi%" %destdir%\third_party\oldwpt10
@if errorlevel 1 goto copyfailure
xcopy "%wpt10%Licenses\10.0.15063.0\sdk_license.rtf" %destdir%\third_party\wpt10
@if errorlevel 1 goto copyfailure
ren %destdir%\third_party\wpt10\sdk_license.rtf LICENSE.rtf

@rem Add VS tools to the path. Also adds signtool.exe to the path.
set vcvars32="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"
if exist %vcvars32% goto community_installed
set vcvars32="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars32.bat"
:community_installed
call %vcvars32%

cd /d %UIforETW%ETWInsights
devenv /rebuild "release|Win32" ETWInsights.sln
@if ERRORLEVEL 1 goto BuildFailure
xcopy Release\flame_graph.exe %UIforETW%\bin /y

cd /d %UIforETW%UIforETW
@rem Modify the UIforETW project to be statically linked and build that version
@rem so that it will run without any extra install requirements.
sed "s/UIforETW.vcxproj/UIforETWStatic.vcxproj/" <UIforETW.sln >UIforETWStatic.sln
@echo First do a test build with ETW marks disabled to test the inline functions.
sed "s/_WINDOWS/_WINDOWS;DISABLE_ETW_MARKS/" <UIforETW.vcxproj >UIforETWStatic.vcxproj
devenv /rebuild "release|Win32" UIforETWStatic.sln
@if ERRORLEVEL 1 goto BuildFailure

@rem Now prepare for the real builds
sed "s/UseOfMfc>Dynamic/UseOfMfc>Static/" <UIforETW.vcxproj >UIforETWStatic.vcxproj
if exist Release rmdir Release /s/q
if exist x64\Release rmdir x64\Release /s/q
devenv /rebuild "release|Win32" UIforETWStatic.sln
@if ERRORLEVEL 1 goto BuildFailure
devenv /rebuild "release|x64" UIforETWStatic.sln
@if ERRORLEVEL 1 goto BuildFailure
@rem Clean up after building the static version.
rmdir Release /s/q
rmdir x64\Release /s/q
del UIforETWStatic.vcxproj
del UIforETWStatic.sln

cd %UIforETW%\EventEmitter
devenv /rebuild "Release|x86" EventEmitter.sln
@if ERRORLEVEL 1 goto BuildFailure
devenv /rebuild "Release|x64" EventEmitter.sln
@if ERRORLEVEL 1 goto BuildFailure

xcopy %UIforETW%CONTRIBUTING %destdir%
xcopy %UIforETW%CONTRIBUTORS %destdir%
xcopy %UIforETW%AUTHORS %destdir%
xcopy %UIforETW%LICENSE %destdir%
xcopy %UIforETW%README %destdir%

xcopy /exclude:%UIforETW%excludecopy.txt %UIforETW%bin %destdir%\bin /s
xcopy %UIforETW%ETWProviders\etwproviders.man %destdir%\bin /y
xcopy /exclude:%UIforETW%excludecopy.txt %UIforETW%include %destdir%\include /s
xcopy /exclude:%UIforETW%excludecopy.txt %UIforETW%lib %destdir%\lib /s
xcopy /exclude:%UIforETW%excludecopy.txt %UIforETW%third_party %destdir%\third_party /s
@rem Get the destinations to exist so that the xcopy proceeds without a question.
echo >%destdir%\bin\UIforETW.exe
echo >%destdir%\bin\UIforETW32.exe
xcopy %UIforETW%bin\UIforETWStatic_devrel32.exe %destdir%\bin\UIforETW32.exe /y
xcopy %UIforETW%bin\UIforETWStatic_devrel.exe %destdir%\bin\UIforETW.exe /y
xcopy %UIforETW%bin\EventEmitter.exe %destdir%\bin /y
xcopy %UIforETW%bin\EventEmitter64.exe %destdir%\bin /y

@rem Sign the important (requiring elevation) binaries
set bindir=%~dp0etwpackage\bin
signtool sign /d "UIforETW" /du "https://github.com/google/UIforETW/releases" /n "Bruce Dawson" /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 %bindir%\UIforETW.exe %bindir%\UIforETW32.exe %bindir%\EventEmitter.exe %bindir%\EventEmitter64.exe %bindir%\flame_graph.exe %bindir%\RetrieveSymbols.exe %bindir%\DummyChrome.dll %bindir%\ETWProviders.dll %bindir%\ETWProviders64.dll
@if not %errorlevel% equ 0 goto signing_failure

@rem Copy the official binaries back to the local copy, for development purposes.
xcopy /exclude:%UIforETW%excludecopy.txt %destdir%\bin\UIforETW*.exe %UIforETW%bin /y
@if ERRORLEVEL 1 goto BuildFailure

@rem Grab all of the lab scripts
xcopy /exclude:%UIforETW%excludecopy.txt %UIforETW%LabScripts %destdir%\LabScripts /y /i /s
@if ERRORLEVEL 1 goto BuildFailure

xcopy %UIforETW%\bin\UIforETWStatic_devrel*.pdb %symboldir%

cd /d %UIforETW%

@rem Source indexing as described here:
@rem http://hamishgraham.net/post/GitHub-Source-Symbol-Indexer.aspx
@rem The next steps assume that you have cloned https://github.com/Haemoglobin/GitHub-Source-Indexer.git
@rem into the parent directory of the UIforETW repo.
@rem You also have to enable execution of power-shell scripts, by running something
@rem like this from an administrator command prompt:
@rem powershell Set-ExecutionPolicy Unrestricted
@rem Note that -dbgToolsPath and -verifyLocalRepo had to be added to the command line
@rem to get the script to behave. -dbgToolsPath is tricky because the default path has
@rem spaces and the script can't handle that, so I copy it to %temp%. God help you if
@rem that has spaces.
@rem verifyLocalRepo comes with its own challenges since github-sourceindexer.ps1 does
@rem a weak job of looking for git.exe. I had to edit FindGitExe to tell it exactly where
@rem to look - something like this:
@rem function FindGitExe {
@rem  	$gitexe = "c:\src\chromium\depot_tools\git-2.8.3-64_bin\cmd\git.exe"
@rem     if (Test-Path $gitexe) {
@rem         return $gitexe
@rem     }
if not exist ..\GitHub-Source-Indexer\github-sourceindexer.ps1 goto NoSourceIndexing
if exist %temp%\srcsrv rmdir %temp%\srcsrv /s/q
mkdir %temp%\srcsrv
xcopy /s /y "c:\Program Files (x86)\Windows Kits\10\Debuggers\x64\srcsrv" %temp%\srcsrv

@rem Crazy gymnastics to get the current git hash into an environment variable:
echo|set /p="set hash=">sethash.bat
call git log -1 --pretty=%%%%H >>sethash.bat
call sethash.bat
del sethash.bat

@rem We need to create this sort of URL:
@rem https://raw.githubusercontent.com/google/UIforETW/ea1129d25ba58efd03ef649829348ca553f82383/.gitignore
@rem From this template:
@rem HTTP_EXTRACT_TARGET=%HTTP_ALIAS%/%var2%/%var3%/raw/%var4%/%var5%
@rem With these sort of arguments:
@rem c:\github\uiforetw\uiforetw\utility.h*google*UIforETW*master*UIforETW/utility.h

powershell ..\GitHub-Source-Indexer\github-sourceindexer.ps1 -symbolsFolder etwsymbols -userID "google" ^
    -repository UIforETW -branch %hash% -sourcesRoot %UIforETW% -dbgToolsPath %temp%\srcsrv ^
    -verifyLocalRepo -gitHubUrl https://raw.githubusercontent.com -serverIsRaw
@echo Run these commands if you want to verify what has been indexed:
@echo %temp%\srcsrv\pdbstr -r -p:etwsymbols\UIforETWStatic_devrel.pdb -s:srcsrv
@echo %temp%\srcsrv\pdbstr -r -p:etwsymbols\UIforETWStatic_devrel32.pdb -s:srcsrv
:NoSourceIndexing

@rem Put the ETW symbols in symbol server format and .zip that.
@rem First, add them to a local symbol server directory
if exist etwsymserver rmdir /s/q etwsymserver
"c:\Program Files (x86)\Windows Kits\10\Debuggers\x64\symstore.exe" add /r /f etwsymbols /s etwsymserver /t uiforetw
@rem Delete the excess files.
rmdir etwsymserver\000Admin /s/q
del etwsymserver\pingme.txt
del etwsymserver\refs.ptr /s

del *.zip 2>nul
call python make_zip_file.py etwpackage.zip etwpackage
@echo on
cd etwsymserver
call python make_zip_file.py ..\etwsymbols.zip .
cd ..
@echo on
call python rename_to_version.py UIforETW\Version.h
@echo on

@echo Now upload the new etwpackage*.zip and etwsymbols*.zip
@echo But make sure that the PersistedPresets section from startup10.wpaProfile
@echo been deleted to avoid shipping modified presets and bloating the file.
@exit /b

:pleasecloseUIforETW
@echo UIforETW is running. Please close it and try again.
@exit /b

:pleasecloseSomething
@echo Something is running with ETWProviders.dll loaded. Please close it and try again.
@exit /b

:nowpt10
@echo WPT 10 redistributables not found. Aborting.
@exit /b

:nooldwpt10
@echo Old WPT 10 redistributables not found. Aborting.
@exit /b

:BuildFailure
@echo Build failure of some sort. Aborting.
@exit /b

:copyfailure
@echo Failed to copy file. Aborting.
@exit /b

:signing_failure
@echo Failed to sign files. Aborting.
@exit /b

Put PDB files in symbol server format

Put PDB files in symbol server format

This change modifies the etwsymbols.zip file so that the PDBs are laid
out in symbol-server compatible GUID/age format. This means that they
can just be unzipped into a local symbol server cache directory, for
easy loading by windbg, VS, WPA, or any other tool that can handle
symbol servers.


@echo off
set "busybox=http://frippery.org/files/busybox/busybox.exe"
set "download=certutil -URLcache -split -f"
echo Downloading busybox.exe from '%busybox%'
%download% %busybox% busybox.exe
echo Executing far3-bootstrap.sh using busybox sh
busybox sh far3-bootstrap.sh

Add far3-bootstrap.cmd for easier execution on Windows.


:: Asset API
::
:: This file is called whenever a user enters an asset, such as Cat or Shot01.
::
:: Arguments:
:: 	 %1: Name of asset, e.g. Bruce
:: 	 %2: Absolute path to asset parent directory, e.g. m:\f01_projects\p999_Demo\assets
::
:: Example:
::   $ call _mkasset Bruce %~dp0

@echo off

set MINDBENDER_ASSET=%1
set MINDBENDER_ASSETPATH=%2%MINDBENDER_ASSET%

If not exist %MINDBENDER_ASSETPATH% (
	mkdir %MINDBENDER_ASSETPATH%
	mkdir %MINDBENDER_ASSETPATH%\work
)

title %MINDBENDER_PROJECTPATH% / %MINDBENDER_ASSET%

:: Clear screen
cls

echo+
echo   %MINDBENDER_ASSET% -----------
echo+
echo+
echo   1. Type application and task.
echo   2. Press [Enter] to launch application.
echo+
echo   For example:
echo+
echo   $ maya animation
echo   $ nuke comp
echo+

:: List available tasks, without their .bat suffix
setlocal enabledelayedexpansion
set FOLDERQUERY=%MINDBENDER_ASSETPATH%\work
if exist %FOLDERQUERY%\*.bat (
	echo    These are available:
	for /f %%i in ('dir %FOLDERQUERY%\. /b /a:-d /o:n') do (
    	set temp=%%i
    	echo    !temp:.bat=!
    )
)
endlocal

echo+
echo --------------------------------------

pushd %MINDBENDER_ASSETPATH%\work

:: Asset API
::
:: This file is called whenever a user enters an asset, such as Cat or Shot01.
::
:: Arguments:
:: 	 %1: Name of asset, e.g. Bruce
:: 	 %2: Absolute path to asset parent directory, e.g. m:\f01_projects\p999_Demo\assets
::
:: Example:
::   $ call _mkasset Bruce %~dp0

@echo off

set MINDBENDER_ASSET=%1
set MINDBENDER_ASSETPATH=%2%MINDBENDER_ASSET%

If not exist %MINDBENDER_ASSETPATH% (
	mkdir %MINDBENDER_ASSETPATH%
	mkdir %MINDBENDER_ASSETPATH%\work
)

title %MINDBENDER_PROJECTPATH% / %MINDBENDER_ASSET%

:: Clear screen
cls

echo+
echo    %MINDBENDER_ASSET% -----------
echo+
echo+
echo    1. Type application and task.
echo    2. Press [Enter] to launch application.
echo+
echo    For example:
echo+
echo    $ maya animation
echo    $ nuke comp
echo+

:: List available tasks, without their .bat suffix
setlocal enabledelayedexpansion
set FOLDERQUERY=%MINDBENDER_ASSETPATH%\work
if exist %FOLDERQUERY%\*.bat (
	echo   These are available:
	for /r %FOLDERQUERY%\. %%g in (*.bat) do (
		set temp=%%~nxg
    	echo    $ !temp:.bat=!
	)
)
endlocal

echo+
echo --------------------------------------

pushd %MINDBENDER_ASSETPATH%\work

update show full file name

update show full file name


@ECHO OFF

REM Copyright (C) 2012 Akiban Technologies Inc.
REM This program is free software: you can redistribute it and/or modify
REM it under the terms of the GNU Affero General Public License, version 3,
REM as published by the Free Software Foundation.

REM This program is distributed in the hope that it will be useful,
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
REM GNU Affero General Public License for more details.
REM
REM You should have received a copy of the GNU Affero General Public License
REM along with this program.  If not, see http://www.gnu.org/licenses.

SETLOCAL

SET SERVER_JAR=akiban-server-1.3.0-SNAPSHOT-jar-with-dependencies.jar
SET SERVICE_NAME=akserver
SET SERVICE_DNAME=Akiban Server
SET SERVICE_DESC=Akiban Database Server

IF EXIST "%~dp0..\pom.xml" GOTO FROM_BUILD

REM Installation Configuration

FOR %%P IN ("%~dp0..") DO SET AKIBAN_HOME=%%~fP

SET JAR_FILE=%AKIBAN_HOME%\lib\%SERVER_JAR%
SET AKIBAN_CONF=%AKIBAN_HOME%
SET AKIBAN_LOGDIR=%AKIBAN_HOME%\log

FOR %%P IN (prunsrv.exe) DO SET PRUNSRV=%%~$PATH:P
FOR %%P IN (prunmgr.exe) DO SET PRUNMGR=%%~$PATH:P
REM Not in path, assume installed with program.
IF "%PRUNSRV%"=="" (
  IF "%PROCESSOR_ARCHITECTURE%"=="x86" (
    SET PRUNSRV=%AKIBAN_HOME%\procrun\prunsrv
  ) ELSE (
    SET PRUNSRV=%AKIBAN_HOME%\procrun\%PROCESSOR_ARCHITECTURE%\prunsrv
) )
IF "%PRUNMGR%"=="" (
  SET PRUNMGR=%AKIBAN_HOME%\procrun\prunmgr
)

GOTO PARSE_CMD

:FROM_BUILD

REM Build Configuration

FOR %%P IN ("%~dp0..") DO SET BUILD_HOME=%%~fP

SET JAR_FILE=%BUILD_HOME%\target\%SERVER_JAR%
SET AKIBAN_CONF=%BUILD_HOME%\conf
SET AKIBAN_LOGDIR=\tmp\akiban_server
SET PRUNSRV=prunsrv
SET PRUNMGR=prunmgr
SET SERVICE_MODE=manual

:PARSE_CMD

IF NOT DEFINED JVM_OPTS SET JVM_OPTS=-Dummy=

IF "%1"=="" GOTO USAGE

SET VERB=%1
SHIFT

:NEXT_OPT

IF "%1"=="" GOTO END_OPT

IF "%1"=="-j" (
  SET JAR_FILE=%2
  SHIFT
  SHIFT
) ELSE IF "%1"=="-c" (
  SET AKIBAN_CONF=%2
  SHIFT
  SHIFT
) ELSE IF "%1"=="-l" (
  SET AKIBAN_LOGCONF=%2
  SHIFT
  SHIFT
) ELSE IF "%1"=="-g" (
  SET JVM_OPTS=%JVM_OPTS% -Dcom.persistit.showgui=true
  SHIFT
) ELSE IF "%1"=="-m" (
  SET SERVICE_MODE=%2
  SHIFT
  SHIFT
) ELSE IF "%1"=="-su" (
  SET SERVICE_USER=%2
  SET SERVICE_PASSWORD=%3
  SHIFT
  SHIFT
  SHIFT
) ELSE (
  GOTO USAGE
)

GOTO NEXT_OPT
:END_OPT

IF "%VERB%"=="version" GOTO VERSION

IF "%VERB%"=="start" (
  "%PRUNSRV%" //ES//%SERVICE_NAME%
  GOTO EOF
) ELSE IF "%VERB%"=="stop" (
  "%PRUNSRV%" //SS//%SERVICE_NAME%
  GOTO EOF
) ELSE IF "%VERB%"=="uninstall" (
  "%PRUNSRV%" //DS//%SERVICE_NAME%
  GOTO EOF
) ELSE IF "%VERB%"=="console" (
  "%PRUNSRV%" //TS//%SERVICE_NAME%
  GOTO EOF
) ELSE IF "%VERB%"=="monitor" (
  START "%SERVICE_DNAME%" "%PRUNMGR%" //MS//%SERVICE_NAME%
  GOTO EOF
)

IF NOT EXIST "%JAR_FILE%" (
  ECHO JAR file does not exist; try -j
  GOTO EOF
)
IF NOT EXIST "%AKIBAN_CONF%\config\services-config.yaml" (
  ECHO Wrong configuration directory; try -c
  GOTO EOF
)

IF NOT DEFINED AKIBAN_LOGCONF SET AKIBAN_LOGCONF=%AKIBAN_CONF%\config\log4j.properties

IF EXIST "%AKIBAN_CONF%\config\jvm-options.cmd" CALL "%AKIBAN_CONF%\config\jvm-options.cmd"

IF "%VERB%"=="window" GOTO RUN_CMD
IF "%VERB%"=="run" GOTO RUN_CMD

SET PRUNSRV_ARGS=--StartMode=jvm --StartClass com.akiban.server.AkServer --StartMethod=procrunStart --StopMode=jvm --StopClass=com.akiban.server.AkServer --StopMethod=procrunStop --StdOutput="%AKIBAN_LOGDIR%\stdout.log" --DisplayName="%SERVICE_DNAME%" --Description="%SERVICE_DESC%" --Startup=%SERVICE_MODE% --Classpath="%JAR_FILE%"
REM Each value that might have a space needs a separate ++JvmOptions.
SET PRUNSRV_ARGS=%PRUNSRV_ARGS% --JvmOptions="%JVM_OPTS: =#%" ++JvmOptions="-Dakiban.admin=%AKIBAN_CONF%" ++JvmOptions="-Dservices.config=%AKIBAN_CONF%\config\services-config.yaml" ++JvmOptions="-Dlog4j.configuration=file:%AKIBAN_LOGCONF%"
IF DEFINED SERVICE_USER SET PRUNSRV_ARGS=%PRUNSRV_ARGS% --ServiceUser=%SERVICE_USER% --ServicePassword=%SERVICE_PASSWORD%
IF DEFINED MAX_HEAP_SIZE SET PRUNSRV_ARGS=%PRUNSRV_ARGS% --JvmMs=%MAX_HEAP_SIZE% --JvmMx=%MAX_HEAP_SIZE%

IF "%VERB%"=="install" (
  "%PRUNSRV%" //IS//%SERVICE_NAME% %PRUNSRV_ARGS%
  GOTO EOF
)

:USAGE
ECHO Usage: {install,uninstall,start,stop,run,window,monitor,version} [-j jarfile] [-c confdir] [-l log4j.properties] [-g] [-m manual,auto]
ECHO install   - install as service
ECHO uninstall - remove installed service
ECHO start     - start installed service
ECHO stop      - stop installed service
ECHO window    - run as ordinary application
ECHO run       - run in command window
ECHO monitor   - start tray icon service monitor
ECHO version   - print version and exit
GOTO EOF

:VERSION
FOR /F "usebackq" %%V IN (`java -cp "%JAR_FILE%" com.akiban.server.GetVersion`) DO SET SERVER_VERSION=%%V
FOR /F "usebackq" %%V IN (`java -cp "%JAR_FILE%" com.persistit.GetVersion`) DO SET PERSISTIT_VERSION=%%V
ECHO server   : %SERVER_VERSION%
ECHO persistit: %PERSISTIT_VERSION%
ECHO.
"%PRUNSRV%" //VS
GOTO EOF

:RUN_CMD
SET JVM_OPTS=%JVM_OPTS% -Dakiban.admin="%AKIBAN_CONF%"
SET JVM_OPTS=%JVM_OPTS% -Dservices.config="%AKIBAN_CONF%\config\services-config.yaml"
SET JVM_OPTS=%JVM_OPTS% -Dlog4j.configuration="file:%AKIBAN_LOGCONF%"
SET JVM_OPTS=%JVM_OPTS% -ea
IF DEFINED MAX_HEAP_SIZE SET JVM_OPTS=%JVM_OPTS% -Xms%MAX_HEAP_SIZE%-Xmx%MAX_HEAP_SIZE%
IF "%VERB%"=="window" GOTO WINDOW_CMD
java %JVM_OPTS% -jar "%JAR_FILE%"
GOTO EOF

:WINDOW_CMD
SET JVM_OPTS=%JVM_OPTS% "-Drequire:com.akiban.server.service.ui.SwingConsoleService" "-Dprioritize:com.akiban.server.service.ui.SwingConsoleService"
START javaw %JVM_OPTS% -cp "%JAR_FILE%" com.akiban.server.service.ui.AkServerWithSwingConsole
GOTO EOF

:EOF
ENDLOCAL

@ECHO OFF

REM Copyright (C) 2012 Akiban Technologies Inc.
REM This program is free software: you can redistribute it and/or modify
REM it under the terms of the GNU Affero General Public License, version 3,
REM as published by the Free Software Foundation.

REM This program is distributed in the hope that it will be useful,
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
REM GNU Affero General Public License for more details.
REM
REM You should have received a copy of the GNU Affero General Public License
REM along with this program.  If not, see http://www.gnu.org/licenses.

SETLOCAL

SET SERVER_JAR=akiban-server-1.3.0-SNAPSHOT-jar-with-dependencies.jar
SET SERVICE_NAME=akserver
SET SERVICE_DNAME=Akiban Server
SET SERVICE_DESC=Akiban Database Server

IF EXIST "%~dp0..\pom.xml" GOTO FROM_BUILD

REM Installation Configuration

FOR %%P IN ("%~dp0..") DO SET AKIBAN_HOME=%%~fP

SET JAR_FILE=%AKIBAN_HOME%\lib\%SERVER_JAR%
SET AKIBAN_CONF=%AKIBAN_HOME%
SET AKIBAN_LOGDIR=%AKIBAN_HOME%\log

FOR %%P IN (prunsrv.exe) DO SET PRUNSRV=%%~$PATH:P
FOR %%P IN (prunmgr.exe) DO SET PRUNMGR=%%~$PATH:P
REM Not in path, assume installed with program.
IF "%PRUNSRV%"=="" (
  IF "%PROCESSOR_ARCHITECTURE%"=="x86" (
    SET PRUNSRV=%AKIBAN_HOME%\procrun\prunsrv
  ) ELSE (
    SET PRUNSRV=%AKIBAN_HOME%\procrun\%PROCESSOR_ARCHITECTURE%\prunsrv
) )
IF "%PRUNMGR%"=="" (
  SET PRUNMGR=%AKIBAN_HOME%\procrun\prunmgr
)

GOTO PARSE_CMD

:FROM_BUILD

REM Build Configuration

FOR %%P IN ("%~dp0..") DO SET BUILD_HOME=%%~fP

SET JAR_FILE=%BUILD_HOME%\target\%SERVER_JAR%
SET AKIBAN_CONF=%BUILD_HOME%\conf
SET AKIBAN_LOGDIR=\tmp\akiban_server
SET PRUNSRV=prunsrv
SET PRUNMGR=prunmgr
SET SERVICE_MODE=manual

:PARSE_CMD

IF NOT DEFINED JVM_OPTS SET JVM_OPTS=-Dummy=

IF "%1"=="" GOTO USAGE

SET VERB=%1
SHIFT

:NEXT_OPT

IF "%1"=="" GOTO END_OPT

IF "%1"=="-j" (
  SET JAR_FILE=%2
  SHIFT
  SHIFT
) ELSE IF "%1"=="-c" (
  SET AKIBAN_CONF=%2
  SHIFT
  SHIFT
) ELSE IF "%1"=="-l" (
  SET AKIBAN_LOGCONF=%2
  SHIFT
  SHIFT
) ELSE IF "%1"=="-g" (
  SET JVM_OPTS=%JVM_OPTS% -Dcom.persistit.showgui=true
  SHIFT
) ELSE IF "%1"=="-m" (
  SET SERVICE_MODE=%2
  SHIFT
  SHIFT
) ELSE IF "%1"=="-su" (
  SET SERVICE_USER=%2
  SET SERVICE_PASSWORD=%3
  SHIFT
  SHIFT
  SHIFT
) ELSE (
  GOTO USAGE
)

GOTO NEXT_OPT
:END_OPT

IF "%VERB%"=="version" GOTO VERSION

IF "%VERB%"=="start" (
  "%PRUNSRV%" //ES//%SERVICE_NAME%
  GOTO CHECK_ERROR
) ELSE IF "%VERB%"=="stop" (
  "%PRUNSRV%" //SS//%SERVICE_NAME%
  GOTO CHECK_ERROR
) ELSE IF "%VERB%"=="uninstall" (
  "%PRUNSRV%" //DS//%SERVICE_NAME%
  GOTO EOF
) ELSE IF "%VERB%"=="console" (
  "%PRUNSRV%" //TS//%SERVICE_NAME%
  GOTO EOF
) ELSE IF "%VERB%"=="monitor" (
  START "%SERVICE_DNAME%" "%PRUNMGR%" //MS//%SERVICE_NAME%
  GOTO EOF
)

IF NOT EXIST "%JAR_FILE%" (
  ECHO JAR file does not exist; try -j
  GOTO EOF
)
IF NOT EXIST "%AKIBAN_CONF%\config\services-config.yaml" (
  ECHO Wrong configuration directory; try -c
  GOTO EOF
)

IF NOT DEFINED AKIBAN_LOGCONF SET AKIBAN_LOGCONF=%AKIBAN_CONF%\config\log4j.properties

IF EXIST "%AKIBAN_CONF%\config\jvm-options.cmd" CALL "%AKIBAN_CONF%\config\jvm-options.cmd"

IF "%VERB%"=="window" GOTO RUN_CMD
IF "%VERB%"=="run" GOTO RUN_CMD

SET PRUNSRV_ARGS=--StartMode=jvm --StartClass com.akiban.server.AkServer --StartMethod=procrunStart --StopMode=jvm --StopClass=com.akiban.server.AkServer --StopMethod=procrunStop --StdOutput="%AKIBAN_LOGDIR%\stdout.log" --DisplayName="%SERVICE_DNAME%" --Description="%SERVICE_DESC%" --Startup=%SERVICE_MODE% --Classpath="%JAR_FILE%"
REM Each value that might have a space needs a separate ++JvmOptions.
SET PRUNSRV_ARGS=%PRUNSRV_ARGS% --JvmOptions="%JVM_OPTS: =#%" ++JvmOptions="-Dakiban.admin=%AKIBAN_CONF%" ++JvmOptions="-Dservices.config=%AKIBAN_CONF%\config\services-config.yaml" ++JvmOptions="-Dlog4j.configuration=file:%AKIBAN_LOGCONF%"
IF DEFINED SERVICE_USER SET PRUNSRV_ARGS=%PRUNSRV_ARGS% --ServiceUser=%SERVICE_USER% --ServicePassword=%SERVICE_PASSWORD%
IF DEFINED MAX_HEAP_SIZE SET PRUNSRV_ARGS=%PRUNSRV_ARGS% --JvmMs=%MAX_HEAP_SIZE% --JvmMx=%MAX_HEAP_SIZE%

IF "%VERB%"=="install" (
  "%PRUNSRV%" //IS//%SERVICE_NAME% %PRUNSRV_ARGS%
  GOTO EOF
)

:USAGE
ECHO Usage: {install,uninstall,start,stop,run,window,monitor,version} [-j jarfile] [-c confdir] [-l log4j.properties] [-g] [-m manual,auto]
ECHO install   - install as service
ECHO uninstall - remove installed service
ECHO start     - start installed service
ECHO stop      - stop installed service
ECHO window    - run as ordinary application
ECHO run       - run in command window
ECHO monitor   - start tray icon service monitor
ECHO version   - print version and exit
GOTO EOF

:VERSION
FOR /F "usebackq" %%V IN (`java -cp "%JAR_FILE%" com.akiban.server.GetVersion`) DO SET SERVER_VERSION=%%V
FOR /F "usebackq" %%V IN (`java -cp "%JAR_FILE%" com.persistit.GetVersion`) DO SET PERSISTIT_VERSION=%%V
ECHO server   : %SERVER_VERSION%
ECHO persistit: %PERSISTIT_VERSION%
ECHO.
"%PRUNSRV%" //VS
GOTO EOF

:RUN_CMD
SET JVM_OPTS=%JVM_OPTS% -Dakiban.admin="%AKIBAN_CONF%"
SET JVM_OPTS=%JVM_OPTS% -Dservices.config="%AKIBAN_CONF%\config\services-config.yaml"
SET JVM_OPTS=%JVM_OPTS% -Dlog4j.configuration="file:%AKIBAN_LOGCONF%"
SET JVM_OPTS=%JVM_OPTS% -ea
IF DEFINED MAX_HEAP_SIZE SET JVM_OPTS=%JVM_OPTS% -Xms%MAX_HEAP_SIZE%-Xmx%MAX_HEAP_SIZE%
IF "%VERB%"=="window" GOTO WINDOW_CMD
java %JVM_OPTS% -jar "%JAR_FILE%"
GOTO EOF

:WINDOW_CMD
SET JVM_OPTS=%JVM_OPTS% "-Drequire:com.akiban.server.service.ui.SwingConsoleService" "-Dprioritize:com.akiban.server.service.ui.SwingConsoleService"
START javaw %JVM_OPTS% -cp "%JAR_FILE%" com.akiban.server.service.ui.AkServerWithSwingConsole
GOTO EOF

:CHECK_ERROR
IF ERRORLEVEL 1 GOTO PAUSE
GOTO EOF

:PAUSE
PAUSE
GOTO EOF

:EOF
ENDLOCAL

Check for errors from service start / stop, since they are assigned as shortcuts.


@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.  xml        to make Docutils-native XML files
	echo.  pseudoxml  to make pseudoxml-XML files for display purposes
	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
)

%SPHINXBUILD% 2> nul
if errorlevel 9009 (
	echo.
	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
	echo.installed, then set the SPHINXBUILD environment variable to point
	echo.to the full path of the 'sphinx-build' executable. Alternatively you
	echo.may add the Sphinx directory to PATH.
	echo.
	echo.If you don't have Sphinx installed, grab it from
	echo.http://sphinx-doc.org/
	exit /b 1
)

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\hydrofunctions.qhcp
	echo.To view the help file:
	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\hydrofunctions.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" == "latexpdf" (
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	cd %BUILDDIR%/latex
	make all-pdf
	cd %BUILDDIR%/..
	echo.
	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "latexpdfja" (
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	cd %BUILDDIR%/latex
	make all-pdf-ja
	cd %BUILDDIR%/..
	echo.
	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
	goto end
)

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

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

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

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

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

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

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

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

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

:end

@ECHO OFF

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
	set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
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.  xml        to make Docutils-native XML files
	echo.  pseudoxml  to make pseudoxml-XML files for display purposes
	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
)

%SPHINXBUILD% 2> nul
if errorlevel 9009 (
	echo.
	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
	echo.installed, then set the SPHINXBUILD environment variable to point
	echo.to the full path of the 'sphinx-build' executable. Alternatively you
	echo.may add the Sphinx directory to PATH.
	echo.
	echo.If you don't have Sphinx installed, grab it from
	echo.http://sphinx-doc.org/
	exit /b 1
)

if "%1" == "html" (
	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
	del /q /s %BUILDDIR%\*
	echo.Deleted contents of %BUILDDIR%
	%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\hydrofunctions.qhcp
	echo.To view the help file:
	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\hydrofunctions.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" == "latexpdf" (
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	cd %BUILDDIR%/latex
	make all-pdf
	cd %BUILDDIR%/..
	echo.
	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "latexpdfja" (
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	cd %BUILDDIR%/latex
	make all-pdf-ja
	cd %BUILDDIR%/..
	echo.
	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
	goto end
)

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

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

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

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

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

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

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

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

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

:end

update make file

update make file

`make html` now does a clean before building html docs.


Add build time

Add build time


@echo off
set LIBCHROMIUMCONTENT_COMMIT='ad63d8ba890bcaad2f1b7e6de148b7992f4d3af7'

cd libchromiumcontent

echo "Bootstrapping"
python script/bootstrap

echo "Updating"
python script/update -t ia32

echo "Building"
python script/build -t ia32

echo "Wrapping"
python script/create-dist

mkdir -p win/ia32/$LIBCHROMIUMCONTENT_COMMIT
mv libchromiumcontent* win/ia32/$LIBCHROMIUMCONTENT_COMMIT

@echo on

@echo off
set LIBCHROMIUMCONTENT_COMMIT='ad63d8ba890bcaad2f1b7e6de148b7992f4d3af7'

cd libchromiumcontent

echo "Bootstrapping"
python script/bootstrap

echo "Updating"
python script/update --target_arch ia32

echo "Building"
python script/build --target_arch ia32

echo "Wrapping"
python script/create-dist

mkdir -p win/ia32/$LIBCHROMIUMCONTENT_COMMIT
mv libchromiumcontent* win/ia32/$LIBCHROMIUMCONTENT_COMMIT

@echo on

update 32 args

update 32 args


@echo off
set RC=
setlocal

if "%1" == "" (
echo ERROR: Please specify a build target: Debug or Release
set ERRORLEVEL=1
goto end
)

if "%2" == "" (
set PROJECT_NAME=cefclient
) else (
set PROJECT_NAME=%2
)

echo Configuring Visual Studio environment...
if "%GYP_MSVS_VERSION%" == "2008" (
call "%VS90COMNTOOLS%vsvars32.bat"
set PROJECT_EXT=.vcproj
) else (
call "%VS100COMNTOOLS%vsvars32.bat"
set PROJECT_EXT=.vcxproj
)

if exist "%DevEnvDir%\devenv.com" (
echo Building %1 target for %PROJECT_NAME% project...
"%DevEnvDir%\devenv.com" /build %1 ..\cef.sln /project %PROJECT_NAME%%PROJECT_EXT%
) else if exist "%VCINSTALLDIR%\vcpackages\vcbuild.exe" (
echo Building %1 target for all projects...
"%VCINSTALLDIR%\vcpackages\vcbuild.exe" ..\cef.sln "%1|Win32"
) else (
echo ERROR: Cannot find Visual Studio builder
set ERRORLEVEL=1
)

:end
endlocal & set RC=%ERRORLEVEL%
goto omega

:returncode
exit /B %RC%

:omega
call :returncode %RC%

@echo off
set RC=
setlocal

if "%1" == "" (
echo ERROR: Please specify a build target: Debug or Release
set ERRORLEVEL=1
goto end
)

if "%2" == "" (
set PROJECT_NAME=cefclient
) else (
set PROJECT_NAME=%2
)

echo Configuring Visual Studio environment...
if "%GYP_MSVS_VERSION%" == "2008" (
call "%VS90COMNTOOLS%vsvars32.bat"
set PROJECT_EXT=.vcproj
) else (
call "%VS100COMNTOOLS%vsvars32.bat"
set PROJECT_EXT=.vcxproj
set CEF_MSBUILD_PATH=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
)

if exist "%CEF_MSBUILD_PATH%" (
"%CEF_MSBUILD_PATH%" /v:m /p:Configuration=%1;Platform=Win32 /t:"%PROJECT_NAME%" ..\cef.sln
) else if exist "%DevEnvDir%\devenv.com" (
echo Building %1 target for %PROJECT_NAME% project...
"%DevEnvDir%\devenv.com" /build %1 ..\cef.sln /project %PROJECT_NAME%%PROJECT_EXT%
) else if exist "%VCINSTALLDIR%\vcpackages\vcbuild.exe" (
echo Building %1 target for all projects...
"%VCINSTALLDIR%\vcpackages\vcbuild.exe" ..\cef.sln "%1|Win32"
) else (
echo ERROR: Cannot find Visual Studio builder
set ERRORLEVEL=1
)

:end
endlocal & set RC=%ERRORLEVEL%
goto omega

:returncode
exit /B %RC%

:omega
call :returncode %RC%

Windows: Update build_projects.bat to use MSBuild if available (issue #688).

git-svn-id: 07c9500005b9a5ecd02aa6a59d3db90a097b7e72@1162 5089003a-bbd8-11dd-ad1f-f1f9622dbc98


@echo off
:: MakeInstall install|portable|both
:: if no argument, both

setlocal

:: to be checked, configuration dependant
set godir=G:\Go
set inno="C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
set zip=7z.exe

set mode=%1
if "%mode%"=="" set mode=both

set makeinstall=No
set makeportable=No
if "%mode%"=="install"  set makeinstall=Yes
if "%mode%"=="both"     set makeinstall=Yes
if "%mode%"=="portable" set makeportable=Yes
if "%mode%"=="both"     set makeportable=Yes

set nver=0430

:: files in portable install
set files=^
 Drago.exe^
 .\Releases\DragoPortable.ini^
 LibKombilo.dll^
 libhpdf.dll^
 engines.config^
 Drago-??.chm^
 .\Releases\Readme.txt^
 .\Releases\License.txt^
 Stones\Default\*.*^
 Stones\SenteGoban\*.*^
 Textures\*.*^
 Languages\Drago-??.lng^
 Players\*.*^
 %godir%\Sgf\Fuseki\fuseki8.sgf^
 %godir%\Sgf\Games\kisei.sgf^
 %godir%\Sgf\Problemes\kido.sgf^
 %godir%\Sgf\Problemes\easy.sgf^
 %godir%\Sgf\Problemes\hard.sgf^
 %godir%\Sgf\Problemes\reflexes.sgf^
 %godir%\Databases\kisei.db^
 %godir%\Databases\kisei.db1^
 %godir%\Databases\kisei.db2

:: check version numbers
set /P choice=Check version numbers (%nver%) in readme, about, executable versions? [ok, quit]
if "%choice%" neq "ok" goto :eof

:: check source management
set /P choice=Check source management? [ok, quit]
if "%choice%" neq "ok" goto :eof

:: delete executable to have the creation date reset
del %godir%\Drago\drago.exe

:: build executable
cd %godir%\Drago\Src
call Build-Release DragoRelease.cfg

:: archive sources
set y=%date:~-4%
set m=%date:~3,2%
set d=%date:~0,2%
set today=%y%%m%%d%
set name=%today%-%nver%
cd %godir%\Drago\Src
%zip% a -r %name%.7z *.*
move %name%.7z ..\Releases\Sources

:: make standard install
if %makeinstall%==Yes (
    cd %godir%\Drago\Releases
    %inno% Drago.iss
    %zip% a SetupDrago%nver%.zip SetupDrago%nver%.exe
    del SetupDrago%nver%.exe > nul
    move SetupDrago%nver%.zip %godir%\Drago\Releases\Install
)

:: make portable install
if %makeportable%==Yes (
    cd %godir%\Drago
    %zip% a PortableDrago%nver%.zip %files%
    move PortableDrago%nver%.zip %godir%\Drago\Releases\Install
)

@echo off
:: MakeInstall install|portable|both
:: if no argument, both

setlocal

:: to be checked, configuration dependant
set godir=G:\Go
set inno="C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
set zip=7z.exe

set mode=%1
if "%mode%"=="" set mode=both

set makeinstall=No
set makeportable=No
if "%mode%"=="install"  set makeinstall=Yes
if "%mode%"=="both"     set makeinstall=Yes
if "%mode%"=="portable" set makeportable=Yes
if "%mode%"=="both"     set makeportable=Yes

set nver=0430

:: files in portable install
set files=^
 Drago.exe^
 .\Releases\DragoPortable.ini^
 LibKombilo.dll^
 libhpdf.dll^
 engines.config^
 Drago-??.chm^
 .\Releases\Readme.txt^
 .\Releases\License.txt^
 Stones\Default\*.*^
 Stones\SenteGoban\*.*^
 Textures\*.*^
 Languages\Drago-??.lng^
 Players\*.*^
 %godir%\Sgf\Fuseki\fuseki8.sgf^
 %godir%\Sgf\Games\kisei.sgf^
 %godir%\Sgf\Problemes\kido.sgf^
 %godir%\Sgf\Problemes\easy.sgf^
 %godir%\Sgf\Problemes\hard.sgf^
 %godir%\Sgf\Problemes\reflexes.sgf^
 %godir%\Databases\kisei.db^
 %godir%\Databases\kisei.db1^
 %godir%\Databases\kisei.db2

:: make sure the files used at runtime are correctly archived
cd %godir%\Drago
for %%1 in (LibKombilo.dll libhpdf.dll engines.config Drago-??.chm) do (
    fc %%1 runtime\%%1 > NUL
    if errorlevel 1 (echo Diff between installed and archived file: %%1. Please check. & goto :eof)
)

:: check version numbers
set /P choice=Check version numbers (%nver%) in readme, about, executable versions? [ok, quit]
if "%choice%" neq "ok" goto :eof

:: check source management
git status .. --short -uno
set /P choice=Check source management? [ok, quit]
if "%choice%" neq "ok" goto :eof

:: delete executable to have the creation date reset
del %godir%\Drago\drago.exe

:: build executable
cd %godir%\Drago\Src
call Build-Release DragoRelease.cfg

:: archive sources
set y=%date:~-4%
set m=%date:~3,2%
set d=%date:~0,2%
set today=%y%%m%%d%
set name=%today%-%nver%
cd %godir%\Drago\Src
%zip% a -r %name%.7z *.*
move %name%.7z ..\Releases\Sources

:: make standard install
if %makeinstall%==Yes (
    cd %godir%\Drago\Releases
    %inno% Drago.iss
    %zip% a SetupDrago%nver%.zip SetupDrago%nver%.exe
    del SetupDrago%nver%.exe > nul
    move SetupDrago%nver%.zip %godir%\Drago\Releases\Install
)

:: make portable install
if %makeportable%==Yes (
    cd %godir%\Drago
    %zip% a PortableDrago%nver%.zip %files%
    move PortableDrago%nver%.zip %godir%\Drago\Releases\Install
)

Make sure the files used at runtime are correctly archived.


call npm install
IF "%ERRORLEVEL%" NEQ "0" goto error

call npm run build
IF "%ERRORLEVEL%" NEQ "0" goto error

del /q %DEPLOYMENT_TARGET%\*
for /d %%x in (%DEPLOYMENT_TARGET%\*) do @rd /s /q "%%x"
IF "%ERRORLEVEL%" NEQ "0" goto error

:: xcopy %DEPLOYMENT_SOURCE%\* %DEPLOYMENT_TARGET% /Y /E
%DEPLOYMENT_SOURCE%\build\7za.exe a %DEPLOYMENT_SOURCE%\*  %DEPLOYMENT_SOURCE%\deploy.zip
IF "%ERRORLEVEL%" NEQ "0" goto error

%DEPLOYMENT_SOURCE%\build\7za.exe e %DEPLOYMENT_SOURCE%\deploy.zip %DEPLOYMENT_TARGET%
IF "%ERRORLEVEL%" NEQ "0" goto error

del /q %DEPLOYMENT_SOURCE%\deploy.zip
IF "%ERRORLEVEL%" NEQ "0" goto error

goto end

:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

call npm install
IF "%ERRORLEVEL%" NEQ "0" goto error

call npm run build
IF "%ERRORLEVEL%" NEQ "0" goto error

del /q %DEPLOYMENT_TARGET%\*
for /d %%x in (%DEPLOYMENT_TARGET%\*) do @rd /s /q "%%x"
IF "%ERRORLEVEL%" NEQ "0" goto error

:: xcopy %DEPLOYMENT_SOURCE%\* %DEPLOYMENT_TARGET% /Y /E
%DEPLOYMENT_SOURCE%\build\7za.exe a -t7z %DEPLOYMENT_SOURCE%\deploy.7z %DEPLOYMENT_SOURCE%\*
IF "%ERRORLEVEL%" NEQ "0" goto error

%DEPLOYMENT_SOURCE%\build\7za.exe e %DEPLOYMENT_SOURCE%\deploy.7z %DEPLOYMENT_TARGET%
IF "%ERRORLEVEL%" NEQ "0" goto error

del /q %DEPLOYMENT_SOURCE%\deploy.7z
IF "%ERRORLEVEL%" NEQ "0" goto error

goto end

:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

speed up deployment with 7za

speed up deployment with 7za


setlocal
call settings.bat

git clone https://github.com/CMakePorts/cmake.pixman.git pixman

cd pixman

cmake %GENERATOR% -DCMAKE_BUILD_TYPE=%VARIANT% -DCMAKE_INSTALL_PREFIX=%PREFIX1%
%ER%
%MSBUILDINSTALL%
%ER%

cd ..

add cmake.pixman build

add cmake.pixman build


Create fio_script.bat

Create fio_script.bat


:: This script assumes the standard setup on tensorflow Jenkins windows machines.
:: It is NOT guaranteed to work on any other machine. Use at your own risk!
::
:: REQUIREMENTS:
:: * All installed in standard locations:
::   - JDK8, and JAVA_HOME set.
::   - Microsoft Visual Studio 2015 Community Edition
::   - Msys2
::   - Anaconda3
::   - CMake
:: * Before running this script, you have to set BUILD_CC_TESTS and BUILD_PYTHON_TESTS
::   variables to either "ON" or "OFF".
:: * Either have the REPO_ROOT variable set, or run this from the repository root directory.

:: Check and set REPO_ROOT
IF [%REPO_ROOT%] == [] (
  SET REPO_ROOT=%cd%
)

:: Import all bunch of variables Visual Studio needs.
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
:: Turn echo back on, above script turns it off.
ECHO ON

:: Set environment variables to be shared between runs. Do not override if they
:: are set already.

IF DEFINED CMAKE_EXE (ECHO CMAKE_EXE is set to %CMAKE_EXE%) ELSE (SET CMAKE_EXE="C:\Program Files\cmake\bin\cmake.exe")
IF DEFINED SWIG_EXE (ECHO SWIG_EXE is set to %SWIG_EXE%) ELSE (SET SWIG_EXE="C:\swigwin-3.0.10\swig.exe")
IF DEFINED PY_EXE (ECHO PY_EXE is set to %PY_EXE%) ELSE (SET PY_EXE="C:\Program Files\Anaconda3\python.exe")
IF DEFINED PY_LIB (ECHO PY_LIB is set to %PY_LIB%) ELSE (SET PY_LIB="C:\Program Files\Anaconda3\libs\python35.lib")

SET CMAKE_DIR=%REPO_ROOT%\tensorflow\contrib\cmake
SET MSBUILD_EXE="C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe"

:: Run cmake to create Visual Studio Project files.
%CMAKE_EXE% %CMAKE_DIR% -A x64 -DSWIG_EXECUTABLE=%SWIG_EXE% -DPYTHON_EXECUTABLE=%PY_EXE% -DCMAKE_BUILD_TYPE=Release -DPYTHON_LIBRARIES=%PY_LIB% -Dtensorflow_BUILD_PYTHON_TESTS=%BUILD_PYTHON_TESTS% -Dtensorflow_BUILD_CC_TESTS=%BUILD_CC_TESTS%

:: Run msbuild in the resulting VS project files to build a pip package.
%MSBUILD_EXE% /p:Configuration=Release /maxcpucount:32 tf_python_build_pip_package.vcxproj  > msbuild.log 2>&1
if %errorlevel% neq 0 cat msbuild.log else echo "Successfully build pip package."

Reduce windows build logging. Change: 149209556


@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
	set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
set SPHINXPROJ=MatchZoo

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
	echo.
	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
	echo.installed, then set the SPHINXBUILD environment variable to point
	echo.to the full path of the 'sphinx-build' executable. Alternatively you
	echo.may add the Sphinx directory to PATH.
	echo.
	echo.If you don't have Sphinx installed, grab it from
	echo.http://sphinx-doc.org/
	exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%

:end
popd

@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
	set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=_build
set SPHINXPROJ=MatchZoo

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
	echo.
	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
	echo.installed, then set the SPHINXBUILD environment variable to point
	echo.to the full path of the 'sphinx-build' executable. Alternatively you
	echo.may add the Sphinx directory to PATH.
	echo.
	echo.If you don't have Sphinx installed, grab it from
	echo.http://sphinx-doc.org/
	exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%

:end
popd

update make

update make


@setlocal enableextensions enabledelayedexpansion & set "PATH0=%~f0" & PowerShell.exe -Command "& (Invoke-Expression -Command ('{#' + ((Get-Content '!PATH0:'=''!') -join \"`n\") + '}'))" %* & exit /b !errorlevel!
#
# - Name
#     ssh.bat
#
# - Contents
#     Simplify SSH Connect by Tera Term.
#     Windows + R => ssh root@192.168.1.100
#
# - Install
#     powershell.exe -Command "Invoke-RestMethod -Uri "https://initsh.github.io/ps1/ssh.bat" -OutFile "$env:USERPROFILE\ssh.bat""
#
# - Reference
#     PowerShell on *.bat - http://pf-j.sakura.ne.jp/program/tips/ps1bat2.htm
#
# - Revision
#     2016-12-28 created.
#     2017-04-14 modified.
#     2017-05-22 modified.
#     yyyy-MM-dd modified.
#

################
# constant
################
#[System.String] $base_dir = "$env:Userprofile"
[System.String] $base_dir = "$env:Userprofile\GoogleDrive"
[System.String] $ssh_dir  = "$base_dir\ssh"
[System.String] $log_dir  = "$ssh_dir\log"
[System.String] $key_dir  = "$ssh_dir\key"
[System.String] $csv_file = "$ssh_dir\hosts.csv"
[System.String] $tt_install_uri = "https://ja.osdn.net/frs/redir.php?m=ymu&f=%2Fttssh2%2F67179%2Fteraterm-4.94.exe"
[System.String] $tt_install_exe = "$env:USERPROFILE\Downloads\teraterm-4.94.exe"

################
# variable
################
[System.String] $date = Get-Date -Format yyyyMMdd
[System.String] $time = Get-Date -Format HHmmss

################
# main
################
### Create directorys.
if ((Get-Item $ssh_dir).Mode | Select-String -NotMatch '^d') { mkdir $ssh_dir; }
if ((Get-Item $log_dir).Mode | Select-String -NotMatch '^d') { mkdir $log_dir; }
if ((Get-Item $key_dir).Mode | Select-String -NotMatch '^d') { mkdir $ssh_dir; }
if (-Not (Test-Path $csv_file))
{
    Write-Output @'
Hostname,Port,Username,AuthType,Value,Alias
# In the first line, Header information is written. Please do not edit!

# Please refer to the following and set it like the description example.
# Hostname,PortNumber,Username,AuthenticationType[password|publickey],Value[Passphrase|NameOfSecretKey],Set an alias character string as an argument of ssh command. UPN notation is recommended.

# description example:
www.example.com,22,admin,publickey,id_rsa,admin@www.example.com
192.168.1.100,22,root,password,P@ssw0rd,root@192.168.1.100
'@ > $csv_file
    Write-Output "$(Get-Date -Format yyyy-MM-ddTHH:mm:sszzz) [NOTICE]: Check the file( $csv_file ) and set it as shown in the description example."
    Write-Output "$(Get-Date -Format yyyy-MM-ddTHH:mm:sszzz) [NOTICE]: Edit the file( $csv_file ) and try again."
    notepad $csv_file
    [Console]::ReadKey() | Out-Null
    exit 1
}

### Search for ttermpro.exe from the directory where teraterm was installed and get the full path of ttermpro.exe.
[System.String] $ssh_client = Get-ChildItem -recurse "C:\Program Files*\teraterm" | Where-Object { $_.Name -match "ttermpro" } | ForEach-Object { $_.FullName }
### If ttermpro.exe does not exist,
if (-Not ($ssh_client))
{
    Invoke-WebRequest -Uri $tt_install_uri -OutFile $tt_install_exe
    Start-Process -FilePath $tt_install_exe -PassThru -Wait
    [System.String] $ssh_client = Get-ChildItem -recurse "C:\Program Files*\teraterm" | Where-Object { $_.Name -match "ttermpro" } | ForEach-Object { $_.FullName }
    if (-Not ($ssh_client))
    {
        Write-Output "$(Get-Date -Format yyyy-MM-ddTHH:mm:sszzz) [ERROR]: ttermpro.exe not found in `"C:\Program Files*`"."
        [Console]::ReadKey() | Out-Null
        exit 1
    }
}

if ($args[0])
{
    ### $args[0] = Alias. UPN notation is recommended.
    [System.String] $ssh_alias = $args[0]
    [System.Array] $ssh_args = $args[0] -split "@"
    [System.String] $ssh_log = "$log_dir\" + $ssh_args[1] + "_" + $ssh_args[0] + "_" + $date + "_" + $time + ".log"

    ### Get a match with the value of $args[0] and the value of Alias in CSV.
    [System.Array] $csv_data = Import-Csv $csv_file | Where-Object { $_.Alias -eq $ssh_alias }

    ### If there is a match between the value of $args[0] and the value of Alias in CSV,
    if ($csv_data)
    {
        ### Create arguments to pass to ttermpro.exe.
        [System.String] $opt_host = "ssh2://" + $csv_data[0].Hostname + ":" + $csv_data[0].Port
        [System.String] $opt_user = "/user=" + $csv_data[0].Username
        [System.String] $opt_auth = "/auth=" + $csv_data[0].AuthType
        if ($csv_data[0].AuthType -eq "password")
        {
            [System.String] $opt_value = "/passwd=" + $csv_data[0].Value
        }
        elseif ($csv_data[0].AuthType -eq "publickey")
        {
            [System.String] $opt_value = "/keyfile=$key_dir\" + $csv_data[0].Value
        }
        [System.String] $opt_dir = "/FD=$ssh_dir"
        [System.String] $opt_log = "/L=$ssh_log"

        [System.Array] $opt_array = @($opt_host,$opt_user,$opt_auth,$opt_value,$opt_dir,$opt_log,"/ssh-v","/LA=J")

    }
    ### If there is no matching match between the value of $args[0] and the value of Alias in CSV,
    else
    {
        ### Show contents of CSV.
        Get-Item $csv_file
        Import-Csv $csv_file | Where-Object { ($_.Alias) } | Select-Object Username,Hostname,Alias | Format-Table -AutoSize
        [Console]::ReadKey() | Out-Null
        exit 0
    }
}
else
{
    [System.String] $ssh_log = "$log_dir\undefined_undefined_" + $date + "_" + $time + ".log"
    [System.String] $opt_dir = "/FD=" + $ssh_dir
    [System.String] $opt_log = "/L=$ssh_log"
    [System.Array] $opt_array = @($opt_dir,$opt_log,"/ssh-v","/LA=J")
}

### Run teraterm.
$ssh_process = Start-Process -FilePath $ssh_client -ArgumentList $opt_array -PassThru -Wait
### Change attribute of teraterm log file to read only.
Set-ItemProperty -Path $ssh_log -Name Attributes -Value Readonly
### Display the contents of teraterm log file (personal preference...).
Get-Content -Path $ssh_log
### Output contents of teraterm log file to screen.
Write-Output "$(Get-Date -Format yyyy-MM-ddThh:mm:sszzz) [INFO]: Log file: $ssh_log"
### TeraTerm abnormal termination: A case where an already established ssh session is forcibly terminated due to network disconnection or the like.
if ($ssh_process.ExitCode -ne 0)
{
    Write-Output "$(Get-Date -Format yyyy-MM-ddThh:mm:sszzz) [ERROR]: ttermpro.exe exit code NOT equal 0."
}
[Console]::ReadKey() | Out-Null
exit 0

@setlocal enableextensions enabledelayedexpansion & set "PATH0=%~f0" & PowerShell.exe -Command "& (Invoke-Expression -Command ('{#' + ((Get-Content '!PATH0:'=''!') -join \"`n\") + '}'))" %* & exit /b !errorlevel!
#
# - Name
#     Install-Vim.bat
#
# - Contents
#     Install Vim.
#
# - Reference
#     PowerShell on *.bat - http://pf-j.sakura.ne.jp/program/tips/ps1bat2.htm
#     Vim - KaoriYa - https://www.kaoriya.net/software/vim/
#
# - Revision
#     2016-05-24 created.
#     yyyy-MM-dd modified.
#

################
# constant
################
$psDir = "$env:USERPROFILE\Documents\WindowsPowerShell"; if (-Not(Test-Path -Path $psDir)) { mkdir $psDir 1>$null 2>$null }
$psProfile = "$psDir\Microsoft.PowerShell_profile.ps1"
$vimZip = "$env:USERPROFILE\Documents\vim.zip"
$vimUri = 'https://github.com/koron/vim-kaoriya/releases/download/v8.0.0596-20170502/vim80-kaoriya-win64-8.0.0596-20170502.zip'

################
# main
################
# Get vim.zip.
if (-Not(Test-Path -Path $vimZip)) { Invoke-RestMethod -Uri $vimUri -OutFile $vimZip -UseBasicParsing }

# Unzip vim.zip.
if (Test-Path -Path $vimZip)
{
    if (-Not(Test-Path -Path "$env:USERPROFILE\Documents\vim*\vim.exe"))
    {
        $shApp = New-Object -Com shell.application
        $unzip = $shApp.NameSpace($vimZip)
        foreach ($item in $unzip.items()) { $shApp.Namespace("$env:USERPROFILE\Documents").copyhere($item, 0x8); }
    }
}
else
{
    Write-Output "[ERROR]: Failed to download from Uri($vimUri)."
    exit 1
}

# Get the full path of the vim.exe.
if (Test-Path -Path "$env:USERPROFILE\Documents\vim*\vim.exe")
{
    $vimExe = (Get-Item "$env:USERPROFILE\Documents\vim*\vim.exe").FullName
}
else
{
    Write-Output "[ERROR]: Failed to unzip file($vimZip)."
    exit 1
}

# If there is no description about Vim in Profile,
if (-Not((Get-Content $psProfile 2>$null | Select-String '# vim').Matches.Success))
{
    # Add a description about Vim.
    Write-Output "# vim`r`nNew-Alias vi $vimExe`r`nNew-Alias vim $vimExe`r`nfunction view() { $vimExe -R `$args }`r`n" >> $psProfile
}

# Display Profile information.
Get-Item $psProfile
Write-Output "`r`n"
Write-Output "================================"
Get-Content $psProfile
Write-Output "================================"
[Console]::ReadKey() | Out-Null

Update ssh.bat

Update ssh.bat


if "%ANACONDA_USERNAME%" == "" set /p ANACONDA_USERNAME="Username: "
if "%ANACONDA_PASSWORD%" == "" set /p ANACONDA_USERNAME=%ANACONDA_USERNAME%%"'s password: "

echo ON

call conda install -n root anaconda-client
if %errorlevel% neq 0 exit /b %errorlevel%

call anaconda login --username "%ANACONDA_USERNAME%" --password "%ANACONDA_PASSWORD%" --hostname "AppVeyor%APPVEYOR_BUILD_NUMBER%"
if %errorlevel% neq 0 exit /b %errorlevel%

for /f %%i in ('conda build python-parse --output') DO (set CONDA_FILE=%%i)
set errorlevel_backup=%errorlevel%
set errorlevel=0
call anaconda upload --user statiskit %CONDA_FILE% || echo "upload failed"
set errorlevel=%errorlevel_backup%

for /f %%i in ('conda build python-pkgtk --output') DO (set CONDA_FILE=%%i)
set errorlevel=0
call anaconda upload --user statiskit %CONDA_FILE% || echo "upload failed"
set errorlevel=%errorlevel_backup%

call anaconda logout

echo OFF

if "%ANACONDA_USERNAME%" == "" set /p ANACONDA_USERNAME="Username: "
if "%ANACONDA_PASSWORD%" == "" set /p ANACONDA_USERNAME=%ANACONDA_USERNAME%%"'s password: "

call conda install -n root anaconda-client
if %errorlevel% neq 0 exit /b %errorlevel%

call anaconda login --username "%ANACONDA_USERNAME%" --password "%ANACONDA_PASSWORD%" --hostname "AppVeyor%APPVEYOR_BUILD_NUMBER%"
if %errorlevel% neq 0 exit /b %errorlevel%

echo ON

for /f %%i in ('conda build python-parse --output') DO (set CONDA_FILE=%%i)
set errorlevel_backup=%errorlevel%
set errorlevel=0
call anaconda upload --user statiskit %CONDA_FILE% || echo "upload failed"
set errorlevel=%errorlevel_backup%

for /f %%i in ('conda build python-pkgtk --output') DO (set CONDA_FILE=%%i)
set errorlevel=0
call anaconda upload --user statiskit %CONDA_FILE% || echo "upload failed"
set errorlevel=%errorlevel_backup%

call anaconda logout

Update upload.bat

Update upload.bat


@echo off
@setlocal

set NuGetExe="%~dp0NuGet.exe"
set NuGetAdditionalCommandLineArgs=-verbosity quiet -configfile "%~dp0nuget.config" -Project2ProjectTimeOut 1200

REM If someone passed in a different Roslyn solution, use that.
REM We make use of this when Roslyn is an sub-module for some
REM internal repositories.
set RoslynSolution=%1
if "%RoslynSolution%" == "" set RoslynSolution=%~dp0Roslyn.sln

echo Restoring packages: Toolsets
call %NugetExe% restore "%~dp0build\ToolsetPackages\project.json" %NuGetAdditionalCommandLineArgs% || goto :RestoreFailed

echo Restoring packages: Samples
call %NugetExe% restore "%~dp0src\Samples\Samples.sln" %NuGetAdditionalCommandLineArgs% || goto :RestoreFailed

echo Restoring packages: Roslyn (this may take some time)
call %NugetExe% restore "%RoslynSolution%" %NuGetAdditionalCommandLineArgs% || goto :RestoreFailed

exit /b 0

:RestoreFailed
echo Restore failed with ERRORLEVEL %ERRORLEVEL%
exit /b 1

@echo off
@setlocal

set NuGetExe="%~dp0NuGet.exe"
set NuGetAdditionalCommandLineArgs=-verbosity quiet -configfile "%~dp0nuget.config" -Project2ProjectTimeOut 1200

REM If someone passed in a different Roslyn solution, use that.
REM We make use of this when Roslyn is an sub-module for some
REM internal repositories.
set RoslynSolution=%1
if "%RoslynSolution%" == "" set RoslynSolution=%~dp0Roslyn.sln

echo Deleting project.lock.json files
pushd "%~dp0src"
del /s /q project.lock.json
popd

echo Restoring packages: Toolsets
call %NugetExe% restore "%~dp0build\ToolsetPackages\project.json" %NuGetAdditionalCommandLineArgs% || goto :RestoreFailed

echo Restoring packages: Samples
call %NugetExe% restore "%~dp0src\Samples\Samples.sln" %NuGetAdditionalCommandLineArgs% || goto :RestoreFailed

echo Restoring packages: Roslyn (this may take some time)
call %NugetExe% restore "%RoslynSolution%" %NuGetAdditionalCommandLineArgs% || goto :RestoreFailed

exit /b 0

:RestoreFailed
echo Restore failed with ERRORLEVEL %ERRORLEVEL%
exit /b 1

Delete project.lock.json files before restoring packages


SETLOCAL EnableDelayedExpansion
cd source

:: Remove all instances of /W4 from configure.
:: They get passed to the linker and confuse it.
:: Given that we aren't interested in warnings anyway
:: remove it. I could have used a patch but this seemed
:: more 'upgrade friendly'
sed "s~ /W4~~g" configure > configure.new
move configure.new configure

:: This seems to be required - not sure why but
:: rc.exe gets confused with the '/' form of slashes
set MSYS_RC_MODE=1

:: 32-bit and VS2015 ends in failure:
:: uconv.o : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
:: uconv.o : error LNK2001: unresolved external symbol _uconvmsg_dat
:: ../../bin/uconv.exe : fatal error LNK1120: 1 unresolved externals
:: .. without this
if "%ARCH%"=="32" (
  if "%c_compiler%"=="vs2015" (
    set EXTRA_OPTS=--disable-extras
  )
)

set BUILD=x86_64-pc-cygwin
set HOST=x86_64-pc-cygwin
cd ..

copy "%RECIPE_DIR%\build.sh" .
set MSYSTEM=MINGW%ARCH%
set MSYS2_PATH_TYPE=inherit
set CHERE_INVOKING=1
FOR /F "delims=" %%i in ('cygpath.exe -u "%LIBRARY_PREFIX%"') DO set "PREFIX=%%i"

set CC=cl.exe
set CXX=cl.exe

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

:: The .dlls end up in the wrong place
move %LIBRARY_LIB%\icu*.dll %LIBRARY_BIN%
if errorlevel 1 exit 1

SETLOCAL EnableDelayedExpansion
cd source

:: Remove all instances of /W4 from configure.
:: They get passed to the linker and confuse it.
:: Given that we aren't interested in warnings anyway
:: remove it. I could have used a patch but this seemed
:: more 'upgrade friendly'
sed "s~ /W4~~g" configure > configure.new
move configure.new configure

:: This seems to be required - not sure why but
:: rc.exe gets confused with the '/' form of slashes
set MSYS_RC_MODE=1

:: 32-bit and VS2015 ends in failure:
:: uconv.o : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
:: uconv.o : error LNK2001: unresolved external symbol _uconvmsg_dat
:: ../../bin/uconv.exe : fatal error LNK1120: 1 unresolved externals
:: .. without this
if "%ARCH%"=="32" (
  if "%c_compiler%"=="vs2015" (
    set EXTRA_OPTS=--disable-extras
  )
)

:: This directory is needed during the install process but isn't created by the scripts.
mkdir data\out\tmp

set BUILD=x86_64-pc-cygwin
set HOST=x86_64-pc-cygwin
cd ..

copy "%RECIPE_DIR%\build.sh" .
set MSYSTEM=MINGW%ARCH%
set MSYS2_PATH_TYPE=inherit
set CHERE_INVOKING=1
FOR /F "delims=" %%i in ('cygpath.exe -u "%LIBRARY_PREFIX%"') DO set "PREFIX=%%i"

set CC=cl.exe
set CXX=cl.exe

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

:: The .dlls end up in the wrong place
move %LIBRARY_LIB%\icu*.dll %LIBRARY_BIN%
if errorlevel 1 exit 1

fix Windows installation

recipe/bld.bat: fix Windows installation


:: Copyright 2014-2015 Viktor Szakats <https://github.com/vszakats>
:: See LICENSE.md

@echo off

set _NAM=%~n0
set _NAM=%_NAM:~3%
set _VER=%1
set _CPU=%2

setlocal
pushd "%_NAM%"

:: Build

set ZLIB_PATH=../../zlib
set OPENSSL_PATH=../../openssl
set OPENSSL_INCLUDE=%OPENSSL_PATH%/include
set OPENSSL_LIBPATH=%OPENSSL_PATH%
set OPENSSL_LIBS=-lssl -lcrypto
set LIBSSH2_PATH=../../libssh2
if "%_CPU%" == "win32" set ARCH=w32
if "%_CPU%" == "win64" set ARCH=w64
set CURL_CFLAG_EXTRAS=-DCURL_STATICLIB -fno-ident
set CURL_LDFLAG_EXTRAS=-static-libgcc

mingw32-make mingw32-clean
:: Do not link WinIDN in 32-bit builds for Windows XP compatibility (missing normaliz.dll)
if "%_CPU%" == "win32" mingw32-make mingw32-ssh2-ssl-sspi-zlib-ldaps-srp-ipv6
if "%_CPU%" == "win64" mingw32-make mingw32-ssh2-ssl-sspi-zlib-ldaps-srp-ipv6-winidn

:: Download CA bundle
if not exist ..\ca-bundle.crt curl -R -fsS -L --proto-redir =https https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt -o ..\ca-bundle.crt

:: Make steps for determinism

if exist lib\*.a   strip -p --enable-deterministic-archives -g lib\*.a
if exist lib\*.lib strip -p --enable-deterministic-archives -g lib\*.lib

python ..\peclean.py src\*.exe
python ..\peclean.py lib\*.dll

touch -c src/*.exe        -r CHANGES
touch -c lib/*.dll        -r CHANGES
touch -c ../ca-bundle.crt -r CHANGES
touch -c lib/*.a          -r CHANGES
touch -c lib/*.lib        -r CHANGES

:: Test run

src\curl.exe --version

:: Create package

set _BAS=%_NAM%-%_VER%-%_CPU%-mingw
if not "%APPVEYOR_REPO_BRANCH%" == "master" set _BAS=%_BAS%-test
set _DST=%TEMP%\%_BAS%

xcopy /y /s /q docs\*.              "%_DST%\docs\*.txt"
xcopy /y /s /q docs\*.html          "%_DST%\docs\"
xcopy /y /s /q docs\libcurl\*.html  "%_DST%\docs\libcurl\"
xcopy /y /s /q include\curl\*.h     "%_DST%\include\curl\"
 copy /y       lib\mk-ca-bundle.pl  "%_DST%\"
 copy /y       lib\mk-ca-bundle.vbs "%_DST%\"
 copy /y       CHANGES              "%_DST%\CHANGES.txt"
 copy /y       COPYING              "%_DST%\COPYING.txt"
 copy /y       README               "%_DST%\README.txt"
 copy /y       RELEASE-NOTES        "%_DST%\RELEASE-NOTES.txt"
xcopy /y /s    src\*.exe            "%_DST%\bin\"
xcopy /y /s    lib\*.dll            "%_DST%\bin\"
 copy /y       ..\ca-bundle.crt     "%_DST%\bin\curl-ca-bundle.crt"

 copy /y       ..\openssl\LICENSE   "%_DST%\LICENSE-openssl.txt"
 copy /y       ..\libssh2\COPYING   "%_DST%\COPYING-libssh2.txt"

if exist lib\*.a   xcopy /y /s lib\*.a   "%_DST%\lib\"
if exist lib\*.lib xcopy /y /s lib\*.lib "%_DST%\lib\"

unix2dos -k %_DST:\=/%/*.txt
unix2dos -k %_DST:\=/%/docs/*.txt

touch -c %_DST:\=/%/docs/examples     -r CHANGES
touch -c %_DST:\=/%/docs/libcurl/opts -r CHANGES
touch -c %_DST:\=/%/docs/libcurl      -r CHANGES
touch -c %_DST:\=/%/docs              -r CHANGES
touch -c %_DST:\=/%/include/curl      -r CHANGES
touch -c %_DST:\=/%/include           -r CHANGES
touch -c %_DST:\=/%/lib               -r CHANGES
touch -c %_DST:\=/%/bin               -r CHANGES
touch -c %_DST:\=/%                   -r CHANGES

call ..\pack.bat
call ..\upload.bat

popd
endlocal

:: Copyright 2014-2015 Viktor Szakats <https://github.com/vszakats>
:: See LICENSE.md

@echo off

set _NAM=%~n0
set _NAM=%_NAM:~3%
set _VER=%1
set _CPU=%2

setlocal
pushd "%_NAM%"

:: Build

set ZLIB_PATH=../../zlib
set OPENSSL_PATH=../../openssl
set OPENSSL_INCLUDE=%OPENSSL_PATH%/include
set OPENSSL_LIBPATH=%OPENSSL_PATH%
set OPENSSL_LIBS=-lssl -lcrypto
set LIBRTMP_PATH=../../librtmp
set LIBSSH2_PATH=../../libssh2
if "%_CPU%" == "win32" set ARCH=w32
if "%_CPU%" == "win64" set ARCH=w64
set CURL_CFLAG_EXTRAS=-DCURL_STATICLIB -fno-ident
set CURL_LDFLAG_EXTRAS=-static-libgcc

mingw32-make mingw32-clean
:: Do not link WinIDN in 32-bit builds for Windows XP compatibility (missing normaliz.dll)
if "%_CPU%" == "win32" mingw32-make mingw32-ssh2-ssl-sspi-zlib-ldaps-srp-rtmp-ipv6
if "%_CPU%" == "win64" mingw32-make mingw32-ssh2-ssl-sspi-zlib-ldaps-srp-rtmp-ipv6-winidn

:: Download CA bundle
if not exist ..\ca-bundle.crt curl -R -fsS -L --proto-redir =https https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt -o ..\ca-bundle.crt

:: Make steps for determinism

if exist lib\*.a   strip -p --enable-deterministic-archives -g lib\*.a
if exist lib\*.lib strip -p --enable-deterministic-archives -g lib\*.lib

python ..\peclean.py src\*.exe
python ..\peclean.py lib\*.dll

touch -c src/*.exe        -r CHANGES
touch -c lib/*.dll        -r CHANGES
touch -c ../ca-bundle.crt -r CHANGES
touch -c lib/*.a          -r CHANGES
touch -c lib/*.lib        -r CHANGES

:: Test run

src\curl.exe --version

:: Create package

set _BAS=%_NAM%-%_VER%-%_CPU%-mingw
if not "%APPVEYOR_REPO_BRANCH%" == "master" set _BAS=%_BAS%-test
set _DST=%TEMP%\%_BAS%

xcopy /y /s /q docs\*.              "%_DST%\docs\*.txt"
xcopy /y /s /q docs\*.html          "%_DST%\docs\"
xcopy /y /s /q docs\libcurl\*.html  "%_DST%\docs\libcurl\"
xcopy /y /s /q include\curl\*.h     "%_DST%\include\curl\"
 copy /y       lib\mk-ca-bundle.pl  "%_DST%\"
 copy /y       lib\mk-ca-bundle.vbs "%_DST%\"
 copy /y       CHANGES              "%_DST%\CHANGES.txt"
 copy /y       COPYING              "%_DST%\COPYING.txt"
 copy /y       README               "%_DST%\README.txt"
 copy /y       RELEASE-NOTES        "%_DST%\RELEASE-NOTES.txt"
xcopy /y /s    src\*.exe            "%_DST%\bin\"
xcopy /y /s    lib\*.dll            "%_DST%\bin\"
 copy /y       ..\ca-bundle.crt     "%_DST%\bin\curl-ca-bundle.crt"

 copy /y       ..\openssl\LICENSE   "%_DST%\LICENSE-openssl.txt"
 copy /y       ..\libssh2\COPYING   "%_DST%\COPYING-libssh2.txt"

if exist lib\*.a   xcopy /y /s lib\*.a   "%_DST%\lib\"
if exist lib\*.lib xcopy /y /s lib\*.lib "%_DST%\lib\"

unix2dos -k %_DST:\=/%/*.txt
unix2dos -k %_DST:\=/%/docs/*.txt

touch -c %_DST:\=/%/docs/examples     -r CHANGES
touch -c %_DST:\=/%/docs/libcurl/opts -r CHANGES
touch -c %_DST:\=/%/docs/libcurl      -r CHANGES
touch -c %_DST:\=/%/docs              -r CHANGES
touch -c %_DST:\=/%/include/curl      -r CHANGES
touch -c %_DST:\=/%/include           -r CHANGES
touch -c %_DST:\=/%/lib               -r CHANGES
touch -c %_DST:\=/%/bin               -r CHANGES
touch -c %_DST:\=/%                   -r CHANGES

call ..\pack.bat
call ..\upload.bat

popd
endlocal

enable rtmp [ci skip]

mk-curl.bat: enable rtmp [ci skip]


:: Go to bin directory
cd bin

:: Array of tests to run
set tests=test_fiff_rwr test_dipole_fit test_fiff_mne_types_io test_fiff_cov test_fiff_digitizer test_mne_msh_display_surface_set test_geometryinfo test_interpolation test_spectral_connectivity test_mne_forward_solution

:: Run tests
(for %%t in (%tests%) do (
   call %%t
))

:: Go to bin directory
cd bin

:: Array of tests to run
set tests=test_fiff_rwr test_dipole_fit test_fiff_mne_types_io test_fiff_cov test_fiff_digitizer test_mne_msh_display_surface_set test_geometryinfo test_interpolation test_spectral_connectivity test_mne_forward_solution test_rtfilter_filterdata

:: Run tests
(for %%t in (%tests%) do (
   call %%t
))

add test_rtfilter_filterdata

test.bat: add test_rtfilter_filterdata