dir "C:\Program Files (x86)\Microsoft Visual Studio 12.0"
call "C:\Program Files (x86)\Microsoft Visual Studio\2013\Community\VC\Auxiliary\Build\vcvars32.bat"
cl /MD /LD /EHsc /Fe:arma3urlfetch.dll^
    src\common.cpp^
    src\arguments.cpp^
    src\requests.cpp^
    src\clients.cpp^
    src\output.cpp^
    src\handler.cpp^
    src\main.cpp^
    /DCURL_STATICLIB^
    /I include\windows\x86^
    lib\windows\libcurl_a.lib^
    /std:c++17
rm *.obj
rm *.lib
rm *.exp

dir "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\"
call "C:\Program Files (x86)\Microsoft Visual Studio\2013\Community\VC\Auxiliary\Build\vcvars32.bat"
cl /MD /LD /EHsc /Fe:arma3urlfetch.dll^
    src\common.cpp^
    src\arguments.cpp^
    src\requests.cpp^
    src\clients.cpp^
    src\output.cpp^
    src\handler.cpp^
    src\main.cpp^
    /DCURL_STATICLIB^
    /I include\windows\x86^
    lib\windows\libcurl_a.lib^
    /std:c++17
rm *.obj
rm *.lib
rm *.exp

update build.bat

update build.bat


ECHO OFF
SET PATH=%PATH%;%PROJECT_HOME%\misc\env\user\win32\scripts
REM SET PATH=%PATH%;C:\Dev\vagrant\bin
ECHO User Environment Setup.

ECHO OFF
SET PATH=%PATH%;%PROJECT_HOME%\misc\env\user\win32\scripts
REM SET PATH=%PATH%;C:\Dev\vagrant\bin
SET PATH=%PATH%;C:\cygwin64\bin
ECHO User Environment Setup.

Add cygwin to env path for windows dev

Add cygwin to env path for windows dev


SET ROOT_DIR=%CD%
SET ESCAPED_ROOT_DIR=%ROOT_DIR:\=\\%
SET /p VERSION=<%ROOT_DIR%\cli\VERSION

SET PATH=C:\Program Files\GnuWin32\bin;%PATH%
SET PATH=C:\Program Files (x86)\Inno Setup 5;%PATH%

