@echo off

set PYTHON_VERSION=2.7.6
set PYTHON_MSI=python-%PYTHON_VERSION%.msi
set PYTHON_EXE=c:\Python27\python.exe
set PYTHON_PATH=c:\Python27;c:\Python27\Scripts

echo,
echo ------------------------------------------------------------------
echo Download Python
echo ------------------------------------------------------------------
echo,

if not exist %PYTHON_EXE% (
if not exist %PYTHON_MSI% (
    curl -L -O http://python.org/ftp/python/%PYTHON_VERSION%/%PYTHON_MSI%
)
)

echo,
echo ------------------------------------------------------------------
echo Install Python
echo ------------------------------------------------------------------
echo,

if not exist %PYTHON_EXE% (
if exist %PYTHON_MSI% (
    msiexec.exe /qb /i %PYTHON_MSI% ALLUSERS=1 ADDLOCAL=ALL
) else (
    echo Python installer package didn't seem to download correctly.
    exit /b 1
)
)

echo,
echo ------------------------------------------------------------------
echo Add Python to PATH
echo ------------------------------------------------------------------
echo,

rem Add the PYTHON_PATH to the PATH environment variable.

rem reg add "HKCU\Environment" /v PATH /t REG_EXPAND_SZ /d "%PYTHON_PATH%"
rem reg add "HKLM\SYSTEM\ControlSet001\Control\Session Manager\Environment" /v PATH /t REG_EXPAND_SZ /d "%PATH%;c:\Python27;c:\Python27\Scripts"
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /f /v PATH /t REG_EXPAND_SZ /d "%PATH%;%PYTHON_PATH%"

rem Set LOCALAPPDATA to APPDATA, otherwise distlib will throw errors.
rem See: https://vilimpoc.org/blog/2014/01/18/time-robbing-python-errors/

reg add "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" /f /v LOCALAPPDATA /t REG_EXPAND_SZ /d "%%APPDATA%%"

rem Temporarily set LOCALAPPDATA.
set LOCALAPPDATA=%APPDATA%

rem Temporarily set the path, so we can use the python command.
set PATH=%PATH%;%PYTHON_PATH%

echo,
echo ------------------------------------------------------------------
echo Add easy_install
echo ------------------------------------------------------------------
echo,

curl -O https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
python ez_setup.py

echo,
echo ------------------------------------------------------------------
echo Add pip
echo ------------------------------------------------------------------
echo,

curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python get-pip.py

echo,
echo ------------------------------------------------------------------
echo Add virtualenv
echo ------------------------------------------------------------------
echo,

pip install virtualenv

echo,
echo ------------------------------------------------------------------
echo Python %PYTHON_VERSION%, easy_install, pip, and virtualenv are
echo now installed!
echo ------------------------------------------------------------------
echo,

Add LOCALAPPDATA to Environment.

Add LOCALAPPDATA to Environment.


@echo off

rem
rem Universal installation script for CK
rem
rem See CK LICENSE.txt for licensing details.
rem See CK Copyright.txt for copyright details.
rem
rem Developer(s): Grigori Fursin, 2016-2017
rem

rem PACKAGE_DIR
rem INSTALL_DIR

cd /D %INSTALL_DIR%

rem set > %PACKAGE_DIR%\xyz
rem exit /b 1

rem ############################################################
set PF=%PACKAGE_URL%/%PACKAGE_NAME%

if "%PACKAGE_WGET%" == "YES" (
  echo.
  echo Downloading package from '%PF%' ...

  if EXIST %PF (
    del /Q /S %PF%
  )

  wget --no-check-certificate "%PF%"

  if %errorlevel% neq 0 (
   echo.
   echo Error: Failed downloading package ...
   goto err
  )

  if "%PACKAGE_RENAME%" == "YES" (
    ren %PACKAGE_NAME2% %PACKAGE_NAME%
  )
)

if "%PACKAGE_GIT%" == "YES" (
  echo.
  echo Cloning package from '%PF%' ...

  if EXIST %PACKAGE_SUB_DIR% (
    rmdir /s /q %PACKAGE_SUB_DIR%
    rmdir %PACKAGE_SUB_DIR%
  )

  git clone %PACKAGE_URL% %PACKAGE_SUB_DIR%

  if %errorlevel% neq 0 (
   echo.
   echo Error: Failed cloning package ...
   goto err
  )
)

rem ############################################################
if "%PACKAGE_UNGZIP%" == "YES" (
  echo.
  echo Ungzipping archive ...

  if EXIST %PACKAGE_NAME1% (
    del /Q /S %PACKAGE_NAME1%
  )

  gzip -d %PACKAGE_NAME%

  if %errorlevel% neq 0 (
   echo.
   echo Error: ungzipping package failed!
   goto err
  )
)

rem ############################################################
if "%PACKAGE_UNTAR%" == "YES" (
  echo.
  echo Untarring archive ...

  if EXIST %PACKAGE_SUB_DIR% (
    rmdir /s /q %PACKAGE_SUB_DIR%
    rmdir %PACKAGE_SUB_DIR%
  )

  tar xvf %PACKAGE_NAME1%

  if NOT "%PACKAGE_UNTAR_SKIP_ERROR_WIN%" == "YES" (
    if %errorlevel% neq 0 (
      echo.
      echo Error: untaring package failed!
      goto err
    )
  )
)

rem ############################################################
if "%PACKAGE_COPY%" == "YES" (
  if EXIST %ORIGINAL_PACKAGE_DIR%\copy (
    echo.
    echo Copying extra files to source dir ...

    xcopy /E %ORIGINAL_PACKAGE_DIR%\copy\* %INSTALL_DIR%\%PACKAGE_SUB_DIR1%
  )

  if EXIST %ORIGINAL_PACKAGE_DIR%\copy.%CK_TARGET_OS_ID% (
    echo.
    echo Copying extra files for %CK_TARGET_OS_ID% to source dir ...

    xcopy /E %ORIGINAL_PACKAGE_DIR%\copy.%CK_TARGET_OS_ID%\* %INSTALL_DIR%\%PACKAGE_SUB_DIR1%
  )
)

rem ############################################################
if "%PACKAGE_PATCH%" == "YES" (
  if EXIST %ORIGINAL_PACKAGE_DIR%\patch.%CK_TARGET_OS_ID% (
    echo.
    echo patching source dir ...

    cd /D %INSTALL_DIR%\%PACKAGE_SUB_DIR%

    for /r %ORIGINAL_PACKAGE_DIR%\patch.%CK_TARGET_OS_ID% %%i in (*) do (
      echo %%~fi
      patch -p1 < %%~fi

rem      if %errorlevel% neq 0 (
rem        echo.
rem        echo Error: patching failed!
rem        goto err
      )
    )
  )
)

rem ############################################################
echo.
echo Configuring ...

cd /D %INSTALL_DIR%

if EXIST install (
  rmdir /s /q install
  rmdir install
)

if EXIST obj (
  rmdir /s /q obj
  rmdir obj
)
mkdir obj

cd /D %INSTALL_DIR%/obj

cmake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\install" ^
      -DCMAKE_BUILD_TYPE:STRING=%CMAKE_CONFIG% ^
      %PACKAGE_CONFIGURE_FLAGS% ^
      -DCMAKE_C_COMPILER="%CK_CC_PATH_FOR_CMAKE%" ^
      -DCMAKE_C_FLAGS="%CK_CC_FLAGS_FOR_CMAKE% %CK_CC_FLAGS_ANDROID_TYPICAL%" ^
      -DCMAKE_CXX_COMPILER="%CK_CXX_PATH_FOR_CMAKE%" ^
      -DCMAKE_CXX_FLAGS="%CK_CXX_FLAGS_FOR_CMAKE% %CK_CXX_FLAGS_ANDROID_TYPICAL%" ^
      -DCMAKE_AR="%CK_AR_PATH_FOR_CMAKE%" ^
      -DCMAKE_LINKER="%CK_LD_PATH_FOR_CMAKE%" ^
      -DCMAKE_EXE_LINKER_FLAGS="%CK_LINKER_FLAGS_ANDROID_TYPICAL%" ^
      -DCMAKE_EXE_LINKER_LIBS="%CK_LINKER_LIBS_ANDROID_TYPICAL%" ^
      %CK_CMAKE_EXTRA% ^
      %INSTALL_DIR%\%PACKAGE_SUB_DIR1%

echo **************************************************************
echo.
echo Building using Visual Studio ...

cmake --build . --config %CMAKE_CONFIG% --target install
if %errorlevel% neq 0 (
 echo.
 echo Problem building CK package!
 goto err
)

exit /b 0

:err
exit /b 1

@echo off

rem
rem Universal installation script for CK
rem
rem See CK LICENSE.txt for licensing details.
rem See CK Copyright.txt for copyright details.
rem
rem Developer(s): Grigori Fursin, 2016-2017
rem

rem PACKAGE_DIR
rem INSTALL_DIR

cd /D %INSTALL_DIR%

rem set > %PACKAGE_DIR%\xyz
rem exit /b 1

rem ############################################################
set PF=%PACKAGE_URL%/%PACKAGE_NAME%

if "%PACKAGE_WGET%" == "YES" (
  echo.
  echo Downloading package from '%PF%' ...

  if EXIST "%PF" (
    del /Q /S %PF%
  )

  wget --no-check-certificate "%PF%"

  if %errorlevel% neq 0 (
   echo.
   echo Error: Failed downloading package ...
   goto err
  )

  if "%PACKAGE_RENAME%" == "YES" (
    ren %PACKAGE_NAME2% %PACKAGE_NAME%
  )
)

if "%PACKAGE_GIT%" == "YES" (
  echo.
  echo Cloning package from '%PF%' ...

  if EXIST "%PACKAGE_SUB_DIR%" (
    rmdir /s /q %PACKAGE_SUB_DIR%
    rmdir %PACKAGE_SUB_DIR%
  )

  git clone %PACKAGE_URL% %PACKAGE_SUB_DIR%

  if %errorlevel% neq 0 (
   echo.
   echo Error: Failed cloning package ...
   goto err
  )
)

rem ############################################################
echo "%PACKAGE_NAME1%"
if "%PACKAGE_UNGZIP%" == "YES" (
  echo.
  echo Ungzipping archive ...

  if EXIST "%PACKAGE_NAME1%" (
    del /Q /S %PACKAGE_NAME1%
  )

  gzip -d %PACKAGE_NAME%

  if %errorlevel% neq 0 (
   echo.
   echo Error: ungzipping package failed!
   goto err
  )
)

rem ############################################################
if "%PACKAGE_UNTAR%" == "YES" (
  echo.
  echo Untarring archive ...

  if EXIST "%PACKAGE_SUB_DIR%" (
    rmdir /s /q %PACKAGE_SUB_DIR%
    rmdir %PACKAGE_SUB_DIR%
  )

  tar xvf %PACKAGE_NAME1%

  if NOT "%PACKAGE_UNTAR_SKIP_ERROR_WIN%" == "YES" (
    if %errorlevel% neq 0 (
      echo.
      echo Error: untaring package failed!
      goto err
    )
  )
)

rem ############################################################
if "%PACKAGE_COPY%" == "YES" (
echo "2"
  if EXIST "%ORIGINAL_PACKAGE_DIR%\copy" (
    echo.
    echo Copying extra files to source dir ...

    xcopy /E %ORIGINAL_PACKAGE_DIR%\copy\* %INSTALL_DIR%\%PACKAGE_SUB_DIR1%
  )

  if EXIST "%ORIGINAL_PACKAGE_DIR%\copy.%CK_TARGET_OS_ID%" (
    echo.
    echo Copying extra files for %CK_TARGET_OS_ID% to source dir ...

    xcopy /E %ORIGINAL_PACKAGE_DIR%\copy.%CK_TARGET_OS_ID%\* %INSTALL_DIR%\%PACKAGE_SUB_DIR1%
  )
)

rem ############################################################
if "%PACKAGE_PATCH%" == "YES" (
  if EXIST "%ORIGINAL_PACKAGE_DIR%\patch.%CK_TARGET_OS_ID%" (
    echo.
    echo patching source dir ...

    cd /D %INSTALL_DIR%\%PACKAGE_SUB_DIR%

    for /r %ORIGINAL_PACKAGE_DIR%\patch.%CK_TARGET_OS_ID% %%i in (*) do (
      echo %%~fi
      patch -p1 < %%~fi

rem      if %errorlevel% neq 0 (
rem        echo.
rem        echo Error: patching failed!
rem        goto err
      )
    )
  )
)

rem ############################################################
echo.
echo Configuring ...

cd /D %INSTALL_DIR%

if EXIST install (
  rmdir /s /q install
  rmdir install
)

if EXIST obj (
  rmdir /s /q obj
  rmdir obj
)
mkdir obj

cd /D %INSTALL_DIR%/obj

cmake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\install" ^
      -DCMAKE_BUILD_TYPE:STRING=%CMAKE_CONFIG% ^
      %PACKAGE_CONFIGURE_FLAGS% ^
      -DCMAKE_C_COMPILER="%CK_CC_PATH_FOR_CMAKE%" ^
      -DCMAKE_C_FLAGS="%CK_CC_FLAGS_FOR_CMAKE% %CK_CC_FLAGS_ANDROID_TYPICAL%" ^
      -DCMAKE_CXX_COMPILER="%CK_CXX_PATH_FOR_CMAKE%" ^
      -DCMAKE_CXX_FLAGS="%CK_CXX_FLAGS_FOR_CMAKE% %CK_CXX_FLAGS_ANDROID_TYPICAL%" ^
      -DCMAKE_AR="%CK_AR_PATH_FOR_CMAKE%" ^
      -DCMAKE_LINKER="%CK_LD_PATH_FOR_CMAKE%" ^
      -DCMAKE_EXE_LINKER_FLAGS="%CK_LINKER_FLAGS_ANDROID_TYPICAL%" ^
      -DCMAKE_EXE_LINKER_LIBS="%CK_LINKER_LIBS_ANDROID_TYPICAL%" ^
      %CK_CMAKE_EXTRA% ^
      %INSTALL_DIR%\%PACKAGE_SUB_DIR1%

echo **************************************************************
echo.
echo Building using Visual Studio ...

