:run
if "%1" == "-debug" goto debug
java -Dappdir=.. -cp ../lib/windows/jmf.jar;../lib/startup.jar;../lib/windows/jdic.jar;../resources;../lib/windows; -Djava.library.path="../lib/windows" org.jivesoftware.launcher.Startup
goto end

:debug
start "Spark" "%JAVA_HOME%\bin\java" -Ddebugger=true -Ddebug.mode=true -XX:+HeapDumpOnOutOfMemoryError -Xdebug -Xint -server -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -Dappdir=.. -cp ../lib/windows/jmf.jar;../lib/startup.jar;../lib/windows/jdic.jar;../resources;../lib/windows; org.jivesoftware.launcher.Startup
goto end
:end

:run
if "%1" == "-debug" goto debug
if "%1" == "-noconsole" goto noconsole
java -Dappdir=.. -cp ../lib/windows/jmf.jar;../lib/startup.jar;../lib/windows/jdic.jar;../resources;../lib/windows; -Djava.library.path="../lib/windows" org.jivesoftware.launcher.Startup
goto end

:noconsole
javaw -Dappdir=.. -cp ../lib/windows/jmf.jar;../lib/startup.jar;../lib/windows/jdic.jar;../resources;../lib/windows; -Djava.library.path="../lib/windows" org.jivesoftware.launcher.Startup
goto end

:debug
start "Spark" "%JAVA_HOME%\bin\java" -Ddebugger=true -Ddebug.mode=true -XX:+HeapDumpOnOutOfMemoryError -Xdebug -Xint -server -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -Dappdir=.. -cp ../lib/windows/jmf.jar;../lib/startup.jar;../lib/windows/jdic.jar;../resources;../lib/windows; org.jivesoftware.launcher.Startup
goto end
:end

Update startup.bat

Update startup.bat

git-svn-id: f13e20fb8540f76a08799c0051229138c0279aa7@8960 b35dd754-fafc-0310-a699-88a17e54d16e


set PATH=C:\Ruby192\bin;%PATH%

ruby -v
call bundle install --binstubs --without docgen --path vendor/bundle || ( call rm Gemfile.lock && call bundle install --binstubs --path vendor/bundle )
ruby bin\rspec -r rspec_junit_formatter -f RspecJunitFormatter -o test.xml -f documentation spec/functional spec/unit spec/stress
set RSPEC_ERRORLVL=%ERRORLEVEL%

REM Return the error level from rspec
exit /B %RSPEC_ERRORLVL%

ruby -v

call bundle check

if %ERRORLEVEL% NEQ 0 (
   call rm Gemfile.lock
   call bundle install --without docgen --path vendor/bundle
)

bundle exec rspec -r rspec_junit_formatter -f RspecJunitFormatter -o test.xml -f documentation spec

set RSPEC_ERRORLVL=%ERRORLEVEL%
REM Return the error level from rspec
exit /B %RSPEC_ERRORLVL%

Clean up `jenkins_run_tests.bat`

Clean up `jenkins_run_tests.bat`

This change ensures the bat file is in sync with what we have in
opscode/chef.


@setlocal
set CONFIGURATION=Release

mkdir build
cd build
:: Using nmake
:: cmake -G "NMake Makefiles" -D CMAKE_BUILD_TYPE=%CONFIGURATION% -D CMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% -D CMAKE_LIBRARY_PATH=%LIBRARY_LIB% CMAKE_INCLUDE_PATH=%LIBRARY_INC% ..
:: if errorlevel 1 exit 1
:: nmake install
:: if errorlevel 1 exit 1

:: Using Visual studio
for /r "%LIBRARY_LIB%" %i in (*.lib) do @echo %i
cmake -G "%CMAKE_GENERATOR%" -D CMAKE_INCLUDE_PATH="%LIBRARY_INC%" -D CMAKE_LIBRARY_PATH="%LIBRARY_LIB%" -D CMAKE_C_FLAGS_RELEASE="/MT" -D CMAKE_CXX_FLAGS_RELEASE="/MT" -D CMAKE_C_FLAGS_DEBUG="/MTd" CMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ..
:: cmake -G "%CMAKE_GENERATOR%" -D CMAKE_BUILD_TYPE=%CONFIGURATION% -D CMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% -D CMAKE_LIBRARY_PATH=%LIBRARY_LIB% CMAKE_INCLUDE_PATH=%LIBRARY_INC% ..
if errorlevel 1 exit 1
msbuild /v:minimal /p:Configuration=%CONFIGURATION% czmq.vcxproj
if errorlevel 1 exit 1
msbuild /v:minimal /p:Configuration=%CONFIGURATION% czmq_selftest.vcxproj
if errorlevel 1 exit 1
ctest -C "%Configuration%" -V
if errorlevel 1 exit 1

@endlocal

@setlocal
set CONFIGURATION=Release

mkdir build
cd build
:: Using nmake
:: cmake -G "NMake Makefiles" -D CMAKE_BUILD_TYPE=%CONFIGURATION% -D CMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% -D CMAKE_LIBRARY_PATH=%LIBRARY_LIB% CMAKE_INCLUDE_PATH=%LIBRARY_INC% ..
:: if errorlevel 1 exit 1
:: nmake install
:: if errorlevel 1 exit 1

:: Using Visual studio
for /r "%LIBRARY_LIB%" %%i in (*.lib) do @echo %%i
cmake -G "%CMAKE_GENERATOR%" -D CMAKE_INCLUDE_PATH="%LIBRARY_INC%" -D CMAKE_LIBRARY_PATH="%LIBRARY_LIB%" -D CMAKE_C_FLAGS_RELEASE="/MT" -D CMAKE_CXX_FLAGS_RELEASE="/MT" -D CMAKE_C_FLAGS_DEBUG="/MTd" CMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ..
:: cmake -G "%CMAKE_GENERATOR%" -D CMAKE_BUILD_TYPE=%CONFIGURATION% -D CMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% -D CMAKE_LIBRARY_PATH=%LIBRARY_LIB% CMAKE_INCLUDE_PATH=%LIBRARY_INC% ..
if errorlevel 1 exit 1
msbuild /v:minimal /p:Configuration=%CONFIGURATION% czmq.vcxproj
if errorlevel 1 exit 1
msbuild /v:minimal /p:Configuration=%CONFIGURATION% czmq_selftest.vcxproj
if errorlevel 1 exit 1
ctest -C "%Configuration%" -V
if errorlevel 1 exit 1

@endlocal

Fix print of libraries

Fix print of libraries


@REM Enable winget: https://docs.microsoft.com/en-us/windows/package-manager/winget/
@REM Browser(s)
winget install Mozilla.FirefoxDeveloperEdition
@REM winget install Google.Chrome.Beta @REM pls no

@REM Development
winget install Microsoft.dotnet
@REM winget install Microsoft.dotnetPreview @REM Sometimes useful :)
winget install JetBrains.Rider
winget install Microsoft.VisualStudioCode
winget install Git.Git
winget install Fork.Fork
winget install Docker.DockerDesktop
winget install Microsoft.WindowsTerminalPreview
winget install Insomnia.Insomnia
winget install PostgreSQL.pgAdmin
winget install JanDeDobbeleer.OhMyPosh
winget install bmatzelle.Gow
winget install gsudo
winget install JackieLiu.NotepadsApp

@REM winget install SublimeHQ.SublimeMerge
winget install Fork.Fork

@REM Communication
winget install Discord.Discord
winget install Krisp.Krisp
@REM winget install Zoom.Zoom

@REM Media
winget install Streamlink.Streamlink
winget install Streamlink.StreamlinkTwitchGui
winget install Spotify.Spotify
winget install Daum.Potplayer

@REM Games
winget install Valve.Steam
winget install EpicGames.EpicGamesLauncher
winget install GOG.Galaxy
winget install Codeusa.BorderlessGaming

@REM Misc
winget install Citrix.WorkspaceApp
@REM winget install OliverSchwendener.ueli
winget install Microsoft.PowerToys
winget install qBittorrent.qBittorrent
winget install calibre.calibre
winget install JAMSoftware.TreeSizeFree
winget install 7zip.7zip
winget install QL-Win.QuickLook
winget install Ghisler.TotalCommander
winget install File-New-Project.EarTrumpet
winget install Joplin.Joplin
winget install Files-Community.Files
@REM winget install BinaryFortress.DisplayFusion @REM Might not work with steam license?

@REM Missing stuff
@REM WSL2 + Pengwin: https://docs.microsoft.com/en-us/windows/wsl/install-win10
@REM TaskbarX: https://chrisandriessen.nl/taskbarx
@REM Caffeine: https://www.zhornsoftware.co.uk/caffeine/
@REM X410: https://x410.dev/
@REM DisplayFusion (steam): https://www.displayfusion.com/

@REM Browser(s)
winget install Mozilla.FirefoxDeveloperEdition
@REM winget install Google.Chrome.Beta @REM pls no

@REM Development
winget install Microsoft.dotnet
@REM winget install Microsoft.dotnetPreview @REM Sometimes useful :)
winget install JetBrains.Rider
winget install Microsoft.VisualStudioCode
winget install Git.Git
winget install Fork.Fork
winget install Docker.DockerDesktop
winget install Microsoft.WindowsTerminalPreview
winget install Insomnia.Insomnia
winget install PostgreSQL.pgAdmin
winget install JanDeDobbeleer.OhMyPosh
winget install bmatzelle.Gow
winget install gsudo
winget install JackieLiu.NotepadsApp

@REM Command line utilies via Scoop: https://github.com/lukesampson/scoop
scoop install fd ripgrep delta zoxide fzf bat

@REM Windows port soon COPIUM
@REM scoop install exa

@REM winget install SublimeHQ.SublimeMerge
winget install Fork.Fork

@REM Communication
winget install Discord.Discord
winget install Krisp.Krisp
@REM winget install Zoom.Zoom

@REM Media
winget install Streamlink.Streamlink
winget install Streamlink.StreamlinkTwitchGui
winget install Spotify.Spotify
winget install Daum.Potplayer

@REM Games
winget install Valve.Steam
winget install EpicGames.EpicGamesLauncher
winget install GOG.Galaxy
winget install Codeusa.BorderlessGaming

@REM Misc
winget install Citrix.WorkspaceApp
@REM winget install OliverSchwendener.ueli
winget install Microsoft.PowerToys
winget install qBittorrent.qBittorrent
winget install calibre.calibre
winget install JAMSoftware.TreeSizeFree
winget install 7zip.7zip
winget install QL-Win.QuickLook
winget install Ghisler.TotalCommander
winget install File-New-Project.EarTrumpet
winget install Joplin.Joplin
winget install Files-Community.Files
@REM winget install BinaryFortress.DisplayFusion @REM Might not work with steam license?

@REM Missing stuff
@REM WSL2 + Pengwin: https://docs.microsoft.com/en-us/windows/wsl/install-win10
@REM TaskbarX: https://chrisandriessen.nl/taskbarx
@REM Caffeine: https://www.zhornsoftware.co.uk/caffeine/
@REM X410: https://x410.dev/
@REM DisplayFusion (steam): https://www.displayfusion.com/

update windows install script

update windows install script


; Shadow RDP

mstsc /shadow:0 /v:<HOSTNAME> /noConsentPrompt /control
mstsc /shadow:0 /v:<HOSTNAME> /control

Create oneliners.bat

Create oneliners.bat


Create toolateforcoffee.bat

Create toolateforcoffee.bat


@echo off

goto entry