REM You must have added to your Inno Setup a Signtool: (http://revolution.screenstepslive.com/s/revolution/m/10695/l/95041-signing-installers-you-create-with-inno-setup)
REM Name: "signtool", Command: "signtool.exe $p"
REM This is to add "signtool.exe" to your path, so it does not need to be fully qualified in the configuration above
SET PATH=C:\Program Files (x86)\Windows Kits\10\bin\x64;%PATH%

sed -i -e "s/VERSION/%VERSION%/" %ROOT_DIR%\cli\installers\windows\windows-installer-x64.iss
sed -i -e "s/CF_SOURCE/%ESCAPED_ROOT_DIR%\\cf.exe/" %ROOT_DIR%\cli\installers\windows\windows-installer-x64.iss
sed -i -e "s/SIGNTOOL_CERT_PASSWORD/%SIGNTOOL_CERT_PASSWORD%/" %ROOT_DIR%\cli\installers\windows\windows-installer-x64.iss
sed -i -e "s/SIGNTOOL_CERT_PATH/%SIGNTOOL_CERT_PATH%/" %ROOT_DIR%\cli\installers\windows\windows-installer-x64.iss

pushd %ROOT_DIR%\cf-cli-binaries
	gzip -d cf-cli-binaries.tgz
	tar -xvf cf-cli-binaries.tar
	MOVE cf-cli_winx64.exe ..\cf.exe
	MOVE cf-cli_win32.exe ..\cf.exe
popd

ISCC %ROOT_DIR%\cli\installers\windows\windows-installer-x64.iss

MOVE %ROOT_DIR%\cli\installers\windows\Output\mysetup.exe cf_installer.exe

zip %ROOT_DIR%\winstallers\cf-cli-installer_winx64.zip cf_installer.exe

sed -i -e "s/VERSION/%VERSION%/" %ROOT_DIR%\cli\installers\windows\windows-installer-x86.iss
sed -i -e "s/CF_SOURCE/%ESCAPED_ROOT_DIR%\\cf.exe/" %ROOT_DIR%\cli\installers\windows\windows-installer-x86.iss
sed -i -e "s/SIGNTOOL_CERT_PASSWORD/%SIGNTOOL_CERT_PASSWORD%/" %ROOT_DIR%\cli\installers\windows\windows-installer-x86.iss
sed -i -e "s/SIGNTOOL_CERT_PATH/%SIGNTOOL_CERT_PATH%/" %ROOT_DIR%\cli\installers\windows\windows-installer-x86.iss

ISCC %ROOT_DIR%\cli\installers\windows\windows-installer-x86.iss

MOVE %ROOT_DIR%\cli\installers\windows\Output\mysetup.exe cf_installer.exe

zip %ROOT_DIR%\winstallers\cf-cli-installer_win32.zip cf_installer.exe

SET ROOT_DIR=%CD%
SET ESCAPED_ROOT_DIR=%ROOT_DIR:\=\\%
SET /p VERSION=<%ROOT_DIR%\cli\VERSION

SET PATH=C:\Program Files\GnuWin32\bin;%PATH%
SET PATH=C:\Program Files (x86)\Inno Setup 5;%PATH%

REM You must have added to your Inno Setup a Signtool: (http://revolution.screenstepslive.com/s/revolution/m/10695/l/95041-signing-installers-you-create-with-inno-setup)
REM Name: "signtool", Command: "signtool.exe $p"
REM This is to add "signtool.exe" to your path, so it does not need to be fully qualified in the configuration above
SET PATH=C:\Program Files (x86)\Windows Kits\10\bin\x64;%PATH%

sed -i -e "s/VERSION/%VERSION%/" %ROOT_DIR%\cli\installers\windows\windows-installer-x64.iss
sed -i -e "s/CF_SOURCE/%ESCAPED_ROOT_DIR%\\cf.exe/" %ROOT_DIR%\cli\installers\windows\windows-installer-x64.iss
sed -i -e "s/SIGNTOOL_CERT_PASSWORD/%SIGNTOOL_CERT_PASSWORD%/" %ROOT_DIR%\cli\installers\windows\windows-installer-x64.iss
sed -i -e "s/SIGNTOOL_CERT_PATH/%SIGNTOOL_CERT_PATH%/" %ROOT_DIR%\cli\installers\windows\windows-installer-x64.iss

pushd %ROOT_DIR%\cf-cli-binaries
	gzip -d cf-cli-binaries.tgz
	tar -xvf cf-cli-binaries.tar
	MOVE cf-cli_winx64.exe ..\cf.exe
popd

ISCC %ROOT_DIR%\cli\installers\windows\windows-installer-x64.iss

MOVE %ROOT_DIR%\cli\installers\windows\Output\mysetup.exe cf_installer.exe

zip %ROOT_DIR%\winstallers\cf-cli-installer_winx64.zip cf_installer.exe

sed -i -e "s/VERSION/%VERSION%/" %ROOT_DIR%\cli\installers\windows\windows-installer-x86.iss
sed -i -e "s/CF_SOURCE/%ESCAPED_ROOT_DIR%\\cf.exe/" %ROOT_DIR%\cli\installers\windows\windows-installer-x86.iss
sed -i -e "s/SIGNTOOL_CERT_PASSWORD/%SIGNTOOL_CERT_PASSWORD%/" %ROOT_DIR%\cli\installers\windows\windows-installer-x86.iss
sed -i -e "s/SIGNTOOL_CERT_PATH/%SIGNTOOL_CERT_PATH%/" %ROOT_DIR%\cli\installers\windows\windows-installer-x86.iss

pushd %ROOT_DIR%\cf-cli-binaries
	MOVE cf-cli_win32.exe ..\cf.exe
popd

ISCC %ROOT_DIR%\cli\installers\windows\windows-installer-x86.iss

MOVE %ROOT_DIR%\cli\installers\windows\Output\mysetup.exe cf_installer.exe

zip %ROOT_DIR%\winstallers\cf-cli-installer_win32.zip cf_installer.exe

package correct binary in windows installers

[fix #127217631]


:: Init Script for cmd.exe
:: Sets some nice defaults
:: Created as part of cmder project

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

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

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

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

:: Prepare for git-for-windows

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

:: Check if msysgit is installed
@if exist "%ProgramFiles%\Git" (
    set "GIT_INSTALL_ROOT=%ProgramFiles%\Git"
) else if exist "%ProgramFiles(x86)%\Git" (
    set "GIT_INSTALL_ROOT=%ProgramFiles(x86)%\Git"
) else if exist "%CMDER_ROOT%\vendor" (
    set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows"
)

:: Add git to the path
@if defined GIT_INSTALL_ROOT (
    set "PATH=%GIT_INSTALL_ROOT%\bin;%GIT_INSTALL_ROOT%\usr\bin;%GIT_INSTALL_ROOT%\share\vim\vim74;%PATH%"
    :: define SVN_SSH so we can use git svn with ssh svn repositories
    if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"
)

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

:: Add aliases
@doskey /macrofile="%CMDER_ROOT%\config\aliases"

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

@if defined CMDER_START (
    @cd /d "%CMDER_START%"
) else (
    @if "%CD%\" == "%CMDER_ROOT%" (
        @cd /d "%HOME%"
    )
)

:: @call "%CMDER_ROOT%/bin/agent.cmd"

:: Init Script for cmd.exe
:: Sets some nice defaults
:: Created as part of cmder project

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

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

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

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

:: Prepare for git-for-windows

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

:: Check if msysgit is installed
@if exist "%ProgramFiles%\Git" (
    set "GIT_INSTALL_ROOT=%ProgramFiles%\Git"
) else if exist "%ProgramFiles(x86)%\Git" (
    set "GIT_INSTALL_ROOT=%ProgramFiles(x86)%\Git"
) else if exist "%CMDER_ROOT%\vendor" (
    set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows"
)

:: Add git to the path
@if defined GIT_INSTALL_ROOT (
    set "PATH=%GIT_INSTALL_ROOT%\bin;%GIT_INSTALL_ROOT%\usr\bin;%GIT_INSTALL_ROOT%\share\vim\vim74;%PATH%"
    :: define SVN_SSH so we can use git svn with ssh svn repositories
    if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"
)

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

:: Add aliases
@doskey /macrofile="%CMDER_ROOT%\config\aliases"

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

@if defined CMDER_START (
    @cd /d "%CMDER_START%"
) else (
    @if "%CD%\" == "%CMDER_ROOT%" (
        @cd /d "%HOME%"
    )
)

:: @call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd"

call git's own ssh-agent script instead of our own


@echo off

Rem https://docs.microsoft.com/en-us/windows/wsl/wsl2-install
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Create fixing-docker.bat

Create fixing-docker.bat


cd "%~dp0"
setlocal enabledelayedexpansion
set limit=0
if !CONFIGURATION!=="Debug" set limit=3
if !CONFIGURATION!=="Release" set limit=100
if !limit!==0 goto bad
for /L %%x in (1, 1, !limit!) do (
   echo:Run number %%x
   "src\!CONFIGURATION!\mytest.exe"
   if errorlevel 1 goto fail
)
goto :eof
:bad
echo:Bad value for %%CONFIGURATION%%
exit /b 1
:fail
set q=!ERRORLEVEL!
echo:Test failed with error !q!
exit /b !q!

cd "%~dp0"
setlocal enabledelayedexpansion
set limit=0
echo:Config is !CONFIGURATION!
if !CONFIGURATION!==Debug set limit=3
if !CONFIGURATION!==Release set limit=100
if !limit!==0 goto bad
for /L %%x in (1, 1, !limit!) do (
   echo:Run number %%x
   "src\!CONFIGURATION!\mytest.exe"
   if errorlevel 1 goto fail
)
goto :eof
:bad
echo:Bad value for %%CONFIGURATION%%
exit /b 1
:fail
set q=!ERRORLEVEL!
echo:Test failed with error !q!
exit /b !q!

Fix batch script

Fix batch script


mkdir build
cd build

cmake ^
    -G "Ninja" ^
    -DCMAKE_C_COMPILER=clang-cl ^
    -DCMAKE_CXX_COMPILER=clang-cl ^
    -DBoost_NO_BOOST_CMAKE=ON ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DDCGP_BUILD_TESTS=no ^
    -DDCGP_BUILD_EXAMPLES=no ^
    ..

cmake --build . -- -v

cmake --build . --target install

cd ..
mkdir build_python
cd build_python

cmake ^
    -G "Ninja" ^
    -DCMAKE_C_COMPILER=clang-cl ^
    -DCMAKE_CXX_COMPILER=clang-cl ^
    -DBoost_NO_BOOST_CMAKE=ON ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DDCGP_BUILD_DCGP=no ^
    -DDCGP_BUILD_DCGPY=yes ^
    -DDCGP_CXX_FLAGS_EXTRA="-D_copysign=copysign -Dand=&& -Dnot=!" ^
    ..

cmake --build . -- -v

cmake --build . --target install

mkdir build
cd build

cmake ^
    -G "Ninja" ^
    -DCMAKE_C_COMPILER=clang-cl ^
    -DCMAKE_CXX_COMPILER=clang-cl ^
    -DBoost_NO_BOOST_CMAKE=ON ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DDCGP_BUILD_TESTS=no ^
    -DDCGP_BUILD_EXAMPLES=no ^
    ..

cmake --build . -- -v

cmake --build . --target install

cd ..
mkdir build_python
cd build_python

cmake ^
    -G "Ninja" ^
    -DCMAKE_C_COMPILER=clang-cl ^
    -DCMAKE_CXX_COMPILER=clang-cl ^
    -DBoost_NO_BOOST_CMAKE=ON ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DDCGP_BUILD_DCGP=no ^
    -DDCGP_BUILD_DCGPY=yes ^
    "-DDCGP_CXX_FLAGS_EXTRA=-D_copysign=copysign -Dand=&& -Dnot=!" ^
    ..

cmake --build . -- -v

cmake --build . --target install

Fix quotes

Fix quotes


@echo off

goto entry

:entry

set base=%~dp0

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

@echo off

goto entry

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

  exit /b 0

:fail_usage
  echo.
  call :usage
  exit /b 1

:fail
  exit /b 1

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

:entry

set base=%~dp0

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

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

Add bolt build usage. Implement help mode


cd ./src/AspNet.Mvc.Formatters.Protobuf
dnu restore
dnu build
dnu pack
dnu publish
cd ..
cd ..
cd ./artifacts

cd ./src/AspNet.Mvc.Formatters.Protobuf
dnu restore
dnu build
dnu pack
dnu publish
cd ..
cd ..
xcopy ./artifacts/bin/AspNet.Mvc.Formatters.Protobuf ./src/AspNet.Mvc.Formatters.Protobuf /s

Add bin copy

Add bin copy


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

@echo "Starting Windows build"

cd /d %~dp0
cd ..

call npm install -g npm@latest || goto :error
call npm install || goto :error
call npm run test || goto :error

goto :EOF

:error
exit /b 1

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

@echo "Starting Windows build"

cd /d %~dp0
cd ..

@rem The image we're currently running has a broken version of Node.js enabled
@rem by nvm (v10.15.3), which has no npm bin. This hack uses the functional
@rem Node v8.9.1 to install npm@latest, it then uses this version of npm to
@rem install npm for v10.15.3.
call nvm use v8.9.1 || goto :error
call node C:\Users\kbuilder\AppData\Roaming\nvm-ps\versions\v8.9.1\node_modules\npm-bootstrap\bin\npm-cli.js i npm -g || goto :error
call nvm use v10.15.3 || goto :error
call node C:\Users\kbuilder\AppData\Roaming\nvm-ps\versions\v8.9.1\node_modules\npm\bin\npm-cli.js i npm -g || goto :error

call npm install || goto :error
call npm run test || goto :error

goto :EOF

:error
exit /b 1

build: patch Windows container, fixing Node 10 (#314)


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

@echo "Starting Windows build"

cd /d %~dp0
cd ..

call npm install -g npm@5 || goto :error

call npm install || goto :error
call npm run test || goto :error

goto :EOF

:error
exit /b 1

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

@echo "Starting Windows build"

cd /d %~dp0
cd ..

call npm install -g npm@latest || goto :error
call npm install || goto :error
call npm run test || goto :error

goto :EOF

:error
exit /b 1

use latest npm on Windows (#576)

chore: use latest npm on Windows (#576)


@setlocal enabledelayedexpansion

@if [%1] == [] goto exit_with_usage

set utils_dir=%~1

nist-sp-800-38a.py --path "%utils_dir%" || exit /b !errorlevel!
cavp.py            --path "%utils_dir%" || exit /b !errorlevel!
file.py            --path "%utils_dir%" || exit /b !errorlevel!

@goto :eof

:exit_with_usage
@echo usage: %0 UTILS_DIR >&2
@exit /b 1

add all_test.bat

add all_test.bat


@echo off
setlocal
set PkgDir=%~dp0
set PATH=%PATH%;%PkgDir%
set Version=4.0.0-alpha1

cd %PkgDir%\System.Waf\Release

nuget Push System.Waf.Core.%Version%.nupkg
nuget Push System.Waf.UnitTesting.Core.%Version%.nupkg
nuget Push System.Waf.Wpf.%Version%.nupkg
nuget Push System.Waf.UnitTesting.Wpf.%Version%.nupkg

Add NuPush.bat

Add NuPush.bat


nmake -nologo -f ifdef.mak

move ifdef.exe %CINTSYSDIR%\ifdef.exe

nmake -nologo -f ifdef.mak clean

test write permission

test write permission

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@22284 27541ba8-7e3a-0410-8455-c3a389f83636


@echo off
Title Shinken installation script for Windows V0.1
echo.
cls
REM Shinken installation script for Windows
REM
REM
REM  V 0.1
REM
REM Copyright (C) 2011 :
REM        * E. Beaulieu - Shinken_install_batch@zebux.org
REM
REM Shinken installationscript for Windows is free software: you can redistribute it and/or modify
REM it under the terms of the GNU Affero General Public License as published by
REM the Free Software Foundation, either version 3 of the License, or
REM (at your option) any later version.
REM
REM Shinken installationscript for Windows is distributed in the hope that it will be useful,
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
REM GNU Affero General Public License for more details.
REM
REM You should have received a copy of the GNU Affero General Public License
REM along with Shinken.  If not, see <http://www.gnu.org/licenses/>.
REM

:: Path initialisation
set PATH_ROOT=c:\shinken\
set PATH_BIN=c:\shinken\bin
set PATH_INSTSRV= c:\shinken\windows

:: Check if the user want to install or remove Shinken
set /p CONT=Do you want [I]ntsall or [R]emove Shinken? (I/R)
if not *%CONT:~0,1% == *I if not *%CONT:~0,1% == *i goto remove

:: Check needed programs
if exist %PATH_INSTSRV%\instsrv.exe goto main
echo You need to install  %PATH_INSTSRV%\instsrv.exe from Microsoft Website !!!
echo  http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD
start /w iexplorer  http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD
pause
exit

:main
cls
color 71
echo                ͻ
echo
echo                     Installation de Shinken
echo
echo                 Please do not close this Windows!
echo
echo                ͼ

:: Check path installation
if exist %PATH_ROOT% goto begin
echo The Shinken directory : %PATH_ROOT% does not exist ! Please create it and reinstall Shinken.
pause
goto end

:begin
move /Y %PATH_BIN%\shinken-poller %PATH_BIN%\shinken-poller.py
move /Y %PATH_BIN%\shinken-reactionner %PATH_BIN%\shinken-reactionner.py
move /Y %PATH_BIN%\shinken-scheduler %PATH_BIN%\shinken-scheduler.py
move /Y %PATH_BIN%\shinken-arbiter %PATH_BIN%\shinken-arbiter.py
move /Y %PATH_BIN%\shinken-broker %PATH_BIN%\shinken-broker.py
move /Y %PATH_BIN%\shinken-receiver %PATH_BIN%\shinken-receiver.py

%PATH_INSTSRV%\instsrv.exe "Shinken-Arbiter" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Scheduler" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Poller" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Reactionner" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Broker" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Receiver" %PATH_INSTSRV%"\srvany.exe"

echo Windows Registry Editor Version 5.00  > %tmp%\Shinken_registry.reg
echo. >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Arbiter\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe"  >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken"  >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-arbiter.py -c c:\\shinken\\etc\\nagios-windows.ini"  >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Broker\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-broker.py -c c:\\shinken\\etc\\brokerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Poller\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-poller.py -c c:\\shinken\\etc\\pollerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Reactionner\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-reactionner.py -c c:\\shinken\\etc\\reactionnerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Reactionner\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-reactionner.py -c c:\\shinken\\etc\\reactionnerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Scheduler\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-scheduler.py -c c:\\shinken\\etc\\schedulerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg

start /w reg inmport %tmp%\Shinken_registry.reg

pause
goto end

:remove
::Remove shinken
color C0
Echo
echo                ͻ
echo
echo                     Shinken uninstallation
echo
echo                                  Please wait ...
echo
echo                ͼ

%PATH_INSTSRV%\instsrv.exe "Shinken-Arbiter" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Scheduler" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Poller" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Reactionner" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Broker" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Receiver" remove

echo Please remove the Shinken directory : %PATH_ROOT%
pause
exit

:end
color
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo   Please Go to http://www.shinken-monitoring.org/wiki/shinken_10min_start for how to launch the discovery pass
pause

@echo off
Title Shinken installation script for Windows V0.1
echo.
cls
REM Shinken installation script for Windows
REM
REM
REM  V 0.1
REM
REM Copyright (C) 2011 :
REM        * E. Beaulieu - Shinken_install_batch@zebux.org
REM
REM Shinken installationscript for Windows is free software: you can redistribute it and/or modify
REM it under the terms of the GNU Affero General Public License as published by
REM the Free Software Foundation, either version 3 of the License, or
REM (at your option) any later version.
REM
REM Shinken installationscript for Windows is distributed in the hope that it will be useful,
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
REM GNU Affero General Public License for more details.
REM
REM You should have received a copy of the GNU Affero General Public License
REM along with Shinken.  If not, see <http://www.gnu.org/licenses/>.
REM

:: Path initialisation
set PATH_ROOT=c:\shinken\
set PATH_BIN=c:\shinken\bin
set PATH_INSTSRV= c:\shinken\windows

:: Check if the user want to install or remove Shinken
set /p CONT=Do you want [I]ntsall or [R]emove Shinken? (I/R)
if not *%CONT:~0,1% == *I if not *%CONT:~0,1% == *i goto remove

:: Check needed programs
if exist %PATH_INSTSRV%\instsrv.exe goto main
echo You need to install  %PATH_INSTSRV%\instsrv.exe from Microsoft Website !!!
echo  http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD
pause
exit

:main
cls
color 71
echo                ͻ
echo
echo                     Installation de Shinken
echo
echo                 Please do not close this Windows!
echo
echo                ͼ

:: Check path installation
if exist %PATH_ROOT% goto begin
echo The Shinken directory : %PATH_ROOT% does not exist ! Please create it and reinstall Shinken.
pause
goto end

:begin
move /Y %PATH_BIN%\shinken-poller %PATH_BIN%\shinken-poller.py
move /Y %PATH_BIN%\shinken-reactionner %PATH_BIN%\shinken-reactionner.py
move /Y %PATH_BIN%\shinken-scheduler %PATH_BIN%\shinken-scheduler.py
move /Y %PATH_BIN%\shinken-arbiter %PATH_BIN%\shinken-arbiter.py
move /Y %PATH_BIN%\shinken-broker %PATH_BIN%\shinken-broker.py
move /Y %PATH_BIN%\shinken-receiver %PATH_BIN%\shinken-receiver.py

%PATH_INSTSRV%\instsrv.exe "Shinken-Arbiter" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Scheduler" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Poller" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Reactionner" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Broker" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Receiver" %PATH_INSTSRV%"\srvany.exe"

echo Windows Registry Editor Version 5.00  > %tmp%\Shinken_registry.reg
echo. >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Arbiter\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe"  >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken"  >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-arbiter.py -c c:\\shinken\\etc\\nagios-windows.ini"  >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Broker\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-broker.py -c c:\\shinken\\etc\\brokerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Poller\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-poller.py -c c:\\shinken\\etc\\pollerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Reactionner\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-reactionner.py -c c:\\shinken\\etc\\reactionnerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Reactionner\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-reactionner.py -c c:\\shinken\\etc\\reactionnerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Scheduler\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-scheduler.py -c c:\\shinken\\etc\\schedulerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg

start /w reg inmport %tmp%\Shinken_registry.reg

pause
goto end

:remove
::Remove shinken
color C0
Echo
echo                ͻ
echo
echo                     Shinken uninstallation
echo
echo                                  Please wait ...
echo
echo                ͼ

%PATH_INSTSRV%\instsrv.exe "Shinken-Arbiter" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Scheduler" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Poller" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Reactionner" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Broker" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Receiver" remove

echo Please remove the Shinken directory : %PATH_ROOT%
pause
exit

:end
color
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo   Please Go to http://www.shinken-monitoring.org/wiki/shinken_10min_start for how to launch the discovery pass
pause

Fix : remove a bad call to iexplore to the windows install script.


### test_app.bat - 201x - Fabien Desert ###
version = "1.2.0-b"
build_hour = "11H00"

echo "Build ${build_hour}"
echo "version ${version}"

update minor version

update minor version


Update Premake

Update Premake


npm install ..\Filter & ^
 npm install ..\OverTlecBuilder &^
 npm install ..\Route &^
 npm install ..\SerializationContext &^
 npm install ..\TestTransport &^
 npm install ..\TlecBuilder &^
 npm install ..\Tlgr &^
 npm install ..\Tlht &^
 npm install ..\TlhtBuilder &^
 npm install ..\TlkeBuilder &^
 npm install ..\modules

install modules bat

install modules bat

--HG--
branch : typescript_modules


remove echo from pandoc script

remove echo from pandoc script


@echo off

goto entry

:usage
  echo usage: bolt test [-v^|--verbose] CONFIG TEST ...
  echo.
  echo arguments:
  echo   CONFIG                   The bolt configuration file to be used for tests
  echo   TEST                     A test file. The test file may contain one or more
  echo                            test methods. Test files have an `assert` library
  echo                            exposed to them automatically.
  echo.
  echo example:
  echo   Run all atomic tests.
  echo.
  echo     bolt test config/bolt/atomic.js src/test/js/atomic/**/*.js
  echo.
  echo.
  echo   Run all browser tests.
  echo.
  echo     bolt test config/bolt/browser.js src/test/js/browser/**/*.js

  exit /b 0

:fail_usage
  echo.
  call :usage
  exit /b 1

:fail
  exit /b 1

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

:entry

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

set verbose=false

if "%~1"=="-v" (set verbose=true
  shift && goto done_flags)
if "%~1"=="--verbose" (set verbose=true
  shift && goto done_flags)

if "%~1"=="" goto done_flags

set flag=%~1
if "%flag:~0,1%"=="-" echo Unknown flag [%flag%] && goto fail_usage

:done_flags

if "%~2"=="" echo Not enough arguments, must specify configuration and at least one test file. && goto fail_usage

set config=%~1
shift

if not exist "%config%" echo Could not find config file [%config%] && exit /b 10
call :is_dir "%config%"
if %errorlevel%==0 echo Could not find config file [%config%] && exit /b 10

for %%i in (node.exe) do set node=%%~$PATH:i
if "%node%"=="" echo error: node.js is not on the system path && goto fail

set remaining=
:remaining
if "%~1"=="" goto end_remaining
set remaining=%remaining% "%~1"
shift
goto remaining
:end_remaining

setlocal enabledelayedexpansion
for %%i in (%remaining%) do (
  if not exist %%i echo Could not find test file [%%i] && exit /b 20
  call :is_dir %%i
  if !errorlevel!==0 echo Could not find test file [%%i] && exit /b 20)
endlocal

"%node%" "%base%bolt-test.js" "%verbose%" "%config%" %remaining%

@echo off

goto entry

:usage
  echo usage: bolt test [-v^|--verbose] CONFIG TEST ...
  echo.
  echo arguments:
  echo   CONFIG                   The bolt configuration file to be used for tests
  echo   TEST                     A test file. The test file may contain one or more
  echo                            test methods. Test files have an `assert` library
  echo                            exposed to them automatically.
  echo.
  echo example:
  echo   Run all atomic tests.
  echo.
  echo     bolt test config/bolt/atomic.js src/test/js/atomic/**/*.js
  echo.
  echo.
  echo   Run all browser tests.
  echo.
  echo     bolt test config/bolt/browser.js src/test/js/browser/**/*.js

  exit /b 0

:fail_usage
  echo.
  call :usage
  exit /b 1

:fail
  exit /b 1

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

:entry

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

set verbose=false

if "%~1"=="-v" (set verbose=true
  shift && goto done_flags)
if "%~1"=="--verbose" (set verbose=true
  shift && goto done_flags)

if "%~1"=="" goto done_flags

set flag=%~1
if "%flag:~0,1%"=="-" echo Unknown flag [%flag%] && goto fail_usage

:done_flags

if "%~2"=="" echo Not enough arguments, must specify configuration and at least one test file. && goto fail_usage

set config=%~1
shift

if not exist "%config%" echo Could not find config file [%config%] && exit /b 10
call :is_dir "%config%"
if %errorlevel%==0 echo Could not find config file [%config%] && exit /b 10

for %%i in (node.exe) do set node=%%~$PATH:i
if "%node%"=="" echo error: node.js is not on the system path && goto fail

set remaining=
:remaining
if "%~1"=="" goto end_remaining
for /F "usebackq delims=" %%s in (`glob -w "%~1"`) do set globbed=%%s
set remaining=%remaining% %globbed%
shift
goto remaining
:end_remaining

setlocal enabledelayedexpansion
for %%i in (%remaining%) do (
  if not exist %%i echo Could not find test file [%%i] && exit /b 20
  call :is_dir %%i
  if !errorlevel!==0 echo Could not find test file [%%i] && exit /b 20)
endlocal

"%node%" "%base%bolt-test.js" "%verbose%" "%config%" %remaining%

Add globbing support for test file arguments passed into bolt test


::
:: ownCloud
::
:: @author Thomas Müller
:: @author Tobias Ramforth (translated into Windows batch file)
::
:: @copyright 2012, 2013 Thomas Müller thomas.mueller@tmit.eu
::

@echo off

set BASEDIR=%~dp0
set DATADIR=data-autotest

:: create autoconfig for sqlite, mysql, postgresql and mssql
echo ^<?php                                      > .\tests\autoconfig-sqlite.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-sqlite.php
echo  'installed' ^=^> false^,                   >> .\tests\autoconfig-sqlite.php
echo  'dbtype' ^=^> 'sqlite'^,                   >> .\tests\autoconfig-sqlite.php
echo  'dbtableprefix' ^=^> 'oc_'^,               >> .\tests\autoconfig-sqlite.php
echo  'adminlogin' ^=^> 'admin'^,                >> .\tests\autoconfig-sqlite.php
echo  'adminpass' ^=^> 'admin'^,                 >> .\tests\autoconfig-sqlite.php
echo  'directory' ^=^> '%BASEDIR%%DATADIR%'^,    >> .\tests\autoconfig-sqlite.php
echo ^)^;                                        >> .\tests\autoconfig-sqlite.php

echo ^<?php                                      > .\tests\autoconfig-mysql.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-mysql.php
echo   'installed' ^=^> false^,                  >> .\tests\autoconfig-mysql.php
echo   'dbtype' ^=^> 'mysql'^,                   >> .\tests\autoconfig-mysql.php
echo   'dbtableprefix' ^=^> 'oc_'^,              >> .\tests\autoconfig-mysql.php
echo   'adminlogin' ^=^> 'admin'^,               >> .\tests\autoconfig-mysql.php
echo   'adminpass' ^=^> 'admin'^,                >> .\tests\autoconfig-mysql.php
echo   'directory' ^=^> '%BASEDIR%%DATADIR%'^,   >> .\tests\autoconfig-mysql.php
echo   'dbuser' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mysql.php
echo   'dbname' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mysql.php
echo   'dbhost' ^=^> 'localhost'^,               >> .\tests\autoconfig-mysql.php
echo   'dbpass' ^=^> 'owncloud'^,                >> .\tests\autoconfig-mysql.php
echo ^)^;                                        >> .\tests\autoconfig-mysql.php

echo ^<?php                                      > .\tests\autoconfig-pgsql.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-pgsql.php
echo   'installed' ^=^> false^,                  >> .\tests\autoconfig-pgsql.php
echo   'dbtype' ^=^> 'pgsql'^,                   >> .\tests\autoconfig-pgsql.php
echo   'dbtableprefix' ^=^> 'oc_'^,              >> .\tests\autoconfig-pgsql.php
echo   'adminlogin' ^=^> 'admin'^,               >> .\tests\autoconfig-pgsql.php
echo   'adminpass' ^=^> 'admin'^,                >> .\tests\autoconfig-pgsql.php
echo   'directory' ^=^> '%BASEDIR%%DATADIR%'^,   >> .\tests\autoconfig-pgsql.php
echo   'dbuser' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-pgsql.php
echo   'dbname' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-pgsql.php
echo   'dbhost' ^=^> 'localhost'^,               >> .\tests\autoconfig-pgsql.php
echo   'dbpass' ^=^> 'owncloud'^,                >> .\tests\autoconfig-pgsql.php
echo ^)^;                                        >> .\tests\autoconfig-pgsql.php

echo ^<?php                                      > .\tests\autoconfig-mssql.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-mssql.php
echo   'installed' ^=^> false^,                  >> .\tests\autoconfig-mssql.php
echo   'dbtype' ^=^> 'mssql'^,                   >> .\tests\autoconfig-mssql.php
echo   'dbtableprefix' ^=^> 'oc_'^,              >> .\tests\autoconfig-mssql.php
echo   'adminlogin' ^=^> 'admin'^,               >> .\tests\autoconfig-mssql.php
echo   'adminpass' ^=^> 'admin'^,                >> .\tests\autoconfig-mssql.php
echo   'directory' ^=^> '%BASEDIR%%DATADIR%'^,   >> .\tests\autoconfig-mssql.php
echo   'dbuser' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mssql.php
echo   'dbname' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mssql.php
echo   'dbhost' ^=^> 'localhost\sqlexpress'^,    >> .\tests\autoconfig-mssql.php
echo   'dbpass' ^=^> 'owncloud'^,                >> .\tests\autoconfig-mssql.php
echo ^)^;                                        >> .\tests\autoconfig-mssql.php