cmake --build . --config %CMAKE_CONFIG% --target install
if %errorlevel% neq 0 (
 echo.
 echo Problem building CK package!
 goto err
)

exit /b 0

:err
exit /b 1

clean up

clean up


@if defined ELIXIR_CLI_ECHO (@echo on) else (@echo off)
setlocal enabledelayedexpansion
if    ""%1""==""""       goto documentation
if /I ""%1""==""--help"" goto documentation
if /I ""%1""==""-h""     goto documentation
if /I ""%1""==""/h""     goto documentation
if    ""%1""==""/?""     goto documentation
goto parseopts

:documentation
echo Usage: %~nx0 [options] [.exs file] [data]
echo.
echo ## General options
echo.
echo   -e "COMMAND"                 Evaluates the given command (*)
echo   -h, --help                   Prints this message and exits
echo   -r "FILE"                    Requires the given files/patterns (*)
echo   -S SCRIPT                    Finds and executes the given script in $PATH
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   -v, --version                Prints Elixir version and exits
echo.
echo   --app APP                    Starts the given app and its dependencies (*)
echo   --erl "SWITCHES"             Switches to be passed down to Erlang (*)
echo   --eval "COMMAND"             Evaluates the given command, same as -e (*)
echo   --logger-otp-reports BOOL    Enables or disables OTP reporting
echo   --logger-sasl-reports BOOL   Enables or disables SASL reporting
echo   --no-halt                    Does not halt the Erlang VM after execution
echo   --werl                       Uses Erlang's Windows shell GUI (Windows only)
echo.
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_OPTIONS or --erl.
echo.
echo ## Distribution options
echo.
echo The following options are related to node distribution.
echo.
echo   --cookie COOKIE              Sets a cookie for this distributed node
echo   --hidden                     Makes a hidden node
echo   --name NAME                  Makes and assigns a name to the distributed node
echo   --rpc-eval NODE "COMMAND"    Evaluates the given command on the given remote node (*)
echo   --sname NAME                 Makes and assigns a short name to the distributed node
echo.
echo ## Release options
echo.
echo The following options are generally used under releases.
echo.
echo   --boot "FILE"                Uses the given FILE.boot to start the system
echo   --boot-var VAR "VALUE"       Makes $VAR available as VALUE to FILE.boot (*)
echo   --erl-config "FILE"          Loads configuration in FILE.config written in Erlang (*)
echo   --vm-args "FILE"             Passes the contents in file as arguments to the VM
echo.
echo --pipe-to is not supported on Windows. If set, Elixir won't boot.
echo.
echo ** Options marked with (*) can be given more than once.
goto end

:parseopts

rem Parameters for Elixir
set parsElixir=

rem Parameters for Erlang
set parsErlang=

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

rem Option which determines whether the loop is over
set endLoop=0

rem Designates which mode / Elixir component to run as
set runMode="elixir"

rem Designates the path to the current script
set SCRIPT_PATH=%~dp0

rem Designates the path to the ERTS system
set ERTS_BIN=

rem Recursive loop called for each parameter that parses the cmd line parameters
:startloop
set "par=%~1"
if "!par!"=="" (
  rem skip if no parameter
  goto expand_erl_libs
)
shift
set par="!par:"=\"!"
if !endLoop! == 1 (
  set parsElixir=!parsElixir! !par!
  goto startloop
)
rem ******* EXECUTION OPTIONS **********************
if !par!=="--werl"   (set useWerl=1 && goto startloop)
if !par!=="+iex"     (set parsElixir=!parsElixir! +iex && set runMode="iex" && goto startloop)
if !par!=="+elixirc" (set parsElixir=!parsElixir! +elixirc && set runMode="elixirc" && goto startloop)
rem ******* EVAL PARAMETERS ************************
if ""==!par:-e=! (
  set "VAR=%~1"
  set parsElixir=!parsElixir! -e "!VAR:"=\"!"
  shift
  goto startloop
)
if ""==!par:--eval=! (
  set "VAR=%~1"
  set parsElixir=!parsElixir! --eval "!VAR:"=\"!"
  shift
  goto startloop
)
if ""==!par:--rpc-eval=! (
  set "VAR=%~2"
  set parsElixir=!parsElixir! --rpc-eval %1 "!VAR:"=\"!"
  shift
  shift
  goto startloop
)
rem ******* ELIXIR PARAMETERS **********************
if ""==!par:-r=!          (set parsElixir=!parsElixir! -r %1 && shift && goto startloop)
if ""==!par:-pr=!         (set parsElixir=!parsElixir! -pr %1 && shift && goto startloop)
if ""==!par:-pa=!         (set parsElixir=!parsElixir! -pa %1 && shift && goto startloop)
if ""==!par:-pz=!         (set parsElixir=!parsElixir! -pz %1 && shift && goto startloop)
if ""==!par:-v=!          (set parsElixir=!parsElixir! -v && goto startloop)
if ""==!par:--app=!       (set parsElixir=!parsElixir! --app %1 && shift && goto startloop)
if ""==!par:--no-halt=!   (set parsElixir=!parsElixir! --no-halt && goto startloop)
if ""==!par:--remsh=!     (set parsElixir=!parsElixir! --remsh %1 && shift && goto startloop)
if ""==!par:--dot-iex=!   (set parsElixir=!parsElixir! --dot-iex %1 && shift && goto startloop)
rem ******* ERLANG PARAMETERS **********************
if ""==!par:--boot=!                (set parsErlang=!parsErlang! -boot %1 && shift && goto startloop)
if ""==!par:--boot-var=!            (set parsErlang=!parsErlang! -boot_var %1 %2 && shift && shift && goto startloop)
if ""==!par:--cookie=!              (set parsErlang=!parsErlang! -setcookie %1 && shift && goto startloop)
if ""==!par:--hidden=!              (set parsErlang=!parsErlang! -hidden && goto startloop)
if ""==!par:--detached=!            (set parsErlang=!parsErlang! -detached && echo warning: the --detached option is deprecated && goto startloop)
if ""==!par:--erl-config=!          (set parsErlang=!parsErlang! -config %1 && shift && goto startloop)
if ""==!par:--logger-otp-reports=!  (set parsErlang=!parsErlang! -logger handle_otp_reports %1 && shift && goto startloop)
if ""==!par:--logger-sasl-reports=! (set parsErlang=!parsErlang! -logger handle_sasl_reports %1 && shift && goto startloop)
if ""==!par:--name=!                (set parsErlang=!parsErlang! -name %1 && shift && goto startloop)
if ""==!par:--sname=!               (set parsErlang=!parsErlang! -sname %1 && shift && goto startloop)
if ""==!par:--vm-args=!             (set parsErlang=!parsErlang! -args_file %1 && shift && goto startloop)
if ""==!par:--erl=!                 (set "beforeExtra=!beforeExtra! %~1" && shift && goto startloop)
if ""==!par:--pipe-to=!             (echo --pipe-to : Option is not supported on Windows && goto end)
set endLoop=1
set parsElixir=!parsElixir! !par!
goto startloop

:expand_erl_libs
rem expand all ebin paths as Windows does not support the ..\*\ebin wildcard
set ext_libs=
for  /d %%d in ("!SCRIPT_PATH!..\lib\*.") do (
  set ext_libs=!ext_libs! -pa "%%~fd\ebin"
)

:run
if not !runMode! == "iex" (
  set beforeExtra=-noshell -s elixir start_cli !beforeExtra!
)
if defined useWerl (
  start !ERTS_BIN!werl.exe !ext_libs! !ELIXIR_ERL_OPTIONS! !parsErlang! !beforeExtra! -extra !parsElixir!
else (
  !ERTS_BIN!erl.exe !ext_libs! !ELIXIR_ERL_OPTIONS! !parsErlang! !beforeExtra! -extra !parsElixir!
)
:end
endlocal

@if defined ELIXIR_CLI_ECHO (@echo on) else (@echo off)
setlocal enabledelayedexpansion
if    ""%1""==""""       goto documentation
if /I ""%1""==""--help"" goto documentation
if /I ""%1""==""-h""     goto documentation
if /I ""%1""==""/h""     goto documentation
if    ""%1""==""/?""     goto documentation
goto parseopts

:documentation
echo Usage: %~nx0 [options] [.exs file] [data]
echo.
echo ## General options
echo.
echo   -e "COMMAND"                 Evaluates the given command (*)
echo   -h, --help                   Prints this message and exits
echo   -r "FILE"                    Requires the given files/patterns (*)
echo   -S SCRIPT                    Finds and executes the given script in $PATH
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   -v, --version                Prints Elixir version and exits
echo.
echo   --app APP                    Starts the given app and its dependencies (*)
echo   --erl "SWITCHES"             Switches to be passed down to Erlang (*)
echo   --eval "COMMAND"             Evaluates the given command, same as -e (*)
echo   --logger-otp-reports BOOL    Enables or disables OTP reporting
echo   --logger-sasl-reports BOOL   Enables or disables SASL reporting
echo   --no-halt                    Does not halt the Erlang VM after execution
echo   --werl                       Uses Erlang's Windows shell GUI (Windows only)
echo.
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_OPTIONS or --erl.
echo.
echo ## Distribution options
echo.
echo The following options are related to node distribution.
echo.
echo   --cookie COOKIE              Sets a cookie for this distributed node
echo   --hidden                     Makes a hidden node
echo   --name NAME                  Makes and assigns a name to the distributed node
echo   --rpc-eval NODE "COMMAND"    Evaluates the given command on the given remote node (*)
echo   --sname NAME                 Makes and assigns a short name to the distributed node
echo.
echo ## Release options
echo.
echo The following options are generally used under releases.
echo.
echo   --boot "FILE"                Uses the given FILE.boot to start the system
echo   --boot-var VAR "VALUE"       Makes $VAR available as VALUE to FILE.boot (*)
echo   --erl-config "FILE"          Loads configuration in FILE.config written in Erlang (*)
echo   --vm-args "FILE"             Passes the contents in file as arguments to the VM
echo.
echo --pipe-to is not supported on Windows. If set, Elixir won't boot.
echo.
echo ** Options marked with (*) can be given more than once.
goto end

:parseopts

rem Parameters for Elixir
set parsElixir=

rem Parameters for Erlang
set parsErlang=

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

rem Option which determines whether the loop is over
set endLoop=0

rem Designates which mode / Elixir component to run as
set runMode="elixir"

rem Designates the path to the current script
set SCRIPT_PATH=%~dp0

rem Designates the path to the ERTS system
set ERTS_BIN=

rem Recursive loop called for each parameter that parses the cmd line parameters
:startloop
set "par=%~1"
if "!par!"=="" (
  rem skip if no parameter
  goto expand_erl_libs
)
shift
set par="!par:"=\"!"
if !endLoop! == 1 (
  set parsElixir=!parsElixir! !par!
  goto startloop
)
rem ******* EXECUTION OPTIONS **********************
if !par!=="--werl"   (set useWerl=1 && goto startloop)
if !par!=="+iex"     (set parsElixir=!parsElixir! +iex && set runMode="iex" && goto startloop)
if !par!=="+elixirc" (set parsElixir=!parsElixir! +elixirc && set runMode="elixirc" && goto startloop)
rem ******* EVAL PARAMETERS ************************
if ""==!par:-e=! (
  set "VAR=%~1"
  set parsElixir=!parsElixir! -e "!VAR:"=\"!"
  shift
  goto startloop
)
if ""==!par:--eval=! (
  set "VAR=%~1"
  set parsElixir=!parsElixir! --eval "!VAR:"=\"!"
  shift
  goto startloop
)
if ""==!par:--rpc-eval=! (
  set "VAR=%~2"
  set parsElixir=!parsElixir! --rpc-eval %1 "!VAR:"=\"!"
  shift
  shift
  goto startloop
)
rem ******* ELIXIR PARAMETERS **********************
if ""==!par:-r=!          (set parsElixir=!parsElixir! -r %1 && shift && goto startloop)
if ""==!par:-pr=!         (set parsElixir=!parsElixir! -pr %1 && shift && goto startloop)
if ""==!par:-pa=!         (set parsElixir=!parsElixir! -pa %1 && shift && goto startloop)
if ""==!par:-pz=!         (set parsElixir=!parsElixir! -pz %1 && shift && goto startloop)
if ""==!par:-v=!          (set parsElixir=!parsElixir! -v && goto startloop)
if ""==!par:--app=!       (set parsElixir=!parsElixir! --app %1 && shift && goto startloop)
if ""==!par:--no-halt=!   (set parsElixir=!parsElixir! --no-halt && goto startloop)
if ""==!par:--remsh=!     (set parsElixir=!parsElixir! --remsh %1 && shift && goto startloop)
if ""==!par:--dot-iex=!   (set parsElixir=!parsElixir! --dot-iex %1 && shift && goto startloop)
rem ******* ERLANG PARAMETERS **********************
if ""==!par:--boot=!                (set parsErlang=!parsErlang! -boot %1 && shift && goto startloop)
if ""==!par:--boot-var=!            (set parsErlang=!parsErlang! -boot_var %1 %2 && shift && shift && goto startloop)
if ""==!par:--cookie=!              (set parsErlang=!parsErlang! -setcookie %1 && shift && goto startloop)
if ""==!par:--hidden=!              (set parsErlang=!parsErlang! -hidden && goto startloop)
if ""==!par:--detached=!            (set parsErlang=!parsErlang! -detached && echo warning: the --detached option is deprecated && goto startloop)
if ""==!par:--erl-config=!          (set parsErlang=!parsErlang! -config %1 && shift && goto startloop)
if ""==!par:--logger-otp-reports=!  (set parsErlang=!parsErlang! -logger handle_otp_reports %1 && shift && goto startloop)
if ""==!par:--logger-sasl-reports=! (set parsErlang=!parsErlang! -logger handle_sasl_reports %1 && shift && goto startloop)
if ""==!par:--name=!                (set parsErlang=!parsErlang! -name %1 && shift && goto startloop)
if ""==!par:--sname=!               (set parsErlang=!parsErlang! -sname %1 && shift && goto startloop)
if ""==!par:--vm-args=!             (set parsErlang=!parsErlang! -args_file %1 && shift && goto startloop)
if ""==!par:--erl=!                 (set "beforeExtra=!beforeExtra! %~1" && shift && goto startloop)
if ""==!par:--pipe-to=!             (echo --pipe-to : Option is not supported on Windows && goto end)
set endLoop=1
set parsElixir=!parsElixir! !par!
goto startloop