:usage
  echo usage: bolt build [-c^|--config CONFIG_JS] [-o^|--output OUTPUT_DIR] [-s^|--src-dir SRC_DIR]
  echo                   [-i^|--inline] [-n^|--invoke-main MAIN_MODULE] [-r^|--register]
  echo                   [-m^|--modules] [-e^|--entry-points FILE ...] [-g^|--entry-group NAME FILE ...]
  echo.
  echo options:
  echo   -c^|--config CONFIG_JS         override bolt configuration file
  echo                                    default: config/bolt/prod.js
  echo   -o^|--output OUTPUT_DIR         override output directory, note this is different
  echo                                  to the jsc compile directory, the compiled output,
  echo                                  will be located at $OUTPUT_DIR/compile
  echo                                    default: scratch/main/js
  echo   -s^|--src-dir SRC_DIR           override source directory
  echo                                    default: src/main/js
  echo   -i^|--inline                    enable generation of inline scripts (only produces output
  echo                                  in conjunction with -e or -g).
  echo   -n^|--invoke-main MAIN_MODULE   specify main module of inline scripts.
  echo   -r^|--register                  register modules in global namespace for inline scripts,
  echo                                  this will default to true unless -n is specified.
  echo   -m^|--modules                   enable generation of flat module files.
  echo   -e^|--entry-points FILE ...     specify a set of entry points, a compiled output
  echo                                  will be generated for each entry point. Multiple
  echo                                  -e flags may be specified.
  echo   -g^|--entry-group NAME FILE ... specify an entry group, a single compiled output
  echo                                  will be generated with NAME for each entry-group.
  echo                                  Multiple -g flags may be specified.
  echo.
  echo example:
  echo   Produce a bolt build for a top level application. A compiled file will be
  echo   generated for each Main module in this example.
  echo.
  echo     bolt build -e src/main/js/**/*Main.js
  echo.
  echo.
  echo   Produce a bolt build for a top level library. A self contained script registering
  echo   all modules in their namespace will be produced.
  echo.
  echo     bolt build -i -g example src/main/js/**/api/*.js
  echo.
  echo.
  echo   Produce a bolt build for a general purpose library, in this build we only want
  echo   modules to be produced, no compiled output.
  echo.
  echo     bolt build -m src/main/js

  exit /b 0

:fail_usage
  echo.
  call :usage
  exit /b 1

:fail
  exit /b 1

:is_dir
  setlocal
  set olddir=%CD%
  cd "%~1" 2>NUL
  set err=%errorlevel%
  cd "%olddir%"
  exit /b %err%

:entry

set base=%~dp0

if "%help_mode%"=="true" call :usage && exit /b 0

set count_targets=0
set count_entry_point=0
set count_entry_group_name=0

:parse_flags
  set flag=%~1
  if not "%flag:~0,1%"=="-" goto done_parse_flags
  shift

  if "%flag%"=="-c" goto parse_config
  if "%flag%"=="--config" goto parse_config
  if "%flag%"=="-o" goto parse_output
  if "%flag%"=="--output" goto parse_output
  if "%flag%"=="-s" goto parse_src
  if "%flag%"=="--src-dir" goto parse_src
  if "%flag%"=="-n" goto parse_invoke
  if "%flag%"=="--invoke-main" goto parse_invoke
  if "%flag%"=="-r" goto parse_register
  if "%flag%"=="--register" goto parse_register
  if "%flag%"=="-i" goto parse_inline
  if "%flag%"=="--inline" goto parse_inline
  if "%flag%"=="-m" goto parse_modules
  if "%flag%"=="--modules" goto parse_modules
  if "%flag%"=="-e" goto parse_points
  if "%flag%"=="--entry-points" goto parse_points
  if "%flag%"=="-g" goto parse_group
  if "%flag%"=="--entry-group" goto parse_group
  if "%flag%"=="--" goto done_parse_flags
  echo invalid flag [%flag%] && goto fail_usage

  goto parse_flags

  :parse_config
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set config_js=%~1
    shift
  goto parse_flags

  :parse_output
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set output_dir=%~1
    shift
  goto parse_flags

  :parse_src
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set src_dir=%~1
    shift
  goto parse_flags

  :parse_invoke
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set invoke_main_flag=-n "%~1"
    shift
  goto parse_flags

  :parse_register
    set register_modules_flag=-r
  goto parse_flags

  :parse_inline
    set generate_inline=true
  goto parse_flags

  :parse_modules
    set generate_modules=true
  goto parse_flags

  :parse_points
    :point_loop
      set entry=%~1
      if "%entry%"=="" goto end_point_loop
      if "%entry:~0,1%"=="-" goto end_point_loop
      shift

      if not exist "%entry%" echo specified file for entry point not found [%entry%] && goto fail
      call :is_dir "%entry%"
      if %errorlevel%==0 echo specified file for entry point not found [%entry%] && goto fail

      set entry_point_%count_entry_point%="%entry%"
      set /a count_entry_point=%count_entry_point% + 1
    goto point_loop
    :end_point_loop
  goto parse_flags

  :parse_group
    echo --entry-group parsing not implemented.
    exit /b 1
  goto parse_flags

:done_parse_flags

if "%config_js%"=="" set config_js=config/bolt/prod.js
if "%output_dir%"=="" set output_dir=scratch/main/js
if "%src_dir%"=="" set src_dir=src/main/js
if "%generate_inline%"=="" set generate_inline=false
if "%generate_modules%"=="" set generate_modules=false

echo Windows support for bolt build is currently not implemented.
exit /b 1

@echo off

goto entry

:usage
  echo usage: bolt build [-c^|--config CONFIG_JS] [-o^|--output OUTPUT_DIR] [-s^|--src-dir SRC_DIR]
  echo                   [-i^|--inline] [-n^|--invoke-main MAIN_MODULE] [-r^|--register]
  echo                   [-m^|--modules] [-e^|--entry-points FILE ...] [-g^|--entry-group NAME FILE ...]
  echo.
  echo options:
  echo   -c^|--config CONFIG_JS         override bolt configuration file
  echo                                    default: config/bolt/prod.js
  echo   -o^|--output OUTPUT_DIR         override output directory, note this is different
  echo                                  to the jsc compile directory, the compiled output,
  echo                                  will be located at $OUTPUT_DIR/compile
  echo                                    default: scratch/main/js
  echo   -s^|--src-dir SRC_DIR           override source directory
  echo                                    default: src/main/js
  echo   -i^|--inline                    enable generation of inline scripts (only produces output
  echo                                  in conjunction with -e or -g).
  echo   -n^|--invoke-main MAIN_MODULE   specify main module of inline scripts.
  echo   -r^|--register                  register modules in global namespace for inline scripts,
  echo                                  this will default to true unless -n is specified.
  echo   -m^|--modules                   enable generation of flat module files.
  echo   -e^|--entry-points FILE ...     specify a set of entry points, a compiled output
  echo                                  will be generated for each entry point. Multiple
  echo                                  -e flags may be specified.
  echo   -g^|--entry-group NAME FILE ... specify an entry group, a single compiled output
  echo                                  will be generated with NAME for each entry-group.
  echo                                  Multiple -g flags may be specified.
  echo.
  echo example:
  echo   Produce a bolt build for a top level application. A compiled file will be
  echo   generated for each Main module in this example.
  echo.
  echo     bolt build -e src/main/js/**/*Main.js
  echo.
  echo.
  echo   Produce a bolt build for a top level library. A self contained script registering
  echo   all modules in their namespace will be produced.
  echo.
  echo     bolt build -i -g example src/main/js/**/api/*.js
  echo.
  echo.
  echo   Produce a bolt build for a general purpose library, in this build we only want
  echo   modules to be produced, no compiled output.
  echo.
  echo     bolt build -m src/main/js

  exit /b 0

:fail_usage
  echo.
  call :usage
  exit /b 1

:fail
  exit /b 1

:is_dir
  setlocal
  set olddir=%CD%
  cd "%~1" 2>NUL
  set err=%errorlevel%
  cd "%olddir%"
  exit /b %err%

:entry

if "%help_mode%"=="true" call :usage && exit /b 0

set count_targets=0
set count_entry_point=0
set count_entry_group_name=0

:parse_flags
  set flag=%~1
  if not "%flag:~0,1%"=="-" goto done_parse_flags
  shift

  if "%flag%"=="-c" goto parse_config
  if "%flag%"=="--config" goto parse_config
  if "%flag%"=="-o" goto parse_output
  if "%flag%"=="--output" goto parse_output
  if "%flag%"=="-s" goto parse_src
  if "%flag%"=="--src-dir" goto parse_src
  if "%flag%"=="-n" goto parse_invoke
  if "%flag%"=="--invoke-main" goto parse_invoke
  if "%flag%"=="-r" goto parse_register
  if "%flag%"=="--register" goto parse_register
  if "%flag%"=="-i" goto parse_inline
  if "%flag%"=="--inline" goto parse_inline
  if "%flag%"=="-m" goto parse_modules
  if "%flag%"=="--modules" goto parse_modules
  if "%flag%"=="-e" goto parse_points
  if "%flag%"=="--entry-points" goto parse_points
  if "%flag%"=="-g" goto parse_group
  if "%flag%"=="--entry-group" goto parse_group
  if "%flag%"=="--" goto done_parse_flags
  echo invalid flag [%flag%] && goto fail_usage

  goto parse_flags

  :parse_config
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set config_js=%~1
    shift
  goto parse_flags

  :parse_output
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set output_dir=%~1
    shift
  goto parse_flags

  :parse_src
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set src_dir=%~1
    shift
  goto parse_flags

  :parse_invoke
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set invoke_main_flag=-n "%~1"
    shift
  goto parse_flags

  :parse_register
    set register_modules_flag=-r
  goto parse_flags

  :parse_inline
    set generate_inline=true
  goto parse_flags

  :parse_modules
    set generate_modules=true
  goto parse_flags

  :parse_points
    :point_loop
      set entry=%~1
      if "%entry%"=="" goto end_point_loop
      if "%entry:~0,1%"=="-" goto end_point_loop
      shift

      if not exist "%entry%" echo specified file for entry point not found [%entry%] && goto fail
      call :is_dir "%entry%"
      if %errorlevel%==0 echo specified file for entry point not found [%entry%] && goto fail

      set entry_point_%count_entry_point%="%entry%"
      set /a count_entry_point=%count_entry_point% + 1
    goto point_loop
    :end_point_loop
  goto parse_flags

  :parse_group
    echo --entry-group parsing not implemented.
    exit /b 1
  goto parse_flags

:done_parse_flags

if "%config_js%"=="" set config_js=config/bolt/prod.js
if "%output_dir%"=="" set output_dir=scratch/main/js
if "%src_dir%"=="" set src_dir=src/main/js
if "%generate_inline%"=="" set generate_inline=false
if "%generate_modules%"=="" set generate_modules=false

echo Windows support for bolt build is currently not implemented.
exit /b 1

Remove variable that is set by outer script


@echo off

wkhtmltopdf --margin-bottom 5 --margin-top 5 --margin-left 5 --margin-right 5 https://mzkit.org/ "D:\mzkit\dist\README.pdf"

@echo off

wkhtmltopdf --javascript-delay 1000 --margin-bottom 5 --margin-top 5 --margin-left 5 --margin-right 5 https://mzkit.org/ "D:\mzkit\dist\README.pdf"

Update buildPdf.cmd

Update buildPdf.cmd


@echo off
set argc=0
for %%x in (%*) do set /A argc+=1
if  %argc%== 0 (
  goto documentation
) else (
  goto parseopts
)
:documentation
echo Usage: %~nx0 [options] [.exs file] [data]
echo.
echo   -v                Prints version and exit
echo   -e command        Evaluates the given command (*)
echo   -r file           Requires the given files/patterns (*)
echo   -S script         Finds and executes the given script
echo   -pr file          Requires the given files/patterns in parallel (*)
echo   -pa path          Prepends the given path to Erlang code path (*)
echo   -pz path          Appends the given path to Erlang code path (*)
echo   --app app         Start the given app and its dependencies (*)
echo   --erl switches    Switches to be passed down to erlang (*)
echo   --name name       Makes and assigns a name to the distributed node
echo   --sname name      Makes and assigns a short name to the distributed node
echo   --cookie cookie   Sets a cookie for this distributed node
echo   --hidden          Makes a hidden node
echo   --detached        Starts the Erlang VM detached from console
echo   --no-halt         Does not halt the Erlang VM after execution
echo   --gen-debug       Turns on default debugging for all GenServers
echo.
echo ** Options marked with (*) can be given more than once
echo ** Options given after the .exs file or -- are passed down to the executed code
echo ** Options can be passed to the erlang runtime using ELIXIR_ERL_OPTS or --erl
goto :EOF

:parseopts

rem Parameters for Erlang
set parsErlang=

rem Make sure we keep a copy of all parameters
set allPars=%*

rem Get the original path name from the batch file
set originPath=%~dp0

rem Optional parameters before the "-extra" parameter
set beforeExtra=

rem Flag which determines whether or not to use werl vs erl
set useWerl=0

rem Recursive loop called for each parameter that parses the cmd line parameters
:startloop
set par="%1"
shift
if "%par%"=="" (
  rem if no parameters defined
  goto :expand_erl_libs
)
if "%par%"=="""" (
  rem if no parameters defined - special case for parameter that is already quoted
  goto :expand_erl_libs
)
rem ******* EXECUTION OPTIONS **********************
IF NOT "%par%"=="%par:+iex" (Set useWerl=1)
rem ******* ERLANG PARAMETERS **********************
IF NOT "%par%"=="%par:--detached=%" (Set parsErlang=%parsErlang% -detached)
IF NOT "%par%"=="%par:--hidden=%"   (Set parsErlang=%parsErlang% -hidden)
IF NOT "%par%"=="%par:--cookie=%"   (Set parsErlang=%parsErlang% -setcookie %1 && shift)
IF NOT "%par%"=="%par:--sname=%"    (Set parsErlang=%parsErlang% -sname %1 && shift)
IF NOT "%par%"=="%par:--name=%"     (Set parsErlang=%parsErlang% -name %1 && shift)
IF NOT "%par%"=="%par:--erl=%"      (Set beforeExtra=%beforeExtra% %~1 && shift)
IF NOT "%par%"=="%par:--gen-debug=%" (Set parsErlang=%parsErlang% -generic_debug)
rem ******* elixir parameters **********************
rem Note: we don't have to do anything with options that don't take an argument
IF NOT "%par%"=="%par:-e=%"      (shift)
IF NOT "%par%"=="%par:-r=%"      (shift)
IF NOT "%par%"=="%par:-pr=%"     (shift)
IF NOT "%par%"=="%par:-pa=%"     (shift)
IF NOT "%par%"=="%par:-pz=%"     (shift)
IF NOT "%par%"=="%par:--app=%"   (shift)
IF NOT "%par%"=="%par:--remsh=%" (shift)
goto:startloop

rem ******* assume all pre-params are parsed ********************
:expand_erl_libs
rem ******* expand all ebin paths as Windows does not support the ..\*\ebin wildcard ********************
SETLOCAL enabledelayedexpansion
set ext_libs=
for  /d %%d in ("%originPath%..\lib\*.") do (
  set ext_libs=!ext_libs! -pa "%%~fd\ebin"
)
SETLOCAL disabledelayedexpansion
:run
IF %useWerl% EQU 1 (
    werl %ext_libs% -noshell %ELIXIR_ERL_OPTS% %parsErlang% -s elixir start_cli %beforeExtra% -extra %*
) ELSE (
    erl %ext_libs% -noshell %ELIXIR_ERL_OPTS% %parsErlang% -s elixir start_cli %beforeExtra% -extra %*
)

@echo off
set argc=0
for %%x in (%*) do set /A argc+=1
if  %argc%== 0 (
  goto documentation
) else (
  goto parseopts
)
:documentation
echo Usage: %~nx0 [options] [.exs file] [data]
echo.
echo   -v                Prints version and exit
echo   -e command        Evaluates the given command (*)
echo   -r file           Requires the given files/patterns (*)
echo   -S script         Finds and executes the given script
echo   -pr file          Requires the given files/patterns in parallel (*)
echo   -pa path          Prepends the given path to Erlang code path (*)
echo   -pz path          Appends the given path to Erlang code path (*)
echo   --app app         Start the given app and its dependencies (*)
echo   --erl switches    Switches to be passed down to erlang (*)
echo   --name name       Makes and assigns a name to the distributed node
echo   --sname name      Makes and assigns a short name to the distributed node
echo   --cookie cookie   Sets a cookie for this distributed node
echo   --hidden          Makes a hidden node
echo   --detached        Starts the Erlang VM detached from console
echo   --no-halt         Does not halt the Erlang VM after execution
echo   --gen-debug       Turns on default debugging for all GenServers
echo.
echo ** Options marked with (*) can be given more than once
echo ** Options given after the .exs file or -- are passed down to the executed code
echo ** Options can be passed to the erlang runtime using ELIXIR_ERL_OPTS or --erl
goto :EOF

:parseopts

rem Parameters for Erlang
set parsErlang=

rem Make sure we keep a copy of all parameters
set allPars=%*

rem Get the original path name from the batch file
set originPath=%~dp0

rem Optional parameters before the "-extra" parameter
set beforeExtra=

rem Flag which determines whether or not to use werl vs erl
set useWerl=0

rem Recursive loop called for each parameter that parses the cmd line parameters
:startloop
set par="%1"
shift
if "%par%"=="" (
  rem if no parameters defined
  goto :expand_erl_libs
)
if "%par%"=="""" (
  rem if no parameters defined - special case for parameter that is already quoted
  goto :expand_erl_libs
)
rem ******* EXECUTION OPTIONS **********************
IF "%par%"==""+iex"" (Set useWerl=1)
rem ******* ERLANG PARAMETERS **********************
IF NOT "%par%"=="%par:--detached=%" (Set parsErlang=%parsErlang% -detached)
IF NOT "%par%"=="%par:--hidden=%"   (Set parsErlang=%parsErlang% -hidden)
IF NOT "%par%"=="%par:--cookie=%"   (Set parsErlang=%parsErlang% -setcookie %1 && shift)
IF NOT "%par%"=="%par:--sname=%"    (Set parsErlang=%parsErlang% -sname %1 && shift)
IF NOT "%par%"=="%par:--name=%"     (Set parsErlang=%parsErlang% -name %1 && shift)
IF NOT "%par%"=="%par:--erl=%"      (Set beforeExtra=%beforeExtra% %~1 && shift)
IF NOT "%par%"=="%par:--gen-debug=%" (Set parsErlang=%parsErlang% -generic_debug)
rem ******* elixir parameters **********************
rem Note: we don't have to do anything with options that don't take an argument
IF NOT "%par%"=="%par:-e=%"      (shift)
IF NOT "%par%"=="%par:-r=%"      (shift)
IF NOT "%par%"=="%par:-pr=%"     (shift)
IF NOT "%par%"=="%par:-pa=%"     (shift)
IF NOT "%par%"=="%par:-pz=%"     (shift)
IF NOT "%par%"=="%par:--app=%"   (shift)
IF NOT "%par%"=="%par:--remsh=%" (shift)
goto:startloop

rem ******* assume all pre-params are parsed ********************
:expand_erl_libs
rem ******* expand all ebin paths as Windows does not support the ..\*\ebin wildcard ********************
SETLOCAL enabledelayedexpansion
set ext_libs=
for  /d %%d in ("%originPath%..\lib\*.") do (
  set ext_libs=!ext_libs! -pa "%%~fd\ebin"
)
SETLOCAL disabledelayedexpansion
:run
IF %useWerl% EQU 1 (
    werl %ext_libs% -noshell %ELIXIR_ERL_OPTS% %parsErlang% -s elixir start_cli %beforeExtra% -extra %*
) ELSE (
    erl %ext_libs% -noshell %ELIXIR_ERL_OPTS% %parsErlang% -s elixir start_cli %beforeExtra% -extra %*
)

Fix bad conditional logic when checking for +iex


@echo off
if "%OS%" == "Windows_NT" goto WinNT
REM for 9x/Me you better not have more than 9 args
python -c "import SCons.Script; SCons.Script.main()" %1 %2 %3 %4 %5 %6 %7 %8 %9
REM no way to set exit status of this script for 9x/Me
goto endscons
:WinNT
python -c "import SCons.Script; SCons.Script.main()" %*
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endscons
if errorlevel 9009 echo you do not have python in your PATH
REM color 00 causes this script to exit with non-zero exit status
if errorlevel 1 color 00
:endscons

@echo off
if "%OS%" == "Windows_NT" goto WinNT
REM for 9x/Me you better not have more than 9 args
python -c "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'scons-__VERSION__'), join(sys.prefix, 'scons')] + sys.path; import SCons.Script; SCons.Script.main()" %1 %2 %3 %4 %5 %6 %7 %8 %9
REM no way to set exit status of this script for 9x/Me
goto endscons
:WinNT
python -c "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'scons-__VERSION__'), join(sys.prefix, 'scons')] + sys.path; import SCons.Script; SCons.Script.main()" %*
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endscons
if errorlevel 9009 echo you do not have python in your PATH
REM color 00 causes this script to exit with non-zero exit status
if errorlevel 1 color 00
:endscons

Fix the scons.bat file for the new library packaging.


set AS_HOME=C:\Sun\AppServer
set IDE_HOME=C:\Program Files\NetBeans 6.7.1
set ANT_HOME=%IDE_HOME%\java2\ant
set ANT_OPTS=-Xmx872m -XX:MaxPermSize=512m "-Dcom.sun.aas.instanceName=server"
set NHINC_PROPERTIES_DIR=%AS_HOME%\domains\domain1\config\nhin
set JAVA_HOME=C:\Java\jdk1.6.0_16
set PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%JAVA_HOME%\bin;%ANT_HOME%\bin

ant -buildfile deploy.xml %*

exit /B %ERRORLEVEL%

Revert this file.

Revert this file.


:: Retrieve data files from Android device using ADB
:: Grab only the shaders/ directory, where edited shaders are stored.

echo off
:: Guess the default installation location
set ANDROID_HOME=%LOCALAPPDATA%\Android
set ANDROID_SDK=%ANDROID_HOME%\sdk
set ADB=%ANDROID_SDK%\platform-tools\adb
::echo %ADB%

set SHADERS_PATH=data/shaders/
set APP_PATH=/sdcard/Android/data/com.android.flickercladding/
set REMOTE_PATH=%APP_PATH%/%SHADERS_PATH%
set LOCAL_PATH=deploy/data/.

%ADB% -d pull %REMOTE_PATH% %LOCAL_PATH%

Add script to copy shaders back from device.


@rem = ' vim: set filetype=perl: ';
@rem = ' --*-Perl-*-- ';
@rem = '
@echo off
setlocal
set PATH=%~dp0\perl\bin;%~dp0\bin;%PATH%
perl -w "%~f0" %*
exit /B %ERRORLEVEL%
';

# StorScore
#
# Copyright (c) Microsoft Corporation
#
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

use strict;
use warnings;

use File::Basename;
use English;

my $script_name = basename( $PROGRAM_NAME );
my $script_dir = dirname( $PROGRAM_NAME );

unless( scalar @ARGV == 1 )
{
    warn "usage: $script_name OUTFILE\n";
    exit(-1);
}

my $outfile = "$script_dir\\$ARGV[0]";

sub my_exec
{
    my $cmd = shift;

    system( "echo TEST_BEGIN >> $outfile" );
    system( "echo $cmd >> $outfile" );

    system( "$cmd >> $outfile 2>&1" );

    system( "echo TEST_END >> $outfile" );
    system( "echo. >> $outfile" );
}

sub run_one
{
    my $args = shift;

    my $cmd = "storscore.cmd ";

    $cmd .= "--target=1234 " unless $args =~ /--target=/;

    $cmd .= "--pretend ";
    $cmd .= "--verbose ";
    $cmd .= "--noprompt ";

    my_exec( "$cmd $args" );
}

sub run_matrix
{
    my $base_args = shift;

    foreach my $target ( undef, 'P:', 'P:\\fake' )
    {
    foreach my $target_type ( qw( auto ssd hdd ) )
    {
    foreach my $recipe ( undef, 'recipes\\corners.rcp' )
    {
        my $matrix_args;

        $matrix_args .= " --target_type=$target_type";
        $matrix_args .= " --target=$target" if defined $target;
        $matrix_args .= " --recipe=$recipe" if defined $recipe;

        run_one( "$matrix_args $base_args" );
    }
    }
    }
}

unlink( $outfile );
chdir( ".." );

# Preserve existing results directory
rename( "results", "results.orig" );

# Run these error conditions just once
run_one( "--this_flag_does_not_exist" );
run_one( "--io_generator=bogus" );
run_one( "--target_type=bogus" );
run_one( "--active_range=0" );
run_one( "--active_range=110" );
run_one( "--partition_bytes=1000000000 --raw_disk" );
run_one( "--compressibility=110" );

# These are the defaults anyway, so just run them once
run_one( "--initialize" );
run_one( "--precondition" );
run_one( "--active_range=100" );
run_one( "--collect_smart" );
run_one( "--collect_logman" );
run_one( "--collect_power" );
run_one( "--io_generator=diskspd" );

# Run the full matrix on these
run_matrix( "" );
run_matrix( "--noinitialize" );
run_matrix( "--noprecondition" );
run_matrix( "--raw_disk" );
run_matrix( "--active_range=1" );
run_matrix( "--active_range=50" );
run_matrix( "--partition_bytes=1000000000" );
run_matrix( "--demo_mode" );
run_matrix( "--test_id=regr" );
run_matrix( "--test_id_prefix=regr" );
run_matrix( "--nocollect_smart" );
run_matrix( "--nocollect_logman" );
run_matrix( "--nocollect_power" );
run_matrix( "--start_on_step=2" );
run_matrix( "--stop_on_step=2" );
run_matrix( "--test_time_override=42" );
run_matrix( "--warmup_time_override=42" );
run_matrix( "--compressibility=0" );
run_matrix( "--compressibility=1" );
run_matrix( "--compressibility=20" );
run_matrix( "--results_share=\\\\share\\dir" );
run_matrix( "--io_generator=sqlio" );

# Restore original results directory
system( "rmdir /S /Q results >NUL 2>&1" );
rename( "results.orig", "results" );

# Post process output file to remove noise
rename( $outfile, "$outfile.orig" );

open( my $in, "<$outfile.orig" );
open( my $out, ">$outfile" );

while( my $line = <$in> )
{
    # Remove random temp file names
    $line =~ s/AppData\\\S*//;

    # Remove ETA info
    $line =~ s/\d{2}:\d{2}:\d{2} (AM|PM)//g;

    # Remove time from autogenerated results dir
    if( $line =~ /results/ )
    {
        $line =~ s/-\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}//g;
    }

    # Remove "Done" line with overall runtime
    $line =~ s/^Done.*//;

    print $out $line;
}