echo localhost:5432:*:oc_autotest:owncloud > %APPDATA%\postgresql\pgpass.conf

::
:: start test execution
::
if [%1] == [] (
	echo "Running on all database backends"
	call:execute_tests "sqlite" "%2"
	call:execute_tests "mysql" "%2"
	call:execute_tests "mssql" "%2"
	::call:execute_tests "ora" "%2"
	call:execute_tests "pgsql" "%2"
) else (
	call:execute_tests "%1" "%2"
)

goto:eof

:execute_tests
	@echo on

	@echo "Setup environment for %~1 testing ..."
	:: back to root folder
	cd %BASEDIR%

	:: revert changes to tests\data
	git checkout tests\data\*

	:: reset data directory
	rmdir /s /q %DATADIR%
	md %DATADIR%

	:: remove the old config file
	:: del /q /f config\config.php
	copy /y tests\preseed-config.php config\config.php

	:: drop database
	if "%~1" == "mysql" mysql -u oc_autotest -powncloud -e "DROP DATABASE oc_autotest"

	if "%~1" == "pgsql" dropdb -h localhost -p 5432 -U oc_autotest -w oc_autotest

	:: we assume a sqlexpress installation
	if "%~1" == "mssql" sqlcmd -S localhost\sqlexpress -U oc_autotest -P owncloud -Q "IF EXISTS (SELECT name FROM sys.databases WHERE name=N'oc_autotest') DROP DATABASE [oc_autotest]"

	:: copy autoconfig
	copy /y %BASEDIR%\tests\autoconfig-%~1.php %BASEDIR%\config\autoconfig.php

	:: trigger installation
	@echo INDEX
	call php -f index.php
	@echo END INDEX

	::test execution
	@echo "Testing with %~1 ..."
	cd tests
	rmdir /s /q coverage-html-%~1
	md coverage-html-%~1
	php -f enable_all.php

        :: no external files on windows for now
        cd ..
        php occ app:disable files_external
        cd tests

	call phpunit --bootstrap bootstrap.php --configuration phpunit-autotest.xml --log-junit autotest-results-%~1.xml --coverage-clover autotest-clover-%~1.xml --coverage-html coverage-html-%~1 %~2

	@echo "Done with testing %~1 ..."
	cd %BASEDIR%