:expand_erl_libs
rem expand all ebin paths as Windows does not support the ..\*\ebin wildcard
set ext_libs=
for  /d %%d in ("!SCRIPT_PATH!..\lib\*.") do (
  set ext_libs=!ext_libs! -pa "%%~fd\ebin"
)

:run
if not !runMode! == "iex" (
  set beforeExtra=-noshell -s elixir start_cli !beforeExtra!
)
if defined useWerl (
  start !ERTS_BIN!werl.exe !ext_libs! !ELIXIR_ERL_OPTIONS! !parsErlang! !beforeExtra! -extra !parsElixir!
) else (
  !ERTS_BIN!erl.exe !ext_libs! !ELIXIR_ERL_OPTIONS! !parsErlang! !beforeExtra! -extra !parsElixir!
)
:end
endlocal

Add missing parens to elixir.bat

Add missing parens to elixir.bat


@REM
@REM Retrieve and validate command line arguments
@REM

@set EVENT_LOC=%1

@set PTHREAD_LOC=%2

@set BLD_TYPE="%3"

@if %EVENT_LOC% == "" (
@echo "Usage: build.bat <pathname for libevent> <pathname for pthread> DEBUG|RELEASE"
@goto end
)

@if %PTHREAD_LOC% == "" (
@echo "Usage: build.bat <pathname for libevent> <pathname for pthread> DEBUG|RELEASE"
@goto end
)

@if /i %BLD_TYPE% NEQ "DEBUG" (
@if /i %BLD_TYPE% NEQ "RELEASE" (
@echo "Usage: build.bat <pathname for libevent> <pathname for pthread> DEBUG|RELEASE"
@goto end
)
)

@cd %BLD_TYPE%
@if not exist t mkdir t
@cd t
@erase *.t *.save
@if not exist lib mkdir lib
@copy /Y ..\..\..\..\t\win32\lib\MemcachedTest.pm .\lib
@copy /Y ..\..\..\..\t\*.t .
@copy /Y ..\..\..\..\t\win32\*.t .
@rename unixsocket.t unixsocket.save
@rename daemonize.t daemonize.save

@REM
@REM Perform the chosen build and run tests
@REM

@set PATH=%PTHREAD_LOC%;%PATH%
@cd ..\
@mingw32-make clean
@mingw32-make EVENT=%EVENT_LOC% PTHREAD=%PTHREAD_LOC% memcached.exe
@if errorlevel 1 goto error_no_BUILD_FAILED
@mingw32-make test
@if errorlevel 1 goto error_no_TEST_FAILED
@cd ..\
@goto end

:error_no_BUILD_FAILED
@echo ERROR: Make with memcached.exe target failed
@goto end

@:error_no_TEST_FAILED
@echo ERROR: Make with test target failed

:end

@REM
@REM Retrieve and validate command line arguments
@REM

@set EVENT_LOC=%1

@set PTHREAD_LOC=%2

@set BLD_TYPE="%3"

@if %EVENT_LOC% == "" (
@echo "Usage: build.bat <pathname for libevent> <pathname for pthread> DEBUG|RELEASE"
@goto end
)

@if %PTHREAD_LOC% == "" (
@echo "Usage: build.bat <pathname for libevent> <pathname for pthread> DEBUG|RELEASE"
@goto end
)

@if /i %BLD_TYPE% NEQ "DEBUG" (
@if /i %BLD_TYPE% NEQ "RELEASE" (
@echo "Usage: build.bat <pathname for libevent> <pathname for pthread> DEBUG|RELEASE"
@goto end
)
)

@mingw32-make -version
@if errorlevel 1 (
@echo "ERROR: mingw32-make not in PATH. Is MingW installed? Exiting..."
@goto end
)

@cd %BLD_TYPE%
@if not exist t mkdir t
@cd t
@erase *.t *.save
@if not exist lib mkdir lib
@copy /Y ..\..\..\..\t\win32\lib\MemcachedTest.pm .\lib
@copy /Y ..\..\..\..\t\*.t .
@copy /Y ..\..\..\..\t\win32\*.t .
@rename unixsocket.t unixsocket.save
@rename daemonize.t daemonize.save

@REM
@REM Perform the chosen build and run tests
@REM

@set PATH=%PTHREAD_LOC%;%PATH%
@cd ..\
@mingw32-make clean
@mingw32-make EVENT=%EVENT_LOC% PTHREAD=%PTHREAD_LOC% memcached.exe
@if errorlevel 1 goto error_no_BUILD_FAILED
@mingw32-make test
@if errorlevel 1 goto error_no_TEST_FAILED
@cd ..\
@goto end

:error_no_BUILD_FAILED
@echo ERROR: Make with memcached.exe target failed
@goto end

@:error_no_TEST_FAILED
@echo ERROR: Make with test target failed

:end

Add check for mingw-make in the PATH.

Add check for mingw-make in the PATH.


@echo off

REM Values to change include VERSION and SUBLOC, both below.

REM The subdirectory to install into
SET SUBLOC="0802"

if NOT "%1"=="" SET VERSION="%1"
if NOT "%1"=="" GOTO GOT_VERSION

REM The full version number of the build in XXXX.XX.XX format
SET VERSION="08.02.0001"

echo.
echo Version not specified - defaulting to %VERSION%
echo.

:GOT_VERSION

echo.
echo Building psqlODBC merge module...

candle -nologo -dVERSION=%VERSION% -dSUBLOC=%SUBLOC% -dPROGRAMFILES="%ProgramFiles%" psqlodbcm.wxs
IF ERRORLEVEL 1 GOTO ERR_HANDLER

light -nologo -out psqlodbc.msm psqlodbcm.wixobj
IF ERRORLEVEL 1 GOTO ERR_HANDLER

echo.
echo Building psqlODBC installer database...

candle -nologo -dVERSION=%VERSION% -dSUBLOC=%SUBLOC% -dPROGRAMFILES="%ProgramFiles%" psqlodbc.wxs
IF ERRORLEVEL 1 GOTO ERR_HANDLER

light -nologo psqlodbc.wixobj
IF ERRORLEVEL 1 GOTO ERR_HANDLER

echo.
echo Done!
GOTO EXIT

:ERR_HANDLER
echo.
echo Aborting build!
GOTO EXIT

:EXIT

@echo off

REM Values to change include VERSION and SUBLOC, both below.

REM The subdirectory to install into
SET SUBLOC="0802"

if NOT "%1"=="" SET VERSION="%1"
if NOT "%1"=="" GOTO GOT_VERSION

REM The full version number of the build in XXXX.XX.XX format
SET VERSION="08.02.0002"

echo.
echo Version not specified - defaulting to %VERSION%
echo.

:GOT_VERSION

echo.
echo Building psqlODBC merge module...

candle -nologo -dVERSION=%VERSION% -dSUBLOC=%SUBLOC% -dPROGRAMFILES="%ProgramFiles%" psqlodbcm.wxs
IF ERRORLEVEL 1 GOTO ERR_HANDLER

light -nologo -out psqlodbc.msm psqlodbcm.wixobj
IF ERRORLEVEL 1 GOTO ERR_HANDLER

echo.
echo Building psqlODBC installer database...

candle -nologo -dVERSION=%VERSION% -dSUBLOC=%SUBLOC% -dPROGRAMFILES="%ProgramFiles%" psqlodbc.wxs
IF ERRORLEVEL 1 GOTO ERR_HANDLER

light -nologo psqlodbc.wixobj
IF ERRORLEVEL 1 GOTO ERR_HANDLER

echo.
echo Done!
GOTO EXIT

:ERR_HANDLER
echo.
echo Aborting build!
GOTO EXIT

:EXIT

Correct version number

Correct version number


mklink %USERPROFILE%\.vimrc %USERPROFILE%\dotfiles\.vimrc
mklink %USERPROFILE%\.gvimrc %USERPROFILE%\dotfiles\.gvimrc
mklink /d %USERPROFILE%\.vim %USERPROFILE%\dotfiles\vim

pause

mklink %USERPROFILE%\.vimrc %USERPROFILE%\dotfiles\.vimrc
mklink %USERPROFILE%\.gvimrc %USERPROFILE%\dotfiles\.gvimrc
mklink /d %USERPROFILE%\vimfiles %USERPROFILE%\dotfiles\.vim

pause

Change .vim directory

Change .vim directory


@echo off

set RALINK_CLI_VER=RA3592-1
set INTEL_CLI_VER=6200-1
set REALTEK_CLI_VER=RT8192-1
set RALINK_PMF_CLI_VER=RA3593-1
set REALTEK_TDLS_CLI_VER=RT8192-1

echo "Install CLI's For STA (INTEL-P2P/RALINK-P2P/REALTEK-P2P/RALINK-PMF/INTEL-6300/INTEL-6200/REALTEK-TDLS)?"
set /p Input=
if /i "%Input%"=="Intel-P2P" (goto Intel-P2P)
if /i "%Input%"=="REALTEK-P2P" (goto Realtek)
if /i "%Input%"=="RALINK-P2P" (goto Ralink-P2P)
if /i "%Input%"=="RALINK-PMF" (goto Ralink-PMF)
if /i "%Input%"=="Intel-6300" (goto Intel-6300)
if /i "%Input%"=="Intel-6200" (goto Intel-6200)
if /i "%Input%"=="REALTEK-TDLS" (goto Realtek-TDLS)
else exit /b

:Intel-P2P
echo Intel-P2P
IF EXIST C:\WFA\CLIs\Intel (
rmdir /S /Q  C:\WFA\CLIs\Intel
mkdir C:\WFA\CLIs\Intel
) ELSE (
mkdir C:\WFA\CLIs\Intel
)
xcopy /S /R /Y Intel-P2P\*.* C:\WFA\CLIs\Intel\
echo WFA_CLI_STA_DEVICE="C:\WFA\CLIs\Intel" > C:\WFA\WFAEndpoint\sigma_settings.txt
netsh wlan show interfaces > C:\WFA\Temp\temp.txt
FOR /F "tokens=2 delims=: " %%i IN ('findstr GUID C:\Wfa\Temp\temp.txt') DO @echo DEVICE={%%i} >> C:\WFA\WfaEndpoint\sigma_settings.txt
echo VERSION=%INTEL_CLI_VER% >> C:\WFA\WfaEndpoint\sigma_settings.txt
goto :EOF

:Intel-6300
echo Intel-6300
IF EXIST C:\WFA\CLIs\Intel (
rmdir /S /Q  C:\WFA\CLIs\Intel
mkdir C:\WFA\CLIs\Intel
) ELSE (
mkdir C:\WFA\CLIs\Intel
)
xcopy /S /R /Y Intel-6300\*.* C:\WFA\CLIs\Intel\
echo WFA_CLI_STA_DEVICE="C:\WFA\CLIs\Intel" > C:\WFA\WFAEndpoint\sigma_settings.txt
echo DEVICE=6300>> C:\WFA\WFAEndpoint\sigma_settings.txt
echo VERSION=%INTEL_CLI_VER% >> C:\WFA\WfaEndpoint\sigma_settings.txt
C:\WFA\CLIs\Intel\RegEditSigma.msi
goto :EOF

:Intel-6200
echo Intel-6200
IF EXIST C:\WFA\CLIs\Intel (
rmdir /S /Q  C:\WFA\CLIs\Intel
mkdir C:\WFA\CLIs\Intel
) ELSE (
mkdir C:\WFA\CLIs\Intel
)
xcopy /S /R /Y Intel-6200\*.* C:\WFA\CLIs\Intel\
echo WFA_CLI_STA_DEVICE="C:\WFA\CLIs\Intel" > C:\WFA\WFAEndpoint\sigma_settings.txt
echo DEVICE=6200>> C:\WFA\WFAEndpoint\sigma_settings.txt
echo VERSION=%INTEL_CLI_VER% >> C:\WFA\WfaEndpoint\sigma_settings.txt
C:\WFA\CLIs\Intel\RegEditSigma.msi
goto :EOF

:Realtek
echo Realtek
IF EXIST C:\WFA\CLIs\Realtek (
rmdir /S /Q  C:\WFA\CLIs\Realtek
mkdir C:\WFA\CLIs\Realtek
) ELSE (
mkdir C:\WFA\CLIs\Realtek
)
xcopy /S /R /Y P2P-Realtek\*.* C:\WFA\CLIs\Realtek\
echo WFA_CLI_STA_DEVICE="C:\WFA\CLIs\Realtek" > C:\WFA\WfaEndpoint\sigma_settings.txt
echo DEVICE=rtl8192s >> C:\WFA\WfaEndpoint\sigma_settings.txt
echo VERSION=%REALTEK_CLI_VER% >> C:\WFA\WfaEndpoint\sigma_settings.txt
goto :EOF

:Realtek-TDLS
echo Realtek-TDLS
IF EXIST C:\WFA\CLIs\Realtek (
rmdir /S /Q  C:\WFA\CLIs\Realtek
mkdir C:\WFA\CLIs\Realtek
) ELSE (
mkdir C:\WFA\CLIs\Realtek
)
xcopy /S /R /Y Realtek-TDLS\*.* C:\WFA\CLIs\Realtek\
echo WFA_CLI_STA_DEVICE="C:\WFA\CLIs\Realtek" > C:\WFA\WfaEndpoint\sigma_settings.txt
echo DEVICE=rtl8192s >> C:\WFA\WfaEndpoint\sigma_settings.txt
echo VERSION=%REALTEK_TDLS_CLI_VER% >> C:\WFA\WfaEndpoint\sigma_settings.txt
xcopy /R /Y Realtek-TDLS\wfa_cli.txt C:\WFA\WfaEndpoint\wfa_cli.txt
goto :EOF