close $in;
close $out;

unlink( "$outfile.orig" );

print "Done! Diff $outfile against another run.\n";

@rem = ' vim: set filetype=perl: ';
@rem = ' --*-Perl-*-- ';
@rem = '
@echo off
setlocal
set PATH=%~dp0\perl\bin;%~dp0\bin;%PATH%
perl -w "%~f0" %*
exit /B %ERRORLEVEL%
';

# StorScore
#
# Copyright (c) Microsoft Corporation
#
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

use strict;
use warnings;

use File::Basename;
use Digest::MD5 'md5_hex';
use English;

my $script_name = basename( $PROGRAM_NAME );
my $script_dir = dirname( $PROGRAM_NAME );

unless( scalar @ARGV == 1 )
{
    warn "usage: $script_name OUTDIR\n";
    exit(-1);
}

my $outdir = "$script_dir\\$ARGV[0]";

die "Directory $outdir exists\n" if -d $outdir;

mkdir( $outdir );

sub my_exec
{
    my $cmd = shift;

    # Unique filenames based on hash of command line
    my $base_filename = "$outdir\\" . md5_hex( $cmd );
    my $tmp_filename = "$base_filename.tmp";
    my $out_filename = "$base_filename.txt";

    system( "echo $cmd > $tmp_filename" );
    system( "$cmd >> $tmp_filename 2>&1" );

    # Post process raw output file to remove noise
    open( my $in, "<$tmp_filename" );
    open( my $out, ">$out_filename" );

    while( my $line = <$in> )
    {
        # Remove random temp file names
        $line =~ s/AppData\\\S*//;

        # Remove ETA info
        $line =~ s/\d{2}:\d{2}:\d{2} (AM|PM)//g;

        # Remove time from autogenerated results dir
        if( $line =~ /results/ )
        {
            $line =~ s/-\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}//g;
        }

        # Remove "Done" line with overall runtime
        $line =~ s/^Done.*//;

        print $out $line;
    }

    close $in;
    close $out;

    unlink( $tmp_filename );
}

sub run_one
{
    my $args = shift;

    my $cmd = "storscore.cmd ";

    $cmd .= "--target=1234 " unless $args =~ /--target=/;

    $cmd .= "--pretend ";
    $cmd .= "--verbose ";
    $cmd .= "--noprompt ";

    my_exec( "$cmd $args" );
}