goto:eof

::
:: NOTES on mysql:
::  - CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY 'owncloud';
::  - grant access permissions: grant all on oc_autotest.* to 'oc_autotest'@'localhost';
::
:: NOTES on pgsql:
::  - su - postgres
::  - createuser -P (enter username and password and enable superuser)
::  - to enable dropdb I decided to add following line to pg_hba.conf (this is not the safest way but I don't care for the testing machine):
:: local	all	all	trust
::
:: NOTES on mssql:
::  we assume the usage of a local installed sqlexpress
::  create a user 'oc_autotest' with password 'owncloud' and assign the server role 'dbcreator'
::  make sure the sqlserver is configured to allow sql authentication
::

::
:: ownCloud
::
:: @author Thomas Müller
:: @author Tobias Ramforth (translated into Windows batch file)
::
:: @copyright 2012, 2013 Thomas Müller thomas.mueller@tmit.eu
::

@echo off

set BASEDIR=%~dp0
set DATADIR=%BASEDIR%data-autotest

:: create autoconfig for sqlite, mysql, postgresql and mssql
echo ^<?php                                      > .\tests\autoconfig-sqlite.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-sqlite.php
echo  'installed' ^=^> false^,                   >> .\tests\autoconfig-sqlite.php
echo  'dbtype' ^=^> 'sqlite'^,                   >> .\tests\autoconfig-sqlite.php
echo  'dbtableprefix' ^=^> 'oc_'^,               >> .\tests\autoconfig-sqlite.php
echo  'adminlogin' ^=^> 'admin'^,                >> .\tests\autoconfig-sqlite.php
echo  'adminpass' ^=^> 'admin'^,                 >> .\tests\autoconfig-sqlite.php
echo  'directory' ^=^> '%DATADIR%'^,             >> .\tests\autoconfig-sqlite.php
echo ^)^;                                        >> .\tests\autoconfig-sqlite.php

echo ^<?php                                      > .\tests\autoconfig-mysql.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-mysql.php
echo   'installed' ^=^> false^,                  >> .\tests\autoconfig-mysql.php
echo   'dbtype' ^=^> 'mysql'^,                   >> .\tests\autoconfig-mysql.php
echo   'dbtableprefix' ^=^> 'oc_'^,              >> .\tests\autoconfig-mysql.php
echo   'adminlogin' ^=^> 'admin'^,               >> .\tests\autoconfig-mysql.php
echo   'adminpass' ^=^> 'admin'^,                >> .\tests\autoconfig-mysql.php
echo   'directory' ^=^> '%DATADIR%'^,            >> .\tests\autoconfig-mysql.php
echo   'dbuser' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mysql.php
echo   'dbname' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mysql.php
echo   'dbhost' ^=^> 'localhost'^,               >> .\tests\autoconfig-mysql.php
echo   'dbpass' ^=^> 'owncloud'^,                >> .\tests\autoconfig-mysql.php
echo ^)^;                                        >> .\tests\autoconfig-mysql.php

echo ^<?php                                      > .\tests\autoconfig-pgsql.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-pgsql.php
echo   'installed' ^=^> false^,                  >> .\tests\autoconfig-pgsql.php
echo   'dbtype' ^=^> 'pgsql'^,                   >> .\tests\autoconfig-pgsql.php
echo   'dbtableprefix' ^=^> 'oc_'^,              >> .\tests\autoconfig-pgsql.php
echo   'adminlogin' ^=^> 'admin'^,               >> .\tests\autoconfig-pgsql.php
echo   'adminpass' ^=^> 'admin'^,                >> .\tests\autoconfig-pgsql.php
echo   'directory' ^=^> '%DATADIR%'^,            >> .\tests\autoconfig-pgsql.php
echo   'dbuser' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-pgsql.php
echo   'dbname' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-pgsql.php
echo   'dbhost' ^=^> 'localhost'^,               >> .\tests\autoconfig-pgsql.php
echo   'dbpass' ^=^> 'owncloud'^,                >> .\tests\autoconfig-pgsql.php
echo ^)^;                                        >> .\tests\autoconfig-pgsql.php

echo ^<?php                                      > .\tests\autoconfig-mssql.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-mssql.php
echo   'installed' ^=^> false^,                  >> .\tests\autoconfig-mssql.php
echo   'dbtype' ^=^> 'mssql'^,                   >> .\tests\autoconfig-mssql.php
echo   'dbtableprefix' ^=^> 'oc_'^,              >> .\tests\autoconfig-mssql.php
echo   'adminlogin' ^=^> 'admin'^,               >> .\tests\autoconfig-mssql.php
echo   'adminpass' ^=^> 'admin'^,                >> .\tests\autoconfig-mssql.php
echo   'directory' ^=^> '%DATADIR%'^,            >> .\tests\autoconfig-mssql.php
echo   'dbuser' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mssql.php
echo   'dbname' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mssql.php
echo   'dbhost' ^=^> 'localhost\sqlexpress'^,    >> .\tests\autoconfig-mssql.php
echo   'dbpass' ^=^> 'owncloud'^,                >> .\tests\autoconfig-mssql.php
echo ^)^;                                        >> .\tests\autoconfig-mssql.php

echo localhost:5432:*:oc_autotest:owncloud > %APPDATA%\postgresql\pgpass.conf

::
:: start test execution
::
if [%1] == [] (
	echo "Running on all database backends"
	call:execute_tests "sqlite" "%2"
	call:execute_tests "mysql" "%2"
	call:execute_tests "mssql" "%2"
	::call:execute_tests "ora" "%2"
	call:execute_tests "pgsql" "%2"
) else (
	call:execute_tests "%1" "%2"
)

goto:eof

:execute_tests
	@echo on

	@echo "Setup environment for %~1 testing ..."
	:: back to root folder
	cd %BASEDIR%

	:: revert changes to tests\data
	git checkout tests\data\*

	:: reset data directory
	rmdir /s /q %DATADIR%
	md %DATADIR%

	:: remove the old config file
	:: del /q /f config\config.php
	copy /y tests\preseed-config.php config\config.php

	:: drop database
	if "%~1" == "mysql" mysql -u oc_autotest -powncloud -e "DROP DATABASE oc_autotest"

	if "%~1" == "pgsql" dropdb -h localhost -p 5432 -U oc_autotest -w oc_autotest

	:: we assume a sqlexpress installation
	if "%~1" == "mssql" sqlcmd -S localhost\sqlexpress -U oc_autotest -P owncloud -Q "IF EXISTS (SELECT name FROM sys.databases WHERE name=N'oc_autotest') DROP DATABASE [oc_autotest]"

	:: copy autoconfig
	copy /y %BASEDIR%\tests\autoconfig-%~1.php %BASEDIR%\config\autoconfig.php

	:: trigger installation
	@echo INDEX
	call php -f index.php
	@echo END INDEX

	::test execution
	@echo "Testing with %~1 ..."
	cd tests
	rmdir /s /q coverage-html-%~1
	md coverage-html-%~1
	php -f enable_all.php

        :: no external files on windows for now
        cd ..
        php occ app:disable files_external
        cd tests

	call phpunit --bootstrap bootstrap.php --configuration phpunit-autotest.xml --log-junit autotest-results-%~1.xml --coverage-clover autotest-clover-%~1.xml --coverage-html coverage-html-%~1 %~2

	@echo "Done with testing %~1 ..."
	cd %BASEDIR%
goto:eof