:Ralink-P2P
echo P2P Ralink
IF EXIST C:\WFA\CLIs\Ralink (
rmdir /S /Q  C:\WFA\CLIs\Ralink
mkdir C:\WFA\CLIs\Ralink
) ELSE (
mkdir C:\WFA\CLIs\Ralink
)
xcopy /S /R /Y Ralink-P2P\*.* C:\WFA\CLIs\Ralink\
echo WFA_CLI_STA_DEVICE="C:\WFA\CLIs\Ralink" > C:\WFA\WfaEndpoint\sigma_settings.txt
netsh wlan show interfaces > C:\WFA\Temp\temp.txt
FOR /F "tokens=2 delims=: " %%i IN ('findstr GUID C:\Wfa\Temp\temp.txt') DO @echo DEVICE={%%i} >> C:\WFA\WfaEndpoint\sigma_settings.txt
echo VERSION=%Ralink_CLI_VER% >> C:\WFA\WfaEndpoint\sigma_settings.txt

:Ralink-PMF
echo PMF Ralink
IF EXIST C:\WFA\CLIs\Ralink (
rmdir /S /Q  C:\WFA\CLIs\Ralink
mkdir C:\WFA\CLIs\Ralink
) ELSE (
mkdir C:\WFA\CLIs\Ralink
)
xcopy /S /R /Y Ralink-PMF\*.* C:\WFA\CLIs\Ralink\
echo WFA_CLI_STA_DEVICE="C:\WFA\CLIs\Ralink" > C:\WFA\WfaEndpoint\sigma_settings.txt
netsh wlan show interfaces > C:\WFA\Temp\temp.txt
FOR /F "tokens=2 delims=: " %%i IN ('findstr GUID C:\Wfa\Temp\temp.txt') DO @echo DEVICE={%%i} >> C:\WFA\WfaEndpoint\sigma_settings.txt
echo VERSION=%Ralink_PMF_CLI_VER% >> C:\WFA\WfaEndpoint\sigma_settings.txt

@echo off

set RALINK_CLI_VER=RA3592-1
set INTEL_CLI_VER=6200-1
set REALTEK_CLI_VER=RT8192-1
set RALINK_PMF_CLI_VER=RA3593-1
set REALTEK_TDLS_CLI_VER=RT8192-1

echo "Install CLI's For STA (INTEL-P2P/RALINK-P2P/REALTEK-P2P/RALINK-PMF/INTEL-6300/INTEL-6200/REALTEK-TDLS)?"
set /p Input=
if /i "%Input%"=="Intel-P2P" (goto Intel-P2P)
if /i "%Input%"=="REALTEK-P2P" (goto Realtek)
if /i "%Input%"=="RALINK-P2P" (goto Ralink-P2P)
if /i "%Input%"=="RALINK-PMF" (goto Ralink-PMF)
if /i "%Input%"=="Intel-6300" (goto Intel-6300)
if /i "%Input%"=="Intel-6200" (goto Intel-6200)
if /i "%Input%"=="REALTEK-TDLS" (goto Realtek-TDLS)
else exit /b

:Intel-P2P
echo Intel-P2P
IF EXIST C:\WFA\CLIs\Intel (
rmdir /S /Q  C:\WFA\CLIs\Intel
mkdir C:\WFA\CLIs\Intel
) ELSE (
mkdir C:\WFA\CLIs\Intel
)
xcopy /S /R /Y Intel-P2P\*.* C:\WFA\CLIs\Intel\
echo WFA_CLI_STA_DEVICE="C:\WFA\CLIs\Intel" > C:\WFA\WFAEndpoint\sigma_settings.txt
netsh wlan show interfaces > C:\WFA\Temp\temp.txt
FOR /F "tokens=2 delims=: " %%i IN ('findstr GUID C:\Wfa\Temp\temp.txt') DO @echo DEVICE={%%i} >> C:\WFA\WfaEndpoint\sigma_settings.txt
echo VERSION=%INTEL_CLI_VER% >> C:\WFA\WfaEndpoint\sigma_settings.txt
goto :EOF

:Intel-6300
echo Intel-6300
IF EXIST C:\WFA\CLIs\Intel (
rmdir /S /Q  C:\WFA\CLIs\Intel
mkdir C:\WFA\CLIs\Intel
) ELSE (
mkdir C:\WFA\CLIs\Intel
)
xcopy /S /R /Y Intel-6300\*.* C:\WFA\CLIs\Intel\
echo WFA_CLI_STA_DEVICE="C:\WFA\CLIs\Intel" > C:\WFA\WFAEndpoint\sigma_settings.txt
echo DEVICE=6300>> C:\WFA\WFAEndpoint\sigma_settings.txt
echo VERSION=%INTEL_CLI_VER% >> C:\WFA\WfaEndpoint\sigma_settings.txt
C:\WFA\CLIs\Intel\RegEditSigma.msi
goto :EOF

:Intel-6200
echo Intel-6200
IF EXIST C:\WFA\CLIs\Intel (
rmdir /S /Q  C:\WFA\CLIs\Intel
mkdir C:\WFA\CLIs\Intel
) ELSE (
mkdir C:\WFA\CLIs\Intel
)
xcopy /S /R /Y Intel-6200\*.* C:\WFA\CLIs\Intel\
echo WFA_CLI_STA_DEVICE="C:\WFA\CLIs\Intel" > C:\WFA\WFAEndpoint\sigma_settings.txt
echo DEVICE=6200>> C:\WFA\WFAEndpoint\sigma_settings.txt
echo VERSION=%INTEL_CLI_VER% >> C:\WFA\WfaEndpoint\sigma_settings.txt
C:\WFA\CLIs\Intel\RegEditSigma.msi
goto :EOF

:Realtek
echo Realtek
IF EXIST C:\WFA\CLIs\Realtek (
rmdir /S /Q  C:\WFA\CLIs\Realtek
mkdir C:\WFA\CLIs\Realtek
) ELSE (
mkdir C:\WFA\CLIs\Realtek
)
xcopy /S /R /Y Realtek-P2P\*.* C:\WFA\CLIs\Realtek\
echo WFA_CLI_STA_DEVICE="C:\WFA\CLIs\Realtek" > C:\WFA\WfaEndpoint\sigma_settings.txt
echo DEVICE=rtl8192s >> C:\WFA\WfaEndpoint\sigma_settings.txt
echo VERSION=%REALTEK_CLI_VER% >> C:\WFA\WfaEndpoint\sigma_settings.txt
goto :EOF

:Realtek-TDLS
echo Realtek-TDLS
IF EXIST C:\WFA\CLIs\Realtek (
rmdir /S /Q  C:\WFA\CLIs\Realtek
mkdir C:\WFA\CLIs\Realtek
) ELSE (
mkdir C:\WFA\CLIs\Realtek
)
xcopy /S /R /Y Realtek-TDLS\*.* C:\WFA\CLIs\Realtek\
echo WFA_CLI_STA_DEVICE="C:\WFA\CLIs\Realtek" > C:\WFA\WfaEndpoint\sigma_settings.txt
echo DEVICE=rtl8192s >> C:\WFA\WfaEndpoint\sigma_settings.txt
echo VERSION=%REALTEK_TDLS_CLI_VER% >> C:\WFA\WfaEndpoint\sigma_settings.txt
xcopy /R /Y Realtek-TDLS\wfa_cli.txt C:\WFA\WfaEndpoint\wfa_cli.txt
goto :EOF

:Ralink-P2P
echo P2P Ralink
IF EXIST C:\WFA\CLIs\Ralink (
rmdir /S /Q  C:\WFA\CLIs\Ralink
mkdir C:\WFA\CLIs\Ralink
) ELSE (
mkdir C:\WFA\CLIs\Ralink
)
xcopy /S /R /Y Ralink-P2P\*.* C:\WFA\CLIs\Ralink\
echo WFA_CLI_STA_DEVICE="C:\WFA\CLIs\Ralink" > C:\WFA\WfaEndpoint\sigma_settings.txt
netsh wlan show interfaces > C:\WFA\Temp\temp.txt
FOR /F "tokens=2 delims=: " %%i IN ('findstr GUID C:\Wfa\Temp\temp.txt') DO @echo DEVICE={%%i} >> C:\WFA\WfaEndpoint\sigma_settings.txt
echo VERSION=%Ralink_CLI_VER% >> C:\WFA\WfaEndpoint\sigma_settings.txt

:Ralink-PMF
echo PMF Ralink
IF EXIST C:\WFA\CLIs\Ralink (
rmdir /S /Q  C:\WFA\CLIs\Ralink
mkdir C:\WFA\CLIs\Ralink
) ELSE (
mkdir C:\WFA\CLIs\Ralink
)
xcopy /S /R /Y Ralink-PMF\*.* C:\WFA\CLIs\Ralink\
echo WFA_CLI_STA_DEVICE="C:\WFA\CLIs\Ralink" > C:\WFA\WfaEndpoint\sigma_settings.txt
netsh wlan show interfaces > C:\WFA\Temp\temp.txt
FOR /F "tokens=2 delims=: " %%i IN ('findstr GUID C:\Wfa\Temp\temp.txt') DO @echo DEVICE={%%i} >> C:\WFA\WfaEndpoint\sigma_settings.txt
echo VERSION=%Ralink_PMF_CLI_VER% >> C:\WFA\WfaEndpoint\sigma_settings.txt

Package comparison checkin differences

Package comparison checkin differences

git-svn-id: c15d90c68879a78f23c010891b142a02cbc7d74d@1093 e6edf6fb-f266-4316-afb4-e53d95876a76


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

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

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

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

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

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

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

goto fail

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

if exist "%JAVA_EXE%" goto init

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

goto fail

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

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

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

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

set CMD_LINE_ARGS=%*
goto execute

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

:execute
@rem Setup the command line

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

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

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

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

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

:omega

Convert line endings from CRLF to LF.

Convert line endings from CRLF to LF.


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

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

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

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

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

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

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

goto fail

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

if exist "%JAVA_EXE%" goto init

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

goto fail

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

if not "%OS%" == "Windows_NT" goto win9xME_args

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

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

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

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

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

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

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

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

:omega

Change line separator

Change line separator


set BOOT2DOCKER_VM=default
set PATH=%PATH%;"C:\\Program Files\\Docker Toolbox\\"
docker-machine start %BOOT2DOCKER_VM%
REM Set the environment variables to use docker-machine and docker commands
@FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd %BOOT2DOCKER_VM%') DO @%i

python setup.py test --addopts --junit-xml=tests.xml

set BOOT2DOCKER_VM=default
set PATH=%PATH%;"C:\\Program Files\\Docker Toolbox\\"
docker-machine start %BOOT2DOCKER_VM%
REM Set the environment variables to use docker-machine and docker commands
@FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd %BOOT2DOCKER_VM%') DO @%

python setup.py test --addopts --junit-xml=tests.xml

remove typo

remove typo


mkdir build
cd build

:: Configure.
cmake -G "NMake Makefiles" -D CMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% \
.
if errorlevel 1 exit 1

:: Build.
nmake
if errorlevel 1 exit 1

:: Install.
nmake install
if errorlevel 1 exit 1

mkdir build
cd build

:: Configure.
cmake -G "NMake Makefiles" -D CMAKE_INSTALL_PREFIX=%PREFIX% .
if errorlevel 1 exit 1

:: Build.
nmake
if errorlevel 1 exit 1

:: Install.
nmake install
if errorlevel 1 exit 1

Update Windows build to deal with newline issue


set QT=%1

set CETEST=%QT%\bin\cetest.exe
set CETEST_ARGS=-cache %QT%\.qmake.cache -libpath \Windows -f

%CETEST% %CETEST_ARGS% tests\auto\qvaluespace\qvaluespace.pro
%CETEST% %CETEST_ARGS% tests\auto\qvaluespaceprovider\qvaluespaceprovider.pro
%CETEST% %CETEST_ARGS% tests\auto\qvaluespacesubscriber\tst_qvaluespacesubscriber\tst_qvaluespacesubscriber.pro
%CETEST% %CETEST_ARGS% tests\auto\qvaluespacesubscriber\tst_qvaluespacesubscriber_oop\tst_qvaluespacesubscriber_oop.pro
%CETEST% %CETEST_ARGS% tests\auto\qsystemreadwritelock\qsystemreadwritelock\test\test.pro
%CETEST% %CETEST_ARGS% tests\auto\qsystemreadwritelock_oop\qsystemreadwritelock_oop\test\test.pro
%CETEST% %CETEST_ARGS% tests\auto\qcrmlparser\qcrmlparser.pro

Remove unbuilt tests on Windows CE.

Remove unbuilt tests on Windows CE.


@ECHO off
TITLE Downloading NadekoBot, please wait
::Setting convenient to read variables which don't delete the windows temp folder
SET root=%~dp0
CD /D %root%
SET rootdir=%cd%
SET build1=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Core\
SET build2=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Rest\
SET build3=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.WebSocket\
SET build4=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Commands\
SET build5=%root%NadekoInstall_Temp\NadekoBot\src\NadekoBot\
SET installtemp=%root%NadekoInstall_Temp\
::Deleting traces of last setup for the sake of clean folders, if by some miracle it still exists
IF EXIST %installtemp% ( RMDIR %installtemp% /S /Q >nul 2>&1)
::Checks that both git and dotnet are installed
dotnet --version >nul 2>&1 || GOTO :dotnet
git --version >nul 2>&1 || GOTO :git
::Creates the install directory to work in and get the current directory because spaces ruins everything otherwise
:start
MKDIR NadekoInstall_Temp
CD /D %installtemp%
::Downloads the latest version of Nadeko
ECHO Downloading Nadeko...
ECHO.
git clone -b master --recursive --depth 1 --progress https://github.com/Kwoth/NadekoBot.git >nul
IF %ERRORLEVEL% EQU 128 (GOTO :giterror)
TITLE Installing NadekoBot, please wait
ECHO.
ECHO Installing...
::Building Nadeko
CD /D %build1%
dotnet restore >nul 2>&1
CD /D %build2%
dotnet restore >nul 2>&1
CD /D %build3%
dotnet restore >nul 2>&1
CD /D %build4%
dotnet restore >nul 2>&1
CD /D %build5%
dotnet restore >nul 2>&1
dotnet build --configuration Release >nul 2>&1
::Attempts to backup old files if they currently exist in the same folder as the batch file
IF EXIST "%root%NadekoBot\" (GOTO :backupinstall)
:freshinstall
	::Moves the NadekoBot folder to keep things tidy
	ROBOCOPY "%root%NadekoInstall_Temp" "%rootdir%" /E /MOVE >nul 2>&1
	IF %ERRORLEVEL% GEQ 8 (GOTO :copyerror)
	GOTO :end