sub run_matrix
{
    my $base_args = shift;

    foreach my $target ( undef, 'P:', 'P:\\fake' )
    {
    foreach my $target_type ( qw( auto ssd hdd ) )
    {
    foreach my $recipe ( undef, 'recipes\\corners.rcp' )
    {
        my $matrix_args;

        $matrix_args .= " --target_type=$target_type";
        $matrix_args .= " --target=$target" if defined $target;
        $matrix_args .= " --recipe=$recipe" if defined $recipe;

        run_one( "$matrix_args $base_args" );
    }
    }
    }
}

chdir( ".." );

# Preserve existing results directory
rename( "results", "results.orig" );

# Run these error conditions just once
run_one( "--this_flag_does_not_exist" );
run_one( "--io_generator=bogus" );
run_one( "--target_type=bogus" );
run_one( "--active_range=0" );
run_one( "--active_range=110" );
run_one( "--partition_bytes=1000000000 --raw_disk" );
run_one( "--compressibility=110" );

# These are the defaults anyway, so just run them once
run_one( "--initialize" );
run_one( "--precondition" );
run_one( "--active_range=100" );
run_one( "--collect_smart" );
run_one( "--collect_logman" );
run_one( "--collect_power" );
run_one( "--io_generator=diskspd" );

# Run the full matrix on these
run_matrix( "" );
run_matrix( "--noinitialize" );
run_matrix( "--noprecondition" );
run_matrix( "--raw_disk" );
run_matrix( "--active_range=1" );
run_matrix( "--active_range=50" );
run_matrix( "--partition_bytes=1000000000" );
run_matrix( "--demo_mode" );
run_matrix( "--test_id=regr" );
run_matrix( "--test_id_prefix=regr" );
run_matrix( "--nocollect_smart" );
run_matrix( "--nocollect_logman" );
run_matrix( "--nocollect_power" );
run_matrix( "--start_on_step=2" );
run_matrix( "--stop_on_step=2" );
run_matrix( "--test_time_override=42" );
run_matrix( "--warmup_time_override=42" );
run_matrix( "--compressibility=0" );
run_matrix( "--compressibility=1" );
run_matrix( "--compressibility=20" );
run_matrix( "--results_share=\\\\share\\dir" );
run_matrix( "--io_generator=sqlio" );

# Restore original results directory
system( "rmdir /S /Q results >NUL 2>&1" );
rename( "results.orig", "results" );

print "Done! Diff $outdir directory against another run.\n";

Split regress tests into separate output files.


pushd "%~dp0"

robocopy Managed-OSVR-Unity OSVR-Unity\Assets\Plugins /E
popd

cd /d "%~dp0"

robocopy Managed-OSVR-Unity OSVR-Unity\Assets\Plugins /E

Tweak Managed-OSVR copy script.

Tweak Managed-OSVR copy script.


@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem                                                                         ##
@rem  Groovy JVM Bootstrap for Windowz                                       ##
@rem                                                                         ##
@rem ##########################################################################

@rem
@rem $Revision: 4170 $ $Date: 2006-10-26 12:11:12 +0000 (Thu, 26 Oct 2006) $
@rem

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

set DIRNAME=%~1
shift

set CLASS=%~1
shift

if exist "%USERPROFILE%/.groovy/preinit.bat" call "%USERPROFILE%/.groovy/preinit.bat"

@rem Determine the command interpreter to execute the "CD" later
set COMMAND_COM="cmd.exe"
if exist "%SystemRoot%\system32\cmd.exe" set COMMAND_COM="%SystemRoot%\system32\cmd.exe"
if exist "%SystemRoot%\command.com" set COMMAND_COM="%SystemRoot%\command.com"

@rem Use explicit find.exe to prevent cygwin and others find.exe from being used
set FIND_EXE="find.exe"
if exist "%SystemRoot%\system32\find.exe" set FIND_EXE="%SystemRoot%\system32\find.exe"
if exist "%SystemRoot%\command\find.exe" set FIND_EXE="%SystemRoot%\command\find.exe"

:check_JAVA_HOME
@rem Make sure we have a valid JAVA_HOME
if not "%JAVA_HOME%" == "" goto have_JAVA_HOME

echo.
echo ERROR: Environment variable JAVA_HOME has not been set.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo.
goto end

:have_JAVA_HOME
@rem Validate JAVA_HOME
%COMMAND_COM% /C DIR "%JAVA_HOME%" 2>&1 | %FIND_EXE% /I /C "%JAVA_HOME%" >nul
if not errorlevel 1 goto check_GROOVY_HOME

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.
echo.
goto end

:check_GROOVY_HOME
@rem Define GROOVY_HOME if not set
if "%GROOVY_HOME%" == "" set GROOVY_HOME=%DIRNAME%..

: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 SERVER_PORT=
set CP=

:win9xME_args_slurp
if "x%~1" == "x" goto execute
if "%~1" == "-Dserver.port" (
	set SERVER_PORT=%~1=%~2
	shift
	shift
	goto win9xME_args_slurp
) else (
	if "x%~1" == "x-cp" (
		set CP=%~2
		shift
		shift
		goto win9xME_args_slurp
	) else (
		if "x%~1" == "x-classpath" (
			set CP=%~2
			shift
			shift
			goto win9xME_args_slurp
		) else (
			set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
			shift
			goto win9xME_args_slurp
		)
	)
)

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

:execute
@rem Setup the command line
set STARTER_CLASSPATH=%GROOVY_HOME%\lib\groovy-starter.jar

if exist "%USERPROFILE%/.groovy/init.bat" call "%USERPROFILE%/.groovy/init.bat"

@rem Setting a classpath using the -cp or -classpath option means not to use
@rem the global classpath. Groovy behaves then the same as the java
@rem interpreter
if "x" == "x%CP%" goto empty_cp
:non_empty_cp
set CP=%STARTER_CLASSPATH%;%CP%;.
goto after_cp
:empty_cp
set CP=%STARTER_CLASSPATH%;.
if "x" == "x%CLASSPATH%" goto after_cp
set STARTER_CLASSPATH=%STARTER_CLASSPATH%;%CLASSPATH%
:after_cp

set STARTER_MAIN_CLASS=org.codehaus.groovy.tools.GroovyStarter
set STARTER_CONF=%GRAILS_HOME%\conf\groovy-starter.conf

set JAVA_EXE=%JAVA_HOME%\bin\java.exe
set TOOLS_JAR=%JAVA_HOME%\lib\tools.jar

if "%JAVA_OPTS%" == "" set JAVA_OPTS="-Xmx128m"
set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name="%PROGNAME%"
set JAVA_OPTS=%JAVA_OPTS% -Dgrails.home="%GRAILS_HOME%"
set JAVA_OPTS=%JAVA_OPTS% -Dtools.jar="%TOOLS_JAR%"
set JAVA_OPTS=%JAVA_OPTS% -Dgroovy.starter.conf="%STARTER_CONF%"

if exist "%USERPROFILE%/.groovy/postinit.bat" call "%USERPROFILE%/.groovy/postinit.bat"

@rem Execute Groovy
CALL "%JAVA_EXE%" %JAVA_OPTS% %SERVER_PORT% -classpath "%STARTER_CLASSPATH%" %STARTER_MAIN_CLASS% --main %CLASS% --conf "%STARTER_CONF%" --classpath "%CP%" "%CMD_LINE_ARGS%"
:end
@rem End local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" endlocal

@rem Optional pause the batch file
if "%GROOVY_BATCH_PAUSE%" == "on" pause

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem                                                                         ##
@rem  Groovy JVM Bootstrap for Windowz                                       ##
@rem                                                                         ##
@rem ##########################################################################

@rem
@rem $Revision: 4170 $ $Date: 2006-10-26 12:11:12 +0000 (Thu, 26 Oct 2006) $
@rem

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

set DIRNAME=%~1
shift

set CLASS=%~1
shift

if exist "%USERPROFILE%/.groovy/preinit.bat" call "%USERPROFILE%/.groovy/preinit.bat"

@rem Determine the command interpreter to execute the "CD" later
set COMMAND_COM="cmd.exe"
if exist "%SystemRoot%\system32\cmd.exe" set COMMAND_COM="%SystemRoot%\system32\cmd.exe"
if exist "%SystemRoot%\command.com" set COMMAND_COM="%SystemRoot%\command.com"

@rem Use explicit find.exe to prevent cygwin and others find.exe from being used
set FIND_EXE="find.exe"
if exist "%SystemRoot%\system32\find.exe" set FIND_EXE="%SystemRoot%\system32\find.exe"
if exist "%SystemRoot%\command\find.exe" set FIND_EXE="%SystemRoot%\command\find.exe"

:check_JAVA_HOME
@rem Make sure we have a valid JAVA_HOME
if not "%JAVA_HOME%" == "" goto have_JAVA_HOME

echo.
echo ERROR: Environment variable JAVA_HOME has not been set.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo.
goto end

:have_JAVA_HOME
@rem Validate JAVA_HOME
%COMMAND_COM% /C DIR "%JAVA_HOME%" 2>&1 | %FIND_EXE% /I /C "%JAVA_HOME%" >nul
if not errorlevel 1 goto check_GROOVY_HOME

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.
echo.
goto end

:check_GROOVY_HOME
@rem Define GROOVY_HOME if not set
if "%GROOVY_HOME%" == "" set GROOVY_HOME=%DIRNAME%..

: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 SERVER_PORT=
set CP=

:win9xME_args_slurp
if "x%~1" == "x" goto execute
if "%~1" == "-Dserver.port" (
	set SERVER_PORT=%~1=%~2
	shift
	shift
	goto win9xME_args_slurp
) else (
	if "x%~1" == "x-cp" (
		set CP=%~2
		shift
		shift
		goto win9xME_args_slurp
	) else (
		if "x%~1" == "x-classpath" (
			set CP=%~2
			shift
			shift
			goto win9xME_args_slurp
		) else (
			set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
			shift
			goto win9xME_args_slurp
		)
	)
)

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

:execute
@rem Setup the command line
set STARTER_CLASSPATH=%GRAILS_HOME%\lib\groovy-starter.jar

if exist "%USERPROFILE%/.groovy/init.bat" call "%USERPROFILE%/.groovy/init.bat"

@rem Setting a classpath using the -cp or -classpath option means not to use
@rem the global classpath. Groovy behaves then the same as the java
@rem interpreter
if "x" == "x%CP%" goto empty_cp
:non_empty_cp
set CP=%STARTER_CLASSPATH%;%CP%;.
goto after_cp
:empty_cp
set CP=%STARTER_CLASSPATH%;.
if "x" == "x%CLASSPATH%" goto after_cp
set STARTER_CLASSPATH=%STARTER_CLASSPATH%;%CLASSPATH%
:after_cp

set STARTER_MAIN_CLASS=org.codehaus.groovy.tools.GroovyStarter
set STARTER_CONF=%GRAILS_HOME%\conf\groovy-starter.conf

set JAVA_EXE=%JAVA_HOME%\bin\java.exe
set TOOLS_JAR=%JAVA_HOME%\lib\tools.jar

if "%JAVA_OPTS%" == "" set JAVA_OPTS="-Xmx128m"
set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name="%PROGNAME%"
set JAVA_OPTS=%JAVA_OPTS% -Dgrails.home="%GRAILS_HOME%"
set JAVA_OPTS=%JAVA_OPTS% -Dtools.jar="%TOOLS_JAR%"
set JAVA_OPTS=%JAVA_OPTS% -Dgroovy.starter.conf="%STARTER_CONF%"

if exist "%USERPROFILE%/.groovy/postinit.bat" call "%USERPROFILE%/.groovy/postinit.bat"

@rem Execute Groovy
CALL "%JAVA_EXE%" %JAVA_OPTS% %SERVER_PORT% -classpath "%STARTER_CLASSPATH%" %STARTER_MAIN_CLASS% --main %CLASS% --conf "%STARTER_CONF%" --classpath "%CP%" "%CMD_LINE_ARGS%"
:end
@rem End local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" endlocal

@rem Optional pause the batch file
if "%GROOVY_BATCH_PAUSE%" == "on" pause

fix for GRAILS-1166

fix for GRAILS-1166

git-svn-id: 29aad96320b2a07b98332cd568fc1316025c072f@4384 1cfb16fd-6d17-0410-8ff1-b7e8e1e2867d


rem we remove everything from dist
echo off
del /Q dist\*.*

rem python 3.3

set pythonexe="c:\python33_x64\python"
%pythonexe% clean_pyd.py
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64

set pythonexe="c:\python33\python"
%pythonexe% clean_pyd.py
%pythonexe% setup.py sdist --formats=gztar,zip --verbose
%pythonexe% setup.py bdist_wininst

rem python 3.4

set pythonexe="c:\python34_x64\python"
%pythonexe% clean_pyd.py
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64

set pythonexe="c:\python34\python"
%pythonexe% clean_pyd.py
%pythonexe% setup.py sdist --formats=gztar,zip --verbose
%pythonexe% setup.py bdist_wininst

rem help

%pythonexe% make_help.py
if not exist dist\html mkdir dist\html
xcopy /E /C /I /Y _doc\sphinxdoc\build\html dist\html

rem we remove everything from dist
echo off
del /Q dist\*.*

rem python 3.3

set pythonexe="c:\Python33_x64\python"
%pythonexe% clean_pyd.py
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64

set pythonexe="c:\Python33\python"
%pythonexe% clean_pyd.py
%pythonexe% setup.py sdist --formats=gztar,zip --verbose
%pythonexe% setup.py bdist_wininst