::
:: NOTES on mysql:
::  - CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY 'owncloud';
::  - grant access permissions: grant all on oc_autotest.* to 'oc_autotest'@'localhost';
::
:: NOTES on pgsql:
::  - su - postgres
::  - createuser -P (enter username and password and enable superuser)
::  - to enable dropdb I decided to add following line to pg_hba.conf (this is not the safest way but I don't care for the testing machine):
:: local	all	all	trust
::
:: NOTES on mssql:
::  we assume the usage of a local installed sqlexpress
::  create a user 'oc_autotest' with password 'owncloud' and assign the server role 'dbcreator'
::  make sure the sqlserver is configured to allow sql authentication
::

Allow overwriting DATADIR completly so ramdisk can be used


@echo off

set LEIN_VERSION=1.4.0-SNAPSHOT

rem it is possible to set LEIN_JAR variable manually
rem if it's set, don't overwrite it
if "x%LEIN_JAR%" == "x" goto SET_LEIN
goto ARGS_HANDLING

:SET_LEIN
set LEIN_DIR=%~dp0
set LEIN_JAR=%LEIN_DIR%leiningen-%LEIN_VERSION%-standalone.jar

:ARGS_HANDLING
if "x%1" == "xself-install" goto SELF_INSTALL
if "x%1" == "xupgrade"      goto NO_UPGRADE

if not exist "%LEIN_JAR%" goto NO_LEIN_JAR

rem ##################################################
rem count number of command line arguments
rem
set ARGCOUNT=0
for %%a in (%*) do set /a ARGCOUNT+=1
rem ##################################################

rem ##################################################
rem add jars found under "lib" directory to CLASSPATH
rem

call :FIND_DIR_CONTAINING_UPWARDS project.clj

if "%DIR_CONTAINING%" neq "" cd "%DIR_CONTAINING%"

setLocal EnableDelayedExpansion
set CP="
for /R ./lib %%a in (*.jar) do (
   set CP=!CP!;%%a
)
set CP=!CP!"

set CLASSPATH="%LEIN_JAR%";%CP%;"%CLASSPATH%"
if "x%DEBUG%" == "x" goto RUN
echo CLASSPATH=%CLASSPATH%
rem ##################################################

:RUN
if "x%1" == "xrepl" goto RUN_REPL
if "%ARGCOUNT%" == "2" goto RUN_ARG2
if "%ARGCOUNT%" == "3" goto RUN_ARG3
java -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\")"
goto EOF

:RUN_ARG2
java -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\" \"%2\")"
goto EOF

:RUN_ARG3
java -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\" \"%2\" \"%3\")"
goto EOF

:RUN_REPL
%RLWRAP% java -client %JAVA_OPTS% -cp src;classes;%CLASSPATH% clojure.main %2 %3 %4
goto EOF

:NO_LEIN_JAR
echo.
echo "%LEIN_JAR%" can not be found.
echo You can try running "lein self-install"
echo or change LEIN_JAR environment variable
echo or edit lein.bat to set appropriate LEIN_JAR path.
echo.
goto EOF

:SELF_INSTALL
if exist "%LEIN_JAR%" (
    echo %LEIN_JAR% already exists. Delete and retry.
    goto EOF
)
set HTTP_CLIENT=wget -O
wget>nul 2>&1
if ERRORLEVEL 9009 (
    curl>nul 2>&1
    if ERRORLEVEL 9009 goto NO_HTTP_CLIENT
    set HTTP_CLIENT=curl -f -L -o
)
set LEIN_JAR_URL=http://github.com/downloads/technomancy/leiningen/leiningen-%LEIN_VERSION%-standalone.jar
%HTTP_CLIENT% "%LEIN_JAR%" %LEIN_JAR_URL%
if ERRORLEVEL 1 (
    del "%LEIN_JAR%">nul 2>&1
    goto DOWNLOAD_FAILED
)
goto EOF

:DOWNLOAD_FAILED
echo.
echo *** DOWNLOAD FAILED! Check URL/Version. ***
echo.
goto EOF

:NO_HTTP_CLIENT
echo.
echo ERROR: Wget/Curl not found. Make sure at least either of Wget and Curl is
echo        installed and is in PATH. You can get them from URLs below:
echo.
echo Wget: "http://users.ugent.be/~bpuype/wget/"
echo Curl: "http://curl.haxx.se/dlwiz/?type=bin&os=Win32&flav=-&ver=2000/XP"
echo.
goto EOF

:NO_UPGRADE
echo.
echo Upgrade feature is not available on Windows. Please edit the value of
echo variable LEIN_VERSION in file %~f0
echo then run "lein self-install".
echo.
goto EOF

rem Find directory containing filename supplied in first argument
rem looking in current directory, and looking up the parent
rem chain until we find it, or run out
rem returns result in %DIR_CONTAINING%
rem empty string if we don't find it
:FIND_DIR_CONTAINING_UPWARDS
set DIR_CONTAINING=%CD%
set LAST_DIR=

:LOOK_AGAIN
if "%DIR_CONTAINING%" == "%LAST_DIR%" (
    rem didn't find it
    set DIR_CONTAINING=
    goto :EOF
)

if EXIST "%DIR_CONTAINING%\%1" (
    rem found it - use result in DIR_CONTAINING
    goto :EOF
)

set LAST_DIR=%DIR_CONTAINING%
call :GET_PARENT_PATH "%DIR_CONTAINING%\.."
set DIR_CONTAINING=%PARENT_PATH%
goto :LOOK_AGAIN

:GET_PARENT_PATH
set PARENT_PATH=%~f1
goto :EOF

:EOF

Convert lein.bat to DOS-style line endings.


add less command

add less command


REM ---
REM Emit the version info for dotnet, for debugging purposes
REM ---
dotnet --version

dotnet-sonarscanner begin ^
    /k:"ZptSharp" ^
    /v:AppVeyor_build_%APPVEYOR_BUILD_NUMBER% ^
    /o:craigfowler-github ^
    /s:%APPVEYOR_BUILD_FOLDER%\.SonarQube.Analysis.xml ^
    /d:sonar.host.url="https://sonarcloud.io" ^
    /d:sonar.login=%SONARCLOUD_SECRET_KEY% ^
    /d:sonar.cs.nunit.reportsPaths=%APPVEYOR_BUILD_FOLDER%\.TestResults\TestResults.*.xml ^
    /d:sonar.cs.opencover.reportsPaths=%APPVEYOR_BUILD_FOLDER%\.TestResults\coverage.opencover.*.xml ^
    /d:sonar.branch.name=%APPVEYOR_REPO_BRANCH%

REM ---
REM The tests have to be run separately, otherwise the NUnit test results file
REM and the Coverlet results files will end up overwriting one another, which is
REM rather frustrating.
REM This workaround runs them separately and moves the results files to 'safe' filenames after
REM they have been executed.
REM ---

dotnet test ZptSharp.Tests ^
    /p:CollectCoverage=true ^
    /p:CoverletOutputFormat=\"json,opencover\" ^
    /p:CoverletOutput=\"../.TestResults/\" ^
    --test-adapter-path:. ^
    --logger:\"nunit;LogFilePath=../.TestResults\TestResults.xml\"

move .TestResults\TestResults.xml .TestResults\TestResults.ZptSharp.Tests.xml
move .TestResults\coverage.opencover.xml .TestResults\coverage.opencover.ZptSharp.Tests.xml

dotnet test ZptSharp.Mvc5.Tests ^
    /p:CollectCoverage=true ^
    /p:CoverletOutputFormat=\"json,opencover\" ^
    /p:CoverletOutput=\"../.TestResults/\" ^
    --test-adapter-path:. ^
    --logger:\"nunit;LogFilePath=../.TestResults\TestResults.xml\"

move .TestResults\TestResults.xml .TestResults\TestResults.ZptSharp.Mvc5.Tests.xml
move .TestResults\coverage.opencover.xml .TestResults\coverage.opencover.ZptSharp.Mvc5.Tests.xml

REM ---
REM 'Capture' the exit code from dotnet test for later use
REM ---
set exitcode=%errorlevel%

dotnet-sonarscanner end ^
    /d:"sonar.login=%SONARCLOUD_SECRET_KEY%"

REM ---
REM Upload all files in the test results directory to AppVeyor as artifacts
REM ---
FOR %%F IN (.TestResults\*.*) DO appveyor PushArtifact %%F

exit /B %exitcode%

REM ---
REM Emit the version info for dotnet, for debugging purposes
REM ---
dotnet --version

dotnet-sonarscanner begin ^
    /k:"ZptSharp" ^
    /v:AppVeyor_build_%APPVEYOR_BUILD_NUMBER% ^
    /o:craigfowler-github ^
    /s:%APPVEYOR_BUILD_FOLDER%\.SonarQube.Analysis.xml ^
    /d:sonar.host.url="https://sonarcloud.io" ^
    /d:sonar.login=%SONARCLOUD_SECRET_KEY% ^
    /d:sonar.cs.nunit.reportsPaths=%APPVEYOR_BUILD_FOLDER%\.TestResults\TestResults.*.xml ^
    /d:sonar.cs.opencover.reportsPaths=%APPVEYOR_BUILD_FOLDER%\.TestResults\coverage.opencover.*.xml ^
    /d:sonar.branch.name=%APPVEYOR_REPO_BRANCH%

REM ---
REM The tests have to be run separately, otherwise the NUnit test results file
REM and the Coverlet results files will end up overwriting one another, which is
REM rather frustrating.
REM This workaround runs them separately and moves the results files to 'safe' filenames after
REM they have been executed.
REM ---

dotnet test ZptSharp.Tests ^
    /p:CollectCoverage=true ^
    /p:CoverletOutputFormat=\"json,opencover\" ^
    /p:CoverletOutput=\"../.TestResults/\" ^
    --test-adapter-path:. ^
    --logger:\"nunit;LogFilePath=../.TestResults\TestResults.xml\"

REM ---
REM 'Capture' the exit code from dotnet test for later use
REM ---
set generalexitcode=%errorlevel%

move .TestResults\TestResults.xml .TestResults\TestResults.ZptSharp.Tests.xml
move .TestResults\coverage.opencover.xml .TestResults\coverage.opencover.ZptSharp.Tests.xml

dotnet test ZptSharp.Mvc5.Tests ^
    /p:CollectCoverage=true ^
    /p:CoverletOutputFormat=\"json,opencover\" ^
    /p:CoverletOutput=\"../.TestResults/\" ^
    --test-adapter-path:. ^
    --logger:\"nunit;LogFilePath=../.TestResults\TestResults.xml\"

move .TestResults\TestResults.xml .TestResults\TestResults.ZptSharp.Mvc5.Tests.xml
move .TestResults\coverage.opencover.xml .TestResults\coverage.opencover.ZptSharp.Mvc5.Tests.xml

REM ---
REM 'Capture' the exit code from dotnet test for later use
REM ---
set mvcexitcode=%errorlevel%

dotnet-sonarscanner end ^
    /d:"sonar.login=%SONARCLOUD_SECRET_KEY%"

REM ---
REM Upload all files in the test results directory to AppVeyor as artifacts
REM ---
FOR %%F IN (.TestResults\*.*) DO appveyor PushArtifact %%F

REM If both exit codes are zero then this is exit 0, otherwise it will raise an error.
set /A "exitcode=generalexitcode+mvcexitcode"
exit /B %exitcode%

Fix build exit status

Fix build exit status

I realised that I accidentally broke the way in which
the build status is reported.  That means some builds
would have passed when they should have failed.


@ setlocal enableextensions enabledelayedexpansion

@ set VERSIONS_PATH=%USERPROFILE%\Tools
@ set DEFAULT_RUBY_VERSION=2.0.0-p353

:: Search for a .ruby-version file to specify the version of ruby to use
@ set DIRECTORY=%CD%
:SearchForRubyVersion
@ if exist "%DIRECTORY%\.ruby-version" (
	set /p RUBY_VERSION= < "%DIRECTORY%\.ruby-version"
	goto :RubyVersionFound
) else (
	pushd "%DIRECTORY%\.."
	set DIRECTORY=!CD!
	popd
	if "%DIRECTORY:~1,-1%" == ":" goto :RubyVersionNotFound
	goto :SearchForRubyVersion
)

:RubyVersionNotFound
@ set RUBY_VERSION=%DEFAULT_RUBY_VERSION%

:RubyVersionFound

:: Compute how to call Ruby based on the version

@ set RUBY_PATH=%VERSIONS_PATH%\ruby-%RUBY_VERSION%
@ if "%RUBY_VERSION:~0,5%" == "jruby" (
	set RUBY_PATH=%VERSIONS_PATH%\%RUBY_VERSION%
	set SCRIPT="!RUBY_PATH!\bin\jruby.exe" -S "%~n0"
	if exist "!RUBY_PATH!\bin\j%~n0.exe" set SCRIPT="!RUBY_PATH!\bin\j%~n0.exe"
) else (
	set SCRIPT="%RUBY_PATH%\bin\ruby.exe" "%RUBY_PATH%\bin\%~n0"
	if exist "%RUBY_PATH%\bin\%~n0.exe" set SCRIPT="%RUBY_PATH%\bin\%~n0.exe"
)

:: Call the good Ruby
@ call %SCRIPT% %*

@ setlocal enableextensions enabledelayedexpansion

@ set VERSIONS_PATH=%USERPROFILE%\Tools
@ set DEFAULT_RUBY_VERSION=2.0.0-p353

:: Search for a .ruby-version file to specify the version of ruby to use
@ set DIRECTORY=%CD%
:SearchForRubyVersion
@ if exist "%DIRECTORY%\.ruby-version" (
	set /p RUBY_VERSION= < "%DIRECTORY%\.ruby-version"
	goto :RubyVersionFound
) else (
	pushd "%DIRECTORY%\.."
	set DIRECTORY=!CD!
	popd
	if "%DIRECTORY:~1,-1%" == ":" goto :RubyVersionNotFound
	goto :SearchForRubyVersion
)

:RubyVersionNotFound
@ set RUBY_VERSION=%DEFAULT_RUBY_VERSION%

:RubyVersionFound

:: Compute how to call Ruby based on the version

@ set RUBY_PATH=%VERSIONS_PATH%\ruby-%RUBY_VERSION%
@ if "%RUBY_VERSION:~0,5%" == "jruby" (
	set RUBY_PATH=%VERSIONS_PATH%\%RUBY_VERSION%
	set SCRIPT="!RUBY_PATH!\bin\jruby.exe" -S "%~n0"
	if exist "!RUBY_PATH!\bin\j%~n0.exe" set SCRIPT="!RUBY_PATH!\bin\j%~n0.exe"
) else (
	set SCRIPT="%RUBY_PATH%\bin\ruby.exe" "%RUBY_PATH%\bin\%~n0"
	if exist "%RUBY_PATH%\bin\%~n0.exe" set SCRIPT="%RUBY_PATH%\bin\%~n0.exe"
)

:: Save current code page
@ for /f "usebackq tokens=2 delims=:" %%i in (`chcp`) do @ set CURRENTCP=%%i
:: Change current code page to 1252 as it is expected by Ruby
@ chcp 1252 > NUL
:: Call the good Ruby
@ call %SCRIPT% %*
:: Restore old code page
@ chcp %CURRENTCP% > NUL

Call Ruby with code page 1252 in order to support path with accents


python C:\Python27\pyinstaller\pyinstaller.py --onefile --noconsole --icon=resources\img\icon.ico --name=CargoScan  src\main.py

python C:\Python27\pyinstaller\pyinstaller.py --onefile --noconsole --icon=resources\ui\img\icon.ico --name=CargoScan  src\main.py

fix build.bat

fix build.bat


@ECHO OFF
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*"

@ECHO OFF
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE"

Return the error code from build.cmd

Return the error code from build.cmd


@echo off
set DEPENDENCIES_PREFIX=%cd%\dependencies
set BOOST_PREFIX=%DEPENDENCIES_PREFIX%\boost
set PROTOBUF_PREFIX=%DEPENDENCIES_PREFIX%\protobuf
set TMSP_PREFIX=%DEPENDENCIES_PREFIX%\tmsp
set INSTALL_PREFIX=%DEPENDENCIES_PREFIX%\install
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64

if exist "%INSTALL_PREFIX%" (goto done)

pushd "%BOOST_PREFIX%"
call bootstrap.bat
b2 headers
b2 --toolset=msvc-14.0 --prefix="%INSTALL_PREFIX%\debug" --layout=tagged -j8 -a address-model=64 link=static runtime-link=static variant=debug install
b2 --toolset=msvc-14.0 --prefix="%INSTALL_PREFIX%\release" --layout=tagged -j8 -a address-model=64 link=static runtime-link=static variant=release install
popd

pushd "%PROTOBUF_PREFIX%\cmake"
if exist debug (rmdir /s /q debug)
mkdir debug
pushd debug
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX="%INSTALL_PREFIX%\debug" -DCMAKE_BUILD_TYPE=Debug -Dprotobuf_BUILD_TESTS=OFF ..
nmake install
popd
if exist release (rmdir /s /q release)
mkdir release
pushd release
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX="%INSTALL_PREFIX%\release" -DCMAKE_BUILD_TYPE=Release -Dprotobuf_BUILD_TESTS=OFF ..
nmake install
popd
popd

pushd "%TMSP_PREFIX%\types"
mkdir "%INSTALL_PREFIX%\debug\include\tmsp"
"%INSTALL_PREFIX%\release\bin\protoc" --cpp_out="%INSTALL_PREFIX%\debug\include\tmsp" types.proto
mkdir "%INSTALL_PREFIX%\release\include\tmsp"
"%INSTALL_PREFIX%\release\bin\protoc" --cpp_out="%INSTALL_PREFIX%\release\include\tmsp" types.proto
popd

:done

Add build.cmd

Add build.cmd


:: Copyright (c) 2011 The Native Client Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file.

@echo off
setlocal
set HERMETIC_CYGWIN=hermetic_cygwin_1_7_24-1_0
if exist "%~dp0..\cygwin\%HERMETIC_CYGWIN%.installed" goto :skip_cygwin_install
if exist "%~dp0..\tools\BUILD\.gcc-extras-version" del "%~dp0..\tools\BUILD\.gcc-extras-version"
if exist "%~dp0..\tools\BACKPORTS\binutils" rmdir /s /q "%~dp0..\tools\BACKPORTS\binutils"
if exist "%~dp0..\tools\BACKPORTS\gcc" rmdir /s /q "%~dp0..\tools\BACKPORTS\gcc"
if exist "%~dp0..\tools\BACKPORTS\gdb" rmdir /s /q "%~dp0..\tools\BACKPORTS\gdb"
if exist "%~dp0..\tools\BACKPORTS\glibc" rmdir /s /q "%~dp0..\tools\BACKPORTS\glibc"
if exist "%~dp0..\tools\BACKPORTS\linux-headers-for-nacl" rmdir /s /q "%~dp0..\tools\BACKPORTS\linux-headers-for-nacl"
if exist "%~dp0..\tools\BACKPORTS\newlib" rmdir /s /q "%~dp0..\tools\BACKPORTS\newlib"
if not exist "%~dp0..\cygwin" goto :dont_remove_cygwin
rmdir /s /q "%~dp0..\cygwin"
if errorlevel 1 goto :rmdir_fail
mkdir "%~dp0..\cygwin"
:dont_remove_cygwin
cscript //nologo //e:jscript "%~dp0get_file.js" https://commondatastorage.googleapis.com/nativeclient-mirror/nacl/cygwin_mirror/%HERMETIC_CYGWIN%.exe "%~dp0%HERMETIC_CYGWIN%.exe"
if errorlevel 1 goto :download_fail
:download_success
start /WAIT %~dp0%HERMETIC_CYGWIN%.exe /DEVEL /S /D=%~dp0..\cygwin
if errorlevel 1 goto :install_fail
set CYGWIN=nodosfilewarning
"%~dp0..\cygwin\bin\touch" "%~dp0..\cygwin\%HERMETIC_CYGWIN%.installed"
if errorlevel 1 goto :install_fail
del /f /q "%~dp0%HERMETIC_CYGWIN%.exe"
:skip_cygwin_install
endlocal
set "PATH=%~dp0..\cygwin\bin;%PATH%"
goto :end
:rmdir_fail
endlocal
echo Failed to remove old version of cygwin
set ERRORLEVEL=1
goto :end
:download_fail
:: TODO(bradnelson): Check certs when this issue is resolved.
::     http://code.google.com/p/nativeclient/issues/detail?id=2931
c:\cygwin\bin\wget --no-check-certificate https://commondatastorage.googleapis.com/nativeclient-mirror/nacl/cygwin_mirror/%HERMETIC_CYGWIN%.exe -O "%~dp0%HERMETIC_CYGWIN%.exe"
if errorlevel 1 goto :wget_fail
goto download_success
:wget_fail
c:\cygwin\bin\wget --no-check-certificate https://commondatastorage.googleapis.com/nativeclient-mirror/nacl/cygwin_mirror/%HERMETIC_CYGWIN%.exe -O "%~dp0%HERMETIC_CYGWIN%.exe"
if errorlevel 1 goto :cygwin_wget_fail
goto download_success
:cygwin_wget_fail
endlocal
echo Failed to download cygwin
set ERRORLEVEL=1
goto :end
:install_fail
endlocal
echo Failed to install cygwin
set ERRORLEVEL=1
goto :end
:end

:: Copyright (c) 2011 The Native Client Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file.

@echo off
setlocal
set CYGWIN_VERSION=cygwin_1_7_24-1_0
set HERMETIC_CYGWIN=hermetic_%CYGWIN_VERSION%
if exist "%~dp0..\cygwin\%CYGWIN_VERSION%.installed" goto :skip_cygwin_install
if exist "%~dp0..\pnacl\git\binutils" rmdir /s /q "%~dp0..\pnacl\git\binutils"
if exist "%~dp0..\pnacl\git\clang" rmdir /s /q "%~dp0..\pnacl\git\clang"
if exist "%~dp0..\pnacl\git\compiler-rt" rmdir /s /q "%~dp0..\pnacl\git\compiler-rt"
if exist "%~dp0..\pnacl\git\dummydir" rmdir /s /q "%~dp0..\pnacl\git\dummydir"
if exist "%~dp0..\pnacl\git\gcc" rmdir /s /q "%~dp0..\pnacl\git\gcc"
if exist "%~dp0..\pnacl\git\llvm" rmdir /s /q "%~dp0..\pnacl\git\llvm"
if exist "%~dp0..\pnacl\git\llvm-test-suite" rmdir /s /q "%~dp0..\pnacl\git\llvm-test-suite"
if exist "%~dp0..\tools\BUILD\.gcc-extras-version" del "%~dp0..\tools\BUILD\.gcc-extras-version"
if exist "%~dp0..\tools\BACKPORTS\binutils" rmdir /s /q "%~dp0..\tools\BACKPORTS\binutils"
if exist "%~dp0..\tools\BACKPORTS\gcc" rmdir /s /q "%~dp0..\tools\BACKPORTS\gcc"
if exist "%~dp0..\tools\BACKPORTS\gdb" rmdir /s /q "%~dp0..\tools\BACKPORTS\gdb"
if exist "%~dp0..\tools\BACKPORTS\glibc" rmdir /s /q "%~dp0..\tools\BACKPORTS\glibc"
if exist "%~dp0..\tools\BACKPORTS\linux-headers-for-nacl" rmdir /s /q "%~dp0..\tools\BACKPORTS\linux-headers-for-nacl"
if exist "%~dp0..\tools\BACKPORTS\newlib" rmdir /s /q "%~dp0..\tools\BACKPORTS\newlib"
if not exist "%~dp0..\cygwin" goto :dont_remove_cygwin
rmdir /s /q "%~dp0..\cygwin"
if errorlevel 1 goto :rmdir_fail
mkdir "%~dp0..\cygwin"
:dont_remove_cygwin
cscript //nologo //e:jscript "%~dp0get_file.js" https://commondatastorage.googleapis.com/nativeclient-mirror/nacl/cygwin_mirror/%HERMETIC_CYGWIN%.exe "%~dp0%HERMETIC_CYGWIN%.exe"
if errorlevel 1 goto :download_fail
:download_success
start /WAIT %~dp0%HERMETIC_CYGWIN%.exe /DEVEL /S /D=%~dp0..\cygwin
if errorlevel 1 goto :install_fail
set CYGWIN=nodosfilewarning
"%~dp0..\cygwin\bin\touch" "%~dp0..\cygwin\%CYGWIN_VERSION%.installed"
if errorlevel 1 goto :install_fail
del /f /q "%~dp0%HERMETIC_CYGWIN%.exe"
:skip_cygwin_install
endlocal
set "PATH=%~dp0..\cygwin\bin;%PATH%"
goto :end
:rmdir_fail
endlocal
echo Failed to remove old version of cygwin
set ERRORLEVEL=1
goto :end
:download_fail
:: TODO(bradnelson): Check certs when this issue is resolved.
::     http://code.google.com/p/nativeclient/issues/detail?id=2931
c:\cygwin\bin\wget --no-check-certificate https://commondatastorage.googleapis.com/nativeclient-mirror/nacl/cygwin_mirror/%HERMETIC_CYGWIN%.exe -O "%~dp0%HERMETIC_CYGWIN%.exe"
if errorlevel 1 goto :wget_fail
goto download_success
:wget_fail
c:\cygwin\bin\wget --no-check-certificate https://commondatastorage.googleapis.com/nativeclient-mirror/nacl/cygwin_mirror/%HERMETIC_CYGWIN%.exe -O "%~dp0%HERMETIC_CYGWIN%.exe"
if errorlevel 1 goto :cygwin_wget_fail
goto download_success
:cygwin_wget_fail
endlocal
echo Failed to download cygwin
set ERRORLEVEL=1
goto :end
:install_fail
endlocal
echo Failed to install cygwin
set ERRORLEVEL=1
goto :end
:end

Fix win-pnacl-x86_32 bot

Fix win-pnacl-x86_32 bot

Yes another git repo (dummydir) which is affected in CYGWIN upgrade process.
Directories binutils/clang/compiler-rt/gcc/llvm/llvm-test-suite are not
really used anymore, but if old versions found they break git update anyway.

BUG=none
TEST=try run on nacl-toolchain-win7-pnacl-x86_64 bot
R=bradnelson@google.com

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

git-svn-id: 721b910a23eff8a86f00c8fd261a7587cddf18f8@12036 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2


rmdir /s /q build
mkdir build
cd build

cmake ^
    -G "Ninja" ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True ^
    -DBUILD_TESTING:BOOL=OFF ^
    -DSKIP_PYBIND11:BOOL=ON ^
    %SRC_DIR%
if errorlevel 1 exit 1

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

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

Update bld_cxx.bat

Update bld_cxx.bat


@echo off
:: Test attempt to run Minecraft with commandline arguments.
:: Eg "launchClient -channel 2"
:: Currently must be run from within the mod dev folder.
:: Works by generating a Minecraft config file from the commandline arguments,
:: which the Mod then loads at initialisation time.

REM Command line parser due to dbenham - see here: http://stackoverflow.com/a/8162578

setlocal enableDelayedExpansion

:: Define the option names along with default values, using a <space>
:: delimiter between options.
:: Each option has the format -name:[default]
:: The option names are NOT case sensitive.
::
:: Options that have a default value expect the subsequent command line
:: argument to contain the value. If the option is not provided then the
:: option is set to the default. If the default contains spaces, contains
:: special characters, or starts with a colon, then it should be enclosed
:: within double quotes. The default can be undefined by specifying the
:: default as empty quotes "".
:: NOTE - defaults cannot contain * or ? with this solution.
::
:: Options that are specified without any default value are simply flags
:: that are either defined or undefined. All flags start out undefined by
:: default and become defined if the option is supplied.
::
:: The order of the definitions is not important.
::
set "options=-port:0"

:: Set the default option values
for %%O in (%options%) do for /f "tokens=1,* delims=:" %%A in ("%%O") do set "%%A=%%~B"

:loop
:: Validate and store the options, one at a time, using a loop.
:: Each SHIFT is done starting at the first option so required args are preserved.
::
if not "%~1"=="" (
  set "test=!options:*%~1:=! "
  if "!test!"=="!options! " (
    rem No substitution was made so this is an invalid option.
    rem Error handling goes here.
    rem I will simply echo an error message.
    echo Error: Invalid option %~1
  ) else if "!test:~0,1!"==" " (
    rem Set the flag option using the option name.
    rem The value doesn't matter, it just needs to be defined.
    set "%~1=1"
  ) else (
    rem Set the option value using the option as the name.
    rem and the next arg as the value
    set "%~1=%~2"
    shift /1
  )
  shift /1
  goto :loop
)

:: Now all supplied options are stored in variables whose names are the
:: option names. Missing options have the default value, or are undefined if
:: there is no default.
:: To get the value of a single parameter, just remember to include the `-`
:: eg: echo The value of -username is: !-username!

REM now output the config file:
(
echo # Configuration file
echo # Autogenerated from command-line options
echo.
echo malmoports {
echo I:portOverride=!-port!
echo }
) > "run\config\malmomodCLIENT.cfg"

REM finally run Minecraft:
call gradlew setupDecompWorkspace
call gradlew build
call gradlew runClient

@echo off
:: Test attempt to run Minecraft with commandline arguments.
:: Eg "launchClient -channel 2"
:: Currently must be run from within the mod dev folder.
:: Works by generating a Minecraft config file from the commandline arguments,
:: which the Mod then loads at initialisation time.

REM Command line parser due to dbenham - see here: http://stackoverflow.com/a/8162578

setlocal enableDelayedExpansion

:: Define the option names along with default values, using a <space>
:: delimiter between options.
:: Each option has the format -name:[default]
:: The option names are NOT case sensitive.
::
:: Options that have a default value expect the subsequent command line
:: argument to contain the value. If the option is not provided then the
:: option is set to the default. If the default contains spaces, contains
:: special characters, or starts with a colon, then it should be enclosed
:: within double quotes. The default can be undefined by specifying the
:: default as empty quotes "".
:: NOTE - defaults cannot contain * or ? with this solution.
::
:: Options that are specified without any default value are simply flags
:: that are either defined or undefined. All flags start out undefined by
:: default and become defined if the option is supplied.
::
:: The order of the definitions is not important.
::
set "options=-port:0"

:: Set the default option values
for %%O in (%options%) do for /f "tokens=1,* delims=:" %%A in ("%%O") do set "%%A=%%~B"

:loop
:: Validate and store the options, one at a time, using a loop.
:: Each SHIFT is done starting at the first option so required args are preserved.
::
if not "%~1"=="" (
  set "test=!options:*%~1:=! "
  if "!test!"=="!options! " (
    rem No substitution was made so this is an invalid option.
    rem Error handling goes here.
    rem I will simply echo an error message.
    echo Error: Invalid option %~1
  ) else if "!test:~0,1!"==" " (
    rem Set the flag option using the option name.
    rem The value doesn't matter, it just needs to be defined.
    set "%~1=1"
  ) else (
    rem Set the option value using the option as the name.
    rem and the next arg as the value
    set "%~1=%~2"
    shift /1
  )
  shift /1
  goto :loop
)

:: Now all supplied options are stored in variables whose names are the
:: option names. Missing options have the default value, or are undefined if
:: there is no default.
:: To get the value of a single parameter, just remember to include the `-`
:: eg: echo The value of -username is: !-username!

REM now output the config file:
if not exist run\config\ (
  mkdir run\config
)
(
echo # Configuration file
echo # Autogenerated from command-line options
echo.
echo malmoports {
echo I:portOverride=!-port!
echo }
) > "run\config\malmomodCLIENT.cfg"

REM finally run Minecraft:
call gradlew setupDecompWorkspace
call gradlew build
call gradlew runClient

Update launchClient.bat

Update launchClient.bat

Add mkdir for run\config


@echo off
if NOT exist %CD%\..\..\..\build (
  echo ERROR: OpenCV Winpack installation is required
  pause
  exit
)

:: Path to FFMPEG binary files
set PATH=%PATH%;%CD%\..\..\..\build\bin\

:: Detect Python binary
python -V
if %ERRORLEVEL% EQU 0 (
  set PYTHON=python
) else (
  if exist C:\Python27-x64\python.exe (
    set PYTHON=C:\Python27-x64\python.exe
  ) else (
    if exist C:\Python27\python.exe (
      set PYTHON=C:\Python27\python.exe
    ) else (
      echo ERROR: Python not found
      pause
      exit
    )
  )
)
echo Using python: %PYTHON%

:: Detect python architecture
%PYTHON% -c "import platform; exit(64 if platform.architecture()[0] == '64bit' else 32)"
if %ERRORLEVEL% EQU 32 (
  echo Detected: Python 32-bit
  set PYTHONPATH=%CD%\..\..\..\build\python\2.7\x86
) else (
  if %ERRORLEVEL% EQU 64 (
    echo Detected: Python 64-bit
    set PYTHONPATH=%CD%\..\..\..\build\python\2.7\x64
  ) else (
    echo ERROR: Unknown python arch
    pause
    exit
  )
)

:: Launch demo
%PYTHON% demo.py

@echo off
setlocal enableDelayedExpansion

set SCRIPTDIR=%~dp0
if NOT exist %SCRIPTDIR%\..\..\..\build (
  echo ERROR: OpenCV Winpack installation is required
  pause
  exit
)

:: Path to FFMPEG binary files
set PATH=%PATH%;%SCRIPTDIR%\..\..\..\build\bin\

:: Detect Python binary
python -V
if %ERRORLEVEL% EQU 0 (
  set PYTHON=python
) else (
  if exist C:\Python27-x64\python.exe (
    set PYTHON=C:\Python27-x64\python.exe
  ) else (
    if exist C:\Python27\python.exe (
      set PYTHON=C:\Python27\python.exe
    ) else (
      echo ERROR: Python not found
      pause
      exit
    )
  )
)
echo Using python: %PYTHON%

:: Detect python architecture
%PYTHON% -c "import platform; exit(64 if platform.architecture()[0] == '64bit' else 32)"
if %ERRORLEVEL% EQU 32 (
  echo Detected: Python 32-bit
  set PYTHONPATH=%CD%\..\..\..\build\python\2.7\x86
) else (
  if %ERRORLEVEL% EQU 64 (
    echo Detected: Python 64-bit
    set PYTHONPATH=%CD%\..\..\..\build\python\2.7\x64
  ) else (
    echo ERROR: Unknown python arch
    pause
    exit
  )
)

:: Don't generate unnecessary .pyc cache files
set PYTHONDONTWRITEBYTECODE=1

if [%1]==[] goto rundemo
%PYTHON% %*
set result=%errorlevel%
IF %result% NEQ 0 (pause)
EXIT /B %result%

:rundemo
%PYTHON% demo.py
set result=%errorlevel%
IF %result% NEQ 0 (pause)
EXIT /B %result%

update winpack python samples launcher

samples: update winpack python samples launcher

- accepts script parameter (allows drag & drop from 'explorer')
- use script dir instead of current dir (can launch samples from 'samples/dnn')
- added 'pause' to show error messages (about missing numpy) instead of instant closing


doskey comit =python c:\Windows\ComIt\runWithoutRequests.py $*

Create alias.cmd

Create alias.cmd


@echo off

set fdir="%ProgramFiles%\MSBuild\14.0\Bin"

if not exist %fdir% (
	set fdir="%ProgramFiles(x86)%\MSBuild\14.0\Bin"
)

set msbuild=%fdir%\msbuild.exe

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S obj') DO RMDIR /S /Q "%%G"
%msbuild% WebSocket4Net.UWP.sln /p:Configuration=Debug /t:Clean;Rebuild /p:OutputPath=..\bin\UWP\Debug

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S obj') DO RMDIR /S /Q "%%G"
%msbuild% WebSocket4Net.UWP.sln /p:Configuration=Release /t:Clean;Rebuild /p:OutputPath=..\bin\UWP\Release

pause

@echo off

set fdir="%ProgramFiles%\MSBuild\14.0\Bin"

if not exist %fdir% (
	set fdir="%ProgramFiles(x86)%\MSBuild\14.0\Bin"
)

set msbuild=%fdir%\msbuild.exe

set outDir=bin\UWP\Debug
FOR /F "tokens=*" %%G IN ('DIR /B /AD /S obj') DO RMDIR /S /Q "%%G"
%msbuild% WebSocket4Net.UWP.sln /p:Configuration=Debug /t:Clean;Rebuild /p:OutDir=..\%outDir%

set outDir=%outDir%\WebSocket4Net.UWP
del %outDir%\*.pdb
del %outDir%\*.pri

set outDir=bin\UWP\Release
FOR /F "tokens=*" %%G IN ('DIR /B /AD /S obj') DO RMDIR /S /Q "%%G"
%msbuild% WebSocket4Net.UWP.sln /p:Configuration=Release /t:Clean;Rebuild /p:OutDir=..\%outDir%

set outDir=%outDir%\WebSocket4Net.UWP
del %outDir%\*.pdb
del %outDir%\*.pri

pause

Build script fixes for UWP.

Build script fixes for UWP.


@mkdir _shake 2> nul
@ghc --make src/Main.hs -isrc -rtsopts -with-rtsopts=-I0 -outputdir=_shake -o _shake/build && _shake\build --lint --directory ".." %*

@mkdir _shake 2> nul
@ghc --make -fwarn-tabs -fwarn-unused-imports src/Main.hs -isrc -rtsopts -with-rtsopts=-I0 -outputdir=_shake -o _shake/build
@_shake\build --lint --directory ".." %*

Add -fwarn-tabs and -fwarn-unused-imports.


Use mvn.cmd instead of mvn.bat in build.bat


@echo Off
set config=%1
if "%config%" == "" (
    set config=Release
)

:: use MSBuild from .net framework by default
set MsBuildExe="%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild"

:: prefer vs2019, vs2017, vs2015 then vs2013
if exist "%PROGRAMFILES%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES%\MSBuild\14.0\Bin\MsBuild.exe" (
    set MsBuildExe="%PROGRAMFILES%\MSBuild\14.0\Bin\MsBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\MSBuild\14.0\Bin\MsBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\MSBuild\14.0\Bin\MsBuild.exe"
) else if exist "%PROGRAMFILES%\MSBuild\12.0\Bin\MsBuild.exe" (
    set MsBuildExe="%PROGRAMFILES%\MSBuild\12.0\Bin\MsBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\MSBuild\12.0\Bin\MsBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\MSBuild\12.0\Bin\MsBuild.exe"
)
echo %MsBuildExe%
%MsBuildExe% Build\Build.proj /p:Configuration="%config%";ExcludeXmlAssemblyFiles=false /v:M /fl /flp:LogFile=msbuild.log;Verbosity=Normal /nr:false /m

@echo Off
set config=%1
if "%config%" == "" (
    set config=Release
)

:: use MSBuild from .net framework by default
set MsBuildExe="%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild"

:: prefer vs2019, vs2017, vs2015 then vs2013
if exist "%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe"
) else if exist "%PROGRAMFILES%\MSBuild\14.0\Bin\MsBuild.exe" (
    set MsBuildExe="%PROGRAMFILES%\MSBuild\14.0\Bin\MsBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\MSBuild\14.0\Bin\MsBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\MSBuild\14.0\Bin\MsBuild.exe"
) else if exist "%PROGRAMFILES%\MSBuild\12.0\Bin\MsBuild.exe" (
    set MsBuildExe="%PROGRAMFILES%\MSBuild\12.0\Bin\MsBuild.exe"
) else if exist "%PROGRAMFILES(X86)%\MSBuild\12.0\Bin\MsBuild.exe" (
    set MsBuildExe="%PROGRAMFILES(X86)%\MSBuild\12.0\Bin\MsBuild.exe"
)
echo %MsBuildExe%
%MsBuildExe% Build\Build.proj /p:Configuration="%config%";ExcludeXmlAssemblyFiles=false /v:M /fl /flp:LogFile=msbuild.log;Verbosity=Normal /nr:false /m