:backupinstall
	TITLE Backing up old files
	::Recursively copies all files and folders from NadekoBot to NadekoBot_Old
	ROBOCOPY "%root%NadekoBot" "%root%NadekoBot_Old" /MIR >nul 2>&1
	IF %ERRORLEVEL% GEQ 8 (GOTO :copyerror)
	ECHO.
	ECHO Old files backed up to NadekoBot_Old
	::Copies the credentials and database from the backed up data to the new folder
	COPY "%root%NadekoBot_Old\src\NadekoBot\credentials.json" "%installtemp%NadekoBot\src\NadekoBot\credentials.json" >nul 2>&1
	IF %ERRORLEVEL% GEQ 8 (GOTO :copyerror)
	ECHO.
	ECHO credentials.json copied to new folder
	ROBOCOPY "%root%NadekoBot_Old\src\NadekoBot\bin" "%installtemp%NadekoBot\src\NadekoBot\bin" /E >nul 2>&1
	IF %ERRORLEVEL% GEQ 8 (GOTO :copyerror)
	ECHO.
	ECHO Old bin folder copied to new folder
	ROBOCOPY "%root%NadekoBot_Old\src\NadekoBot\data" "%installtemp%NadekoBot\src\NadekoBot\data" /E >nul 2>&1
	IF %ERRORLEVEL% GEQ 8 (GOTO :copyerror)
	ECHO.
	ECHO Old data folder copied to new folder
	::Moves the setup Nadeko folder
	RMDIR "%root%NadekoBot\" /S /Q >nul 2>&1
	ROBOCOPY "%root%NadekoInstall_Temp" "%rootdir%" /E /MOVE >nul 2>&1
	IF %ERRORLEVEL% GEQ 8 (GOTO :copyerror)
	GOTO :end
:dotnet
	::Terminates the batch script if it can't run dotnet --version
	TITLE Error!
	ECHO dotnet not found, make sure it's been installed as per the guides instructions!
	ECHO Press any key to exit.
	PAUSE >nul 2>&1
	CD /D "%root%"
	GOTO :EOF
:git
	::Terminates the batch script if it can't run git --version
	TITLE Error!
	ECHO git not found, make sure it's been installed as per the guides instructions!
	ECHO Press any key to exit.
	PAUSE >nul 2>&1
	CD /D "%root%"
	GOTO :EOF
:giterror
	ECHO.
	ECHO Git clone failed, trying again
	RMDIR %installtemp% /S /Q >nul 2>&1
	GOTO :start
:copyerror
	::If at any point a copy error is encountered
	TITLE Error!
	ECHO.
	ECHO An error in copying data has been encountered, returning an exit code of %ERRORLEVEL%
	ECHO.
	ECHO Make sure to close any files, such as `NadekoBot.db` before continuing or try running the installer as an Administrator
	PAUSE >nul 2>&1
	CD /D "%root%"
	GOTO :EOF
:end
	::Normal execution of end of script
	TITLE Installation complete!
	CD /D "%root%"
	RMDIR /S /Q "%installtemp%" >nul 2>&1
	ECHO.
	ECHO Installation complete, press any key to close this window!
	PAUSE >nul 2>&1
	del Stable.bat

@ECHO off
TITLE Downloading NadekoBot, please wait
::Setting convenient to read variables which don't delete the windows temp folder
SET root=%~dp0
CD /D %root%
SET rootdir=%cd%
SET build1=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Core\
SET build2=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Rest\
SET build3=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.WebSocket\
SET build4=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Commands\
SET build5=%root%NadekoInstall_Temp\NadekoBot\src\NadekoBot\
SET installtemp=%root%NadekoInstall_Temp\
::Deleting traces of last setup for the sake of clean folders, if by some miracle it still exists
IF EXIST %installtemp% ( RMDIR %installtemp% /S /Q >nul 2>&1)
::Checks that both git and dotnet are installed
dotnet --version >nul 2>&1 || GOTO :dotnet
git --version >nul 2>&1 || GOTO :git
::Creates the install directory to work in and get the current directory because spaces ruins everything otherwise
:start
MKDIR NadekoInstall_Temp
CD /D %installtemp%
::Downloads the latest version of Nadeko
ECHO Downloading Nadeko...
ECHO.
git clone -b master --recursive --depth 1 --progress https://github.com/Kwoth/NadekoBot.git >nul
IF %ERRORLEVEL% EQU 128 (GOTO :giterror)
TITLE Installing NadekoBot, please wait
ECHO.
ECHO Installing...
::Building Nadeko
CD /D %build1%
dotnet restore >nul 2>&1
CD /D %build2%
dotnet restore >nul 2>&1
CD /D %build3%
dotnet restore >nul 2>&1
CD /D %build4%
dotnet restore >nul 2>&1
CD /D %build5%
dotnet restore >nul 2>&1
dotnet build --configuration Release >nul 2>&1
::Attempts to backup old files if they currently exist in the same folder as the batch file
IF EXIST "%root%NadekoBot\" (GOTO :backupinstall)
:freshinstall
	::Moves the NadekoBot folder to keep things tidy
	ROBOCOPY "%root%NadekoInstall_Temp" "%rootdir%" /E /MOVE >nul 2>&1
	IF %ERRORLEVEL% GEQ 8 (GOTO :copyerror)
	GOTO :end
:backupinstall
	TITLE Backing up old files
	::Recursively copies all files and folders from NadekoBot to NadekoBot_Old
	ROBOCOPY "%root%NadekoBot" "%root%NadekoBot_Old" /MIR >nul 2>&1
	IF %ERRORLEVEL% GEQ 8 (GOTO :copyerror)
	ECHO.
	ECHO Old files backed up to NadekoBot_Old
	::Copies the credentials and database from the backed up data to the new folder
	COPY "%root%NadekoBot_Old\src\NadekoBot\credentials.json" "%installtemp%NadekoBot\src\NadekoBot\credentials.json" >nul 2>&1
	IF %ERRORLEVEL% GEQ 8 (GOTO :copyerror)
	ECHO.
	ECHO credentials.json copied to new folder
	ROBOCOPY "%root%NadekoBot_Old\src\NadekoBot\bin" "%installtemp%NadekoBot\src\NadekoBot\bin" /E >nul 2>&1
	IF %ERRORLEVEL% GEQ 8 (GOTO :copyerror)
	ECHO.
	ECHO Old bin folder copied to new folder
	ROBOCOPY "%root%NadekoBot_Old\src\NadekoBot\data" "%installtemp%NadekoBot\src\NadekoBot\data" /E >nul 2>&1
	IF %ERRORLEVEL% GEQ 8 (GOTO :copyerror)
	ECHO.
	ECHO Old data folder copied to new folder
	::Moves the setup Nadeko folder
	RMDIR "%root%NadekoBot\" /S /Q >nul 2>&1
	ROBOCOPY "%root%NadekoInstall_Temp" "%rootdir%" /E /MOVE >nul 2>&1
	IF %ERRORLEVEL% GEQ 8 (GOTO :copyerror)
	GOTO :end
:dotnet
	::Terminates the batch script if it can't run dotnet --version
	TITLE Error!
	ECHO dotnet not found, make sure it's been installed as per the guides instructions!
	ECHO Press any key to exit.
	PAUSE >nul 2>&1
	CD /D "%root%"
	GOTO :EOF
:git
	::Terminates the batch script if it can't run git --version
	TITLE Error!
	ECHO git not found, make sure it's been installed as per the guides instructions!
	ECHO Press any key to exit.
	PAUSE >nul 2>&1
	CD /D "%root%"
	GOTO :EOF
:giterror
	ECHO.
	ECHO Git clone failed, trying again
	RMDIR %installtemp% /S /Q >nul 2>&1
	GOTO :start
:copyerror
	::If at any point a copy error is encountered
	TITLE Error!
	ECHO.
	ECHO An error in copying data has been encountered, returning an exit code of %ERRORLEVEL%
	ECHO.
	ECHO Make sure to close any files, such as `NadekoBot.db` before continuing or try running the installer as an Administrator
	PAUSE >nul 2>&1
	CD /D "%root%"
	GOTO :EOF
:end
	::Normal execution of end of script
	TITLE Installation complete!
	CD /D "%root%"
	RMDIR /S /Q "%installtemp%" >nul 2>&1
	ECHO.
	ECHO Installation complete, press any key to close this window!
	timeout /t 5
	del Stable.bat

Update Stable.bat

Update Stable.bat


@setlocal

@if "%1" == "v1.3" (
    @set pkg_file=foobar2000_v1.3.17.exe
    @goto :install
)

@if "%1" == "v1.4" (
    @set pkg_file=foobar2000_v1.4.exe
    @goto :install
)

@echo Usage: %~nx0 version
@echo Supported versions: v1.3 v1.4
@cmd /c exit 1
@goto :end

:install

@set target_dir=tools\foobar2000\%1

@cd "%~dp0..\.."

@if exist %target_dir%\. (
    rmdir /s /q %target_dir%
    @if errorlevel 1 goto :end
)

mkdir %target_dir%
@if errorlevel 1 goto :end

@cd %target_dir%
@if errorlevel 1 goto :end

curl --silent --fail --show-error --location -o %pkg_file% ^
    "https://hyperblast.org/files/foobar2000/%pkg_file%"
@if errorlevel 1 goto :end

echo.>portable_mode_enabled
@if errorlevel 1 goto :end

%pkg_file% /S /D=%cd%
@if errorlevel 1 goto :end

del %pkg_file%
@if errorlevel 1 goto :end

xcopy /E /F /Y "%~dp0foobar2000\%1" .
@if errorlevel 1 goto :end

:end

@setlocal

@if "%1" == "v1.3" (
    @set pkg_file=foobar2000_v1.3.20.exe
    @goto :install
)

@if "%1" == "v1.4" (
    @set pkg_file=foobar2000_v1.4.3.exe
    @goto :install
)

@echo Usage: %~nx0 version
@echo Supported versions: v1.3 v1.4
@cmd /c exit 1
@goto :end

:install

@set target_dir=tools\foobar2000\%1

@cd "%~dp0..\.."

@if exist %target_dir%\. (
    rmdir /s /q %target_dir%
    @if errorlevel 1 goto :end
)

mkdir %target_dir%
@if errorlevel 1 goto :end

@cd %target_dir%
@if errorlevel 1 goto :end

curl --silent --fail --show-error --location -o %pkg_file% ^
    "https://hyperblast.org/files/foobar2000/%pkg_file%"
@if errorlevel 1 goto :end

echo.>portable_mode_enabled
@if errorlevel 1 goto :end

%pkg_file% /S /D=%cd%
@if errorlevel 1 goto :end

del %pkg_file%
@if errorlevel 1 goto :end

xcopy /E /F /Y "%~dp0foobar2000\%1" .
@if errorlevel 1 goto :end

:end

update foobar2000 versions

scripts/install/foobar2000.cmd: update foobar2000 versions


@echo off
REM Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
REM for details. All rights reserved. Use of this source code is governed by a
REM BSD-style license that can be found in the LICENSE file.

setlocal
rem Handle the case where dart-sdk/bin has been symlinked to.
set DIR_NAME_WITH_SLASH=%~dp0
set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%%
call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR
rem Get rid of surrounding quotes.
for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi

rem Get absolute full name for SDK_DIR.
for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi

rem Remove trailing backslash if there is one
IF %SDK_DIR:~-1%==\ set SDK_DIR=%SDK_DIR:~0,-1%

set DOCGEN=%SDK_DIR%\pkg\docgen\bin\docgen.dart
set DART=%BIN_DIR%\dart
set SNAPSHOT=%BIN_DIR%\snapshots\utils_wrapper.dart.snapshot

if not defined DART_CONFIGURATION set DART_CONFIGURATION=ReleaseIA32

set BUILD_DIR=%SDK_DIR%\..\build\%DART_CONFIGURATION%
if exist "%SNAPSHOT%" (
  "%DART%" "%SNAPSHOT%" "dartdoc" "--library-root=%SDK_DIR%" %*
) else (
  "%BUILD_DIR%\dart-sdk\bin\dart" "--package-root=%BUILD_DIR%\packages" "%DOCGEN%" %*
)

endlocal

exit /b %errorlevel%

:follow_links
setlocal
for %%i in (%1) do set result=%%~fi
set current=
for /f "tokens=2 delims=[]" %%i in ('dir /a:l ^"%~dp1^" 2^>nul ^
                                     ^| find ">     %~n1 ["') do (
  set current=%%i
)
if not "%current%"=="" call :follow_links "%current%", result
endlocal & set %~2=%result%
goto :eof

:end

@echo off
REM Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
REM for details. All rights reserved. Use of this source code is governed by a
REM BSD-style license that can be found in the LICENSE file.

setlocal
rem Handle the case where dart-sdk/bin has been symlinked to.
set DIR_NAME_WITH_SLASH=%~dp0
set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%%
call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR
rem Get rid of surrounding quotes.
for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi

rem Get absolute full name for SDK_DIR.
for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi

rem Remove trailing backslash if there is one
IF %SDK_DIR:~-1%==\ set SDK_DIR=%SDK_DIR:~0,-1%

set DOCGEN=%SDK_DIR%\pkg\docgen\bin\docgen.dart
set DART=%BIN_DIR%\dart
set SNAPSHOT=%BIN_DIR%\snapshots\utils_wrapper.dart.snapshot

if not defined DART_CONFIGURATION set DART_CONFIGURATION=ReleaseIA32

set BUILD_DIR=%SDK_DIR%\..\build\%DART_CONFIGURATION%
if exist "%SNAPSHOT%" (
  "%DART%" "%SNAPSHOT%" "docgen" %*
) else (
  "%BUILD_DIR%\dart-sdk\bin\dart" "--package-root=%BUILD_DIR%\packages" "%DOCGEN%" %*
)

endlocal

exit /b %errorlevel%

:follow_links
setlocal
for %%i in (%1) do set result=%%~fi
set current=
for /f "tokens=2 delims=[]" %%i in ('dir /a:l ^"%~dp1^" 2^>nul ^
                                     ^| find ">     %~n1 ["') do (
  set current=%%i
)
if not "%current%"=="" call :follow_links "%current%", result
endlocal & set %~2=%result%
goto :eof