rem python 3.4

set pythonexe="c:\Python34_x64\python"
%pythonexe% clean_pyd.py
%pythonexe% setup.py build bdist_wininst --plat-name=win-amd64

set pythonexe="c:\Python34\python"
%pythonexe% clean_pyd.py
%pythonexe% setup.py sdist --formats=gztar,zip --verbose
%pythonexe% setup.py bdist_wininst

rem help

%pythonexe% -u make_help.py
if not exist dist\html mkdir dist\html
xcopy /E /C /I /Y _doc\sphinxdoc\build\html dist\html

fix the script building the documentation and setup


echo 'y' | "%ANDROID_HOME%/tools/android.bat" update sdk --no-ui --all --filter android-10,android-23,platform-tools,tools,build-tools-23.0.3

echo y | "%ANDROID_HOME%/tools/android.bat" update sdk --no-ui --all --filter android-10,android-23,platform-tools,tools,build-tools-23.0.3

Fix quot

Fix quot


setlocal
call settings.bat

call fetch.bat http://www.gaia-gis.it/gaia-sins/spatialite-tools-4.2.0.tar.gz spatialite-tools-4.2.0

if "%COMPILER%" == "MINGW" (
   echo "Sorry, MINGW is not supported for now"
   exit /b 1
)

cd spatialite-tools-4.2.0

"%SEDC%" -i nmake.opt -e s@INSTDIR=.*@INSTDIR=\$\(PREFIX\)@"
if "%Variant%" == "Debug" (
    "%SEDC%" -i nmake.opt -e "s@\/MD @\/MDd \/Zi @"
    "%SEDC%" -i nmake.opt -e "s@\/Ox@@"
)
"%SEDC%" -i makefile.vc -e "s@C:\\\\OSGeo4W@$(PREFIX)@g"
"%SEDC%" -i makefile.vc -e "s@C:\\\\OSGeo4w@$(PREFIX)@g"

rem MAKE THE MOST LIBS STATICALLY LINKED TO AVOID DLL CONFLICTS
"%SEDC%" -i makefile.vc -e "s@libexpat.lib@expat.lib@g"
"%SEDC%" -i makefile.vc -e "s@spatialite_i.lib@spatialite.lib $(PREFIX)\\\\lib\\\\freexl.lib $(PREFIX)\\\\lib\\\\libxml2.lib $(PREFIX)\\\\lib\\\\zlib.lib $(PREFIX)\\\\lib\\\geos_c.lib@g"
"%SEDC%" -i makefile.vc -e "s@proj_i.lib@proj.lib@g"
"%SEDC%" -i makefile.vc -e "s@readosm_i.lib@readosm.lib@g"
"%SEDC%" -i makefile.vc -e "s@sqlite3_i.lib@sqlite3.lib@g"

nmake -f makefile.vc install
%ER%

setlocal
call settings.bat

call fetch.bat http://www.gaia-gis.it/gaia-sins/spatialite-tools-4.2.0.tar.gz spatialite-tools-4.2.0

cd spatialite-tools-4.2.0

if "%COMPILER%" == "MINGW" (

  SET "PATH=%MSYSDIR%;%PREFIX%\bin;%PATH%"
  set "LIBSPATIALITE_CFLAGS=%CFLAGS%"
  set "LIBSPATIALITE_LIBS=%LDFLAGS%"
  set "LIBFREEXL_CFLAGS=%CFLAGS%"
  set "LIBFREEXL_LIBS=%LDFLAGS%"
  set "LIBREADOSM_CFLAGS=%CFLAGS%"
  set "LIBREADOSM_LIBS=%LDFLAGS%"

  if NOT EXIST Makefile (bash -c "./configure --prefix=%PREFIX:\=/%")
  %ER%
  bash -c "make install"
  %ER%

) else (

"%SEDC%" -i nmake.opt -e "s@INSTDIR=.*@INSTDIR=\$\(PREFIX\)@"
if "%Variant%" == "Debug" (
    "%SEDC%" -i nmake.opt -e "s@\/MD @\/MDd \/Zi @"
    "%SEDC%" -i nmake.opt -e "s@\/Ox@@"
)
"%SEDC%" -i makefile.vc -e "s@C:\\\\OSGeo4W@$(PREFIX)@g"
"%SEDC%" -i makefile.vc -e "s@C:\\\\OSGeo4w@$(PREFIX)@g"

rem MAKE THE MOST LIBS STATICALLY LINKED TO AVOID DLL CONFLICTS
"%SEDC%" -i makefile.vc -e "s@libexpat.lib@expat.lib@g"
"%SEDC%" -i makefile.vc -e "s@spatialite_i.lib@spatialite.lib $(PREFIX)\\\\lib\\\\freexl.lib $(PREFIX)\\\\lib\\\\libxml2.lib $(PREFIX)\\\\lib\\\\zlib.lib $(PREFIX)\\\\lib\\\geos_c.lib@g"
"%SEDC%" -i makefile.vc -e "s@proj_i.lib@proj.lib@g"
"%SEDC%" -i makefile.vc -e "s@readosm_i.lib@readosm.lib@g"
"%SEDC%" -i makefile.vc -e "s@sqlite3_i.lib@sqlite3.lib@g"

nmake -f makefile.vc install
%ER%
)

fix spatialite-tools on MinGW

fix spatialite-tools on MinGW


REM query the DNS `TXT` record of `google.com` with a 15 second time out
nslookup -q=TXT -timeout=15 google.com

REM https://blogs.technet.microsoft.com/rmilne/2015/09/11/how-to-use-nslookup-to-check-dns-txt-record/
REM http://www.windowscommandline.com/nslookup/
REM https://www.owasp.org/index.php/OWASP_File_Hash_Repository

Create nslookup_example_txt.bat

Create nslookup_example_txt.bat

nslookup example


@ECHO OFF
REM -- Automates cygwin installation

SETLOCAL

REM -- Change to the directory of the executing batch file
CD %~dp0

REM -- Configure our paths
SET ROOTDIR=C:\cygwin
SET SITE=http://mirrors.kernel.org/sourceware/cygwin/
SET SSHD_PORT=13610
SET SSH_TASK_TEMPLATE_URL=https://raw.githubusercontent.com/weikinhuang/dotfiles/master/dotenv/other/cygwin/win-schtasks-ssh.xml

REM -- Additional variables
SET ADD_ARGS=""
SET LOCALDIR="%ROOTDIR%\setup"
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
    SET SETUP_NAME=setup-x86.exe
) ELSE (
    SET SETUP_NAME=setup-x86_64.exe
)

REM -- STARTING SCRIPT
set DLOAD_SCRIPT=download.vbs

REM -- pure batch downloader: https://semitwist.com/articles/article/view/downloading-files-from-plain-batch-with-zero-dependencies
REM -- Windows has no built-in wget or curl, so generate a VBS script to do it:
REM -------------------------------------------------------------------------
ECHO Option Explicit                                                    >  %DLOAD_SCRIPT%
ECHO Dim args, http, fileSystem, adoStream, url, target, status         >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set args = Wscript.Arguments                                       >> %DLOAD_SCRIPT%
ECHO Set http = CreateObject("WinHttp.WinHttpRequest.5.1")              >> %DLOAD_SCRIPT%
ECHO url = args(0)                                                      >> %DLOAD_SCRIPT%
ECHO target = args(1)                                                   >> %DLOAD_SCRIPT%
ECHO WScript.Echo "Getting '" ^& target ^& "' from '" ^& url ^& "'..."  >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO http.Open "GET", url, False                                        >> %DLOAD_SCRIPT%
ECHO http.Send                                                          >> %DLOAD_SCRIPT%
ECHO status = http.Status                                               >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO If status ^<^> 200 Then                                            >> %DLOAD_SCRIPT%
ECHO     WScript.Echo "FAILED to download: HTTP Status " ^& status      >> %DLOAD_SCRIPT%
ECHO     WScript.Quit 1                                                 >> %DLOAD_SCRIPT%
ECHO End If                                                             >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set adoStream = CreateObject("ADODB.Stream")                       >> %DLOAD_SCRIPT%
ECHO adoStream.Open                                                     >> %DLOAD_SCRIPT%
ECHO adoStream.Type = 1                                                 >> %DLOAD_SCRIPT%
ECHO adoStream.Write http.ResponseBody                                  >> %DLOAD_SCRIPT%
ECHO adoStream.Position = 0                                             >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set fileSystem = CreateObject("Scripting.FileSystemObject")        >> %DLOAD_SCRIPT%
ECHO If fileSystem.FileExists(target) Then fileSystem.DeleteFile target >> %DLOAD_SCRIPT%
ECHO adoStream.SaveToFile target                                        >> %DLOAD_SCRIPT%
ECHO adoStream.Close                                                    >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
REM -------------------------------------------------------------------------

mkdir "%ROOTDIR%"
mkdir "%LOCALDIR%"

IF NOT EXIST "%ROOTDIR%\%SETUP_NAME%" cscript //Nologo "%DLOAD_SCRIPT%" http://cygwin.com/%SETUP_NAME% "%ROOTDIR%\%SETUP_NAME%"

REM -- cleanup temp files
del "%DLOAD_SCRIPT%"

REM -- These are the packages we will install (in addition to the default packages)
SET PACKAGES=bash-completion,bc,bind,ca-certificates,curl,cygutils-extra,git,git-completion,git-svn,gnupg
SET PACKAGES=%PACKAGES%,inetutils,nc,nc6,ncurses,openssh,openssl,procps,rsync,screen,unzip,vim,wget,xxd
REM -- Extra packages
SET PACKAGES=%PACKAGES%,GraphicsMagick,ImageMagick,aspell,aspell-en,bzip2,fdupes,heimdal,mkisofs,p7zip

REM -- Do it!
ECHO *** INSTALLING DEFAULT PACKAGES
"%ROOTDIR%\%SETUP_NAME%" -q -d -D -L -X -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" %ADD_ARGS%
ECHO.
ECHO.
ECHO *** INSTALLING CUSTOM PACKAGES
"%ROOTDIR%\%SETUP_NAME%" -q -d -D -L -X -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" -P "%PACKAGES%" %ADD_ARGS%

REM -- Show what we did
ECHO.
ECHO.
ECHO cygwin installation updated
ECHO - "%PACKAGES%"
ECHO.

REM -- make cygdrive root / instead of /cygdrive
ECHO.
ECHO.
ECHO updating cygdrive fstab
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/# none \/cygdrive cygdrive /none \/ cygdrive /' /etc/fstab"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/none \/cygdrive cygdrive /none \/ cygdrive /' /etc/fstab"
ECHO.
ECHO.

REM -- make the home directory
ECHO.
ECHO.
ECHO making the home directory be the windows home
REM -- WIN XP-
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ -d \"/c/Documents and Settings/$USER\" ]]; then mv \"/home/$USER\" \"/home/$USER.bak\"; ln -s \"/c/Documents and Settings/$USER\" \"/home/$USER\"; fi;"
REM -- WIN Vista+
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ -d \"/c/Users/$USER\" ]]; then mv \"/home/$USER\" \"/home/$USER.bak\"; ln -s \"/c/Users/$USER\" \"/home/$USER\"; fi;"
ECHO.
ECHO.

REM -- setup sshd for local user only
ECHO.
ECHO.
ECHO setup sshd for local user only
"%ROOTDIR%\bin\bash.exe" --login -c "ssh-host-config --no --port %SSHD_PORT%"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#ListenAddress 0.0.0.0$/ListenAddress 127.0.0.1/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#ListenAddress ::$/ListenAddress ::1/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#PasswordAuthentication yes$/PasswordAuthentication no/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^UsePrivilegeSeparation sandbox/#UsePrivilegeSeparation sandbox/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ ! -f ~/.ssh/id_rsa ]]; then ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys; fi;"
"%ROOTDIR%\bin\bash.exe" --login -c "echo > /etc/motd"

REM -- Sadly in the newest Windows 10: http://www.thewindowsclub.com/create-elevated-shortcut-run-programs-bypass-uac instead
"%ROOTDIR%\bin\bash.exe" --login -c "mkdir -p /startup"
"%ROOTDIR%\bin\bash.exe" --login -c "wget -O /startup/ssh-task.xml %SSH_TASK_TEMPLATE_URL%"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/##HOSTNAME##/'$(hostname)'/' /startup/ssh-task.xml"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/##USER##/'$(whoami)'/' /startup/ssh-task.xml"
schtasks /delete /f /tn cygwinsshd
schtasks /create /xml "%ROOTDIR%\startup\ssh-task.xml" /tn cygwinsshd

IF NOT EXIST "%ROOTDIR%\cygsetup.cmd" (
    echo "%ROOTDIR%\%SETUP_NAME%" -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" "%ADD_ARGS%" > "%ROOTDIR%\cygsetup.cmd"
)

ECHO.
ECHO.

ENDLOCAL

PAUSE
EXIT /B 0

@ECHO OFF
REM -- Automates cygwin installation

SETLOCAL

REM -- Change to the directory of the executing batch file
CD %~dp0

REM -- Configure our paths
SET ROOTDIR=C:\cygwin
SET SITE=http://mirrors.kernel.org/sourceware/cygwin/
SET SSHD_PORT=13610
SET SSH_TASK_TEMPLATE_URL=https://raw.githubusercontent.com/weikinhuang/dotfiles/master/dotenv/other/cygwin/win-schtasks-ssh.xml

REM -- Additional variables
SET ADD_ARGS=""
SET LOCALDIR="%ROOTDIR%\setup"
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
    SET SETUP_NAME=setup-x86.exe
) ELSE (
    SET SETUP_NAME=setup-x86_64.exe
)