use VS2022 msbuild if exists

use VS2022 msbuild if exists


@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off

:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.15
:: ----------------------

:: Prerequisites
:: -------------

:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
  goto error
)

:: Verify yarn installed
where yarn 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo "Missing yarn, installing via npm"
  npm i -g yarn
)

echo "Yarn installed, continuing to deployment"

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

IF NOT DEFINED DEPLOYMENT_SOURCE (
  SET DEPLOYMENT_SOURCE=%~dp0%.
)

IF NOT DEFINED DEPLOYMENT_TARGET (
  SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)

IF NOT DEFINED NEXT_MANIFEST_PATH (
  SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest

  IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
    SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
  )
)

IF NOT DEFINED KUDU_SYNC_CMD (
  :: Install kudu sync
  echo Installing Kudu Sync
  call npm install kudusync -g --silent
  IF !ERRORLEVEL! NEQ 0 goto error

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------
echo Handling function App deployment with custom build.cmd script.
echo "build.cmd running in directory %cd%"

:: Restore dotnet packages and build dotnet projects
dotnet restore
dotnet build -c Release

:: Restore node packages and build node projects
yarn install
yarn build

:: 3. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f ./ -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
  IF !ERRORLEVEL! NEQ 0 goto error
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
goto end

:: Execute command routine that will echo out when error
:ExecuteCmd
setlocal
set _CMD_=%*
call %_CMD_%
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%_CMD_%
exit /b %ERRORLEVEL%

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

REM @echo off
REM cls

REM echo "build.cmd running in directory %cd%"

REM dotnet restore std-artist-tally-tool
REM dotnet build -c Release std-artist-tally-tool

REM REM .paket\paket.bootstrapper.exe
REM REM if errorlevel 1 (
REM REM   exit /b %errorlevel%
REM REM )

REM REM .paket\paket.exe restore --force
REM REM if errorlevel 1 (
REM REM   exit /b %errorlevel%
REM REM )

REM call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_TEMP%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
REM IF !ERRORLEVEL! NEQ 0 goto error

@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off

:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.15
:: ----------------------

:: Prerequisites
:: -------------

:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
  goto error
)