:end

Fix docgen.bat so it can start docgen from snapshot.

R=alanknight@google.com

Review URL: https://codereview.chromium.org//149723004

git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@32145 260f80e4-7a28-3924-810f-c04153c831b5


call "%VS%\VC\vcvarsall.bat" x86
@echo on

cov-build --dir cov_dir msbuild.exe /m:1 /p:Configuration="%CONFIGURATION%" /p:Platform="%PLATFORM%" /t:"%TARGET%" %EXTRA% %FILE%

if errorlevel 1 goto error

cov-analyze --dir cov_dir -j auto --aggressiveness-level high --security --concurrency --preview --all --rule --enable-fnptr --strip-path c:\git\xenbus

cov-commit-defects --dir cov_dir --host dagu-4.uk.xensource.com --port 8080 --user windows --password coverity --stream %PLATFORM%

exit 0

:error
exit 1

call "%VS%\VC\vcvarsall.bat" x86
@echo on
msbuild.exe /m:1 /p:Configuration="%CONFIGURATION%" /p:Platform="%PLATFORM%" /t:"%TARGET%" %EXTRA% %FILE%
if errorlevel 1 goto error
exit 0

:error
exit 1

Revert script pollution that was accidentally pushed

Signed-off-by: Paul Durrant <dba6cd059c0054f8a3c62ba902cd9d7238853ee4@citrix.com>


@echo off

echo.
echo ################
echo TO_ICF
echo ################
echo.

setlocal EnableDelayedExpansion

if exist *.icf del /Q *.icf
if exist *.tmp del /Q *.tmp

set ManagerName=ManagerName

:: Get ManagerName
for /f "usebackq skip=1 tokens=*" %%i in (`wmic computersystem get name ^| findstr /r /v "^$" `) do (
	    set ManagerName=%%i )

echo ################
echo Get ManagerName= %ManagerName%
echo ################

echo ################
echo Get diskdrive get FirmwareRevision, Index, Model
echo ################
wmic diskdrive get FirmwareRevision, Index, Model > diskdrive.tmp
type diskdrive.tmp > diskdrive.txt

for /f "skip=1 tokens=1,2,3,4* " %%i in (diskdrive.txt) do (
    ::echo %%j %%k %%i
    set "formattedValue=%%k"
    ::set ModelName=!formattedValue:~0,20!
    echo %%j !formattedValue:~0,20! %%i >> disklist.tmp
)

::type disklist.tmp
sort disklist.tmp > disksort.tmp
type disksort.tmp

echo ################
echo Get os get "SystemDrive"
echo ################

wmic os get "SystemDrive" > SystemDrive.tmp
type SystemDrive.tmp > SystemDrive.txt

for /f "skip=1 tokens=1,2,3,4* " %%i in (SystemDrive.txt) do (
    echo %%i
    set SystemDrive=%%i
)
echo ################
echo Get os get "SystemDrive"="%SystemDrive%"
echo ################

echo ################
echo Get os get "SystemDriveID"
echo ################

wmic logicaldisk where 'DeviceID="%SystemDrive%"' get Access > SystemDriveID.tmp

type SystemDriveID.tmp > SystemDriveID.txt

for /f "skip=1 tokens=1,2,3,4* " %%i in (SystemDriveID.txt) do (
    echo %%i
    set SystemDriveID=%%i
)
echo ################
echo Get os get "SystemDriveID"="%SystemDriveID%"
echo ################

echo ################
echo Remove OS disk in list
echo ################
type disksort.tmp | findstr /v " %SystemDriveID% " > disksort.txt
type disksort.txt
echo ################
echo Remove OS disk in list
echo ################

if disksort.txt == "" goto END

echo ################
echo Careate icf_info.tmp file
echo ################

:: Careate icf_info_top.tmp
set TampFileName=icf_info_top
::echo ################
::echo Careate !TampFileName!.tmp
::echo ################
::echo.
echo Version 1.1.0 >> !TampFileName!.tmp
echo 'TEST SETUP ==================================================================== >> !TampFileName!.tmp
echo 'Test Description >> !TampFileName!.tmp
echo. >> !TampFileName!.tmp
echo 'Run Time >> !TampFileName!.tmp
echo '	hours      minutes    seconds >> !TampFileName!.tmp
echo 	0          10         0 >> !TampFileName!.tmp
echo 'Ramp Up Time ^(s^) >> !TampFileName!.tmp
echo 	300 >> !TampFileName!.tmp
echo 'Default Disk Workers to Spawn >> !TampFileName!.tmp
echo 	NUMBER_OF_CPUS >> !TampFileName!.tmp
echo 'Default Network Workers to Spawn >> !TampFileName!.tmp
echo 	0 >> !TampFileName!.tmp
echo 'Record Results >> !TampFileName!.tmp
echo 	ALL >> !TampFileName!.tmp
echo 'Worker Cycling >> !TampFileName!.tmp
echo '	start      step       step type >> !TampFileName!.tmp
echo 	1          1          LINEAR >> !TampFileName!.tmp
echo 'Disk Cycling >> !TampFileName!.tmp
echo '	start      step       step type >> !TampFileName!.tmp
echo 	1          1          LINEAR >> !TampFileName!.tmp
echo 'Queue Depth Cycling >> !TampFileName!.tmp
echo '	start      end        step       step type >> !TampFileName!.tmp
echo 	1          32         2          EXPONENTIAL >> !TampFileName!.tmp
echo 'Test Type >> !TampFileName!.tmp
echo 	NORMAL >> !TampFileName!.tmp
echo 'END test setup >> !TampFileName!.tmp
echo 'RESULTS DISPLAY =============================================================== >> !TampFileName!.tmp
echo 'Record Last Update Results,Update Frequency,Update Type >> !TampFileName!.tmp
echo 	DISABLED,1,WHOLE_TEST >> !TampFileName!.tmp
echo 'Bar chart 1 statistic >> !TampFileName!.tmp
echo 	Total I/Os per Second >> !TampFileName!.tmp
echo 'Bar chart 2 statistic >> !TampFileName!.tmp
echo 	Total MBs per Second (Decimal) >> !TampFileName!.tmp
echo 'Bar chart 3 statistic >> !TampFileName!.tmp
echo 	Average I/O Response Time (ms) >> !TampFileName!.tmp
echo 'Bar chart 4 statistic >> !TampFileName!.tmp
echo 	Maximum I/O Response Time (ms) >> !TampFileName!.tmp
echo 'Bar chart 5 statistic >> !TampFileName!.tmp
echo 	%% CPU Utilization (total) >> !TampFileName!.tmp
echo 'Bar chart 6 statistic >> !TampFileName!.tmp
echo 	Total Error Count >> !TampFileName!.tmp
echo 'END results display >> !TampFileName!.tmp
echo 'ACCESS SPECIFICATIONS ========================================================= >> !TampFileName!.tmp
echo 'Access specification name,default assignment >> !TampFileName!.tmp
echo 	RVI_SAS_disk(2K),NONE >> !TampFileName!.tmp
echo 'size,%% of size,%% reads,%% random,delay,burst,align,reply >> !TampFileName!.tmp
echo 	2048,100,0,100,0,1,2048,0 >> !TampFileName!.tmp
echo 'Access specification name,default assignment >> !TampFileName!.tmp
echo 	RVI_SATA_disk(6K),NONE >> !TampFileName!.tmp
echo 'size,%% of size,%% reads,%% random,delay,burst,align,reply >> !TampFileName!.tmp
echo 	6144,100,0,100,0,1,6144,0 >> !TampFileName!.tmp
echo 'END access specifications >> !TampFileName!.tmp
echo 'MANAGER LIST ================================================================== >> !TampFileName!.tmp
echo 'Manager ID, manager name >> !TampFileName!.tmp
echo 	1, >> !TampFileName!.tmp
echo 'Manager network address >> !TampFileName!.tmp
echo. >> !TampFileName!.tmp

:: Careate icf_Worker_info_top.tmp
set TampFileName=icf_Worker_info_top
::echo ################
::echo Careate !TampFileName!.tmp
::echo ################
::echo.
echo 'Worker >> !TampFileName!.tmp
::echo     Worker 1 >> !TampFileName!.tmp

:: Careate icf_Worker_info_mid_top.tmp
set TampFileName=icf_Worker_info_mid_top
::echo ################
::echo Careate !TampFileName!.tmp
::echo ################
::echo.
echo 'Worker type >> !TampFileName!.tmp
echo 	DISK >> !TampFileName!.tmp
echo 'Default target settings for worker >> !TampFileName!.tmp
echo 'Number of outstanding IOs,test connection rate,transactions per connection,use fixed seed,fixed seed value >> !TampFileName!.tmp
::echo 	1,DISABLED,1,DISABLED,0 >> !TampFileName!.tmp

:: Careate icf_Worker_info_mid_bot.tmp
set TampFileName=icf_Worker_info_mid_bot
::echo ################
::echo Careate !TampFileName!.tmp
::echo ################
::echo.
echo 'Disk maximum size,starting sector,Data pattern >> !TampFileName!.tmp
echo 	0,0,0 >> !TampFileName!.tmp
echo 'End default target settings for worker >> !TampFileName!.tmp
echo 'Assigned access specs >> !TampFileName!.tmp
echo 	RVI_SAS_disk(2K) >> !TampFileName!.tmp
echo 'End assigned access specs >> !TampFileName!.tmp
echo 'Target assignments >> !TampFileName!.tmp
echo 'Target >> !TampFileName!.tmp
::echo     1: "" >> !TampFileName!.tmp

:: Careate icf_Worker_info_bot.tmp
set TampFileName=icf_Worker_info_bot
::echo ################
::echo Careate !TampFileName!.tmp
::echo ################
::echo.
echo 'Target type >> !TampFileName!.tmp
echo 	DISK >> !TampFileName!.tmp
echo 'End target >> !TampFileName!.tmp
echo 'End target assignments >> !TampFileName!.tmp
echo 'End worker >> !TampFileName!.tmp

:: Careate icf_info_bot.tmp
set TampFileName=icf_info_bot
::echo ################
::echo Careate !TampFileName!.tmp
::echo ################
::echo.
echo 'End manager >> !TampFileName!.tmp
echo 'END manager list >> !TampFileName!.tmp
echo Version 1.1.0 >> !TampFileName!.tmp

echo ################
echo Disk detect...
echo ################

for /f "tokens=2,3" %%a in ('echo list disk ^| diskpart') do (
    set DiskNum=%%a )

echo ################
echo Start carte many icf file
echo ################
echo.

::set DiskNum=26
set FileName=00

for /L %%i in (1, 1, %DiskNum%) do (
    set "formattedValue=000000%%i"
	set FileName=!formattedValue:~-2!
    echo !FileName!.icf
	:: imput icf_info_top
	type icf_info_top.tmp                               >> !FileName!.icf
	    :: imput icf_Worker_info_top(outstanding=8)
	    type icf_Worker_info_top.tmp                    >> !FileName!.icf
        echo     Worker 1 >> !FileName!.icf
	    :: imput icf_Worker_mid_top
	    type icf_Worker_info_mid_top.tmp                >> !FileName!.icf
	    echo 	8,DISABLED,1,DISABLED,0 >> !FileName!.icf
	    :: imput icf_Worker_info_mid_bot
	    type icf_Worker_info_mid_bot.tmp                >> !FileName!.icf
	    echo     %%i: "">> !FileName!.icf
	    :: imput icf_Worker_info_bot
	    type icf_Worker_info_bot.tmp                    >> !FileName!.icf
	:: imput Other Worker info(outstanding=1)
	for /L %%j in (2, 1, %DiskNum%) do (
	    if %%i==%%j (
		    :: imput icf_Worker_info_top
	        type icf_Worker_info_top.tmp                >> !FileName!.icf
            echo     Worker %%j >> !FileName!.icf
	        :: imput icf_Worker_mid_top
	        type icf_Worker_info_mid_top.tmp            >> !FileName!.icf
	        echo 	1,DISABLED,1,DISABLED,0 >> !FileName!.icf
	        :: imput icf_Worker_info_mid_bot
	        type icf_Worker_info_mid_bot.tmp            >> !FileName!.icf
	        echo     1: "" >> !FileName!.icf
		    :: imput icf_Worker_info_bot
	        type icf_Worker_info_bot.tmp                >> !FileName!.icf
	    )else (
		    :: imput icf_Worker_info_top
	        type icf_Worker_info_top.tmp                >> !FileName!.icf
            echo     Worker %%j >> !FileName!.icf
	        :: imput icf_Worker_mid_top
	        type icf_Worker_info_mid_top.tmp            >> !FileName!.icf
	        echo 	1,DISABLED,1,DISABLED,0 >> !FileName!.icf
	        :: imput icf_Worker_info_mid_bot
	        type icf_Worker_info_mid_bot.tmp            >> !FileName!.icf
	        echo     %%j: "" >> !FileName!.icf
	        :: imput icf_Worker_info_bot
	        type icf_Worker_info_bot.tmp                >> !FileName!.icf
	    )
	)
	 type icf_info_bot.tmp                              >> !FileName!.icf
)

echo.
echo ################
echo Complete carte many icf file
echo ################
echo.

if exist *.tmp del /Q *.tmp

@echo off

echo.
echo ################
echo TO_ICF
echo ################
echo.

setlocal EnableDelayedExpansion

if exist *.icf del /Q *.icf
if exist *.tmp del /Q *.tmp

set ManagerName=ManagerName

:: Get ManagerName
for /f "usebackq skip=1 tokens=*" %%i in (`wmic computersystem get name ^| findstr /r /v "^$" `) do (
	    set ManagerName=%%i )

echo ################
echo Get ManagerName= %ManagerName%
echo ################

echo ################
echo Get os get "SystemDrive"
echo ################

wmic os get "SystemDrive" > SystemDrive.tmp
type SystemDrive.tmp > SystemDrive.txt

for /f "skip=1 tokens=1,2,3,4* " %%i in (SystemDrive.txt) do (
    echo %%i
    set SystemDrive=%%i
)
echo ################
echo Get os get "SystemDrive"="%SystemDrive%"
echo ################

echo ################
echo Get os get "SystemDriveID"
echo ################