REM -- STARTING SCRIPT
set DLOAD_SCRIPT=download.vbs

REM -- pure batch downloader: https://semitwist.com/articles/article/view/downloading-files-from-plain-batch-with-zero-dependencies
REM -- Windows has no built-in wget or curl, so generate a VBS script to do it:
REM -------------------------------------------------------------------------
ECHO Option Explicit                                                    >  %DLOAD_SCRIPT%
ECHO Dim args, http, fileSystem, adoStream, url, target, status         >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set args = Wscript.Arguments                                       >> %DLOAD_SCRIPT%
ECHO Set http = CreateObject("WinHttp.WinHttpRequest.5.1")              >> %DLOAD_SCRIPT%
ECHO url = args(0)                                                      >> %DLOAD_SCRIPT%
ECHO target = args(1)                                                   >> %DLOAD_SCRIPT%
ECHO WScript.Echo "Getting '" ^& target ^& "' from '" ^& url ^& "'..."  >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO http.Open "GET", url, False                                        >> %DLOAD_SCRIPT%
ECHO http.Send                                                          >> %DLOAD_SCRIPT%
ECHO status = http.Status                                               >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO If status ^<^> 200 Then                                            >> %DLOAD_SCRIPT%
ECHO     WScript.Echo "FAILED to download: HTTP Status " ^& status      >> %DLOAD_SCRIPT%
ECHO     WScript.Quit 1                                                 >> %DLOAD_SCRIPT%
ECHO End If                                                             >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set adoStream = CreateObject("ADODB.Stream")                       >> %DLOAD_SCRIPT%
ECHO adoStream.Open                                                     >> %DLOAD_SCRIPT%
ECHO adoStream.Type = 1                                                 >> %DLOAD_SCRIPT%
ECHO adoStream.Write http.ResponseBody                                  >> %DLOAD_SCRIPT%
ECHO adoStream.Position = 0                                             >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set fileSystem = CreateObject("Scripting.FileSystemObject")        >> %DLOAD_SCRIPT%
ECHO If fileSystem.FileExists(target) Then fileSystem.DeleteFile target >> %DLOAD_SCRIPT%
ECHO adoStream.SaveToFile target                                        >> %DLOAD_SCRIPT%
ECHO adoStream.Close                                                    >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
REM -------------------------------------------------------------------------

mkdir "%ROOTDIR%"
mkdir "%LOCALDIR%"

IF NOT EXIST "%ROOTDIR%\%SETUP_NAME%" cscript //Nologo "%DLOAD_SCRIPT%" http://cygwin.com/%SETUP_NAME% "%ROOTDIR%\%SETUP_NAME%"

REM -- cleanup temp files
del "%DLOAD_SCRIPT%"

REM -- These are the packages we will install (in addition to the default packages)
SET PACKAGES=bash-completion,bc,bind,ca-certificates,curl,cygutils-extra,git,git-completion,git-svn,gnupg
SET PACKAGES=%PACKAGES%,inetutils,jq,nc,nc6,ncurses,openssh,openssl,procps,rsync,screen,unzip,vim,wget,xxd
REM -- Extra packages
SET PACKAGES=%PACKAGES%,GraphicsMagick,ImageMagick,aspell,aspell-en,bzip2,fdupes,heimdal,mkisofs,p7zip

REM -- Do it!
ECHO *** INSTALLING DEFAULT PACKAGES
"%ROOTDIR%\%SETUP_NAME%" -q -d -D -L -X -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" %ADD_ARGS%
ECHO.
ECHO.
ECHO *** INSTALLING CUSTOM PACKAGES
"%ROOTDIR%\%SETUP_NAME%" -q -d -D -L -X -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" -P "%PACKAGES%" %ADD_ARGS%

REM -- Show what we did
ECHO.
ECHO.
ECHO cygwin installation updated
ECHO - "%PACKAGES%"
ECHO.

REM -- make cygdrive root / instead of /cygdrive
ECHO.
ECHO.
ECHO updating cygdrive fstab
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/# none \/cygdrive cygdrive /none \/ cygdrive /' /etc/fstab"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/none \/cygdrive cygdrive /none \/ cygdrive /' /etc/fstab"
ECHO.
ECHO.

REM -- make the home directory
ECHO.
ECHO.
ECHO making the home directory be the windows home
REM -- WIN XP-
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ -d \"/c/Documents and Settings/$USER\" ]]; then mv \"/home/$USER\" \"/home/$USER.bak\"; ln -s \"/c/Documents and Settings/$USER\" \"/home/$USER\"; fi;"
REM -- WIN Vista+
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ -d \"/c/Users/$USER\" ]]; then mv \"/home/$USER\" \"/home/$USER.bak\"; ln -s \"/c/Users/$USER\" \"/home/$USER\"; fi;"
ECHO.
ECHO.

REM -- setup sshd for local user only
ECHO.
ECHO.
ECHO setup sshd for local user only
"%ROOTDIR%\bin\bash.exe" --login -c "ssh-host-config --no --port %SSHD_PORT%"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#ListenAddress 0.0.0.0$/ListenAddress 127.0.0.1/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#ListenAddress ::$/ListenAddress ::1/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#PasswordAuthentication yes$/PasswordAuthentication no/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^UsePrivilegeSeparation sandbox/#UsePrivilegeSeparation sandbox/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ ! -f ~/.ssh/id_rsa ]]; then ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys; fi;"
"%ROOTDIR%\bin\bash.exe" --login -c "echo > /etc/motd"

REM -- Sadly in the newest Windows 10: http://www.thewindowsclub.com/create-elevated-shortcut-run-programs-bypass-uac instead
"%ROOTDIR%\bin\bash.exe" --login -c "mkdir -p /startup"
"%ROOTDIR%\bin\bash.exe" --login -c "wget -O /startup/ssh-task.xml %SSH_TASK_TEMPLATE_URL%"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/##HOSTNAME##/'$(hostname)'/' /startup/ssh-task.xml"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/##USER##/'$(whoami)'/' /startup/ssh-task.xml"
schtasks /delete /f /tn cygwinsshd
schtasks /create /xml "%ROOTDIR%\startup\ssh-task.xml" /tn cygwinsshd

IF NOT EXIST "%ROOTDIR%\cygsetup.cmd" (
    echo "%ROOTDIR%\%SETUP_NAME%" -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" "%ADD_ARGS%" > "%ROOTDIR%\cygsetup.cmd"
)

ECHO.
ECHO.

ENDLOCAL

PAUSE
EXIT /B 0

Add jq to cygwin setup

Add jq to cygwin setup


IF "%ARCH%"=="32" (
    powershell -command "& { iwr ftp://ftp.fftw.org/pub/fftw/fftw-3.3.4-dll32.zip -OutFile fftw-3.3.4-dll32.zip }"
    7z e .\fftw-3.3.4-dll32.zip -offtw3
) ELSE (
    powershell -command "& { iwr ftp://ftp.fftw.org/pub/fftw/fftw-3.3.4-dll64.zip -OutFile fftw-3.3.4-dll64.zip }"
    7z e .\fftw-3.3.4-dll64.zip -offtw3
)

cd fftw3
lib /def:libfftw3f-3.def
cd ..

ls fftw3
move fftw3\libfftw3f-3.lib %LIBRARY_LIB%\
move fftw3\fftw3.f %LIBRARY_INC%\

Make FFTW3 work for windows

Make FFTW3 work for windows

Former-commit-id: 3c55074b3421ec9ea51ee762e039ca5c64a16954


@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
pushd %~dp0\..\Docs
echo Dumping AngelScript API...
..\Bin\ScriptCompiler -dumpapi ScriptAPI.dox AngelScriptAPI.h
if errorlevel 1 exit /B 1
pushd %~dp0\..\Source\Engine\LuaScript\pkgs\
echo Dumping LuaScript API...
..\..\..\..\Bin\tolua++ -L ToDoxHook.lua -P -o ..\..\..\..\Docs\LuaScriptAPI.dox Urho3D.tolua
if errorlevel 1 exit /B 1
pushd %~dp0\..\Docs
echo Converting Doxygen files to HTML...
doxygen Doxyfile 1>nul
echo Finish.
popd

Add new line at end of file.

Add new line at end of file.


:<<"::CMDLITERAL"
@ECHO OFF
SET MASTHEADURL=http://%1:52311/masthead/masthead.afxm
ECHO

powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://software.bigfix.com/download/bes/95/BigFix-BES-Client-9.5.1.9.exe', 'c:\Windows\Temp\BESClient.exe') }" -ExecutionPolicy Bypass
powershell -command "& { (New-Object Net.WebClient).DownloadFile('%MASTHEADURL%', 'c:\Windows\Temp\masthead.afxm') }" -ExecutionPolicy Bypass

ECHO I am %COMSPEC%
ECHO put CMD/BAT lines in here.
ECHO %0
ECHO %1
ECHO %MASTHEADURL%

PAUSE
EXIT
::CMDLITERAL

:<<"::CMDLITERAL"
@ECHO OFF
SET MASTHEADURL=http://%1:52311/masthead/masthead.afxm
ECHO

REM http://stackoverflow.com/questions/4781772/how-to-test-if-an-executable-exists-in-the-path-from-a-windows-batch-file
where /q powershell || ECHO Cound not find powershell. && EXIT /B

powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://software.bigfix.com/download/bes/95/BigFix-BES-Client-9.5.1.9.exe', 'c:\Windows\Temp\BESClient.exe') }" -ExecutionPolicy Bypass
powershell -command "& { (New-Object Net.WebClient).DownloadFile('%MASTHEADURL%', 'c:\Windows\Temp\masthead.afxm') }" -ExecutionPolicy Bypass

ECHO I am %COMSPEC%
ECHO put CMD/BAT lines in here.
ECHO %0
ECHO %1
ECHO %MASTHEADURL%

PAUSE
EXIT
::CMDLITERAL

Update install_bigfix.bat

Update install_bigfix.bat


:<<"::CMDLITERAL"
@ECHO OFF
SET MASTHEADURL=http://%1:52311/masthead/masthead.afxm
ECHO

bitsadmin /transfer bigfixdl%random% /download /priority FOREGROUND http://software.bigfix.com/download/bes/95/BigFix-BES-Client-9.5.1.9.exe C:\Windows\Temp\bigfixclient.exe

ECHO I am %COMSPEC%
ECHO put CMD/BAT lines in here.
ECHO %0
ECHO %1
ECHO %MASTHEADURL%

PAUSE
EXIT
::CMDLITERAL

:<<"::CMDLITERAL"
@ECHO OFF
SET MASTHEADURL=http://%1:52311/masthead/masthead.afxm
ECHO

bitsadmin /transfer bigfixdl%random% /download /priority FOREGROUND http://software.bigfix.com/download/bes/95/BigFix-BES-Client-9.5.1.9.exe C:\Windows\Temp\bigfixclient.exe
bitsadmin /transfer bigfixcfgdl%random% /download /priority FOREGROUND %MASTHEADURL% C:\Windows\Temp\masthead.afxm

ECHO I am %COMSPEC%
ECHO put CMD/BAT lines in here.
ECHO %0
ECHO %1
ECHO %MASTHEADURL%

PAUSE
EXIT
::CMDLITERAL

Update install_bigfix.bat

Update install_bigfix.bat


:: msbuild must be in path
SET PATH=%PATH%;%WINDIR%\Microsoft.NET\Framework64\v4.0.30319
where msbuild
if errorLevel 1 ( echo "msbuild was not found on PATH" && exit /b 1 )

git submodule update --init --recursive
cd IronFrame
call build.bat build || exit /b 1
cd ..

rmdir /S /Q packages
bin\nuget restore || exit /b 1
MSBuild Containerizer\Containerizer.csproj /t:Rebuild /p:Configuration=Release || exit /b 1
MSBuild Containerizer.Tests\Containerizer.Tests.csproj /t:Rebuild /p:Configuration=Release || exit /b 1
packages\nspec.0.9.68\tools\NSpecRunner.exe Containerizer.Tests\bin\Release\Containerizer.Tests.dll || exit /b 1

:: msbuild must be in path
SET DEVENV_PATH=%programfiles(x86)%\Microsoft Visual Studio 12.0\Common7\IDE
SET PATH=%PATH%;%DEVENV_PATH%;%WINDIR%\Microsoft.NET\Framework64\v4.0.30319
where msbuild
if errorLevel 1 ( echo "msbuild was not found on PATH" && exit /b 1 )

git submodule update --init --recursive
pushd IronFrame || exit /b 1
  ..\bin\nuget restore || exit /b 1
  devenv IronFrame.sln /build "Release" || exit /b 1
  :: call build.bat build || exit /b 1
popd

rmdir /S /Q packages
bin\nuget restore || exit /b 1
MSBuild Containerizer\Containerizer.csproj /t:Rebuild /p:Configuration=Release || exit /b 1
MSBuild Containerizer.Tests\Containerizer.Tests.csproj /t:Rebuild /p:Configuration=Release || exit /b 1
packages\nspec.0.9.68\tools\NSpecRunner.exe Containerizer.Tests\bin\Release\Containerizer.Tests.dll || exit /b 1

Use visual studio instead of msbuild

Use visual studio instead of msbuild

Signed-off-by: Dave_Goddard <a5692579077bf98cb035292473fe12572309d028@pivotal.io>


@echo on

if exist %PREFIX%\Scripts\f2py.exe (
  set F2PY=%PREFIX%\Scripts\f2py.exe
) else (
  set F2PY=%PREFIX%\Scripts\f2py.bat
)