:: Verify yarn installed
where yarn 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo "Missing yarn, installing via npm"
  call npm install yarn -g --silent
  IF !ERRORLEVEL! NEQ 0 goto error
  echo "Finished installing Yarn."
)

echo "Yarn installed, continuing to deployment"

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

IF NOT DEFINED DEPLOYMENT_SOURCE (
  SET DEPLOYMENT_SOURCE=%~dp0%.
)

IF NOT DEFINED DEPLOYMENT_TARGET (
  SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)

IF NOT DEFINED NEXT_MANIFEST_PATH (
  SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest

  IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
    SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
  )
)

IF NOT DEFINED KUDU_SYNC_CMD (
  :: Install kudu sync
  echo Installing Kudu Sync
  call npm install kudusync -g --silent
  IF !ERRORLEVEL! NEQ 0 goto error

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------
echo Handling function App deployment with custom build.cmd script.
echo "build.cmd running in directory %cd%"

:: Restore dotnet packages and build dotnet projects
dotnet restore
dotnet build -c Release

:: Restore node packages and build node projects
yarn install
yarn build

:: 3. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f ./ -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
  IF !ERRORLEVEL! NEQ 0 goto error
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
goto end

:: Execute command routine that will echo out when error
:ExecuteCmd
setlocal
set _CMD_=%*
call %_CMD_%
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%_CMD_%
exit /b %ERRORLEVEL%

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

REM @echo off
REM cls

REM echo "build.cmd running in directory %cd%"

REM dotnet restore std-artist-tally-tool
REM dotnet build -c Release std-artist-tally-tool

REM REM .paket\paket.bootstrapper.exe
REM REM if errorlevel 1 (
REM REM   exit /b %errorlevel%
REM REM )

REM REM .paket\paket.exe restore --force
REM REM if errorlevel 1 (
REM REM   exit /b %errorlevel%
REM REM )

REM call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_TEMP%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
REM IF !ERRORLEVEL! NEQ 0 goto error

Update build.cmd

Update build.cmd


@ECHO OFF
@SETLOCAL

@ECHO.
@ECHO  **** STARTING BUILD  ****

@SET THIS_SCRIPT_FOLDER=%~dp0
CD "%THIS_SCRIPT_FOLDER%"
@SET ARTIFACTS=artifacts
@SET NUGET_COMMAND=src\.nuget\nuget.exe
@SET PACKAGE_VERSION=%APPVEYOR_BUILD_VERSION%

IF "%PACKAGE_VERSION%"=="" (
	SET PACKAGE_VERSION=2.0.0-pre%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%
)

@SET NUGET_PACKAGE_ID=Serilog.Sinks.Kafka
@SET SOLUTION=%THIS_SCRIPT_FOLDER%src\Serilog.Sinks.Kafka.sln
@SET PROJECT_FOLDER=src\%NUGET_PACKAGE_ID%
@SET MSBUILDARGS=/target:Rebuild /fileLogger /verbosity:minimal /ToolsVersion:14.0
@SET NUGET_PACKAGE_FOLDER=%ARTIFACTS%\%NUGET_PACKAGE_ID%
@SET DOTNET_FRAMEWORK=net45
@SET NUGET_FRAMEWORK_FOLDER=%NUGET_PACKAGE_FOLDER%\lib\%DOTNET_FRAMEWORK%

RMDIR /Q /S "%ARTIFACTS%" >nul 2>&1
MKDIR "%ARTIFACTS%"

"%NUGET_COMMAND%" restore "%SOLUTION%"  -Verbosity quiet ||  GOTO BuildFailed

@ECHO.
@ECHO  **** BUIILD DEBUG  ****
MSBuild "%SOLUTION%" %MSBUILDARGS% ||  GOTO BuildFailed
COPY msbuild.log "%ARTIFACTS%\msbuild.DEBUG.log" ||  GOTO BuildFailed

@ECHO.
@ECHO  **** BUIILD RELEASE  ****
MSBuild "%SOLUTION%" %MSBUILDARGS% /property:Configuration=Release ||  GOTO BuildFailed
COPY msbuild.log "%ARTIFACTS%\msbuild.RELEASE.log" ||  GOTO BuildFailed

@ECHO.
@ECHO  **** CREATE NUGET PACKAGE  ****
MKDIR "%NUGET_FRAMEWORK_FOLDER%" ||  GOTO BuildFailed
COPY "%PROJECT_FOLDER%\bin\Release\%NUGET_PACKAGE_ID%.??l" "%NUGET_FRAMEWORK_FOLDER%\" ||  GOTO BuildFailed
COPY "%PROJECT_FOLDER%\bin\Release\%NUGET_PACKAGE_ID%.pdb" "%NUGET_FRAMEWORK_FOLDER%\" ||  GOTO BuildFailed
MKDIR "%NUGET_FRAMEWORK_FOLDER%\CodeContracts\" ||  GOTO BuildFailed
COPY "%PROJECT_FOLDER%\bin\Release\CodeContracts\*.*" "%NUGET_FRAMEWORK_FOLDER%\CodeContracts\" ||  GOTO BuildFailed
COPY "%PROJECT_FOLDER%\bin\Release\%NUGET_PACKAGE_ID%.nuspec" "%NUGET_PACKAGE_FOLDER%\" ||  GOTO BuildFailed

%NUGET_COMMAND% pack "%NUGET_PACKAGE_FOLDER%\%NUGET_PACKAGE_ID%.nuspec" -Version %PACKAGE_VERSION% ^
     -NonInteractive -OutputDirectory %ARTIFACTS% -Properties version=%PACKAGE_VERSION%||  GOTO BuildFailed

@ECHO.
@ECHO **** BUILD SUCCESSFUL ****
GOTO:EOF

:BuildFailed
@ECHO.
@ECHO *** BUILD FAILED ***
EXIT /B -1

@ECHO OFF
@SETLOCAL

@ECHO.
@ECHO  **** STARTING BUILD  ****

@SET THIS_SCRIPT_FOLDER=%~dp0
CD "%THIS_SCRIPT_FOLDER%"
@SET ARTIFACTS=artifacts
@SET NUGET_COMMAND=src\.nuget\nuget.exe
@SET PACKAGE_VERSION=%APPVEYOR_BUILD_VERSION%

IF "%PACKAGE_VERSION%"=="" (
	SET PACKAGE_VERSION=0.0.1
)

SET PRERELEASE_PACKAGE_VERSION=%PACKAGE_VERSION%-prerelease

@SET NUGET_PACKAGE_ID=Serilog.Sinks.Kafka
@SET SOLUTION=%THIS_SCRIPT_FOLDER%src\Serilog.Sinks.Kafka.sln
@SET PROJECT_FOLDER=src\%NUGET_PACKAGE_ID%
@SET MSBUILDARGS=/target:Rebuild /fileLogger /verbosity:minimal /ToolsVersion:14.0
@SET NUGET_PACKAGE_FOLDER=%ARTIFACTS%\%NUGET_PACKAGE_ID%
@SET DOTNET_FRAMEWORK=net45
@SET NUGET_FRAMEWORK_FOLDER=%NUGET_PACKAGE_FOLDER%\lib\%DOTNET_FRAMEWORK%

RMDIR /Q /S "%ARTIFACTS%" >nul 2>&1
MKDIR "%ARTIFACTS%"

@ECHO.
@ECHO  **** RESTORE NUGET PACKAGES  ****
"%NUGET_COMMAND%" restore "%SOLUTION%"  -Verbosity quiet ||  GOTO BuildFailed

@ECHO.
@ECHO  **** BUIILD DEBUG  ****
MSBuild "%SOLUTION%" %MSBUILDARGS% ||  GOTO BuildFailed
COPY msbuild.log "%ARTIFACTS%\msbuild.DEBUG.log" ||  GOTO BuildFailed

@ECHO.
@ECHO  **** BUIILD RELEASE  ****
MSBuild "%SOLUTION%" %MSBUILDARGS% /property:Configuration=Release ||  GOTO BuildFailed
COPY msbuild.log "%ARTIFACTS%\msbuild.RELEASE.log" ||  GOTO BuildFailed

@ECHO.
@ECHO  **** STAGE NUGET PACKAGE FOLDER ****
MKDIR "%NUGET_FRAMEWORK_FOLDER%" ||  GOTO BuildFailed
COPY "%PROJECT_FOLDER%\bin\Release\%NUGET_PACKAGE_ID%.??l" "%NUGET_FRAMEWORK_FOLDER%\" ||  GOTO BuildFailed
COPY "%PROJECT_FOLDER%\bin\Release\%NUGET_PACKAGE_ID%.pdb" "%NUGET_FRAMEWORK_FOLDER%\" ||  GOTO BuildFailed
MKDIR "%NUGET_FRAMEWORK_FOLDER%\CodeContracts\" ||  GOTO BuildFailed
COPY "%PROJECT_FOLDER%\bin\Release\CodeContracts\*.*" "%NUGET_FRAMEWORK_FOLDER%\CodeContracts\" ||  GOTO BuildFailed
COPY "%PROJECT_FOLDER%\bin\Release\%NUGET_PACKAGE_ID%.nuspec" "%NUGET_PACKAGE_FOLDER%\" ||  GOTO BuildFailed

@ECHO.
@ECHO  **** CREATE PRERELEASE NUGET PACKAGE ****
%NUGET_COMMAND% pack "%NUGET_PACKAGE_FOLDER%\%NUGET_PACKAGE_ID%.nuspec" -Version %PRERELEASE_PACKAGE_VERSION% ^
     -NonInteractive -OutputDirectory %ARTIFACTS% -Properties version=%PACKAGE_VERSION%||  GOTO BuildFailed

@ECHO.
@ECHO  **** CREATE RELEASE NUGET PACKAGE ****
%NUGET_COMMAND% pack "%NUGET_PACKAGE_FOLDER%\%NUGET_PACKAGE_ID%.nuspec" -Version %PACKAGE_VERSION% ^
     -NonInteractive -OutputDirectory %ARTIFACTS% -Properties version=%PACKAGE_VERSION%||  GOTO BuildFailed

@ECHO.
@ECHO **** BUILD SUCCESSFUL ****
GOTO:EOF

:BuildFailed
@ECHO.
@ECHO *** BUILD FAILED ***
EXIT /B -1

Build both release and pre-release packages.