wmic logicaldisk where 'DeviceID="%SystemDrive%"' get Access > SystemDriveID.tmp

type SystemDriveID.tmp > SystemDriveID.txt

for /f "skip=1 tokens=1,2,3,4* " %%i in (SystemDriveID.txt) do (
    echo %%i
    set SystemDriveID=%%i
)
echo ################
echo Get os get "SystemDriveID"="%SystemDriveID%"
echo ################

echo ################
echo Get diskdrive get FirmwareRevision, Index, InterfaceType, Model
echo ################
::ic diskdrive get              %%i,   %%j,           %%k,   %%l
wmic diskdrive get FirmwareRevision, Index, InterfaceType, Model  > diskdrive.tmp
type diskdrive.tmp > diskdrive.txt

for /f "skip=1 tokens=1,2,3,4,5* " %%i in (diskdrive.txt) do (
    set "formattedValue=%%l %%m %%n"
	set /A a=100+%%j
    if %%j==%SystemDriveID% (
        echo REMOVE %%j !formattedValue:~0,20! %%i -- THIS IS OS DISK
    )else (
		set b=SAS_2K
		if %%k==IDE (
		    set b=SATA_6K
		    ::echo !a:~1! !formattedValue:~0,20! %%i
		    set "line[!a:~1!]=%%j %%i !b! ^(!formattedValue:~0,20!
		)else if %%l==ATA (
			set b=SATA_6K
            set "line[!a:~1!]=%%j %%i !b! !formattedValue:~0,20!
        )else (
            set "line[!a:~1!]=%%j %%i !b! !formattedValue:~0,20!
		)
    )
)

if exist disksort.txt del /Q disksort.txt

::Show array elements
::sort diskdrive.txt
for /F "tokens=2 delims==" %%a in ('set line[') do echo %%a >> disksort.tmp
type disksort.tmp

echo ################
echo Get disksort.tmp file line-------------
echo ################
set file=disksort.tmp
set /a cnt=0
for /f %%a in ('type "%file%"^|find "" /v /c') do set /a cnt=%%a
echo %file% has %cnt% lines

set DiskNum=%cnt%

echo ################
echo Get disksort.txt file-------------
echo ################

set "myfile=disksort.tmp"
set "outputfile=disksort.txt"