mkdir "%SRC_DIR%\dist"

"%PYTHON%" setup.py bdist_wheel ^
           --dist-dir="%SRC_DIR%\dist" ^
           --compiler=mingw32 ^
           -- ^
           -DF2PY_EXECUTABLE:FILEPATH="%F2PY%"

"%PYTHON%" -m pip install ^
           --no-index ^
           --find-links="%SRC_DIR%\dist" ^
           fastscapelib_fortran ^
           -vvv

if errorlevel 1 exit 1

@echo on

if exist %PREFIX%\Scripts\f2py.exe (
  set F2PY=%PREFIX%\Scripts\f2py.exe
) else (
  set F2PY=%PREFIX%\Scripts\f2py.bat
)

mkdir "%SRC_DIR%\dist"

"%PYTHON%" setup.py build ^
           --compiler=mingw32 ^
           -G "MinGW Makefiles" ^
           -- ^
           -DF2PY_EXECUTABLE:FILEPATH="%F2PY%"

"%PYTHON%" setup.py install

if errorlevel 1 exit 1

use python setup.py build/install instead of bdist_wheel/pip

bdist_wheel doesn't support the --compiler option


mkdir build
cd build

cmake ^
    -G "Ninja" ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DBUILD_TESTING=ON ^
    %SRC_DIR%
if errorlevel 1 exit 1

:: Build.
cmake --build . --config Release
if errorlevel 1 exit 1

:: Install.
cmake --build . --config Release --target install
if errorlevel 1 exit 1

:: Test.
ctest --output-on-failure -C Release
if errorlevel 1 exit 1

mkdir build
cd build

cmake ^
    -G "Ninja" ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DBUILD_TESTING=ON ^
    %SRC_DIR%
if errorlevel 1 exit 1

:: Build.
cmake --build . --config Release
if errorlevel 1 exit 1

:: Install.
cmake --build . --config Release --target install
if errorlevel 1 exit 1

:: Test.
:: Some tests disabled for https://github.com/robotology/ycm/issues/382
ctest --output-on-failure -C Release -E "YCMBootstrap-not-use-system|YCMBootstrap-disable-find|RunCMake.IncludeUrl"
if errorlevel 1 exit 1

Update bld.bat

Update bld.bat


@echo off
setlocal

:: Change this for SxS
set VSVersion=14.0

if /i "%~1"=="" goto Help
if /i "%~1"=="-?" goto Help
if /i "%~1"=="/?" goto Help

set LoggingValue=
set Exp=0
set ServerLogging=

:ArgLoop
if /i "%~1"=="on" set LoggingValue=1& goto ArgLoopCondition
if /i "%~1"=="off" set LoggingValue=0& goto ArgLoopCondition
if /i "%~1"=="/exp" set Exp=1& goto ArgLoopCondition
if /i "%~1"=="-exp" set Exp=1& goto ArgLoopCondition
if /i "%~1"=="/version" goto SetVersion
if /i "%~1"=="-version" goto SetVersion
if /i "%~1"=="-serverlogging" goto SetServerLogging
if /i "%~1"=="/serverlogging" goto SetServerLogging
echo ERROR: Unknown argument '%~1'& exit /b -1

:SetVersion
shift
if "%~1"=="" echo ERROR: Expected version number.
set VSVersion=%~1
goto ArgLoopCondition

:SetServerLogging
REM Documentation on GDBServer command line arguments: http://www.sourceware.org/gdb/onlinedocs/gdb/Server.html
set ServerLogging=--debug
if /i "%~2"=="full" shift & set ServerLogging=--debug --remote-debug
goto ArgLoopCondition

:ArgLoopCondition
shift
if NOT "%~1"=="" goto :ArgLoop

if "%LoggingValue%"=="" echo ERROR: 'on' or 'off' must be specified.& exit /b -1
if /i NOT "%LoggingValue%"=="1" if NOT "%ServerLogging%"=="" echo ERROR: '/serverlogging' can only be used with 'on'& exit /b -1

set reg_exe=reg.exe
if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" set reg_exe=%windir%\syswow64\reg.exe

set MainRegRoot=HKLM\SOFTWARE\Microsoft\VisualStudio\%VSVersion%
set OptionalRegRoots=HKCU\SOFTWARE\Microsoft\VisualStudio\%VSVersion%_Config HKLM\SOFTWARE\Microsoft\Glass\%VSVersion%

if "%Exp%"=="1" goto :SetExpRegRoots

call :SetRegRoot %MainRegRoot%
for %%r in (%OptionalRegRoots%) do call :SetForRegRootIfExists %%r
exit /b 0

:SetExpRegRoots
reg query HKCU\Software\Microsoft\VisualStudio | findstr %VSVersion%Exp_Config > %TMP%\%VSVersion%ExpRegRoots.txt
set ExpRoots=
set ExpRootFound=
for /f "delims=" %%r in (%TMP%\%VSVersion%ExpRegRoots.txt) do set ExpRootFound=1& call set ExpRoots=%%ExpRoots%% %%r
if NOT "%ExpRootFound%"=="1" echo ERROR: Experimental instance could not be found. Experimental instance must be started before this batch script can work.& exit /b -1

for %%r in (%ExpRoots%) do call :SetRegRoot %%r
exit /b 0

:SetForRegRootIfExists
REM check if the registry root exists
call %reg_exe% query %1 /ve 1>NUL 2>NUL
if NOT %ERRORLEVEL%==0 goto eof

:SetRegRoot
call %reg_exe% add %1\Debugger /v EnableMIDebugLogger /t REG_DWORD /d %LoggingValue% /f
if not %ERRORLEVEL%==0 echo ERROR: failed to write to the registry (%1) & exit /b -1

if "%ServerLogging%"=="" goto DeleteServerLogging
goto AddServerLogging

:AddServerLogging
call %reg_exe% add %1\Debugger /v GDBServerLoggingArguments /t REG_SZ /d "%ServerLogging%" /f
if not %ERRORLEVEL%==0 echo ERROR: failed to write to the registry (%1) & exit /b -1
goto eof

:DeleteServerLogging
call %reg_exe% delete %1\Debugger /v GDBServerLoggingArguments /f 1>NUL 2>NUL
goto eof

:Help
echo SetMIDebugLogging.cmd ^<on^|off^> [/serverlogging [full]] [/exp] [/version 12.0 ^| 14.0]
echo.
echo SetMIDebugLogging.cmd is used to enable/disable logging for the Microsoft
echo MI debug engine.
echo.
echo Logging will be saved to %TMP%\Microsoft.MIDebug.log.
echo.
echo /exp              Changes the setting for the experimental instance of
echo                   Visual Studio instead of the normal instance.
echo                   NOTE: For the experimental instance, this command must be
echo                   run after the experimental instance is started, but before
echo                   start debugging.
echo.
echo /version ^<number^> Changes the version of Visual Studio which is affected.
echo                   Default is '%VSVersion%'.
echo.
echo /serverlogging [full] Enables logging from gdbserver. This option is only
echo                   supported when enabling logging ('on'). 'full' logging will
echo                   turn on packet logging in addition to normal logging.
echo.
:eof

@echo off
setlocal

if /i "%~1"=="" goto Help
if /i "%~1"=="-?" goto Help
if /i "%~1"=="/?" goto Help

set LoggingValue=
set Exp=0
set ServerLogging=
set VSRootDir=
set MIEngineRelativeDir=Common7\IDE\CommonExtensions\Microsoft\MDD\Debugger
set MIEngineRelativePath=%MIEngineRelativeDir%\Microsoft.MIDebugEngine.dll

:ArgLoop
if /i "%~1"=="on" set LoggingValue=1& goto ArgLoopCondition
if /i "%~1"=="off" set LoggingValue=0& goto ArgLoopCondition
if /i "%~1"=="/VSRootDir" goto SetVSRoot
if /i "%~1"=="-VSRootDir" goto SetVSRoot
if /i "%~1"=="-serverlogging" goto SetServerLogging
if /i "%~1"=="/serverlogging" goto SetServerLogging
echo ERROR: Unknown argument '%~1'& exit /b -1

:SetVSRoot
shift
if "%~1"=="" echo ERROR: Expected version number.
set VSRootDir=%~1
if not exist "%VSRootDir%" echo ERROR: '/VSRootDir' value '%VSRootDir%' does not exist & exit /b -1
if not exist "%VSRootDir%\%MIEngineRelativePath%" echo ERROR: '/VSRootDir' value '%VSRootDir%' does not contain MIEngine (%VSRootDir%\%MIEngineRelativePath%) & exit /b -1
goto ArgLoopCondition

:SetServerLogging
REM Documentation on GDBServer command line arguments: http://www.sourceware.org/gdb/onlinedocs/gdb/Server.html
set ServerLogging=--debug
if /i "%~2"=="full" shift & set ServerLogging=--debug --remote-debug
goto ArgLoopCondition

:ArgLoopCondition
shift
if NOT "%~1"=="" goto :ArgLoop

if "%LoggingValue%"=="" echo ERROR: 'on' or 'off' must be specified.& exit /b -1
if /i NOT "%LoggingValue%"=="1" if NOT "%ServerLogging%"=="" echo ERROR: '/serverlogging' can only be used with 'on'& exit /b -1

set SetLoggingError=
if NOT "%VSRootDir%"=="" call :SetLogging "%VSRootDir%" & goto Done

REM If '/VSRootDir' is NOT specified, try ALL the default locations
set ProgRoot=%ProgramFiles(x86)%
if "%ProgRoot%"=="" set ProgRoot=%ProgramFiles%
set VSVersionFound=
set MIEngineFound=
call :TryVSPath "%ProgRoot%\Microsoft Visual Studio 14.0"
call :TryVSPath "%ProgRoot%\Microsoft Visual Studio\VS15Preview"
if "%VSVersionFound%"=="" echo ERROR: Visual Studio 2015+ is not installed, or not installed to the default location. Use '/VSRootDir' to specify the directory. & exit /b -1
if "%MIEngineFound%"=="" echo ERROR: The found version(s) of Visual Studio do not have the MIEngine installed. & exit /b -1
goto Done

:Done
    echo.
    if NOT "%SetLoggingError%"=="" exit /b -1
    echo SetMIDebugLogging.cmd succeeded. Restart Visual Studio to take effect.
    if "%LoggingValue%"=="1" echo Logging will be saved to %TMP%\Microsoft.MIDebug.log.
    exit /b 0

:TryVSPath
    REM Arg1: path to VS Root

    if NOT "%SetLoggingError%"=="" goto :EOF
    if not exist "%~1" goto :EOF
    set VSVersionFound=1
    if not exist "%~1\%MIEngineRelativePath%" goto :EOF
    set MIEngineFound=1
    goto SetLogging

:SetLogging
    REM Arg1: path to VS Root
    set PkgDefFile=%~1\%MIEngineRelativeDir%\logging.pkgdef

    if NOT exist "%PkgDefFile%" goto SetLogging_NoPkgDef
        del "%PkgDefFile%"
        if NOT exist "%PkgDefFile%" goto SetLogging_NoPkgDef
        echo ERROR: Failed to remove "%PkgDefFile%". Ensure this script is run as an administrator.
        set SetLoggingError=1
        goto :EOF
    :SetLogging_NoPkgDef

    if "%LoggingValue%"=="0" goto UpdateConfiguration

    :EnableLogging
        echo [$RootKey$\Debugger]> "%PkgDefFile%"
            if exist "%PkgDefFile%" goto EnableLogging_PkgDefCreated
            echo ERROR: Failed to create "%PkgDefFile%". Ensure this script is run as an administrator.
            set SetLoggingError=1
            goto :EOF
        :EnableLogging_PkgDefCreated

        echo "Logging"=dword:00000001>> "%PkgDefFile%"
        if NOT "%ServerLogging%"=="" echo "GDBServerLoggingArguments"="%ServerLogging%">> "%PkgDefFile%"

    :UpdateConfiguration
    echo Setting logging for %1
    call "%~1\Common7\IDE\devenv.com" /updateconfiguration
    if "%ERRORLEVEL%"=="0" goto :EOF
    echo ERROR: '"%~1\Common7\IDE\devenv.com" /updateconfiguration' failed with error %ERRORLEVEL%.
    set SetLoggingError=1
    goto :EOF

:Help
echo SetMIDebugLogging.cmd ^<on^|off^> [/serverlogging [full]] [/VSRootDir ^<value^>]
echo.
echo SetMIDebugLogging.cmd is used to enable/disable logging for the Microsoft
echo MI debug engine.
echo.
echo Logging will be saved to %TMP%\Microsoft.MIDebug.log.
echo.
echo /serverlogging [full] Enables logging from gdbserver. This option is only
echo            supported when enabling logging ('on'). 'full' logging will
echo            turn on packet logging in addition to normal logging.
echo.
echo /VSRootDir ^<value^> sets the path to the root of Visual Studio
echo            (ex: C:\Program Files (x86)\Microsoft Visual Studio 14.0). If not
echo            specified, the default install directories for all versions of VS
echo            2015+ will be used.
echo.
:eof

Use pkgdef files to control MIEngine logging (#451)

* Use pkgdef files to control MIEngine logging

This checkin changes SetMIDebugLogging.cmd to use pkgdef files instead of directly writing to the registry. This should resolve issues that customers who have multiple _Config keys have been having. I believe this will also fix logging for Dev15, though I don't have a Dev15 machine with the Android tools installed at the moment to verify.

* Update help text / comment to make it more clear what happens if /VSRootDir is NOT set


mkdir build
cd build

cmake -G "Visual Studio 16 2019" ^
	-DCMAKE_BUILD_TYPE=Rel  ^
	-DENABLE_TESTS=OFF ^
	-DNETCDF_PREFIX="%LIBRARY_PREFIX%" ^
	-DHDF5_ROOT="%LIBRARY_PREFIX%" ^
	-DGDAL_DIR="%LIBRARY_PREFIX%" ^
	-DGDAL_LIBRARY="%LIBRARY_PREFIX%\lib\gdal_i.lib" ^
	-DGDAL_INCLUDE_DIR="%LIBRARY_PREFIX%\include" ^
	-DLIBXML2_LIBRARIES="%LIBRARY_PREFIX%\lib\libxml2.lib" ^
	-DLIBXML2_INCLUDE_DIR="%LIBRARY_PREFIX%\include\libxml2" ^
	-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
	-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
	..

cmake --build .

copy /B mdal\Debug\*.dll %LIBRARY_BIN%
copy /B tools\Debug\*.exe %LIBRARY_BIN%

mkdir build
cd build

cmake  ^
	-DCMAKE_BUILD_TYPE=Rel  ^
	-DENABLE_TESTS=OFF ^
	-DNETCDF_PREFIX="%LIBRARY_PREFIX%" ^
	-DHDF5_ROOT="%LIBRARY_PREFIX%" ^
	-DGDAL_DIR="%LIBRARY_PREFIX%" ^
	-DGDAL_LIBRARY="%LIBRARY_PREFIX%\lib\gdal_i.lib" ^
	-DGDAL_INCLUDE_DIR="%LIBRARY_PREFIX%\include" ^
	-DLIBXML2_LIBRARIES="%LIBRARY_PREFIX%\lib\libxml2.lib" ^
	-DLIBXML2_INCLUDE_DIR="%LIBRARY_PREFIX%\include\libxml2" ^
	-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
	-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
	..

cmake --build .

copy /B mdal\Debug\*.dll %LIBRARY_BIN%
copy /B tools\Debug\*.exe %LIBRARY_BIN%

Fix incorrect VS version bug

Fix incorrect VS version bug


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

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

SET BASEFOLDER=C:\Windows\Temp

powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://download.microsoft.com/download/2/5/0/2508F7B4-6DDE-4C3E-B1FA-E1EB66F2F79F/SQLServer2016-SSEI-Dev.exe', '%BASEFOLDER%\SQLServer-SSEI-Dev.exe') }" -ExecutionPolicy Bypass

REM SQLServer-SSEI-Dev.exe /Q /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS

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

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

SET BASEFOLDER=C:\Windows\Temp

powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://download.microsoft.com/download/2/5/0/2508F7B4-6DDE-4C3E-B1FA-E1EB66F2F79F/SQLServer2016-SSEI-Dev.exe', '%BASEFOLDER%\SQLServer-SSEI-Dev.exe') }" -ExecutionPolicy Bypass

%BASEFOLDER%\SQLServer-SSEI-Dev.exe /Q /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS

Update bigfix_setup_root_eval.bat

Update bigfix_setup_root_eval.bat


@echo off

if "%ALIASES%" == "" (
  set ALIASES="%CMDER_ROOT%\config\user_aliases.cmd"
)

setlocal enabledelayedexpansion

if "%~1" == "" echo Use /? for help & echo. & goto :p_show

:: check command usage

rem #region parseargument
goto parseargument

:do_shift
  shift

:parseargument
  set currentarg=%~1

  if /i "%currentarg%" equ "/f" (
    set ALIASES=%~2
    set _f=%~2
    shift
    goto :do_shift
  ) else if /i "%currentarg%" == "/reload" (
    goto :p_reload
  ) else if "%currentarg%" equ "/H" (
    goto :p_help
  ) else if "%currentarg%" equ "/h" (
    goto :p_help
  ) else if "%currentarg%" equ "/?" (
    goto :p_help
  ) else if /i "%currentarg%" equ "/d" (
    if "%~2" neq "" (
      if "%~3" equ "" (
        :: /d flag for delete existing alias
        call :p_del %~2
        shift
        goto :eof
      )
    )
  ) else if "%currentarg%" neq "" (
    if "%~2" equ "" (
      :: Show the specified alias
      doskey /macros | %WINDIR%\System32\findstr /b %currentarg%= && exit /b
      echo insufficient parameters.
      goto :p_help
    ) else (
      :: handle quotes within command definition, e.g. quoted long file names
      set _x=%*
    )
  )

rem #endregion parseargument

if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" (
  set _x=!_x:/f "%ALIASES%" =!

  if not exist "%ALIASES%" (
    echo ;= @echo off>"%ALIASES%"
    echo ;= rem Call DOSKEY and use this file as the macrofile>>"%ALIASES%"
    echo ;= %%SystemRoot%%\system32\doskey /listsize=1000 /macrofile=%%0%%>>"%ALIASES%"
    echo ;= rem In batch mode, jump to the end of the file>>"%ALIASES%"
    echo ;= goto:eof>>"%ALIASES%"
    echo ;= Add aliases below here>>"%ALIASES%"
  )
)

:: validate alias
for /f "delims== tokens=1,* usebackq" %%G in (`echo "!_x!"`) do (
  set alias_name=%%G
  set alias_value=%%H
)

:: leading quotes added while validating
set alias_name=!alias_name:~1!

:: trailing quotes added while validating
set alias_value=!alias_value:~0,-1!

::remove spaces
set _temp=%alias_name: =%

if not ["%_temp%"] == ["%alias_name%"] (
  echo Your alias name can not contain a space
  endlocal
  exit /b
)

:: replace already defined alias
%WINDIR%\System32\findstr /b /v /i "%alias_name%=" "%ALIASES%" >> "%ALIASES%.tmp"
echo %alias_name%=%alias_value% >> "%ALIASES%.tmp" && type "%ALIASES%.tmp" > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
doskey /macrofile="%ALIASES%"
endlocal
exit /b

:p_del
set del_alias=%~1
%WINDIR%\System32\findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp"
type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
doskey %del_alias%=
doskey /macrofile="%ALIASES%"
goto:eof

:p_reload
doskey /macrofile="%ALIASES%"
echo Aliases reloaded
exit /b

:p_show
doskey /macros|%WINDIR%\System32\findstr /v /r "^;=" | sort
exit /b

:p_help
echo.Usage:
echo.
echo.  alias [options] [alias=alias command]
echo.
echo.Options:
echo.
echo.  Note: Options MUST precede the alias definition.
echo.
echo.  /d [alias]     Delete an [alias].
echo.  /f [macrofile] Path to the [macrofile] you want to store the new alias in.
echo.                 Default: %cmder_root%\config\user_aliases.cmd
echo.  /reload        Reload the aliases file.  Can be used with /f argument.
echo.                 Default: %cmder_root%\config\user_aliases.cmd
echo.
echo. If alias is called with no parameters, it will display the list of existing
echo. aliases.
echo.
echo. In the alias command, you can use the following notations:
echo.
echo. ^^^^^^^^%% - %% signs in env vars must be escaped if preserving the variable
echo.         in he alias is desired. Variables in aliases surrounded by double
echo.         quotes only require '^^%%' vs '^^^^^^^^%%'
echo. $*    - allows the alias to assume all the parameters of the supplied
echo.         command.
echo. $1-$9 - Allows you to seperate parameter by number, much like %%1 in
echo.         batch.
echo. $T    - Command seperator, allowing you to string several commands
echo.         together into one alias.
echo.
echo. For more information, read DOSKEY /?
exit /b

@echo off

if "%ALIASES%" == "" (
  set ALIASES="%CMDER_ROOT%\config\user_aliases.cmd"
)

setlocal enabledelayedexpansion

if "%~1" == "" echo Use /? for help & echo. & goto :p_show

:: check command usage

rem #region parseargument
goto parseargument

:do_shift
  shift

:parseargument
  set currentarg=%~1

  if /i "%currentarg%" equ "/f" (
    set ALIASES=%~2
    set _f=%~2
    shift
    goto :do_shift
  ) else if /i "%currentarg%" == "/reload" (
    goto :p_reload
  ) else if "%currentarg%" equ "/H" (
    goto :p_help
  ) else if "%currentarg%" equ "/h" (
    goto :p_help
  ) else if "%currentarg%" equ "/?" (
    goto :p_help
  ) else if /i "%currentarg%" equ "/d" (
    if "%~2" neq "" (
      if "%~3" equ "" (
        :: /d flag for delete existing alias
        call :p_del %~2
        shift
        goto :eof
      )
    )
  ) else if "%currentarg%" neq "" (
    if "%~2" equ "" (
      :: Show the specified alias
      doskey /macros | %WINDIR%\System32\findstr /b %currentarg%= && exit /b
      echo insufficient parameters.
      goto :p_help
    ) else (
      :: handle quotes within command definition, e.g. quoted long file names
      set _x=%*
    )
  )

rem #endregion parseargument

if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" (
  set _x=!_x:/f "%ALIASES%" =!

  if not exist "%ALIASES%" (
    echo ;= @echo off>"%ALIASES%"
    echo ;= rem Call DOSKEY and use this file as the macrofile>>"%ALIASES%"
    echo ;= %%SystemRoot%%\system32\doskey /listsize=1000 /macrofile=%%0%%>>"%ALIASES%"
    echo ;= rem In batch mode, jump to the end of the file>>"%ALIASES%"
    echo ;= goto:eof>>"%ALIASES%"
    echo ;= Add aliases below here>>"%ALIASES%"
  )
)

:: validate alias
for /f "delims== tokens=1,* usebackq" %%G in (`echo "!_x!"`) do (
  set alias_name=%%G
  set alias_value=%%H
)

:: leading quotes added while validating
set alias_name=!alias_name:~1!

:: trailing quotes added while validating
set alias_value=!alias_value:~0,-1!

:: '.' escaped
set alias_name_esc=!alias_name:.=\.!

::remove spaces
set _temp=%alias_name: =%

if not ["%_temp%"] == ["%alias_name%"] (
  echo Your alias name can not contain a space
  endlocal
  exit /b
)

:: replace already defined alias
%WINDIR%\System32\findstr /v /i "^%alias_name_esc%=" "%ALIASES%" >> "%ALIASES%.tmp"
echo %alias_name%=%alias_value% >> "%ALIASES%.tmp" && type "%ALIASES%.tmp" > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
doskey /macrofile="%ALIASES%"
endlocal
exit /b

:p_del
set del_alias=%~1

:: '.' escaped
set del_alias_esc=!del_alias:.=\.!

%WINDIR%\System32\findstr /v /i "^%del_alias_esc%=" "%ALIASES%" >> "%ALIASES%.tmp"
type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
doskey %del_alias%=
doskey /macrofile="%ALIASES%"
goto:eof

:p_reload
doskey /macrofile="%ALIASES%"
echo Aliases reloaded
exit /b

:p_show
doskey /macros|%WINDIR%\System32\findstr /v /r "^;=" | sort
exit /b

:p_help
echo.Usage:
echo.
echo.  alias [options] [alias=alias command]
echo.
echo.Options:
echo.
echo.  Note: Options MUST precede the alias definition.
echo.
echo.  /d [alias]     Delete an [alias].
echo.  /f [macrofile] Path to the [macrofile] you want to store the new alias in.
echo.                 Default: %cmder_root%\config\user_aliases.cmd
echo.  /reload        Reload the aliases file.  Can be used with /f argument.
echo.                 Default: %cmder_root%\config\user_aliases.cmd
echo.
echo. If alias is called with no parameters, it will display the list of existing
echo. aliases.
echo.
echo. In the alias command, you can use the following notations:
echo.
echo. ^^^^^^^^%% - %% signs in env vars must be escaped if preserving the variable
echo.         in he alias is desired. Variables in aliases surrounded by double
echo.         quotes only require '^^%%' vs '^^^^^^^^%%'
echo. $*    - allows the alias to assume all the parameters of the supplied
echo.         command.
echo. $1-$9 - Allows you to seperate parameter by number, much like %%1 in
echo.         batch.
echo. $T    - Command seperator, allowing you to string several commands
echo.         together into one alias.
echo.
echo. For more information, read DOSKEY /?
exit /b

fix 'alias ..=cd ..' removing 2 char aliases


dotnet restore -r win10-x64 & dotnet publish -r win10-x64
dotnet restore -r ubuntu.16.04-x64 & dotnet publish -r ubuntu.16.04-x64

Add publish script for Infinni.Demo

Add publish script for Infinni.Demo


mkdir build && cd build

set PKG_CONFIG_PATH=%LIBRARY_LIB%

cmake -LAH -G "NMake Makefiles" ^
  -DCMAKE_INSTALL_PREFIX:PATH=%LIBRARY_PREFIX% ^
  -DCMAKE_PREFIX_PATH:PATH="%LIBRARY_PREFIX%" ^
  -DCMAKE_BUILD_TYPE=Release ^
  %SRC_DIR%\src
if errorlevel 1 exit 1

cmake --build . --target install --config Release
if errorlevel 1 exit 1

mkdir build && cd build

set PKG_CONFIG_PATH=%LIBRARY_LIB%\pkgconfig

cmake -LAH -G "NMake Makefiles" ^
  -DCMAKE_INSTALL_PREFIX:PATH=%LIBRARY_PREFIX% ^
  -DCMAKE_PREFIX_PATH:PATH="%LIBRARY_PREFIX%" ^
  -DCMAKE_BUILD_TYPE=Release ^
  %SRC_DIR%\src
if errorlevel 1 exit 1

cmake --build . --target install --config Release
if errorlevel 1 exit 1

append pkgconfig to LIBRARY_LIB for PKG_CONFIG_PATH