for /f "tokens=*" %%a in ('type "%myfile%" ^| find /v /n "" ^& break ^> "%myfile%"') do (
     set "str=%%a
     set "str=!str:]= !"
     set "str=!str:[=!"
     >>%outputfile% echo(!str!
)

echo ################
echo Get 1~%DiskNum%.tmp file-------------
echo ################

for /f "tokens=1,2,3,4,5,6,7" %%i in (disksort.txt) do (
    set work=%%i
	echo i="%%i",j="%%j",k="%%k",l="%%l",m="%%m",n="%%n",o="%%o",
    if "%%o"=="" if "%%n"=="" (
	    echo 11 i="%%i",j="%%j",k="%%k",l="%%l",m="%%m",n="%%n",o="%%o",
	    echo %%j,%%k,%%l,%%m, > !work!.tmp
	    )else if "%%o"=="" (
	        echo 22 i="%%i",j="%%j",k="%%k",l="%%l",m="%%m",n="%%n",o="%%o",
	        echo %%j,%%k,%%l,%%m %%n, > !work!.tmp
	    )else (
	        ::echo 33 i="%%i",j="%%j",k="%%k",l="%%l",m="%%m",n="%%n",o="%%o",
	        ::echo %%j,%%k,%%l,%%m, > !work!.tmp
	)else (
		echo 44 i="%%i",j="%%j",k="%%k",l="%%l",m="%%m",n="%%n",o="%%o",
	    echo %%j,%%k,%%l,%%m %%n %%o, > !work!.tmp
	)
)

echo ################
echo Careate icf_info.tmp file
echo ################

:: Careate icf_info_top.tmp
set TampFileName=icf_info_top
::echo ################
::echo Careate !TampFileName!.tmp
::echo ################
::echo.
echo Version 1.1.0 >> !TampFileName!.tmp
echo 'TEST SETUP ==================================================================== >> !TampFileName!.tmp
echo 'Test Description >> !TampFileName!.tmp
echo. >> !TampFileName!.tmp
echo 'Run Time >> !TampFileName!.tmp
echo '	hours      minutes    seconds >> !TampFileName!.tmp
echo 	0          10         0 >> !TampFileName!.tmp
echo 'Ramp Up Time ^(s^) >> !TampFileName!.tmp
echo 	300 >> !TampFileName!.tmp
echo 'Default Disk Workers to Spawn >> !TampFileName!.tmp
echo 	NUMBER_OF_CPUS >> !TampFileName!.tmp
echo 'Default Network Workers to Spawn >> !TampFileName!.tmp
echo 	0 >> !TampFileName!.tmp
echo 'Record Results >> !TampFileName!.tmp
echo 	ALL >> !TampFileName!.tmp
echo 'Worker Cycling >> !TampFileName!.tmp
echo '	start      step       step type >> !TampFileName!.tmp
echo 	1          1          LINEAR >> !TampFileName!.tmp
echo 'Disk Cycling >> !TampFileName!.tmp
echo '	start      step       step type >> !TampFileName!.tmp
echo 	1          1          LINEAR >> !TampFileName!.tmp
echo 'Queue Depth Cycling >> !TampFileName!.tmp
echo '	start      end        step       step type >> !TampFileName!.tmp
echo 	1          32         2          EXPONENTIAL >> !TampFileName!.tmp
echo 'Test Type >> !TampFileName!.tmp
echo 	NORMAL >> !TampFileName!.tmp
echo 'END test setup >> !TampFileName!.tmp
echo 'RESULTS DISPLAY =============================================================== >> !TampFileName!.tmp
echo 'Record Last Update Results,Update Frequency,Update Type >> !TampFileName!.tmp
echo 	DISABLED,1,WHOLE_TEST >> !TampFileName!.tmp
echo 'Bar chart 1 statistic >> !TampFileName!.tmp
echo 	Total I/Os per Second >> !TampFileName!.tmp
echo 'Bar chart 2 statistic >> !TampFileName!.tmp
echo 	Total MBs per Second (Decimal) >> !TampFileName!.tmp
echo 'Bar chart 3 statistic >> !TampFileName!.tmp
echo 	Average I/O Response Time (ms) >> !TampFileName!.tmp
echo 'Bar chart 4 statistic >> !TampFileName!.tmp
echo 	Maximum I/O Response Time (ms) >> !TampFileName!.tmp
echo 'Bar chart 5 statistic >> !TampFileName!.tmp
echo 	%% CPU Utilization (total) >> !TampFileName!.tmp
echo 'Bar chart 6 statistic >> !TampFileName!.tmp
echo 	Total Error Count >> !TampFileName!.tmp
echo 'END results display >> !TampFileName!.tmp
echo 'ACCESS SPECIFICATIONS ========================================================= >> !TampFileName!.tmp
echo 'Access specification name,default assignment >> !TampFileName!.tmp
echo 	SAS_2K,NONE >> !TampFileName!.tmp
echo 'size,%% of size,%% reads,%% random,delay,burst,align,reply >> !TampFileName!.tmp
echo 	2048,100,0,100,0,1,2048,0 >> !TampFileName!.tmp
echo 'Access specification name,default assignment >> !TampFileName!.tmp
echo 	SATA_6K,NONE >> !TampFileName!.tmp
echo 'size,%% of size,%% reads,%% random,delay,burst,align,reply >> !TampFileName!.tmp
echo 	6144,100,0,100,0,1,6144,0 >> !TampFileName!.tmp
echo 'END access specifications >> !TampFileName!.tmp
echo 'MANAGER LIST ================================================================== >> !TampFileName!.tmp
echo 'Manager ID, manager name >> !TampFileName!.tmp
echo 	1, >> !TampFileName!.tmp
echo 'Manager network address >> !TampFileName!.tmp
echo. >> !TampFileName!.tmp

:: Careate icf_Worker_info_top.tmp
set TampFileName=icf_Worker_info_top
::echo ################
::echo Careate !TampFileName!.tmp
::echo ################
::echo.
echo 'Worker >> !TampFileName!.tmp
::echo     Worker 1 >> !TampFileName!.tmp

:: Careate icf_Worker_info_mid_top.tmp
set TampFileName=icf_Worker_info_mid_top
::echo ################
::echo Careate !TampFileName!.tmp
::echo ################
::echo.
echo 'Worker type >> !TampFileName!.tmp
echo 	DISK >> !TampFileName!.tmp
echo 'Default target settings for worker >> !TampFileName!.tmp
echo 'Number of outstanding IOs,test connection rate,transactions per connection,use fixed seed,fixed seed value >> !TampFileName!.tmp
::echo 	1,DISABLED,1,DISABLED,0 >> !TampFileName!.tmp

:: Careate icf_Worker_info_mid_mid.tmp
set TampFileName=icf_Worker_info_mid_mid
::echo ################
::echo Careate !TampFileName!.tmp
::echo ################
::echo.
echo 'Disk maximum size,starting sector,Data pattern >> !TampFileName!.tmp
echo 	0,0,0 >> !TampFileName!.tmp
echo 'End default target settings for worker >> !TampFileName!.tmp
echo 'Assigned access specs >> !TampFileName!.tmp
::echo 	SAS_2K >> !TampFileName!.tmp

:: Careate icf_Worker_info_mid_bot.tmp
set TampFileName=icf_Worker_info_mid_bot
echo 'End assigned access specs >> !TampFileName!.tmp
echo 'Target assignments >> !TampFileName!.tmp
echo 'Target >> !TampFileName!.tmp
::echo     1: "" >> !TampFileName!.tmp

:: Careate icf_Worker_info_bot.tmp
set TampFileName=icf_Worker_info_bot
::echo ################
::echo Careate !TampFileName!.tmp
::echo ################
::echo.
echo 'Target type >> !TampFileName!.tmp
echo 	DISK >> !TampFileName!.tmp
echo 'End target >> !TampFileName!.tmp
echo 'End target assignments >> !TampFileName!.tmp
echo 'End worker >> !TampFileName!.tmp

:: Careate icf_info_bot.tmp
set TampFileName=icf_info_bot
::echo ################
::echo Careate !TampFileName!.tmp
::echo ################
::echo.
echo 'End manager >> !TampFileName!.tmp
echo 'END manager list >> !TampFileName!.tmp
echo Version 1.1.0 >> !TampFileName!.tmp

echo ################
echo disksort.txt has xx lines
echo ################

set file=disksort.txt
set /a cnt=0
for /f %%a in ('type "%file%"^|find "" /v /c') do set /a cnt=%%a
echo %file% has %cnt% lines

set DiskNum=%cnt%

::echo ################
::echo get spic disk info
::echo ################

::for /f "tokens=1,2,3,4,5* " %%i in (1.tmp) do (
::    set TargetID=%%i
::	set TargetFW=%%j
::	set AssignedName=%%k
::   if "%%n"=="" if "%%m"=="" (
::	    set TargetName=%%l
::	)else if "%%n"=="" (
::	    set TargetName=%%l %%m
::	)else (
::	    set TargetName=%%l %%m %%n
::	)
::)

echo ################
echo Start carte many icf file
echo ################
echo.

::set DiskNum=5
set FileName=00

for /L %%i in (1, 1, %DiskNum%) do (
    set "formattedValue=000000%%i"
	set FileName=!formattedValue:~-2!
    echo !FileName!.icf
    for /f "tokens=1,2,3,4 delims=," %%a in (%%i.tmp) do (
        set TargetID=%%a
	    set TargetFW=%%b
		set AssignedName=%%c
	    set TargetName=%%d
    )
	echo !AssignedName! !TargetID! !TargetName! !TargetFW!
	:: imput icf_info_top
	type icf_info_top.tmp                               >> !FileName!.icf
	    :: imput icf_Worker_info_top(outstanding=8)
	    type icf_Worker_info_top.tmp                    >> !FileName!.icf
        echo     Worker 1 >> !FileName!.icf
	    :: imput icf_Worker_mid_top
	    type icf_Worker_info_mid_top.tmp                >> !FileName!.icf
	    echo 	8,DISABLED,1,DISABLED,0 >> !FileName!.icf
	    :: imput icf_Worker_info_mid_mid
	    type icf_Worker_info_mid_mid.tmp                >> !FileName!.icf
		echo 	!AssignedName! >> !FileName!.icf
	    :: imput icf_Worker_info_mid_bot
	    type icf_Worker_info_mid_bot.tmp                >> !FileName!.icf
	    echo     !TargetID!: "!TargetName! !TargetFW!" >> !FileName!.icf
	    :: imput icf_Worker_info_bot
	    type icf_Worker_info_bot.tmp                    >> !FileName!.icf
	:: imput Other Worker info(outstanding=1)
	for /L %%j in (2, 1, %DiskNum%) do (
	    if %%i==%%j (
		    for /f "tokens=1,2,3,4 delims=," %%a in (1.tmp) do (
                set TargetID=%%a
	            set TargetFW=%%b
	            set AssignedName=%%c
	            set TargetName=%%d
			)
	        echo !AssignedName! !TargetID! !TargetName! !TargetFW!
		    :: imput icf_Worker_info_top
	        type icf_Worker_info_top.tmp                >> !FileName!.icf
            echo     Worker %%j >> !FileName!.icf
	        :: imput icf_Worker_mid_top
	        type icf_Worker_info_mid_top.tmp            >> !FileName!.icf
	        echo 	1,DISABLED,1,DISABLED,0 >> !FileName!.icf
	        :: imput icf_Worker_info_mid_mid
	        type icf_Worker_info_mid_mid.tmp                >> !FileName!.icf
		    echo 	!AssignedName! >> !FileName!.icf
			:: imput icf_Worker_info_mid_bot
	        type icf_Worker_info_mid_bot.tmp            >> !FileName!.icf
	        echo    !TargetID!: "!TargetName! !TargetFW!" >> !FileName!.icf
		    :: imput icf_Worker_info_bot
	        type icf_Worker_info_bot.tmp                >> !FileName!.icf
	    )else (
		    for /f "tokens=1,2,3,4 delims=," %%a in (%%j.tmp) do (
                set TargetID=%%a
	            set TargetFW=%%b
	            set AssignedName=%%c
	            set TargetName=%%d
            )
	        echo !AssignedName! !TargetID! !TargetName! !TargetFW!
		    :: imput icf_Worker_info_top
	        type icf_Worker_info_top.tmp                >> !FileName!.icf
            echo     Worker %%j >> !FileName!.icf
	        :: imput icf_Worker_mid_top
	        type icf_Worker_info_mid_top.tmp            >> !FileName!.icf
	        echo 	1,DISABLED,1,DISABLED,0 >> !FileName!.icf
	        :: imput icf_Worker_info_mid_mid
	        type icf_Worker_info_mid_mid.tmp                >> !FileName!.icf
		    echo 	!AssignedName! >> !FileName!.icf
			:: imput icf_Worker_info_mid_bot
	        type icf_Worker_info_mid_bot.tmp            >> !FileName!.icf
	        echo    !TargetID!: "!TargetName! !TargetFW!" >> !FileName!.icf
	        :: imput icf_Worker_info_bot
	        type icf_Worker_info_bot.tmp                >> !FileName!.icf
	    )
	)
	 type icf_info_bot.tmp                              >> !FileName!.icf
)

echo.
echo ################
echo Complete carte many icf file
echo ################
echo.

if exist *.tmp del /Q *.tmp

PAUSE

fix over 10 target cant access

fix over 10 target cant access


@echo off
setlocal
set ConfigDir=%1
set SetupDir=%2
set OutputDir=%3
copy /-Y %ConfigDir%*.xml %OutputDir%
copy /Y %ConfigDir%*.ps1 %OutputDir%
if not exist %OutputDir%formats\ mkdir %OutputDir%formats\
if not exist %OutputDir%lang\ mkdir %OutputDir%lang\
if not exist %OutputDir%progress\ mkdir %OutputDir%progress\
if not exist %OutputDir%tools\ mkdir %OutputDir%tools\
copy /Y %ConfigDir%formats\*.xml %OutputDir%formats\
copy /Y %ConfigDir%lang\*.xml %OutputDir%lang\
copy /Y %ConfigDir%progress\*.lua %OutputDir%progress\
copy /Y %ConfigDir%tools\*.xml %OutputDir%tools\
copy /Y %SetupDir%*.portable %OutputDir%
endlocal

@echo off
setlocal
set ConfigDir=%1
set SetupDir=%2
set OutputDir=%3
copy /Y %ConfigDir%*.ps1 %OutputDir%
if not exist %OutputDir%formats\ mkdir %OutputDir%formats\
if not exist %OutputDir%lang\ mkdir %OutputDir%lang\
if not exist %OutputDir%progress\ mkdir %OutputDir%progress\
if not exist %OutputDir%tools\ mkdir %OutputDir%tools\
copy /Y %ConfigDir%formats\*.xml %OutputDir%formats\
copy /Y %ConfigDir%lang\*.xml %OutputDir%lang\
copy /Y %ConfigDir%progress\*.lua %OutputDir%progress\
copy /Y %ConfigDir%tools\*.xml %OutputDir%tools\
copy /Y %SetupDir%*.portable %OutputDir%
endlocal

Fix copy script

Fix copy script


@echo off
setlocal

set ConfigDir=%1
set OutputDir=%2
set BuildSystem=%3
set FormatsFolder=formats
set LangFolder=formats
set ProgressFolder=formats
set ToolsFolder=formats

echo ConfigDir: %ConfigDir%
echo OutputDir: %OutputDir%
echo BuildSystem: %BuildSystem%

if %BuildSystem% == CI goto done

copy /Y %ConfigDir%*.ps1 %OutputDir%

if not exist %OutputDir%%FormatsFolder%\ mkdir %OutputDir%%FormatsFolder%\
if not exist %OutputDir%%LangFolder%\ mkdir %OutputDir%%LangFolder%\
if not exist %OutputDir%%ProgressFolder%\ mkdir %OutputDir%%ProgressFolder%\
if not exist %OutputDir%%ToolsFolder%\ mkdir %OutputDir%%ToolsFolder%\

copy /Y %ConfigDir%%FormatsFolder%\*.xml %OutputDir%%FormatsFolder%\
copy /Y %ConfigDir%%LangFolder%\*.xml %OutputDir%%LangFolder%\
copy /Y %ConfigDir%%ProgressFolder%\*.lua %OutputDir%%ProgressFolder%\
copy /Y %ConfigDir%%ToolsFolder%\*.xml %OutputDir%%ToolsFolder%\
copy /Y %ConfigDir%*.portable %OutputDir%

:done
endlocal

@echo off
setlocal

set ConfigDir=%1
set OutputDir=%2
set BuildSystem=%3
set FormatsFolder=formats
set LangFolder=lang
set ProgressFolder=progress
set ToolsFolder=tools

echo ConfigDir: %ConfigDir%
echo OutputDir: %OutputDir%
echo BuildSystem: %BuildSystem%

if %BuildSystem% == CI goto done

copy /Y %ConfigDir%*.ps1 %OutputDir%

if not exist %OutputDir%%FormatsFolder%\ mkdir %OutputDir%%FormatsFolder%\
if not exist %OutputDir%%LangFolder%\ mkdir %OutputDir%%LangFolder%\
if not exist %OutputDir%%ProgressFolder%\ mkdir %OutputDir%%ProgressFolder%\
if not exist %OutputDir%%ToolsFolder%\ mkdir %OutputDir%%ToolsFolder%\

copy /Y %ConfigDir%%FormatsFolder%\*.xml %OutputDir%%FormatsFolder%\
copy /Y %ConfigDir%%LangFolder%\*.xml %OutputDir%%LangFolder%\
copy /Y %ConfigDir%%ProgressFolder%\*.lua %OutputDir%%ProgressFolder%\
copy /Y %ConfigDir%%ToolsFolder%\*.xml %OutputDir%%ToolsFolder%\
copy /Y %ConfigDir%*.portable %OutputDir%

:done
endlocal

Fix copy config script

Fix copy config script


cd source

:: Can't seem to determine msys2 due to bug in config.guess,
:: BUT runConfigureICU expects cygwin, so we just pretend we are
bash runConfigureICU Cygwin/MSVC --build=x86_64-pc-cygwin --prefix=%CYGWIN_PREFIX%
:: Ignore errorlevel - there are warnings about various things missing
:: which we don't actually seem to need. Just keep going...
::if errorlevel 1 exit 1

make -j%CPU_COUNT%
if errorlevel 1 exit 1

make install
if errorlevel 1 exit 1

cd source

:: I don't understand but running rc.exe fails without this...
set MSYS_RC_MODE=1

:: Can't seem to determine msys2 due to bug in config.guess,
:: BUT runConfigureICU expects cygwin, so we just pretend we are
bash runConfigureICU Cygwin/MSVC --build=x86_64-pc-cygwin --prefix=${CYGWIN_PREFIX}/Library
:: Ignore errorlevel - there are warnings about various things missing
:: which we don't actually seem to need. Just keep going...
::if errorlevel 1 exit 1

make -j%CPU_COUNT%
if errorlevel 1 exit 1

make install
if errorlevel 1 exit 1

set MSYS_RC_MODE so rc.exe runs

set MSYS_RC_MODE so rc.exe runs


@echo off

echo Checking for the existence of variables.bat
if NOT EXIST "variables.bat" (
    rem No variable file defined
    shutdown -s -t 0
    exit
)

echo Loading variables.bat
rem Source variables
call %~dp0\variables.bat
if "%reportURLFile%"=="" (
    rem No report URL file defined
    shutdown -s -t 0
    exit
)
if "%srcDir%"=="" (
    rem No source dir defined
    shutdown -s -t 0
    exit
)

SET /P reportURL=<%reportURLFile%
SET userAgent="CCX/CI_BOT"
SET logFile="%reportFolder%/log.html"

echo Copy files over to local disk
call :postStatus "preparation" "Copy testsuite to local folder"
rem robocopy returns a non-zero exit code even on success (https://ss64.com/nt/robocopy-exit.html), so we cannot use executeCommand
call robocopy %suiteSrcDir% %suiteDstDir% /e >> "%logFile%"

call :postStatus "preparation" "Copy code to local folder"
call robocopy %srcDir% %dstDir% /e >> "%logFile%"
call :executeCommand cd %dstDir%

echo Compile CCX
call :postStatus "building" "Compiling CCExtractor"
rem Go to Windows build folder
call :executeCommand cd windows
rem Build CCExtractor using the sln script
call :executeCommand "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild" ccextractor.sln
rem check whether installation successful
if EXIST Debug\ccextractorwin.exe (
    cd Debug
    rem Run testsuite
    echo Run tests
    call :postStatus "testing" "Running tests"
    call :executeCommand cd %suiteDstDir%
    call :executeCommand "%tester%" --entries "%testFile%" --executable "%dstDir%\windows\Debug\ccextractorwin.exe" --tempfolder "%tempFolder%" --timeout 3000 --reportfolder "%reportFolder%" --resultfolder "%resultFolder%" --samplefolder "%sampleFolder%" --method Server --url "%reportURL%"
    call :postStatus "completed" "Ran all tests"
    echo Done running tests
    rem Shut down
    timeout 5
    shutdown -s -t 0
    exit
)
else
(
    call :haltAndCatchFire "build"
)
echo End
EXIT %ERRORLEVEL%
rem Functions to shorten the script

rem Fail when the exit status is not equal to 0
:executeCommand
echo %* >> "%logFile%"
%* >> "%logFile%"
SET /A status=%ERRORLEVEL%
IF %status% NEQ 0 (
    echo Command exited with %status% >> "%logFile%"
    rem No message needed as we post before anyway
    call :haltAndCatchFire ""
)
EXIT /B 0

rem Post status to the server
:postStatus
echo "Posting status %~1 (message: %~2) to the server"
curl -s -A "%userAgent%" --data "type=progress&status=%~1&message=%~2" -w "\n" "%reportURL%" >> "%logFile%"
EXIT /B 0

rem Exit script and post abort status
:haltAndCatchFire
echo "Halt and catch fire (reason: %~1)"
call :postStatus "canceled" "%~1"
timeout 5
echo Post log
curl -s -A "%userAgent%" --form "type=logupload" --form "file=@%logFile%" -w "\n" "%reportURL%"
rem Shut down, but only in 10 seconds, to give the time to finish the post status
timeout 10
shutdown -s -t 0
EXIT 0

@echo off

echo Checking for the existence of variables.bat
if NOT EXIST "variables.bat" (
    rem No variable file defined
    shutdown -s -t 0
    exit
)

echo Loading variables.bat
rem Source variables
call %~dp0\variables.bat
if "%reportURLFile%"=="" (
    rem No report URL file defined
    shutdown -s -t 0
    exit
)
if "%srcDir%"=="" (
    rem No source dir defined
    shutdown -s -t 0
    exit
)

SET /P reportURL=<%reportURLFile%
SET userAgent="CCX/CI_BOT"
SET logFile="%reportFolder%/log.html"

echo Copy files over to local disk
call :postStatus "preparation" "Copy testsuite to local folder"
rem robocopy returns a non-zero exit code even on success (https://ss64.com/nt/robocopy-exit.html), so we cannot use executeCommand
call robocopy %suiteSrcDir% %suiteDstDir% /e >> "%logFile%"

call :postStatus "preparation" "Copy code to local folder"
call robocopy %srcDir% %dstDir% /e >> "%logFile%"
call :executeCommand cd %dstDir%

echo Compile CCX using cmake
call :postStatus "building" "Compiling CCExtractor using cmake"
rem making a build folder
mkdir build
cd build
rem Compiling using cmake from src source to build repo
cmake ../src
rem Building CCExtractor
cmake --build . --config Debug --target ccextractor
if EXIST Debug\ccextractor.exe (
	call :postStatus "building" "Successful build using cmake"
)
else (
	call :postStatus "building" "Failed to build using cmake"
)
cd ..
rmdir /Q/S build

echo Compile CCX
call :postStatus "building" "Compiling CCExtractor"
rem Go to Windows build folder
call :executeCommand cd windows
rem Build CCExtractor using the sln script
call :executeCommand "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild" ccextractor.sln
rem check whether installation successful
if EXIST Debug\ccextractorwin.exe (
    cd Debug
    rem Run testsuite
    echo Run tests
    call :postStatus "testing" "Running tests"
    call :executeCommand cd %suiteDstDir%
    call :executeCommand "%tester%" --entries "%testFile%" --executable "%dstDir%\windows\Debug\ccextractorwin.exe" --tempfolder "%tempFolder%" --timeout 3000 --reportfolder "%reportFolder%" --resultfolder "%resultFolder%" --samplefolder "%sampleFolder%" --method Server --url "%reportURL%"
    call :postStatus "completed" "Ran all tests"
    echo Done running tests
    rem Shut down
    timeout 5
    shutdown -s -t 0
    exit
)
else
(
    call :haltAndCatchFire "build"
)
echo End
EXIT %ERRORLEVEL%
rem Functions to shorten the script

rem Fail when the exit status is not equal to 0
:executeCommand
echo %* >> "%logFile%"
%* >> "%logFile%"
SET /A status=%ERRORLEVEL%
IF %status% NEQ 0 (
    echo Command exited with %status% >> "%logFile%"
    rem No message needed as we post before anyway
    call :haltAndCatchFire ""
)
EXIT /B 0

rem Post status to the server
:postStatus
echo "Posting status %~1 (message: %~2) to the server"
curl -s -A "%userAgent%" --data "type=progress&status=%~1&message=%~2" -w "\n" "%reportURL%" >> "%logFile%"
EXIT /B 0

rem Exit script and post abort status
:haltAndCatchFire
echo "Halt and catch fire (reason: %~1)"
call :postStatus "canceled" "%~1"
timeout 5
echo Post log
curl -s -A "%userAgent%" --form "type=logupload" --form "file=@%logFile%" -w "\n" "%reportURL%"
rem Shut down, but only in 10 seconds, to give the time to finish the post status
timeout 10
shutdown -s -t 0
EXIT 0

Add cmake check on Windows CI (#95)

[IMPROVEMENT] Add cmake check on Windows CI  (#95)

Adds a check in the CI for building cmake