:: Disable "Stop running this script?" alert dialog.
reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Styles" ^
    /v "MaxScriptStatements" /t REG_DWORD /d 0xffffffff /f

:: Disable Java update dialogs.
reg add ^
    "HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Update\Policy" ^
reg add ^
    "HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Update\Policy" ^
    /v "EnableJavaUpdate" /t REG_DWORD /d 0 /f
reg add ^
    "HKEY_CURRENT_USER\Software\AppDataLow\Software\JavaSoft\DeploymentProperties" ^
    /v "deployment.expiration.check.enabled" /t REG_SZ /d false /f
reg add ^
    "HKEY_CURRENT_USER\Software\AppDataLow\Software\JavaSoft\DeploymentProperties" ^
    /v "deployment.expiration.decision.10.55.2" /t REG_SZ /d block /f
reg add ^
    "HKEY_CURRENT_USER\Software\AppDataLow\Software\JavaSoft\DeploymentProperties" ^
    /v "deployment.expiration.decision.suppression.10.55.2" /t REG_SZ /d true /f
reg add ^
    "HKEY_CURRENT_USER\Software\AppDataLow\Software\JavaSoft\DeploymentProperties" ^
    /v "deployment.expiration.decision.timestamp.10.55.2" /t REG_SZ /d 1413180896 /f
reg add ^
    "HKEY_CURRENT_USER\Software\Microsoft\Active Setup\Declined Install On Demand IEv5" ^
    /v "{08B0e5c0-4FCB-11CF-AAA5-00401C608501}" /t REG_SZ /d 1 /f   /v "EnableJavaUpdate" /t REG_DWORD /d 0 /f

:: Disable Windows crash dialogs.
reg add ^
    "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting" ^
    /v "DontShowUI" /t REG_DWORD /d 1 /f
reg add ^
    "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting" ^
    /v "ForceQueue" /t REG_DWORD /d 1 /f

:: Disable JavaScript error dialogs.
reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" ^
    /v "Error Dlg Displayed On Every Error" /t REG_SZ /d no /f

:: Disable script error dialogs for IE8 & IE9.
reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" ^
    /v "Disable Script Debugger" /t REG_SZ /d yes /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" ^
    /v "DisableScriptDebuggerIE" /t REG_SZ /d yes /f

:: Disable cross-origin XHRs. Sauce enables this in IE by default.
@ECHO OFF
REG ADD "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3" /v 1406 /t REG_DWORD /d 3 /f

Disable cross-origin requests in IE

Disable cross-origin requests in IE


@echo off

cd ..\
mkdir xpiks-deps
cd xpiks-deps

git init
git remote add origin https://bitbucket.org/ribtoks/xpiks-deps.git

git fetch origin 76c80a64ff15d6f67cabf37e4120d1a0c19a5e31

git reset --hard FETCH_HEAD

@echo off

cd ..\
mkdir xpiks-deps
cd xpiks-deps

git init
git remote add origin https://bitbucket.org/ribtoks/xpiks-deps.git

git fetch origin 76c80a64ff15d6f67cabf37e4120d1a0c19a5e31:refs/remotes/origin/foo-commit

git reset --hard FETCH_HEAD

Update checkout_deps_windows.bat

Update checkout_deps_windows.bat


@echo off
setlocal enableextensions enabledelayedexpansion
title Building i2pd

REM Copyright (c) 2013-2017, The PurpleI2P Project
REM This file is part of Purple i2pd project and licensed under BSD3
REM See full license text in LICENSE file at top of project tree

REM To use that script, you must have installed in your MSYS installation theese packages:
REM Base: git make zip
REM x86_64: mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-gcc
REM i686: mingw-w64-i686-boost mingw-w64-i686-openssl mingw-w64-i686-gcc

REM setting up variables for MSYS
REM Note: if you installed MSYS64 to different path, edit WD variable (only C:\msys64 needed to edit)!
set "WD=C:\msys64\usr\bin\"
set MSYS2_PATH_TYPE=inherit
set CHERE_INVOKING=enabled_from_arguments
set MSYSTEM=MSYS

REM detecting number of processors and subtract 1.
set /a threads=%NUMBER_OF_PROCESSORS%-1

REM we must work in root of repo
cd ..

echo Receiving latest commit and cleaning up...
"%WD%bash" -lc "git pull && make clean" > build/build_git.log 2>&1
echo.

REM set to variable current commit hash
FOR /F "usebackq" %%a IN (`%WD%bash -lc 'git describe --tags'`) DO (
 set tag=%%a
)

"%WD%bash" -lc "echo To use configs and certificates, move all files and certificates folder from contrib directory here. > README.txt" >> nul

REM starting building
set MSYSTEM=MINGW32
set bitness=32
call :BUILDING
echo.

set MSYSTEM=MINGW64
set bitness=64
call :BUILDING
echo.

del README.txt >> nul

echo Build complete...
pause
exit /b 0

:BUILDING
echo Building i2pd %tag% for win%bitness%:
echo Build AVX+AESNI...
"%WD%bash" -lc "make USE_UPNP=yes USE_AVX=1 USE_AESNI=1 -j%threads% && zip -r9 build/i2pd_%tag%_win%bitness%_mingw_avx_aesni.zip i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates && make clean" > build/build_win%bitness%_avx_aesni.log 2>&1
echo Build AVX...
"%WD%bash" -lc "make USE_UPNP=yes USE_AVX=1 -j%threads% && zip -r9 build/i2pd_%tag%_win%bitness%_mingw_avx.zip i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates && make clean" > build/build_win%bitness%_avx.log 2>&1
echo Build AESNI...
"%WD%bash" -lc "make USE_UPNP=yes USE_AESNI=1 -j%threads% && zip -r9 build/i2pd_%tag%_win%bitness%_mingw_aesni.zip i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates && make clean" > build/build_win%bitness%_aesni.log 2>&1
echo Build without extensions...
"%WD%bash" -lc "make USE_UPNP=yes -j%threads% && zip -r9 build/i2pd_%tag%_win%bitness%_mingw.zip i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates && make clean" > build/build_win%bitness%.log 2>&1

:EOF

@echo off
setlocal enableextensions enabledelayedexpansion
title Building i2pd

REM Copyright (c) 2013-2017, The PurpleI2P Project
REM This file is part of Purple i2pd project and licensed under BSD3
REM See full license text in LICENSE file at top of project tree

REM To use that script, you must have installed in your MSYS installation theese packages:
REM Base: git make zip
REM x86_64: mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-gcc
REM i686: mingw-w64-i686-boost mingw-w64-i686-openssl mingw-w64-i686-gcc

REM setting up variables for MSYS
REM Note: if you installed MSYS64 to different path, edit WD variable (only C:\msys64 needed to edit)!
set "WD=C:\msys64\usr\bin\"
set MSYS2_PATH_TYPE=inherit
set CHERE_INVOKING=enabled_from_arguments
set MSYSTEM=MSYS

set "xSH=%WD%bash -lc"

REM detecting number of processors and subtract 1.
set /a threads=%NUMBER_OF_PROCESSORS%-1

REM we must work in root of repo
cd ..

REM deleting old log files
del /S build_*.log >> nul

echo Receiving latest commit and cleaning up...
%xSH% "git pull && make clean" > build/build_git.log 2>&1
echo.

REM set to variable current commit hash
FOR /F "usebackq" %%a IN (`%xSH% 'git describe --tags'`) DO (
 set tag=%%a
)

%xSH% "echo To use configs and certificates, move all files and certificates folder from contrib directory here. > README.txt" >> nul

REM starting building
set MSYSTEM=MINGW32
set bitness=32
call :BUILDING
echo.

set MSYSTEM=MINGW64
set bitness=64
call :BUILDING
echo.

del README.txt >> nul

echo Build complete...
pause
exit /b 0

:BUILDING
echo Building i2pd %tag% for win%bitness%:
echo Build AVX+AESNI...
%xSH% "make USE_UPNP=yes USE_AVX=1 USE_AESNI=1 -j%threads% && zip -r9 build/i2pd_%tag%_win%bitness%_mingw_avx_aesni.zip i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates && make clean" > build/build_win%bitness%_avx_aesni.log 2>&1
echo Build AVX...
%xSH% "make USE_UPNP=yes USE_AVX=1 -j%threads% && zip -r9 build/i2pd_%tag%_win%bitness%_mingw_avx.zip i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates && make clean" > build/build_win%bitness%_avx.log 2>&1
echo Build AESNI...
%xSH% "make USE_UPNP=yes USE_AESNI=1 -j%threads% && zip -r9 build/i2pd_%tag%_win%bitness%_mingw_aesni.zip i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates && make clean" > build/build_win%bitness%_aesni.log 2>&1
echo Build without extensions...
%xSH% "make USE_UPNP=yes -j%threads% && zip -r9 build/i2pd_%tag%_win%bitness%_mingw.zip i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates && make clean" > build/build_win%bitness%.log 2>&1

:EOF

update windows build batch

update windows build batch


@echo Begin Post-Build script

if "%BuildingInsideVisualStudio%" == "true" (
    set PKG_DIR=%SolutionDir%\NuGet.Packages
) else (
    set PKG_DIR=%TargetDir%\..\NuGet.Packages
)

if "%BuildingInsideVisualStudio%" == "true" (
    set CHOCO_PKG_DIR=%SolutionDir%\Chocolatey.Packages
) else (
    set CHOCO_PKG_DIR=%TargetDir%\..\Chocolatey.Packages
)

copy /y "%SolutionDir%SDK\OrleansConfiguration.xml" "%TargetDir%"
copy /y "%SolutionDir%SDK\ClientConfiguration.xml" "%TargetDir%"

if "%BuildOrleansNuGet%" == "" (
    if "%Configuration%" == "Release" (
        set BuildOrleansNuGet=true
    ) else (
        set BuildOrleansNuGet=false
    )
)
if "%BuildOrleansChocolatey%" == "" (
    if "%Configuration%" == "Release" (
        set BuildOrleansChocolatey=true
    ) else (
        set BuildOrleansChocolatey=false
    )
)

@echo BuildingInsideVisualStudio = %BuildingInsideVisualStudio% BuildOrleansNuGet = %BuildOrleansNuGet% BuildOrleansChocolatey = %BuildOrleansChocolatey%

copy /y "%SolutionDir%NuGet\*.props" "%TargetDir%\"
copy /y "%SolutionDir%NuGet\EmptyFile.cs" "%TargetDir%\"
copy /y "%SolutionDir%NuGet\*Install.ps1" "%TargetDir%\"

if not "%BuildingInsideVisualStudio%" == "true" (
    if "%BuildOrleansNuGet%" == "true" (
        @echo Clean old generated Orleans NuGet packages from %TargetDir%
        del /q *.nupkg

        @echo Build Orleans NuGet packages from %TargetDir%
        call "%SolutionDir%NuGet\CreateOrleansPackages.bat" . .\Version.txt
        if ERRORLEVEL 1 EXIT /B 1

        @echo Copying Orleans NuGet packages to %PKG_DIR%
        if not exist "%PKG_DIR%" (md "%PKG_DIR%") else (del /s/q "%PKG_DIR%\*")
        xcopy /y *.nupkg "%PKG_DIR%\"
    ) else (
        @echo Skipping generation of Orleans NuGet packages for Configuration=%Configuration% because BuildOrleansNuGet=%BuildOrleansNuGet%
    )
    if "%BuildOrleansChocolatey%" == "true" (
        @echo Clean old generated Orleans Chocolatey packages from %TargetDir%
        del /q orleans.nupkg

        @echo Build Orleans Chocolatey packages from %TargetDir%
        call "%SolutionDirChocolatey\CreateOrleansChocolateyPackage.bat" . .\Version.txt
        if ERRORLEVEL 1 EXIT /B 1

        @echo Copying Orleans Chocolatey packages to %PKG_DIR%
        if not exist "%CHOCO_PKG_DIR%" (md "%CHOCO_PKG_DIR%") else (del /s/q "%CHOCO_PKG_DIR%\*")
        xcopy /y orleans.nupkg "%CHOCO_PKG_DIR%\"
    ) else (
        @echo Skipping generation of Orleans NuGet packages for Configuration=%Configuration% because BuildOrleansNuGet=%BuildOrleansNuGet%
    )
)

@echo Begin Post-Build script

if "%BuildingInsideVisualStudio%" == "true" (
    set PKG_DIR=%SolutionDir%\NuGet.Packages
) else (
    set PKG_DIR=%TargetDir%\..\NuGet.Packages
)

if "%BuildingInsideVisualStudio%" == "true" (
    set CHOCO_PKG_DIR=%SolutionDir%\Chocolatey.Packages
) else (
    set CHOCO_PKG_DIR=%TargetDir%\..\Chocolatey.Packages
)

copy /y "%SolutionDir%SDK\OrleansConfiguration.xml" "%TargetDir%"
copy /y "%SolutionDir%SDK\ClientConfiguration.xml" "%TargetDir%"

if "%BuildOrleansNuGet%" == "" (
    if "%Configuration%" == "Release" (
        set BuildOrleansNuGet=true
    ) else (
        set BuildOrleansNuGet=false
    )
)
if "%BuildOrleansChocolatey%" == "" (
    if "%Configuration%" == "Release" (
        set BuildOrleansChocolatey=true
    ) else (
        set BuildOrleansChocolatey=false
    )
)

@echo BuildingInsideVisualStudio = %BuildingInsideVisualStudio% BuildOrleansNuGet = %BuildOrleansNuGet% BuildOrleansChocolatey = %BuildOrleansChocolatey%

copy /y "%SolutionDir%NuGet\*.props" "%TargetDir%\"
copy /y "%SolutionDir%NuGet\EmptyFile.cs" "%TargetDir%\"
copy /y "%SolutionDir%NuGet\*Install.ps1" "%TargetDir%\"

if not "%BuildingInsideVisualStudio%" == "true" (
    if "%BuildOrleansNuGet%" == "true" (
        @echo Clean old generated Orleans NuGet packages from %TargetDir%
        del /q *.nupkg

        @echo Build Orleans NuGet packages from %TargetDir%
        call "%SolutionDir%NuGet\CreateOrleansPackages.bat" . .\Version.txt
        if ERRORLEVEL 1 EXIT /B 1

        @echo Copying Orleans NuGet packages to %PKG_DIR%
        if not exist "%PKG_DIR%" (md "%PKG_DIR%") else (del /s/q "%PKG_DIR%\*")
        xcopy /y *.nupkg "%PKG_DIR%\"
    ) else (
        @echo Skipping generation of Orleans NuGet packages for Configuration=%Configuration% because BuildOrleansNuGet=%BuildOrleansNuGet%
    )
    if "%BuildOrleansChocolatey%" == "true" (
        @echo Clean old generated Orleans Chocolatey packages from %TargetDir%
        del /q *.nupkg

        @echo Build Orleans Chocolatey packages from %TargetDir%
        call "%SolutionDir%Chocolatey\CreateOrleansChocolateyPackage.bat" . .\Version.txt
        if ERRORLEVEL 1 EXIT /B 1

        @echo Copying Orleans Chocolatey packages to %CHOCO_PKG_DIR%
        if not exist "%CHOCO_PKG_DIR%" (md "%CHOCO_PKG_DIR%") else (del /s/q "%CHOCO_PKG_DIR%\*")
        xcopy /y "%SolutionDir%Chocolatey\*.nupkg" "%CHOCO_PKG_DIR%\"
    ) else (
        @echo Skipping generation of Orleans NuGet packages for Configuration=%Configuration% because BuildOrleansNuGet=%BuildOrleansNuGet%
    )
)

build running

build running


set CMAKE_CONFIG=Release

mkdir build_%CMAKE_CONFIG%
pushd build_%CMAKE_CONFIG%

cmake -G "NMake Makefiles"                           ^
      -DCMAKE_BUILD_TYPE:STRING=%CMAKE_CONFIG%       ^
      -DBLA_VENDOR:STRING=OpenBLAS                   ^
      -DENABLE_PYTHON:BOOL=ON                        ^
      -DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" ^
      -DBUILD_DOCUMENTATION:BOOL=OFF                 ^
      -DVCOMP_WORKAROUND=OFF                         ^
      "%SRC_DIR%"
if errorlevel 1 exit rem 1

cmake --build . --target install --config %CMAKE_CONFIG%
if errorlevel 1 exit 1

popd

set CMAKE_CONFIG=Release

mkdir build_%CMAKE_CONFIG%
pushd build_%CMAKE_CONFIG%

cmake -G "NMake Makefiles"                           ^
      -DCMAKE_BUILD_TYPE:STRING=%CMAKE_CONFIG%       ^
      -DBLA_VENDOR:STRING=OpenBLAS                   ^
      -DENABLE_PYTHON:BOOL=ON                        ^
      -DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" ^
      -DBUILD_DOCUMENTATION:BOOL=OFF                 ^
      -DVCOMP_WORKAROUND=OFF                         ^
      -DENABLE_PACKAGING:BOOL=OFF                    ^
      "%SRC_DIR%"
if errorlevel 1 exit rem 1

cmake --build . --target install --config %CMAKE_CONFIG%
if errorlevel 1 exit 1

popd

Disable packaging to Avoid copying msvc runtime


REM First toolchain will run clean {
set PROJECT_DIR=examples/GTest
set TOOLCHAIN=vs-14-2015
.\jenkins.py --verbose --clear-except
REM }

REM {
set PROJECT_DIR=examples/qt-widgets
set TOOLCHAIN=vs-14-2015
.\jenkins.py --verbose --upload --nocreate
set TOOLCHAIN=vs-12-2013
.\jenkins.py --verbose --upload --nocreate
set TOOLCHAIN=vs-11-2012
.\jenkins.py --verbose --upload --nocreate
set TOOLCHAIN=mingw
.\jenkins.py --verbose --upload --nocreate
REM }

REM {
set PROJECT_DIR=examples/qt-camera
set TOOLCHAIN=vs-14-2015
.\jenkins.py --verbose --upload --nocreate
set TOOLCHAIN=vs-12-2013
.\jenkins.py --verbose --upload --nocreate
set TOOLCHAIN=vs-11-2012
.\jenkins.py --verbose --upload --nocreate
set TOOLCHAIN=mingw
.\jenkins.py --verbose --upload --nocreate
REM }

REM {
set PROJECT_DIR=examples/qt-location
set TOOLCHAIN=vs-14-2015
.\jenkins.py --verbose --upload --nocreate
set TOOLCHAIN=vs-12-2013
.\jenkins.py --verbose --upload --nocreate
set TOOLCHAIN=vs-11-2012
.\jenkins.py --verbose --upload --nocreate
set TOOLCHAIN=mingw
.\jenkins.py --verbose --upload --nocreate
REM }

REM {
set PROJECT_DIR=examples/qt-qml
set TOOLCHAIN=vs-14-2015
.\jenkins.py --verbose --upload --nocreate
set TOOLCHAIN=vs-12-2013
.\jenkins.py --verbose --upload --nocreate
set TOOLCHAIN=vs-11-2012
.\jenkins.py --verbose --upload --nocreate
set TOOLCHAIN=mingw
.\jenkins.py --verbose --upload --nocreate
REM }

REM First toolchain will run clean {
set PROJECT_DIR=examples/GTest
set TOOLCHAIN=vs-14-2015
.\jenkins.py --verbose --clear-except || exit /b 1
REM }

REM {
set PROJECT_DIR=examples/qt-widgets
set TOOLCHAIN=vs-14-2015
.\jenkins.py --verbose --upload --nocreate || exit /b 1
set TOOLCHAIN=vs-12-2013
.\jenkins.py --verbose --upload --nocreate || exit /b 1
set TOOLCHAIN=vs-11-2012
.\jenkins.py --verbose --upload --nocreate || exit /b 1
set TOOLCHAIN=mingw
.\jenkins.py --verbose --upload --nocreate || exit /b 1
REM }

REM {
set PROJECT_DIR=examples/qt-camera
set TOOLCHAIN=vs-14-2015
.\jenkins.py --verbose --upload --nocreate || exit /b 1
set TOOLCHAIN=vs-12-2013
.\jenkins.py --verbose --upload --nocreate || exit /b 1
set TOOLCHAIN=vs-11-2012
.\jenkins.py --verbose --upload --nocreate || exit /b 1
set TOOLCHAIN=mingw
.\jenkins.py --verbose --upload --nocreate || exit /b 1
REM }

REM {
set PROJECT_DIR=examples/qt-location
set TOOLCHAIN=vs-14-2015
.\jenkins.py --verbose --upload --nocreate || exit /b 1
set TOOLCHAIN=vs-12-2013
.\jenkins.py --verbose --upload --nocreate || exit /b 1
set TOOLCHAIN=vs-11-2012
.\jenkins.py --verbose --upload --nocreate || exit /b 1
set TOOLCHAIN=mingw
.\jenkins.py --verbose --upload --nocreate || exit /b 1
REM }

REM {
set PROJECT_DIR=examples/qt-qml
set TOOLCHAIN=vs-14-2015
.\jenkins.py --verbose --upload --nocreate || exit /b 1
set TOOLCHAIN=vs-12-2013
.\jenkins.py --verbose --upload --nocreate || exit /b 1
set TOOLCHAIN=vs-11-2012
.\jenkins.py --verbose --upload --nocreate || exit /b 1
set TOOLCHAIN=mingw
.\jenkins.py --verbose --upload --nocreate || exit /b 1
REM }

Exit on error

Exit on error

[skip ci]


@ECHO OFF

if "%1" == "" (
  echo "Usage: do2 <Release | ReleaseDLL | Debug | DebugDLL"
	goto :END
)

if not exist sodium_version.c (
	echo "Are you on the right path?" %CD%
	goto :END
)

if "%2" == "x64" (SET ARCH=x64) else (SET ARCH=Win32)
SET CFLAGS=/nologo /DTEST_SRCDIR=\".\" /I..\..\src\libsodium\include\sodium /I..\..\src\libsodium\include /I..\quirks
SET LDFLAGS=/link /LTCG advapi32.lib ..\..\Build\%1\%ARCH%\libsodium.lib
if "%1" == "ReleaseDLL" ( goto :ReleaseDLL )
if "%1" == "DebugDLL"   ( goto :DebugDLL )
if "%1" == "Release"   ( goto :Release )
if "%1" == "Debug"   ( goto :Debug )
echo "Invalid build type"
goto :END
:ReleaseDLL
	SET CFLAGS=%CFLAGS% /MD /Ox
	SET PATH=..\..\Build\%1\%ARCH%;%PATH%
	goto :COMPILE
:Release
	SET CFLAGS=%CFLAGS% /MT /Ox /DSODIUM_STATIC /DSODIUM_EXPORT=
	goto :COMPILE
:DebugDLL
	SET CFLAGS=%CFLAGS% /GS /MDd /Od
	SET PATH=..\..\Build\%1\%ARCH%;%PATH%
	goto :COMPILE
:Debug
	SET CFLAGS=%CFLAGS% /GS /MTd /Od /DSODIUM_STATIC /DSODIUM_EXPORT=
	goto :COMPILE
:COMPILE
FOR %%f in (*.c) DO (
	cl %CFLAGS% %%f %LDFLAGS% /OUT:%%f.exe > NUL 2>&1
	if not exist %%f.exe (
		echo %%f compile failed
		goto :END
	)
	%%f.exe
	if errorlevel 1 (
		echo %%f failed
	) else (
		echo %%f ok
	)
)
REM Remove temporary files
del *.exe *.obj *.res
:END

@ECHO OFF

if "%1" == "" (
  echo "Usage: wintest.bat <Release | ReleaseDLL | Debug | DebugDLL"
	goto :END
)

if not exist sodium_version.c (
	echo "Are you on the right path?" %CD%
	goto :END
)

if "%2" == "x64" (SET ARCH=x64) else (SET ARCH=Win32)
SET CFLAGS=/nologo /DTEST_SRCDIR=\".\" /I..\..\src\libsodium\include\sodium /I..\..\src\libsodium\include /I..\quirks
SET LDFLAGS=/link /LTCG advapi32.lib ..\..\Build\%1\%ARCH%\libsodium.lib
if "%1" == "ReleaseDLL" ( goto :ReleaseDLL )
if "%1" == "DebugDLL"   ( goto :DebugDLL )
if "%1" == "Release"   ( goto :Release )
if "%1" == "Debug"   ( goto :Debug )
echo "Invalid build type"
goto :END
:ReleaseDLL
	SET CFLAGS=%CFLAGS% /MD /Ox
	SET PATH=..\..\Build\%1\%ARCH%;%PATH%
	goto :COMPILE
:Release
	SET CFLAGS=%CFLAGS% /MT /Ox /DSODIUM_STATIC /DSODIUM_EXPORT=
	goto :COMPILE
:DebugDLL
	SET CFLAGS=%CFLAGS% /GS /MDd /Od
	SET PATH=..\..\Build\%1\%ARCH%;%PATH%
	goto :COMPILE
:Debug
	SET CFLAGS=%CFLAGS% /GS /MTd /Od /DSODIUM_STATIC /DSODIUM_EXPORT=
	goto :COMPILE
:COMPILE
FOR %%f in (*.c) DO (
	cl %CFLAGS% %%f %LDFLAGS% /OUT:%%f.exe > NUL 2>&1
	if not exist %%f.exe (
		echo %%f compile failed
		goto :END
	)
	%%f.exe
	if errorlevel 1 (
		echo %%f failed
	) else (
		echo %%f ok
	)
)
REM Remove temporary files
del *.exe *.obj *.res
:END

Fix wintest.bat usage

Fix wintest.bat usage


REM
REM Licensed to the Apache Software Foundation (ASF) under one
REM or more contributor license agreements.  See the NOTICE file
REM distributed with this work for additional information
REM regarding copyright ownership.  The ASF licenses this file
REM to you under the Apache License, Version 2.0 (the
REM "License"); you may not use this file except in compliance
REM with the License.  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,
REM software distributed under the License is distributed on an
REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
REM KIND, either express or implied.  See the License for the
REM specific language governing permissions and limitations
REM under the License.
REM

REM HACK ALERT: This script supports debug builds in $PROTON_HOME\build only.

set PROTON_HOME=%~dp0
set PROTON_HOME=%PROTON_HOME:~0,-1%

if "%CPROTON_BUILD%"=="" (
    if EXIST %PROTON_HOME%\build\proton-c (
        set PROTON_BINDINGS=%PROTON_HOME%\build\proton-c\bindings
    ) else (
        set PROTON_BINDINGS=%PROTON_HOME%\proton-c\bindings
    )
    if EXIST %PROTON_HOME%\build\proton-j (
        set PROTON_JARS=%PROTON_HOME%\build\proton-j\proton-j.jar
    ) else (
        set PROTON_JARS=%PROTON_HOME%\proton-j\proton-j.jar
    )
) else (
    set PROTON_BINDINGS=%CPROTON_BUILD%\bindings
)
echo PROTON_BINDINGS = %PROTON_BINDINGS%

REM Python & Jython
set PYTHON_BINDINGS=%PROTON_BINDINGS%\python
set COMMON_PYPATH=%PROTON_HOME%\tests\python:%PROTON_HOM%\proton-c\bindings\python
set PYTHONPATH=%COMMON_PYPATH%:%PYTHON_BINDINGS%
set JYTHONPATH=%COMMON_PYPATH%:%PROTON_HOM%\proton-j\src\main\resources:%PROTON_JARS%
set CLASSPATH=%PROTON_JARS%

REM PHP
set PHP_BINDINGS=%PROTON_BINDINGS%\php
if EXIST %PHP_BINDINGS% (
    echo include_path="%PHP_BINDINGS%:%PROTON_HOME%\proton-c\bindings\php" >  %PHP_BINDINGS%\php.ini
    echo extension="%PHP_BINDINGS%\cproton.so"                             >> %PHP_BINDINGS%\php.ini
    set PHPRC=%PHP_BINDINGS%\php.ini
)

REM Ruby
set RUBY_BINDINGS=%PROTON_BINDINGS%\ruby
set RUBYLIB=%RUBY_BINDINGS%:%PROTON_HOME%\proton-c\bindings\ruby\lib:%PROTON_HOME%\tests\ruby

REM Perl
set PERL_BINDINGS=%PROTON_BINDINGS%\perl
set PERL5LIB=%PERL5LIB%:%PERL_BINDINGS%:%PROTON_HOME%\proton-c\bindings\perl\lib

REM test applications
if EXIST %PROTON_HOME%\build\tests\tools\apps\c set PATH=%PATH%;%PROTON_HOME%\build\tests\tools\apps\c

if EXIST %PROTON_HOME%\tests\tools\apps\python set PATH=%PATH%;%PROTON_HOME%\tests\tools\apps\python

REM test applications
set PATH=%PATH%;%PROTON_HOME%\tests\python;%PROTON_HOME%\build\proton-c\debug

PROTON-596: Add config.bat environment settings for windows.
* Bug-for-bug compatible with config.sh
** adds new paths after old paths
** uses fixed \build folder for builds
* For use with debug builds only (pending conversion to cmake configure .in file)
To use:
  > cd proton
  > call config.bat
  > cd build
  > ctest

git-svn-id: 33ed6c3feaacb64944efc691d1ae8e09b17f2bf9@1600727 13f79535-47bb-0310-9956-ffa450edef68


@setlocal enabledelayedexpansion

REM Parse Arguments.

set NugetZipUrlRoot=https://dotnetci.blob.core.windows.net/roslyn
set NugetZipUrl=%NuGetZipUrlRoot%/nuget.65.zip
set RoslynRoot=%~dp0
set BuildConfiguration=Debug
set BuildRestore=false

REM Because override the C#/VB toolset to build against our LKG package, it is important
REM that we do not reuse MSBuild nodes from other jobs/builds on the machine. Otherwise,
REM we'll run into issues such as https://github.com/dotnet/roslyn/issues/6211.
set MSBuildAdditionalCommandLineArgs=/nologo /m /nodeReuse:false /consoleloggerparameters:Verbosity=minimal /filelogger /fileloggerparameters:Verbosity=normal

:ParseArguments
if "%1" == "" goto :DoneParsing
if /I "%1" == "/?" call :Usage && exit /b 1
if /I "%1" == "/debug" set BuildConfiguration=Debug&&shift&& goto :ParseArguments
if /I "%1" == "/release" set BuildConfiguration=Release&&shift&& goto :ParseArguments
if /I "%1" == "/test32" set Test64=false&&shift&& goto :ParseArguments
if /I "%1" == "/test64" set Test64=true&&shift&& goto :ParseArguments
if /I "%1" == "/testDeterminism" set TestDeterminism=true&&shift&& goto :ParseArguments
if /I "%1" == "/restore" set BuildRestore=true&&shift&& goto :ParseArguments
call :Usage && exit /b 1
:DoneParsing

call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat" || goto :BuildFailed

powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\check-branch.ps1" || goto :BuildFailed

REM Restore the NuGet packages
if "%BuildRestore%" == "true" (
    call "%RoslynRoot%\Restore.cmd" || goto :BuildFailed
) else (
    powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\restore.ps1" "%NugetZipUrl%" || goto :BuildFailed
)

REM Ensure the binaries directory exists because msbuild can fail when part of the path to LogFile isn't present.
set bindir=%RoslynRoot%Binaries
if not exist "%bindir%" mkdir "%bindir%" || goto :BuildFailed

REM Set the build version only so the assembly version is set to the semantic version,
REM which allows analyzers to load because the compiler has binding redirects to the
REM semantic version
msbuild %MSBuildAdditionalCommandLineArgs% /p:BuildVersion=0.0.0.0 "%RoslynRoot%build\Toolset.sln" /p:NuGetRestorePackages=false /p:Configuration=%BuildConfiguration% /fileloggerparameters:LogFile="%bindir%\Bootstrap.log" || goto :BuildFailed
powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\check-msbuild.ps1" "%bindir%\Bootstrap.log" || goto :BuildFailed

if not exist "%bindir%\Bootstrap" mkdir "%bindir%\Bootstrap" || goto :BuildFailed
move "Binaries\%BuildConfiguration%\*" "%bindir%\Bootstrap" || goto :BuildFailed
copy "build\scripts\*" "%bindir%\Bootstrap" || goto :BuildFailed

REM Clean the previous build
msbuild %MSBuildAdditionalCommandLineArgs% /t:Clean build/Toolset.sln /p:Configuration=%BuildConfiguration%  /fileloggerparameters:LogFile="%bindir%\BootstrapClean.log" || goto :BuildFailed

call :TerminateBuildProcesses

if defined TestDeterminism (
    powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\test-determinism.ps1" "%bindir%\Bootstrap" || goto :BuildFailed
    call :TerminateBuildProcesses
    exit /b 0
)

msbuild %MSBuildAdditionalCommandLineArgs% /p:BootstrapBuildPath="%bindir%\Bootstrap" BuildAndTest.proj /p:Configuration=%BuildConfiguration% /p:Test64=%Test64% /fileloggerparameters:LogFile="%bindir%\Build.log";verbosity=diagnostic || goto :BuildFailed
powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\check-msbuild.ps1" "%bindir%\Build.log" || goto :BuildFailed

call :TerminateBuildProcesses

REM Verify that our project.lock.json files didn't change as a result of
REM restore.  If they do then the commit changed the dependencies without
REM updating the lock files.
REM git diff --exit-code --quiet
REM if ERRORLEVEL 1 (
REM    echo Commit changed dependencies without updating project.lock.json
REM    git diff --exit-code
REM    exit /b 1
REM )

REM Ensure caller sees successful exit.
exit /b 0

:Usage
@echo Usage: cibuild.cmd [/debug^|/release] [/test32^|/test64] [/restore]
@echo   /debug   Perform debug build.  This is the default.
@echo   /release Perform release build.
@echo   /test32  Run unit tests in the 32-bit runner.  This is the default.
@echo   /test64  Run units tests in the 64-bit runner.
@echo   /restore Perform actual nuget restore instead of using zip drops.
@echo.
@goto :eof

:BuildFailed
echo Build failed with ERRORLEVEL %ERRORLEVEL%
call :TerminateBuildProcesses
exit /b 1

:TerminateBuildProcesses
@REM Kill any instances VBCSCompiler.exe to release locked files, ignoring stderr if process is not open
@REM This prevents future CI runs from failing while trying to delete those files.
@REM Kill any instances of msbuild.exe to ensure that we never reuse nodes (e.g. if a non-roslyn CI run
@REM left some floating around).

taskkill /F /IM vbcscompiler.exe 2> nul
taskkill /F /IM msbuild.exe 2> nul

@setlocal enabledelayedexpansion

REM Parse Arguments.

set NugetZipUrlRoot=https://dotnetci.blob.core.windows.net/roslyn
set NugetZipUrl=%NuGetZipUrlRoot%/nuget.65.zip
set RoslynRoot=%~dp0
set BuildConfiguration=Debug
set BuildRestore=false

REM Because override the C#/VB toolset to build against our LKG package, it is important
REM that we do not reuse MSBuild nodes from other jobs/builds on the machine. Otherwise,
REM we'll run into issues such as https://github.com/dotnet/roslyn/issues/6211.
set MSBuildAdditionalCommandLineArgs=/nologo /m /nodeReuse:false /consoleloggerparameters:Verbosity=minimal /filelogger /fileloggerparameters:Verbosity=normal

:ParseArguments
if "%1" == "" goto :DoneParsing
if /I "%1" == "/?" call :Usage && exit /b 1
if /I "%1" == "/debug" set BuildConfiguration=Debug&&shift&& goto :ParseArguments
if /I "%1" == "/release" set BuildConfiguration=Release&&shift&& goto :ParseArguments
if /I "%1" == "/test32" set Test64=false&&shift&& goto :ParseArguments
if /I "%1" == "/test64" set Test64=true&&shift&& goto :ParseArguments
if /I "%1" == "/testDeterminism" set TestDeterminism=true&&shift&& goto :ParseArguments
if /I "%1" == "/restore" set BuildRestore=true&&shift&& goto :ParseArguments

REM /buildTimeLimit is the time limit, measured in minutes, for the Jenkins job that runs
REM the build. The Jenkins script netci.groovy passes the time limit to this script.

REM netci.groovy does not yet pass the time limit to cibuild.cmd. We are making this
REM change to cibuild.cmd in all branches *before* modifying netci.groovy. If we didn't
REM do things in this order, we'd have to modify cibuild.cmd in *all* branches *at the
REM same time* we made the change to netci.groovy. This way, we'll be able to first
REM modify netci.groovy to pass the new parameter without causing any harm. Then we'll
REM be able go to each branch in turn, modifying cibuild.cmd and BuildAndTest.cmd to
REM actually make use of the new parameter.
if /I "%1" == "/buildTimeLimit" set BuildTimeLimit=%2&&shift&&shift&& goto:ParseArguments

call :Usage && exit /b 1
:DoneParsing

call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat" || goto :BuildFailed

powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\check-branch.ps1" || goto :BuildFailed

REM Restore the NuGet packages
if "%BuildRestore%" == "true" (
    call "%RoslynRoot%\Restore.cmd" || goto :BuildFailed
) else (
    powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\restore.ps1" "%NugetZipUrl%" || goto :BuildFailed
)

REM Ensure the binaries directory exists because msbuild can fail when part of the path to LogFile isn't present.
set bindir=%RoslynRoot%Binaries
if not exist "%bindir%" mkdir "%bindir%" || goto :BuildFailed

REM Set the build version only so the assembly version is set to the semantic version,
REM which allows analyzers to load because the compiler has binding redirects to the
REM semantic version
msbuild %MSBuildAdditionalCommandLineArgs% /p:BuildVersion=0.0.0.0 "%RoslynRoot%build\Toolset.sln" /p:NuGetRestorePackages=false /p:Configuration=%BuildConfiguration% /fileloggerparameters:LogFile="%bindir%\Bootstrap.log" || goto :BuildFailed
powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\check-msbuild.ps1" "%bindir%\Bootstrap.log" || goto :BuildFailed

if not exist "%bindir%\Bootstrap" mkdir "%bindir%\Bootstrap" || goto :BuildFailed
move "Binaries\%BuildConfiguration%\*" "%bindir%\Bootstrap" || goto :BuildFailed
copy "build\scripts\*" "%bindir%\Bootstrap" || goto :BuildFailed

REM Clean the previous build
msbuild %MSBuildAdditionalCommandLineArgs% /t:Clean build/Toolset.sln /p:Configuration=%BuildConfiguration%  /fileloggerparameters:LogFile="%bindir%\BootstrapClean.log" || goto :BuildFailed

call :TerminateBuildProcesses

if defined TestDeterminism (
    powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\test-determinism.ps1" "%bindir%\Bootstrap" || goto :BuildFailed
    call :TerminateBuildProcesses
    exit /b 0
)

msbuild %MSBuildAdditionalCommandLineArgs% /p:BootstrapBuildPath="%bindir%\Bootstrap" BuildAndTest.proj /p:Configuration=%BuildConfiguration% /p:Test64=%Test64% /fileloggerparameters:LogFile="%bindir%\Build.log";verbosity=diagnostic || goto :BuildFailed
powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\check-msbuild.ps1" "%bindir%\Build.log" || goto :BuildFailed

call :TerminateBuildProcesses

REM Verify that our project.lock.json files didn't change as a result of
REM restore.  If they do then the commit changed the dependencies without
REM updating the lock files.
REM git diff --exit-code --quiet
REM if ERRORLEVEL 1 (
REM    echo Commit changed dependencies without updating project.lock.json
REM    git diff --exit-code
REM    exit /b 1
REM )

REM Ensure caller sees successful exit.
exit /b 0

:Usage
@echo Usage: cibuild.cmd [/debug^|/release] [/test32^|/test64] [/restore]
@echo   /debug   Perform debug build.  This is the default.
@echo   /release Perform release build.
@echo   /test32  Run unit tests in the 32-bit runner.  This is the default.
@echo   /test64  Run units tests in the 64-bit runner.
@echo   /restore Perform actual nuget restore instead of using zip drops.
@echo.
@goto :eof

:BuildFailed
echo Build failed with ERRORLEVEL %ERRORLEVEL%
call :TerminateBuildProcesses
exit /b 1

:TerminateBuildProcesses
@REM Kill any instances VBCSCompiler.exe to release locked files, ignoring stderr if process is not open
@REM This prevents future CI runs from failing while trying to delete those files.
@REM Kill any instances of msbuild.exe to ensure that we never reuse nodes (e.g. if a non-roslyn CI run
@REM left some floating around).

taskkill /F /IM vbcscompiler.exe 2> nul
taskkill /F /IM msbuild.exe 2> nul

Prepare cibuild.cmd to receive /buildTimeLimit


@echo off

set CoreRT_TestRoot=%~dp0
set CoreRT_BuildArch=x64
set CoreRT_BuildType=Debug
set CoreRT_BuildOS=Windows_NT
set CoreRT_TestRun=true
set CoreRT_TestCompileMode=protojit
set CoreRT_TestExtRepo=
set CoreRT_BuildExtRepo=

:ArgLoop
if "%1" == "" goto :ArgsDone
if /i "%1" == "/?" goto :Usage
if /i "%1" == "x64"    (set CoreRT_BuildArch=x64&&shift&goto ArgLoop)
if /i "%1" == "x86"    (set CoreRT_BuildArch=x86&&shift&goto ArgLoop)
if /i "%1" == "arm"    (set CoreRT_BuildArch=arm&&shift&goto ArgLoop)

if /i "%1" == "debug"    (set CoreRT_BuildType=Debug&shift&goto ArgLoop)
if /i "%1" == "release"  (set CoreRT_BuildType=Release&shift&goto ArgLoop)
if /i "%1" == "/extrepo"  (set CoreRT_TestExtRepo=%2&shift&shift&goto ArgLoop)
if /i "%1" == "/buildextrepo" (set CoreRT_BuildExtRepo=%2&shift&shift&goto ArgLoop)
if /i "%1" == "/mode" (set CoreRT_TestCompileMode=%2&shift&shift&goto ArgLoop)
if /i "%1" == "/runtest" (set CoreRT_TestRun=%2&shift&shift&goto ArgLoop)
if /i "%1" == "/nocache" (set CoreRT_NuGetOptions=-nocache&shift&goto ArgLoop)

echo Invalid command line argument: %1
goto :Usage

:Usage
echo %0 [OS] [arch] [flavor] [/extrepo] [/buildextrepo] [/mode] [/runtest]
echo     /mode         : Compilation mode. Specify cpp/protojit. Default: protojit
echo     /runtest      : Should just compile or run compiled bianry? Specify: true/false. Default: true.
echo     /extrepo      : Path to external repo, currently supports: GitHub: dotnet/coreclr. Specify full path. If unspecified, runs corert tests
echo     /buildextrepo : Should build at root level of external repo? Specify: true/false. Default: true
echo     /nocache      : When restoring toolchain packages, obtain them from the feed not the cache.
exit /b 2

:ArgsDone

setlocal EnableDelayedExpansion
set __BuildStr=%CoreRT_BuildOS%.%CoreRT_BuildArch%.%CoreRT_BuildType%
set __BinDir=%CoreRT_TestRoot%..\bin\tests
set __LogDir=%CoreRT_TestRoot%\..\bin\Logs\%__BuildStr%\tests
set __NuPkgInstallDir=%__BinDir%\package
set __BuiltNuPkgDir=%CoreRT_TestRoot%..\bin\Product\%__BuildStr%\.nuget

set __PackageRestoreCmd=restore.cmd
call %__PackageRestoreCmd% /nugetexedir %CoreRT_TestRoot%..\packages /installdir %__NuPkgInstallDir% /nupkgdir %__BuiltNuPkgDir% /nugetopt %CoreRT_NuGetOptions%
if not "%ErrorLevel%"=="100" (((call :Fail "Preptests failed... cannot continue")) & exit /b -1)

REM ** Validate the paths needed to run tests
if not exist "%CoreRT_AppDepSdkDir%" ((call :Fail "AppDep SDK not installed at %CoreRT_AppDepSdkDir%") & exit /b -1)
if not exist "%CoreRT_ProtoJitDir%"  ((call :Fail "ProtoJIT not installed at %CoreRT_ProtoJitDir%") & exit /b -1)
if not exist "%CoreRT_ObjWriterDir%" ((call :Fail "ObjWriter not installed at %ObjWriterDir%") & exit /b -1)
if not exist "%CoreRT_ToolchainDir%\dotnet-compile-native.bat" ((call :Fail "dotnet-compile-native.bat not found in %CoreRT_ToolchainDir%") & exit /b -1)

if not "%CoreRT_TestExtRepo%"=="" goto :TestExtRepo

if not defined CoreRT_ToolchainPkg ((call :Fail "Run %__PackageRestoreCmd% first") & exit /b -1)
if not defined CoreRT_ToolchainVer ((call :Fail "Run %__PackageRestoreCmd% first") & exit /b -1)

if /i "%__BuildType%"=="Debug" (
    set __LinkLibs=msvcrtd.lib
) else (
    set __LinkLibs=msvcrt.lib
)

echo. > %__BinDir%\testResults.tmp

set /a __TotalTests=0
set /a __PassedTests=0
for /f "delims=" %%a in ('dir /s /aD /b src\*') do (
    set __SourceFolder=%%a
    set __SourceFileName=%%~na
    set __RelativePath=!__SourceFolder:%CoreRT_TestRoot%=!
    if exist "!__SourceFolder!\!__SourceFileName!.cs" (
        call :CompileFile !__SourceFolder! !__SourceFileName! %__LogDir%\!__RelativePath!
        set /a __TotalTests=!__TotalTests!+1
    ) else (echo !__SourceFolder!\!__SourceFileName!)
)
set /a __FailedTests=%__TotalTests%-%__PassedTests%

echo ^<?xml version="1.0" encoding="utf-8"?^> > %__BinDir%\testResults.xml
echo ^<assemblies^>  >> %__BinDir%\testResults.xml
echo ^<assembly name="ILCompiler" total="%__TotalTests%" passed="%__PassedTests%" failed="%__FailedTests%" skipped="0"^>  >> %__BinDir%\testResults.xml
echo ^<collection total="%__TotalTests%" passed="%__PassedTests%" failed="%__FailedTests%" skipped="0"^>  >> %__BinDir%\testResults.xml
type %__BinDir%\testResults.tmp >> %__BinDir%\testResults.xml
echo ^</collection^>  >> %__BinDir%\testResults.xml
echo ^</assembly^>  >> %__BinDir%\testResults.xml
echo ^</assemblies^>  >> %__BinDir%\testResults.xml

echo.
set "__ConsoleOut=TOTAL: %__TotalTests% PASSED: %__PassedTests%"

if %__TotalTests% EQU %__PassedTests% (set __StatusPassed=1)
if %__TotalTests% EQU 0 (set __StatusPassed=0)
if "%__StatusPassed%"=="1" (
    powershell -Command Write-Host "%__ConsoleOut%" -foreground "Black" -background "Green"
    exit /b 0
) else (
    powershell -Command Write-Host "%__ConsoleOut%" -foreground "White" -background "Red"
    exit /b 1
)

:CompileFile
    echo.
    echo Compiling directory %~1
    set __SourceFolder=%~1
    set __SourceFileName=%~2
    set __CompileLogPath=%~3
    if not exist "!__CompileLogPath!" (mkdir !__CompileLogPath!)
    endlocal
    set __SourceFile=!__SourceFolder!\!__SourceFileName!
    call :DeleteFile "!__SourceFile!.S"
    call :DeleteFile "!__SourceFile!.compiled.exe"
    call :DeleteFile "!__SourceFile!.obj"
    call :DeleteFile "!__SourceFile!.exe"

    set __VSProductVersion=140
    set __VCBuildArch=x86_amd64
    setlocal
    echo.
    echo Begin managed build of !__SourceFile!.cs
    call "!VS%__VSProductVersion%COMNTOOLS!\VsDevCmd.bat"
    csc.exe /nologo /noconfig /unsafe+ /nowarn:1701,1702,2008 /langversion:5 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE;DEBUG;SIGNED /errorendlocation /preferreduilang:en-US /reference:..\packages\System.Collections\4.0.0\ref\dotnet\System.Collections.dll /reference:..\packages\System.Console\4.0.0-beta-23419\ref\dotnet\System.Console.dll /reference:..\packages\System.Diagnostics.Debug\4.0.0\ref\dotnet\System.Diagnostics.Debug.dll /reference:..\packages\System.Globalization\4.0.0\ref\dotnet\System.Globalization.dll /reference:..\packages\System.IO\4.0.10\ref\dotnet\System.IO.dll /reference:..\packages\System.IO.FileSystem\4.0.0\ref\dotnet\System.IO.FileSystem.dll /reference:..\packages\System.IO.FileSystem.Primitives\4.0.0\ref\dotnet\System.IO.FileSystem.Primitives.dll /reference:..\packages\System.Reflection\4.0.0\ref\dotnet\System.Reflection.dll /reference:..\packages\System.Reflection.Extensions\4.0.0\ref\dotnet\System.Reflection.Extensions.dll /reference:..\packages\System.Reflection.Primitives\4.0.0\ref\dotnet\System.Reflection.Primitives.dll /reference:..\packages\System.Resources.ResourceManager\4.0.0\ref\dotnet\System.Resources.ResourceManager.dll /reference:..\packages\System.Runtime\4.0.20\ref\dotnet\System.Runtime.dll /reference:..\packages\System.Runtime.Extensions\4.0.10\ref\dotnet\System.Runtime.Extensions.dll /reference:..\packages\System.Runtime.Handles\4.0.0\ref\dotnet\System.Runtime.Handles.dll /reference:..\packages\System.Runtime.InteropServices\4.0.10\ref\dotnet\System.Runtime.InteropServices.dll /reference:..\packages\System.Text.Encoding\4.0.0\ref\dotnet\System.Text.Encoding.dll /reference:..\packages\System.Text.Encoding.Extensions\4.0.0\ref\dotnet\System.Text.Encoding.Extensions.dll /reference:..\packages\System.Threading\4.0.0\ref\dotnet\System.Threading.dll /reference:..\packages\System.Threading.Overlapped\4.0.0\ref\dotnet\System.Threading.Overlapped.dll /reference:..\packages\System.Threading.Tasks\4.0.10\ref\dotnet\System.Threading.Tasks.dll /debug+ /debug:full /filealign:512 /optimize- /out:!__SourceFile!.exe /target:exe /warnaserror+ /utf8output !__SourceFile!.cs

    echo.
    echo Compiling ILCompiler !__SourceFile!.exe
    call !CoreRT_ToolchainDir!\dotnet-compile-native.bat %__BuildArch% %__BuildType% /mode %CoreRT_TestCompileMode% /appdepsdk %CoreRT_AppDepSdkDir% /codegenpath %CoreRT_ProtoJitDir% /objgenpath %CoreRT_ObjWriterDir% /logpath %__CompileLogPath% /linklibs %__LinkLibs% /in !__SourceFile!.exe /out !__SourceFile!.compiled.exe
    endlocal

    set __SavedErrorLevel=%ErrorLevel%
    if "%CoreRT_TestRun%"=="false" (goto :SkipTestRun)

    if "%__SavedErrorLevel%"=="0" (
        echo.
        echo Running test !__SourceFileName!
        call !__SourceFile!.cmd
        set __SavedErrorLevel=!ErrorLevel!
    )

:SkipTestRun
    if "%__SavedErrorLevel%"=="0" (
        set /a __PassedTests=%__PassedTests%+1
        echo ^<test name="!__SourceFile!" type="Program" method="Main" result="Pass" /^> >> %__BinDir%\testResults.tmp
    ) ELSE (
        echo ^<test name="!__SourceFile!" type="Program" method="Main" result="Fail"^> >> %__BinDir%\testResults.tmp
        echo ^<failure exception-type="Exit code: %ERRORLEVEL%" ^> >> %__BinDir%\testResults.tmp
        echo     ^<message^>See !__SourceFile!.*.log ^</message^> >> %__BinDir%\testResults.tmp
        echo ^</failure^> >> %__BinDir%\testResults.tmp
        echo ^</test^> >> %__BinDir%\testResults.tmp
    )
    goto :eof

:DeleteFile
    if exist %1 del %1
    goto :eof

:Fail
    echo.
    powershell -Command Write-Host %1 -foreground "red"
    exit /b -1

:TestExtRepo
    echo Running external tests
    if not exist "%CoreRT_TestExtRepo%" ((call :Fail "%CoreRT_TestExtRepo% does not exist") & exit /b -1)
    if not "%CoreRT_BuildExtRepo%" == "false" (
        pushd %CoreRT_TestExtRepo%
        call build.cmd %CoreRT_BuildArch% %CoreRT_BuildType%
        if not !ErrorLevel!=="0" ((call :Fail "%CoreRT_TestExtRepo% build failed") & popd & exit /b -1)
        popd
    )

    echo.
    powershell -Command Write-Host "set CLRCustomTestLauncher=%CoreRT_TestRoot%ILCompiler.cmd" -foreground "cyan"
    set CLRCustomTestLauncher=%CoreRT_TestRoot%ILCompiler.cmd

    set CORE_ROOT=%CoreRT_TestExtRepo%\bin\Product\%__BuildStr%
    pushd %CoreRT_TestExtRepo%\tests
    call runtest.cmd %CoreRT_BuildArch% %CoreRT_BuildType% exclude %CoreRT_TestRoot%\CoreCLR.issues.targets
    set __SavedErrorLevel=%ErrorLevel%
    popd
    exit /b %__SavedErrorLevel%

@echo off

set CoreRT_TestRoot=%~dp0
set CoreRT_BuildArch=x64
set CoreRT_BuildType=Debug
set CoreRT_BuildOS=Windows_NT
set CoreRT_TestRun=true
set CoreRT_TestCompileMode=protojit
set CoreRT_TestExtRepo=
set CoreRT_BuildExtRepo=

:ArgLoop
if "%1" == "" goto :ArgsDone
if /i "%1" == "/?" goto :Usage
if /i "%1" == "x64"    (set CoreRT_BuildArch=x64&&shift&goto ArgLoop)
if /i "%1" == "x86"    (set CoreRT_BuildArch=x86&&shift&goto ArgLoop)
if /i "%1" == "arm"    (set CoreRT_BuildArch=arm&&shift&goto ArgLoop)

if /i "%1" == "debug"    (set CoreRT_BuildType=Debug&shift&goto ArgLoop)
if /i "%1" == "release"  (set CoreRT_BuildType=Release&shift&goto ArgLoop)
if /i "%1" == "/extrepo"  (set CoreRT_TestExtRepo=%2&shift&shift&goto ArgLoop)
if /i "%1" == "/buildextrepo" (set CoreRT_BuildExtRepo=%2&shift&shift&goto ArgLoop)
if /i "%1" == "/mode" (set CoreRT_TestCompileMode=%2&shift&shift&goto ArgLoop)
if /i "%1" == "/runtest" (set CoreRT_TestRun=%2&shift&shift&goto ArgLoop)
if /i "%1" == "/nocache" (set CoreRT_NuGetOptions=-nocache&shift&goto ArgLoop)

echo Invalid command line argument: %1
goto :Usage

:Usage
echo %0 [OS] [arch] [flavor] [/extrepo] [/buildextrepo] [/mode] [/runtest]
echo     /mode         : Compilation mode. Specify cpp/protojit. Default: protojit
echo     /runtest      : Should just compile or run compiled bianry? Specify: true/false. Default: true.
echo     /extrepo      : Path to external repo, currently supports: GitHub: dotnet/coreclr. Specify full path. If unspecified, runs corert tests
echo     /buildextrepo : Should build at root level of external repo? Specify: true/false. Default: true
echo     /nocache      : When restoring toolchain packages, obtain them from the feed not the cache.
exit /b 2

:ArgsDone

setlocal EnableDelayedExpansion
set __BuildStr=%CoreRT_BuildOS%.%CoreRT_BuildArch%.%CoreRT_BuildType%
set __BinDir=%CoreRT_TestRoot%..\bin\tests
set __LogDir=%CoreRT_TestRoot%\..\bin\Logs\%__BuildStr%\tests
set __NuPkgInstallDir=%__BinDir%\package
set __BuiltNuPkgDir=%CoreRT_TestRoot%..\bin\Product\%__BuildStr%\.nuget

set __PackageRestoreCmd=restore.cmd
call %__PackageRestoreCmd% /nugetexedir %CoreRT_TestRoot%..\packages /installdir %__NuPkgInstallDir% /nupkgdir %__BuiltNuPkgDir% /nugetopt %CoreRT_NuGetOptions%
if not "%ErrorLevel%"=="100" (((call :Fail "Preptests failed... cannot continue")) & exit /b -1)

REM ** Validate the paths needed to run tests
if not exist "%CoreRT_AppDepSdkDir%" ((call :Fail "AppDep SDK not installed at %CoreRT_AppDepSdkDir%") & exit /b -1)
if not exist "%CoreRT_ProtoJitDir%"  ((call :Fail "ProtoJIT not installed at %CoreRT_ProtoJitDir%") & exit /b -1)
if not exist "%CoreRT_ObjWriterDir%" ((call :Fail "ObjWriter not installed at %ObjWriterDir%") & exit /b -1)
if not exist "%CoreRT_ToolchainDir%\dotnet-compile-native.bat" ((call :Fail "dotnet-compile-native.bat not found in %CoreRT_ToolchainDir%") & exit /b -1)

if not "%CoreRT_TestExtRepo%"=="" goto :TestExtRepo

if not defined CoreRT_ToolchainPkg ((call :Fail "Run %__PackageRestoreCmd% first") & exit /b -1)
if not defined CoreRT_ToolchainVer ((call :Fail "Run %__PackageRestoreCmd% first") & exit /b -1)

if /i "%__BuildType%"=="Debug" (
    set __LinkLibs=msvcrtd.lib
) else (
    set __LinkLibs=msvcrt.lib
)

echo. > %__BinDir%\testResults.tmp

set /a __TotalTests=0
set /a __PassedTests=0
for /f "delims=" %%a in ('dir /s /aD /b src\*') do (
    set __SourceFolder=%%a
    set __SourceFileName=%%~na
    set __RelativePath=!__SourceFolder:%CoreRT_TestRoot%=!
    if exist "!__SourceFolder!\!__SourceFileName!.cs" (
        call :CompileFile !__SourceFolder! !__SourceFileName! %__LogDir%\!__RelativePath!
        set /a __TotalTests=!__TotalTests!+1
    ) else (echo !__SourceFolder!\!__SourceFileName!)
)
set /a __FailedTests=%__TotalTests%-%__PassedTests%

echo ^<?xml version="1.0" encoding="utf-8"?^> > %__BinDir%\testResults.xml
echo ^<assemblies^>  >> %__BinDir%\testResults.xml
echo ^<assembly name="ILCompiler" total="%__TotalTests%" passed="%__PassedTests%" failed="%__FailedTests%" skipped="0"^>  >> %__BinDir%\testResults.xml
echo ^<collection total="%__TotalTests%" passed="%__PassedTests%" failed="%__FailedTests%" skipped="0"^>  >> %__BinDir%\testResults.xml
type %__BinDir%\testResults.tmp >> %__BinDir%\testResults.xml
echo ^</collection^>  >> %__BinDir%\testResults.xml
echo ^</assembly^>  >> %__BinDir%\testResults.xml
echo ^</assemblies^>  >> %__BinDir%\testResults.xml

echo.
set "__ConsoleOut=TOTAL: %__TotalTests% PASSED: %__PassedTests%"

if %__TotalTests% EQU %__PassedTests% (set __StatusPassed=1)
if %__TotalTests% EQU 0 (set __StatusPassed=0)
if "%__StatusPassed%"=="1" (
    powershell -Command Write-Host "%__ConsoleOut%" -foreground "Black" -background "Green"
    exit /b 0
) else (
    powershell -Command Write-Host "%__ConsoleOut%" -foreground "White" -background "Red"
    exit /b 1
)

:CompileFile
    echo.
    echo Compiling directory %~1
    set __SourceFolder=%~1
    set __SourceFileName=%~2
    set __CompileLogPath=%~3
    if not exist "!__CompileLogPath!" (mkdir !__CompileLogPath!)
    endlocal
    set __SourceFile=!__SourceFolder!\!__SourceFileName!
    call :DeleteFile "!__SourceFile!.S"
    call :DeleteFile "!__SourceFile!.compiled.exe"
    call :DeleteFile "!__SourceFile!.obj"
    call :DeleteFile "!__SourceFile!.exe"

    set __VSProductVersion=140
    set __VCBuildArch=x86_amd64
    setlocal
    echo.
    echo Begin managed build of !__SourceFile!.cs
    call "!VS%__VSProductVersion%COMNTOOLS!\VsDevCmd.bat"
    csc.exe /nologo /noconfig /unsafe+ /nowarn:1701,1702,2008 /langversion:5 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE;DEBUG;SIGNED /errorendlocation /preferreduilang:en-US /reference:..\packages\System.Collections\4.0.0\ref\dotnet\System.Collections.dll /reference:..\packages\System.Console\4.0.0-beta-23419\ref\dotnet\System.Console.dll /reference:..\packages\System.Diagnostics.Debug\4.0.0\ref\dotnet\System.Diagnostics.Debug.dll /reference:..\packages\System.Globalization\4.0.0\ref\dotnet\System.Globalization.dll /reference:..\packages\System.IO\4.0.10\ref\dotnet\System.IO.dll /reference:..\packages\System.IO.FileSystem\4.0.0\ref\dotnet\System.IO.FileSystem.dll /reference:..\packages\System.IO.FileSystem.Primitives\4.0.0\ref\dotnet\System.IO.FileSystem.Primitives.dll /reference:..\packages\System.Reflection\4.0.0\ref\dotnet\System.Reflection.dll /reference:..\packages\System.Reflection.Extensions\4.0.0\ref\dotnet\System.Reflection.Extensions.dll /reference:..\packages\System.Reflection.Primitives\4.0.0\ref\dotnet\System.Reflection.Primitives.dll /reference:..\packages\System.Resources.ResourceManager\4.0.0\ref\dotnet\System.Resources.ResourceManager.dll /reference:..\packages\System.Runtime\4.0.20\ref\dotnet\System.Runtime.dll /reference:..\packages\System.Runtime.Extensions\4.0.10\ref\dotnet\System.Runtime.Extensions.dll /reference:..\packages\System.Runtime.Handles\4.0.0\ref\dotnet\System.Runtime.Handles.dll /reference:..\packages\System.Runtime.InteropServices\4.0.10\ref\dotnet\System.Runtime.InteropServices.dll /reference:..\packages\System.Text.Encoding\4.0.0\ref\dotnet\System.Text.Encoding.dll /reference:..\packages\System.Text.Encoding.Extensions\4.0.0\ref\dotnet\System.Text.Encoding.Extensions.dll /reference:..\packages\System.Threading\4.0.0\ref\dotnet\System.Threading.dll /reference:..\packages\System.Threading.Overlapped\4.0.0\ref\dotnet\System.Threading.Overlapped.dll /reference:..\packages\System.Threading.Tasks\4.0.10\ref\dotnet\System.Threading.Tasks.dll /debug+ /debug:full /filealign:512 /optimize- /out:!__SourceFile!.exe /target:exe /warnaserror+ /utf8output !__SourceFile!.cs

    echo.
    echo Compiling ILCompiler !__SourceFile!.exe
    call !CoreRT_ToolchainDir!\dotnet-compile-native.bat %__BuildArch% %__BuildType% /mode %CoreRT_TestCompileMode% /appdepsdk %CoreRT_AppDepSdkDir% /codegenpath %CoreRT_ProtoJitDir% /objgenpath %CoreRT_ObjWriterDir% /logpath %__CompileLogPath% /linklibs %__LinkLibs% /in !__SourceFile!.exe /out !__SourceFile!.compiled.exe
    endlocal

    set __SavedErrorLevel=%ErrorLevel%
    if "%CoreRT_TestRun%"=="false" (goto :SkipTestRun)

    if "%__SavedErrorLevel%"=="0" (
        echo.
        echo Running test !__SourceFileName!
        call !__SourceFile!.cmd
        set __SavedErrorLevel=!ErrorLevel!
    )

:SkipTestRun
    if "%__SavedErrorLevel%"=="0" (
        set /a __PassedTests=%__PassedTests%+1
        echo ^<test name="!__SourceFile!" type="Program" method="Main" result="Pass" /^> >> %__BinDir%\testResults.tmp
    ) ELSE (
        echo ^<test name="!__SourceFile!" type="Program" method="Main" result="Fail"^> >> %__BinDir%\testResults.tmp
        echo ^<failure exception-type="Exit code: %ERRORLEVEL%" ^> >> %__BinDir%\testResults.tmp
        echo     ^<message^>See !__SourceFile!.*.log ^</message^> >> %__BinDir%\testResults.tmp
        echo ^</failure^> >> %__BinDir%\testResults.tmp
        echo ^</test^> >> %__BinDir%\testResults.tmp
    )
    goto :eof

:DeleteFile
    if exist %1 del %1
    goto :eof

:Fail
    echo.
    powershell -Command Write-Host %1 -foreground "red"
    exit /b -1

:TestExtRepo
    echo Running external tests
    if not exist "%CoreRT_TestExtRepo%" ((call :Fail "%CoreRT_TestExtRepo% does not exist") & exit /b -1)
    if not "%CoreRT_BuildExtRepo%" == "false" (
        pushd %CoreRT_TestExtRepo%
        call build.cmd %CoreRT_BuildArch% %CoreRT_BuildType%
        if not !ErrorLevel!=="0" ((call :Fail "%CoreRT_TestExtRepo% build failed") & popd & exit /b -1)
        popd
    )

    echo.
    powershell -Command Write-Host "set CLRCustomTestLauncher=%CoreRT_TestRoot%ilc.cmd" -foreground "cyan"
    set CLRCustomTestLauncher=%CoreRT_TestRoot%ilc.cmd

    set CORE_ROOT=%CoreRT_TestExtRepo%\bin\Product\%__BuildStr%
    pushd %CoreRT_TestExtRepo%\tests
    call runtest.cmd %CoreRT_BuildArch% %CoreRT_BuildType% exclude %CoreRT_TestRoot%\CoreCLR.issues.targets
    set __SavedErrorLevel=%ErrorLevel%
    popd
    exit /b %__SavedErrorLevel%

Update launcher name in runtests.cmd

Update launcher name in runtests.cmd

The name of the script is actually ilc.cmd.


@if "%_echo%" neq "on" echo off
setlocal EnableDelayedExpansion

set synclog=sync.log
echo Running Sync.cmd %* > %synclog%

set options=/nologo /v:minimal /clp:Summary /flp:v=detailed;Append;LogFile=%synclog%
set unprocessedBuildArgs=
set allargs=%*
set thisArgs=

set src=false
set packages=false
set tests=false
set azureBlobs=false

if [%1]==[] (
  set src=true
  set packages=true
  goto Begin
)

:Loop
if [%1]==[] goto Begin

if /I [%1]==[/?] goto Usage

if /I [%1] == [/p] (
    set packages=true
    set thisArgs=!thisArgs!%1
    goto Next
)

if /I [%1] == [/s] (
    set src=true
    set thisArgs=!thisArgs!%1
    goto Next
)

if /I [%1] == [/t] (
    set tests=true
    set packages=true
    set thisArgs=!thisArgs!%1
    goto Next
)

if /I [%1] == [/ab] (
    set azureBlobs=true
    set thisArgs=!thisArgs!%1
    goto Next
)

set unprocessedBuildArgs=!unprocessedBuildArgs! %1

:Next
shift /1
goto Loop

:Begin
echo Running init-tools.cmd
call %~dp0init-tools.cmd

if [%src%] == [true] (
  echo Fetching git database from remote repos ...
  call git fetch --all -p -v >> %synclog% 2>&1
  if NOT [!ERRORLEVEL!]==[0] (
    echo ERROR: An error occurred while fetching remote source code, see %synclog% for more details.
    exit /b 1
  )
)

if [%azureBlobs%] == [true] (
  echo Connecting and downloading packages from Azure BLOB ...
  echo msbuild.exe %~dp0src\syncAzure.proj !options! !unprocessedBuildArgs! >> %synclog%
  call msbuild.exe %~dp0src\syncAzure.proj !options! !unprocessedBuildArgs!
  if NOT [!ERRORLEVEL!]==[0] (
    echo ERROR: An error occurred while downloading packages from Azure BLOB, see %synclog% for more details. There may have been networking problems so please try again in a few minutes.
    exit /b 1
  )
)

set targets=BatchRestorePackages
if [%tests%] == [true] (
  set options=!options! /p:BuildTestsAgainstPackages=true
  set targets=BatchGenerateTestProjectJsons;!targets!
)

if [%packages%] == [true] (
  set options=!options! /t:!targets! /p:RestoreDuringBuild=true
  echo msbuild.exe %~dp0build.proj !options! !unprocessedBuildArgs! >> %synclog%
  call msbuild.exe %~dp0build.proj !options! !unprocessedBuildArgs!
  if NOT [!ERRORLEVEL!]==[0] (
    echo ERROR: An error occurred while syncing packages, see %synclog% for more details. There may have been networking problems so please try again in a few minutes.
    exit /b 1
  )
)

echo Done Syncing.
exit /b 0

goto :EOF

:Usage
echo.
echo Repository syncing script.
echo.
echo Options:
echo     /s     - Fetches source history from all configured remotes
echo              (git fetch --all -p -v)
echo     /p     - Restores all nuget packages for repository
echo     /t     - Generates tests project.json files and then it restores all nuget packages for repository.
echo     /ab    - Downloads the latests product packages from Azure.
echo              The following properties are required:
echo                 /p:CloudDropAccountName="Account name"
echo                 /p:CloudDropAccessToken="Access token"
echo              To download a specific group of product packages, specify:
echo                 /p:BuildNumberMajor
echo                 /p:BuildNumberMinor
echo.
echo If no option is specified then sync.cmd /s /p is implied.

@if "%_echo%" neq "on" echo off
setlocal EnableDelayedExpansion

set synclog=sync.log
echo Running Sync.cmd %* > %synclog%

set options=/nologo /v:minimal /clp:Summary /flp:v=detailed;Append;LogFile=%synclog%

set "__args= %*"
set processedArgs=
set unprocessedBuildArgs=

set src=false
set packages=false
set tests=false
set azureBlobs=false

if [%1]==[] (
  set src=true
  set packages=true
  goto Begin
)

:Loop
if [%1]==[] goto Begin

if /I [%1]==[/?] goto Usage

if /I [%1] == [/p] (
    set packages=true
    set processedArgs=!processedArgs! %1
    goto Next
)

if /I [%1] == [/s] (
    set src=true
    set processedArgs=!processedArgs! %1
    goto Next
)

if /I [%1] == [/t] (
    set tests=true
    set packages=true
    set processedArgs=!processedArgs! %1
    goto Next
)

if /I [%1] == [/ab] (
    set azureBlobs=true
    set processedArgs=!processedArgs! %1
    goto Next
)

if [!processedArgs!]==[] (
  call set unprocessedBuildArgs=!__args!
) else (
  call set unprocessedBuildArgs=%%__args:*!processedArgs!=%%
)

:Next
shift /1
goto Loop

:Begin
echo Running init-tools.cmd
call %~dp0init-tools.cmd

if [%src%] == [true] (
  echo Fetching git database from remote repos ...
  call git fetch --all -p -v >> %synclog% 2>&1
  if NOT [!ERRORLEVEL!]==[0] (
    echo ERROR: An error occurred while fetching remote source code, see %synclog% for more details.
    exit /b 1
  )
)

if [%azureBlobs%] == [true] (
  echo Connecting and downloading packages from Azure BLOB ...
  echo msbuild.exe %~dp0src\syncAzure.proj !options! !unprocessedBuildArgs! >> %synclog%
  call msbuild.exe %~dp0src\syncAzure.proj !options! !unprocessedBuildArgs!
  if NOT [!ERRORLEVEL!]==[0] (
    echo ERROR: An error occurred while downloading packages from Azure BLOB, see %synclog% for more details. There may have been networking problems so please try again in a few minutes.
    exit /b 1
  )
)

set targets=BatchRestorePackages
if [%tests%] == [true] (
  set options=!options! /p:BuildTestsAgainstPackages=true
  set targets=BatchGenerateTestProjectJsons;!targets!
)

if [%packages%] == [true] (
  set options=!options! /t:!targets! /p:RestoreDuringBuild=true
  echo msbuild.exe %~dp0build.proj !options! !unprocessedBuildArgs! >> %synclog%
  call msbuild.exe %~dp0build.proj !options! !unprocessedBuildArgs!
  if NOT [!ERRORLEVEL!]==[0] (
    echo ERROR: An error occurred while syncing packages, see %synclog% for more details. There may have been networking problems so please try again in a few minutes.
    exit /b 1
  )
)

echo Done Syncing.
exit /b 0

goto :EOF

:Usage
echo.
echo Repository syncing script.
echo.
echo Options:
echo     /s     - Fetches source history from all configured remotes
echo              (git fetch --all -p -v)
echo     /p     - Restores all nuget packages for repository
echo     /t     - Generates tests project.json files and then it restores all nuget packages for repository.
echo     /ab    - Downloads the latests product packages from Azure.
echo              The following properties are required:
echo                 /p:CloudDropAccountName="Account name"
echo                 /p:CloudDropAccessToken="Access token"
echo              To download a specific group of product packages, specify:
echo                 /p:BuildNumberMajor
echo                 /p:BuildNumberMinor
echo.
echo If no option is specified then sync.cmd /s /p is implied.

Change sync.cmd to use argument parsing logic from build.cmd.


@ECHO OFF
SET v40-30319="%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild"
SET v35="%WINDIR%\Microsoft.NET\Framework\v3.5\msbuild"

CD ..\..
ECHO "Looking for Microsoft.NET MSBuild..."
IF EXIST %v40-30319% (
	ECHO "Building with Microsoft.NET v4.0 MSBuild"
	SET MSBUILD_PATH=%v40-30319%
) ELSE IF EXIST "%v35%" (
	ECHO "Building with Microsoft.NET v3.5 MSBuild"
	SET MSBUILD_PATH=%v35%
) ELSE (
	ECHO "Build failed: Microsoft.NET MSBuild (msbuild.exe) not found"
	GOTO END
)

%MSBUILD_PATH% Banshee.sln /p:Configuration=Windows /p:Platform="Any CPU" && ^
ECHO 'Running "post-build.bat"' && ^
build\windows\post-build.bat && ^
CD build\windows

:END

@ECHO OFF
SET v40-30319="%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild"
SET v35="%WINDIR%\Microsoft.NET\Framework\v3.5\msbuild"

SET SOLUTION="Banshee.sln"

IF EXIST "..\..\%SOLUTION%" (
	CD ..\..
)

ECHO "Looking for Microsoft.NET MSBuild..."
IF EXIST %v40-30319% (
	ECHO "Building with Microsoft.NET v4.0 MSBuild"
	SET MSBUILD_PATH=%v40-30319%
) ELSE IF EXIST "%v35%" (
	ECHO "Building with Microsoft.NET v3.5 MSBuild"
	SET MSBUILD_PATH=%v35%
) ELSE (
	ECHO "Build failed: Microsoft.NET MSBuild (msbuild.exe) not found"
	GOTO END
)

%MSBUILD_PATH% %SOLUTION% /p:Configuration=Windows /p:Platform="Any CPU" && ^
ECHO 'Running "post-build.bat"' && ^
build\windows\post-build.bat && ^
CD build\windows

:END

build: allow build-banshee.bat to be called from the root dir (windows)

If we tried running build\windows\build-banshee.bat from the root folder
of the repository instead of inside build\windows, it would fail. Now
the script can be run from both locations.


@echo off

REM Licensed to the Apache Software Foundation (ASF) under one
REM or more contributor license agreements.  See the NOTICE file
REM distributed with this work for additional information
REM regarding copyright ownership.  The ASF licenses this file
REM to you under the Apache License, Version 2.0 (the
REM "License"); you may not use this file except in compliance
REM with the License.  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,
REM software distributed under the License is distributed on an
REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
REM KIND, either express or implied.  See the License for the
REM specific language governing permissions and limitations
REM under the License.

if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem NT Service Install/Uninstall script
rem
rem Options
rem install                Install the service using Tomcat5 as service name.
rem                        Service is installed using default settings.
rem remove                 Remove the service from the System.
rem
rem name        (optional) If the second argument is present it is considered
rem                        to be new service name
rem
rem $Id: service.bat 467182 2006-10-23 23:47:06Z markt $
rem ---------------------------------------------------------------------------

rem Guess CATALINA_HOME if not defined
set CURRENT_DIR=%cd%
if not "%FTPD_HOME%" == "" goto gotHome
set FTPD_HOME=%cd%
if exist "%FTPD_HOME%\bin\ftpd.exe" goto okHome
rem CD to the upper dir
cd ..
set FTPD_HOME=%cd%
:gotHome
if exist "%FTPD_HOME%\bin\ftpd.exe" goto okHome
echo The ftpd.exe was not found...
echo The FTPD_HOME environment variable is not defined correctly.
echo This environment variable is needed to run this program
goto end
rem Make sure prerequisite environment variables are set
if not "%JAVA_HOME%" == "" goto okHome
echo The JAVA_HOME environment variable is not defined
echo This environment variable is needed to run this program
goto end
:okHome

set EXECUTABLE=%FTPD_HOME%\bin\ftpd.exe

rem Set default Service name
set SERVICE_NAME=ftpd
set PR_DISPLAYNAME=Apache FtpServer

if "%1" == "" goto displayUsage
if "%2" == "" goto setServiceName
set SERVICE_NAME=%2
set PR_DISPLAYNAME=Apache Tomcat %2
:setServiceName
if %1 == install goto doInstall
if %1 == remove goto doRemove
if %1 == uninstall goto doRemove
echo Unknown parameter "%1"
:displayUsage
echo.
echo Usage: service.bat install/remove [service_name]
goto end

:doRemove
rem Remove the service
"%EXECUTABLE%" //DS//%SERVICE_NAME%
echo The service '%SERVICE_NAME%' has been removed
goto end

:doInstall
rem Install the service
echo Installing the service '%SERVICE_NAME%' ...
echo Using FTPD_HOME:        %FTPD_HOME%
echo Using JAVA_HOME:        %JAVA_HOME%

rem ----- Create CLASSPATH --------------------------------------------
set FTPD_CLASSPATH=%FTPD_HOME%\common\classes
cd /d "%FTPD_HOME%\common\lib"
for %%i in ("*.jar") do call "%FTPD_HOME%\bin\appendcp.bat" "%FTPD_HOME%\common\lib\%%i"
cd /d %FTPD_HOME%

rem Use the environment variables as an example
rem Each command line option is prefixed with PR_

set FTPD_LOGPATH=%FTPD_HOME%\res\log

set PR_DESCRIPTION=Apache FtpServer (http://incubator.apache.org/ftpserver/)
set PR_INSTALL=%EXECUTABLE%
set PR_LOGPATH=%FTPD_LOGPATH%
set PR_CLASSPATH=%FTPD_CLASSPATH%
rem Set the server jvm from JAVA_HOME
set PR_JVM=%JAVA_HOME%\jre\bin\server\jvm.dll
if exist "%PR_JVM%" goto foundJvm
rem Set the client jvm from JAVA_HOME
set PR_JVM=%JAVA_HOME%\jre\bin\client\jvm.dll
if exist "%PR_JVM%" goto foundJvm
set PR_JVM=auto
:foundJvm
echo Using JVM:              %PR_JVM%

rem Supply additional command line params as start params

set CMD_LINE_ARGS=start
echo %CMD_LINE_ARGS%
shift
shift
:buildArgs
if %1a==a goto endInit
set CMD_LINE_ARGS=%CMD_LINE_ARGS%;%1
echo %CMD_LINE_ARGS%
shift
goto buildArgs

:endInit
echo %CMD_LINE_ARGS%

"%EXECUTABLE%" //IS//%SERVICE_NAME% --StartClass org.apache.ftpserver.commandline.Daemon --StartParams %CMD_LINE_ARGS% --StartPath "%FTPD_HOME%" --StopClass org.apache.ftpserver.commandline.Daemon --StopParams stop
if not errorlevel 1 goto installed
echo Failed installing '%SERVICE_NAME%' service
goto end
:installed
rem Clear the environment variables. They are not needed any more.
set PR_DISPLAYNAME=
set PR_DESCRIPTION=
set PR_INSTALL=
set PR_LOGPATH=
set PR_CLASSPATH=
set PR_JVM=
rem Set extra parameters
"%EXECUTABLE%" //US//%SERVICE_NAME% --StartMode jvm --StopMode jvm --StdOutput "%FTPD_LOGPATH%\out.log" --StdError "%FTPD_LOGPATH%\error.log"
rem More extra parameters
set PR_LOGPATH=%FTPD_HOME%\logs
set PR_STDOUTPUT=auto
set PR_STDERROR=auto
REM "%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp" --JvmMs 128 --JvmMx 256
echo The service '%SERVICE_NAME%' has been installed.

:end
cd %CURRENT_DIR%

@echo off

REM Licensed to the Apache Software Foundation (ASF) under one
REM or more contributor license agreements.  See the NOTICE file
REM distributed with this work for additional information
REM regarding copyright ownership.  The ASF licenses this file
REM to you under the Apache License, Version 2.0 (the
REM "License"); you may not use this file except in compliance
REM with the License.  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,
REM software distributed under the License is distributed on an
REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
REM KIND, either express or implied.  See the License for the
REM specific language governing permissions and limitations
REM under the License.

if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem NT Service Install/Uninstall script
rem
rem Options
rem install                Install the service using ftpd as service name.
rem                        Service is installed using default settings.
rem remove                 Remove the service from the System.
rem
rem name        (optional) If the second argument is present it is considered
rem                        to be new service name
rem
rem $Id: service.bat 467182 2006-10-23 23:47:06Z markt $
rem ---------------------------------------------------------------------------

rem Guess CATALINA_HOME if not defined
set CURRENT_DIR=%cd%
if not "%FTPD_HOME%" == "" goto gotHome
set FTPD_HOME=%cd%
if exist "%FTPD_HOME%\bin\ftpd.exe" goto okHome
rem CD to the upper dir
cd ..
set FTPD_HOME=%cd%
:gotHome
if exist "%FTPD_HOME%\bin\ftpd.exe" goto okHome
echo The ftpd.exe was not found...
echo The FTPD_HOME environment variable is not defined correctly.
echo This environment variable is needed to run this program
goto end
rem Make sure prerequisite environment variables are set
if not "%JAVA_HOME%" == "" goto okHome
echo The JAVA_HOME environment variable is not defined
echo This environment variable is needed to run this program
goto end
:okHome

set EXECUTABLE=%FTPD_HOME%\bin\ftpd.exe

rem Set default Service name
set SERVICE_NAME=ftpd
set PR_DISPLAYNAME=Apache FtpServer

if "%1" == "" goto displayUsage
if "%2" == "" goto setServiceName
set SERVICE_NAME=%2
set PR_DISPLAYNAME=Apache FtpServer %2
:setServiceName
if %1 == install goto doInstall
if %1 == remove goto doRemove
if %1 == uninstall goto doRemove
echo Unknown parameter "%1"
:displayUsage
echo.
echo Usage: service.bat install/remove [service_name]
goto end

:doRemove
rem Remove the service
"%EXECUTABLE%" //DS//%SERVICE_NAME%
echo The service '%SERVICE_NAME%' has been removed
goto end

:doInstall
rem Install the service
echo Installing the service '%SERVICE_NAME%' ...
echo Using FTPD_HOME:        %FTPD_HOME%
echo Using JAVA_HOME:        %JAVA_HOME%

rem ----- Create CLASSPATH --------------------------------------------
set FTPD_CLASSPATH=%FTPD_HOME%\common\classes
cd /d "%FTPD_HOME%\common\lib"
for %%i in ("*.jar") do call "%FTPD_HOME%\bin\appendcp.bat" "%FTPD_HOME%\common\lib\%%i"
cd /d %FTPD_HOME%

rem Use the environment variables as an example
rem Each command line option is prefixed with PR_

set FTPD_LOGPATH=%FTPD_HOME%\res\log

set PR_DESCRIPTION=Apache FtpServer (http://incubator.apache.org/ftpserver/)
set PR_INSTALL=%EXECUTABLE%
set PR_LOGPATH=%FTPD_LOGPATH%
set PR_CLASSPATH=%FTPD_CLASSPATH%
rem Set the server jvm from JAVA_HOME
set PR_JVM=%JAVA_HOME%\jre\bin\server\jvm.dll
if exist "%PR_JVM%" goto foundJvm
rem Set the client jvm from JAVA_HOME
set PR_JVM=%JAVA_HOME%\jre\bin\client\jvm.dll
if exist "%PR_JVM%" goto foundJvm
set PR_JVM=auto
:foundJvm
echo Using JVM:              %PR_JVM%

rem Supply additional command line params as start params

set CMD_LINE_ARGS=start
echo %CMD_LINE_ARGS%
shift
shift
:buildArgs
if %1a==a goto endInit
set CMD_LINE_ARGS=%CMD_LINE_ARGS%;%1
echo %CMD_LINE_ARGS%
shift
goto buildArgs

:endInit
echo %CMD_LINE_ARGS%

"%EXECUTABLE%" //IS//%SERVICE_NAME% --StartClass org.apache.ftpserver.commandline.Daemon --StartParams %CMD_LINE_ARGS% --StartPath "%FTPD_HOME%" --StopClass org.apache.ftpserver.commandline.Daemon --StopParams stop
if not errorlevel 1 goto installed
echo Failed installing '%SERVICE_NAME%' service
goto end
:installed
rem Clear the environment variables. They are not needed any more.
set PR_DISPLAYNAME=
set PR_DESCRIPTION=
set PR_INSTALL=
set PR_LOGPATH=
set PR_CLASSPATH=
set PR_JVM=
rem Set extra parameters
"%EXECUTABLE%" //US//%SERVICE_NAME% --StartMode jvm --StopMode jvm --StdOutput "%FTPD_LOGPATH%\out.log" --StdError "%FTPD_LOGPATH%\error.log"
rem More extra parameters
set PR_LOGPATH=%FTPD_HOME%\logs
set PR_STDOUTPUT=auto
set PR_STDERROR=auto
REM "%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp" --JvmMs 128 --JvmMx 256
echo The service '%SERVICE_NAME%' has been installed.

:end
cd %CURRENT_DIR%

Replace two stray remains of "tomcat"

Replace two stray remains of "tomcat"

git-svn-id: 156d99fefae263fe7040597dc4e7b98918e91509@509613 13f79535-47bb-0310-9956-ffa450edef68


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

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

SET BASEFOLDER=C:\tmp

REM Make folder if not existing:  https://stackoverflow.com/questions/4165387/create-folder-with-batch-but-only-if-it-doesnt-already-exist
if not exist "%BASEFOLDER%" mkdir %BASEFOLDER%

REM Open folder:
start "" %BASEFOLDER%

REM Download SQLServer Developer Edition:
powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://download.microsoft.com/download/2/5/0/2508F7B4-6DDE-4C3E-B1FA-E1EB66F2F79F/SQLServer2016-SSEI-Dev.exe', '%BASEFOLDER%\SQLServer-SSEI-Dev.exe') }" -ExecutionPolicy Bypass
REM Install SQLServer Developer Edition:
REM https://docs.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt?view=sql-server-2017
REM Download Commnad:
%BASEFOLDER%\SQLServer-SSEI-Dev.exe /MEDIAPATH="%BASEFOLDER%" /ACTION=Download /LANGUAGE=en-US /MEDIATYPE=CAB /QUIET

REM Install Command: (interactive)
%BASEFOLDER%\SQLServer-SSEI-Dev.exe /ACTION=Install /MEDIAPATH=C:\tmp /IACCEPTSQLSERVERLICENSETERMS /LANGUAGE=en-US

REM https://github.com/jgstew/bigfix-content/blob/f36708ebf7af38f84a286f3b79131faccb1d2e9c/fixlet/Install%20SQL%20Server%20Management%20Studio%2016.5.1%20-%20Windows.bes
REM Download SQL Server Management Studio:
powershell -command "& { (New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/0/5/B/05B2AF8F-906F-4C57-A58E-5780F64F9D62/SSMS-Setup-ENU.exe', '%BASEFOLDER%\SSMS-Setup-ENU.exe') }" -ExecutionPolicy Bypass
REM https://download.microsoft.com/download/0/5/B/05B2AF8F-906F-4C57-A58E-5780F64F9D62/SSMS-Setup-ENU.exe
REM Install SQL Server Management Studio:
%BASEFOLDER%\SSMS-Setup-ENU.exe /install /quiet /norestart

REM for some reason, this didn't create a start menu shortcut it seems for SQL Server Management Studio

REM Download BigFix Root Server:
powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://software.bigfix.com/download/bes/95/BigFix-BES-9.5.9.62.exe', '%BASEFOLDER%\BigFix-BES.exe') }" -ExecutionPolicy Bypass
REM Install:
REM %BASEFOLDER%\BigFix-BES.exe

REM press any key to continue....
pause

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

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

SET BASEFOLDER=C:\tmp

REM Make folder if not existing:  https://stackoverflow.com/questions/4165387/create-folder-with-batch-but-only-if-it-doesnt-already-exist
if not exist "%BASEFOLDER%" mkdir %BASEFOLDER%

REM Open folder:
start "" %BASEFOLDER%

REM https://github.com/jgstew/bigfix-content/blob/master/fixlet/Install%20SQL%20Server%20Management%20Studio%2016.5.1%20-%20Windows.bes
REM Download SQL Server Management Studio:
start "" powershell -command "& { (New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/0/5/B/05B2AF8F-906F-4C57-A58E-5780F64F9D62/SSMS-Setup-ENU.exe', '%BASEFOLDER%\SSMS-Setup-ENU.exe') }" -ExecutionPolicy Bypass

REM Download BigFix Root Server:
start "" powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://software.bigfix.com/download/bes/95/BigFix-BES-9.5.9.62.exe', '%BASEFOLDER%\BigFix-BES.exe') }" -ExecutionPolicy Bypass

REM Download SQLServer Developer Edition:
powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://download.microsoft.com/download/2/5/0/2508F7B4-6DDE-4C3E-B1FA-E1EB66F2F79F/SQLServer2016-SSEI-Dev.exe', '%BASEFOLDER%\SQLServer-SSEI-Dev.exe') }" -ExecutionPolicy Bypass
REM Install SQLServer Developer Edition:
REM https://docs.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt?view=sql-server-2017
REM Download Commnad:
%BASEFOLDER%\SQLServer-SSEI-Dev.exe /MEDIAPATH="%BASEFOLDER%" /ACTION=Download /LANGUAGE=en-US /MEDIATYPE=CAB /QUIET

REM Install Command: (interactive)
%BASEFOLDER%\SQLServer-SSEI-Dev.exe /ACTION=Install /MEDIAPATH=C:\tmp /IACCEPTSQLSERVERLICENSETERMS /LANGUAGE=en-US

REM https://download.microsoft.com/download/0/5/B/05B2AF8F-906F-4C57-A58E-5780F64F9D62/SSMS-Setup-ENU.exe
REM Install SQL Server Management Studio:
%BASEFOLDER%\SSMS-Setup-ENU.exe /install /quiet /norestart

REM for some reason, this didn't create a start menu shortcut it seems for SQL Server Management Studio

REM press any key to continue....
pause

Update bigfix_setup_root_eval.bat

Update bigfix_setup_root_eval.bat


@if "%_echo%" neq "on" echo off
setlocal EnableDelayedExpansion

echo Stop VBCSCompiler.exe execution.
for /f "tokens=2 delims=," %%F in ('tasklist /nh /fi "imagename eq VBCSCompiler.exe" /fo csv') do taskkill /f /PID %%~F

if [%1] == [-all] (
  echo Cleaning entire working directory ...
  call git clean -xdf
  exit /b !ERRORLEVEL!
)

if [%1]==[] set __args=-b
call %~dp0run.cmd clean %__args% %*
exit /b %ERRORLEVEL%

:Usage
echo.
echo Repository cleaning script.
echo.
echo Options:
echo     -b     - Deletes the binary output directory.
echo     -p     - Deletes the repo-local nuget package directory.
echo     -c     - Deletes the user-local nuget package cache.
echo     -all   - Combines all of the above.
echo.
echo If no option is specified then clean.cmd -b is implied.

exit /b 1

@if "%_echo%" neq "on" echo off
setlocal EnableDelayedExpansion

echo Stop VBCSCompiler.exe execution.
for /f "tokens=2 delims=," %%F in ('tasklist /nh /fi "imagename eq VBCSCompiler.exe" /fo csv') do taskkill /f /PID %%~F

:: Strip all dashes off the argument and use invariant
:: compare to match as many versions of "all" that we can
:: All other argument validation happens inside Run.exe
set NO_DASHES_ARG=%1
if /I [%NO_DASHES_ARG:-=%] == [all] (
  echo Cleaning entire working directory ...
  call git clean -xdf
  exit /b !ERRORLEVEL!
)

if [%1]==[] set __args=-b
call %~dp0run.cmd clean %__args% %*
exit /b %ERRORLEVEL%

:Usage
echo.
echo Repository cleaning script.
echo.
echo Options:
echo     -b     - Deletes the binary output directory.
echo     -p     - Deletes the repo-local nuget package directory.
echo     -c     - Deletes the user-local nuget package cache.
echo     -all   - Combines all of the above.
echo.
echo If no option is specified then clean.cmd -b is implied.

exit /b 1

Handle any and alll variations of -all, --all, AlL, etc in clean.cmd -all. First part of "clean.cmd --all" not causing build.


@echo off
SET NODE_PATH="%~dp0\dev_bundle\lib\node_modules"

"%~dp0\dev_bundle\bin\node.exe" "%~dp0\tools\main.js" %*

@echo off
SET NODE_PATH=%~dp0\dev_bundle\lib\node_modules

"%~dp0\dev_bundle\bin\node.exe" "%~dp0\tools\main.js" %*

Remove quotes on NODE_PATH env var set

Remove quotes on NODE_PATH env var set

apparently it is not correct


@echo off

set NODE_ENV=production
cd %~dp0\..
forever -o stdout.log -e stderr.log -a acMonitor.js

@echo off

set NODE_ENV=production
cd %~dp0\..
forever -l forever.log -o stdout.log -e stderr.log -a -c iojs acMonitor.js

call forever with own logfile referenced


@echo off

echo ^> Running CLI tests...

set MR="%~dp0\..\target\release\multirust-rs.exe"

echo ^> Testing --help
%MR% --help || (echo FAILED && exit /b 1)

echo ^> Testing install
%MR% install -a || (echo FAILED && exit /b 1)

echo ^> Updating PATH
set PATH=%USERPROFILE%\.multirust\bin;%PATH%

echo ^> Testing default
multirust default nightly || (echo FAILED && exit /b 1)

echo ^> Testing rustc
rustc --multirust || (echo FAILED && exit /b 1)

echo ^> Testing cargo
cargo --multirust || (echo FAILED && exit /b 1)

echo ^> Testing override
multirust override i686-msvc-stable || (echo FAILED && exit /b 1)

echo ^> Testing update
multirust update || (echo FAILED && exit /b 1)

echo ^> Testing uninstall
multirust uninstall -y || (echo FAILED && exit /b 1)

echo ^> Finished

@echo off

echo ^> Running CLI tests...

set MR="%~dp0\..\target\release\multirust-rs.exe"

echo ^> Testing --help
%MR% --help || (echo FAILED && exit /b 1)

echo ^> Testing install
%MR% install -a || (echo FAILED && exit /b 1)

echo ^> Updating PATH
set PATH=%USERPROFILE%\.multirust\bin;%PATH%

echo ^> Testing default
multirust default nightly || (echo FAILED && exit /b 1)

echo ^> Testing rustc
call rustc --multirust || (echo FAILED && exit /b 1)

echo ^> Testing cargo
call cargo --multirust || (echo FAILED && exit /b 1)

echo ^> Testing override
multirust override i686-msvc-stable || (echo FAILED && exit /b 1)

echo ^> Testing update
multirust update || (echo FAILED && exit /b 1)

echo ^> Testing uninstall
multirust uninstall -y || (echo FAILED && exit /b 1)

echo ^> Finished

Use call for invoking batch files

Use call for invoking batch files


REM tools\nuget.exe update -self

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /nologo /maxcpucount /nr:true /verbosity:minimal /p:BuildInParallel=true /p:Configuration=Release /p:RestorePackages=true /t:Rebuild src/Twilio.sln

rd download /s /q

if not exist download mkdir download
if not exist download\WindowsPhone mkdir download\WindowsPhone
if not exist download\Silverlight mkdir download\Silverlight
if not exist download\package mkdir download\package
if not exist download\package\twilio mkdir download\package\twilio
if not exist download\package\twiliomvc mkdir download\package\twiliomvc
if not exist download\package\twiliotwiml mkdir download\package\twiliotwiml
if not exist download\package\twiliowebmatrix mkdir download\package\twiliowebmatrix
if not exist download\package\twilioclient mkdir download\package\twilioclient

if not exist download\package\twilio\lib mkdir download\package\twilio\lib
if not exist download\package\twilio\lib\3.5 mkdir download\package\twilio\lib\3.5
REM if not exist download\package\twilio\lib\SL3-WP7 mkdir download\package\twilio\lib\SL3-WP7
if not exist download\package\twilio\lib\SL4-WINDOWSPHONE71 mkdir download\package\twilio\lib\SL4-WINDOWSPHONE71
if not exist download\package\twilio\lib\SL4 mkdir download\package\twilio\lib\SL4

if not exist download\package\twiliomvc\lib mkdir download\package\twiliomvc\lib
if not exist download\package\twiliomvc\lib\3.5 mkdir download\package\twiliomvc\lib\3.5

if not exist download\package\twiliotwiml\lib mkdir download\package\twiliotwiml\lib
if not exist download\package\twiliotwiml\lib\3.5 mkdir download\package\twiliotwiml\lib\3.5

if not exist download\package\twiliowebmatrix\lib mkdir download\package\twiliowebmatrix\lib
if not exist download\package\twiliowebmatrix\lib\3.5 mkdir download\package\twiliowebmatrix\lib\3.5

if not exist download\package\twilioclient\lib mkdir download\package\twilioclient\lib
if not exist download\package\twilioclient\lib\3.5 mkdir download\package\twilioclient\lib\3.5

tools\ilmerge.exe /lib:src\Twilio.Api\bin\Release /internalize /ndebug /v2 /out:download\Twilio.Api.dll Twilio.Api.dll RestSharp.dll
tools\ilmerge.exe /lib:src\Twilio.Api.Silverlight\bin\Release /internalize /ndebug /targetplatform:v4,"C:\Program Files (x86)\Microsoft Silverlight\4.1.10111.0" /out:download\Twilio.Api.Silverlight.dll RestSharp.Silverlight.dll

copy src\Twilio.Api\bin\Release\*.* download
copy src\Twilio.Api.Silverlight\bin\Release\*.* download\Silverlight\
copy src\Twilio.Api.WindowsPhone\bin\Release\*.* download\WindowsPhone\
copy src\Twilio.Mvc\bin\Release\*.* download
copy src\Twilio.Twiml\bin\Release\*.* download
copy src\Twilio.WebMatrix\bin\Release\*.* download
copy src\Twilio.Client.Capability\bin\Release\*.* download
copy LICENSE.txt download

copy src\Twilio.Api\bin\Release\Twilio.Api.* download\package\twilio\lib\3.5\
copy src\Twilio.Api.Silverlight\bin\Release\Twilio.Api.Silverlight.* download\package\twilio\lib\SL4\
REM copy src\Twilio.Api.WindowsPhone\bin\Release\Twilio.Api.WindowsPhone.* download\package\twilio\lib\SL3-WP7\
copy src\Twilio.Api.WindowsPhone\bin\Release\Twilio.Api.WindowsPhone.* download\package\twilio\lib\SL4-WINDOWSPHONE71\

copy src\Twilio.Mvc\bin\Release\Twilio.Mvc.* download\package\twiliomvc\lib\3.5\
copy src\Twilio.Twiml\bin\Release\Twilio.Twiml.* download\package\twiliotwiml\lib\3.5\
copy src\Twilio.WebMatrix\bin\Release\Twilio.WebMatrix.* download\package\twiliowebmatrix\lib\3.5\
copy src\Twilio.Client.Capability\bin\Release\Twilio.Client.Capability.* download\package\twilioclient\lib\3.5\

tools\nuget.exe pack Twilio.nuspec -BasePath download\package\twilio -o download
tools\nuget.exe pack Twilio.Mvc.nuspec -BasePath download\package\twiliomvc -o download
tools\nuget.exe pack Twilio.TwiML.nuspec -BasePath download\package\twiliotwiml -o download
tools\nuget.exe pack Twilio.WebMatrix.nuspec -BasePath download\package\twiliowebmatrix -o download
tools\nuget.exe pack Twilio.Client.nuspec -BasePath download\package\twilioclient -o download

REM tools\nuget.exe update -self

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /nologo /maxcpucount /nr:true /verbosity:minimal /p:BuildInParallel=true /p:Configuration=Release /p:RestorePackages=true /t:Rebuild src/Twilio.sln

rd download /s /q

if not exist download mkdir download
REM if not exist download\WindowsPhone mkdir download\WindowsPhone
REM if not exist download\Silverlight mkdir download\Silverlight
if not exist download\package mkdir download\package
if not exist download\package\twilio mkdir download\package\twilio
if not exist download\package\twiliomvc mkdir download\package\twiliomvc
if not exist download\package\twiliotwiml mkdir download\package\twiliotwiml
if not exist download\package\twiliowebmatrix mkdir download\package\twiliowebmatrix
if not exist download\package\twilioclient mkdir download\package\twilioclient

if not exist download\package\twilio\lib mkdir download\package\twilio\lib
if not exist download\package\twilio\lib\3.5 mkdir download\package\twilio\lib\3.5
REM if not exist download\package\twilio\lib\SL3-WP7 mkdir download\package\twilio\lib\SL3-WP7
if not exist download\package\twilio\lib\SL4-WINDOWSPHONE71 mkdir download\package\twilio\lib\SL4-WINDOWSPHONE71
if not exist download\package\twilio\lib\SL4 mkdir download\package\twilio\lib\SL4

if not exist download\package\twiliomvc\lib mkdir download\package\twiliomvc\lib
if not exist download\package\twiliomvc\lib\3.5 mkdir download\package\twiliomvc\lib\3.5

if not exist download\package\twiliotwiml\lib mkdir download\package\twiliotwiml\lib
if not exist download\package\twiliotwiml\lib\3.5 mkdir download\package\twiliotwiml\lib\3.5

if not exist download\package\twiliowebmatrix\lib mkdir download\package\twiliowebmatrix\lib
if not exist download\package\twiliowebmatrix\lib\3.5 mkdir download\package\twiliowebmatrix\lib\3.5

if not exist download\package\twilioclient\lib mkdir download\package\twilioclient\lib
if not exist download\package\twilioclient\lib\3.5 mkdir download\package\twilioclient\lib\3.5

REM tools\ilmerge.exe /lib:src\Twilio.Api\bin\Release /internalize /ndebug /v2 /out:download\Twilio.Api.dll Twilio.Api.dll RestSharp.dll
REM tools\ilmerge.exe /lib:src\Twilio.Api.Silverlight\bin\Release /internalize /ndebug /targetplatform:v4,"C:\Program Files (x86)\Microsoft Silverlight\4.1.10111.0" /out:download\Twilio.Api.Silverlight.dll RestSharp.Silverlight.dll

REM copy src\Twilio.Api\bin\Release\*.* download
REM copy src\Twilio.Api.Silverlight\bin\Release\*.* download\Silverlight\
REM copy src\Twilio.Api.WindowsPhone\bin\Release\*.* download\WindowsPhone\
REM copy src\Twilio.Mvc\bin\Release\*.* download
REM copy src\Twilio.Twiml\bin\Release\*.* download
REM copy src\Twilio.WebMatrix\bin\Release\*.* download
REM copy src\Twilio.Client.Capability\bin\Release\*.* download
copy LICENSE.txt download

copy src\Twilio.Api\bin\Release\Twilio.Api.* download\package\twilio\lib\3.5\
copy src\Twilio.Api.Silverlight\bin\Release\Twilio.Api.Silverlight.* download\package\twilio\lib\SL4\
REM copy src\Twilio.Api.WindowsPhone\bin\Release\Twilio.Api.WindowsPhone.* download\package\twilio\lib\SL3-WP7\
copy src\Twilio.Api.WindowsPhone\bin\Release\Twilio.Api.WindowsPhone.* download\package\twilio\lib\SL4-WINDOWSPHONE71\

copy src\Twilio.Mvc\bin\Release\Twilio.Mvc.* download\package\twiliomvc\lib\3.5\
copy src\Twilio.Twiml\bin\Release\Twilio.Twiml.* download\package\twiliotwiml\lib\3.5\
copy src\Twilio.WebMatrix\bin\Release\Twilio.WebMatrix.* download\package\twiliowebmatrix\lib\3.5\
copy src\Twilio.Client.Capability\bin\Release\Twilio.Client.Capability.* download\package\twilioclient\lib\3.5\

tools\nuget.exe pack Twilio.nuspec -BasePath download\package\twilio -o download
tools\nuget.exe pack Twilio.Mvc.nuspec -BasePath download\package\twiliomvc -o download
tools\nuget.exe pack Twilio.TwiML.nuspec -BasePath download\package\twiliotwiml -o download
tools\nuget.exe pack Twilio.WebMatrix.nuspec -BasePath download\package\twiliowebmatrix -o download
tools\nuget.exe pack Twilio.Client.nuspec -BasePath download\package\twilioclient -o download

build .bat

build .bat


dir "%LIBRARY_BIN%"

:: Compile clapack
%PYTHON% %RECIPE_DIR%\get_clapack_src.py
if errorlevel 1 exit 1

mkdir build_clapack
if errorlevel 1 exit 1
cd build_clapack
if errorlevel 1 exit 1

cmake ^
    -G "%CMAKE_GENERATOR%" ^
    -DCMAKE_INSTALL_PREFIX="%SRC_DIR%\ext" ^
    -DBoost_ROOT_DIR="%LIBRARY_INC%" ^
    ../clapack
if errorlevel 1 exit 1

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

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

:: Start actual ALPS build
cd %SRC_DIR%
if errorlevel 1 exit 1

mkdir build
if errorlevel 1 exit 1

cd build
if errorlevel 1 exit 1

set PYTHON_LIBRARY=%PREFIX%\libs\python%PY_VER:~0,1%%PY_VER:~2,1%.lib

cmake ^
      -Wno-dev ^
      -G "%CMAKE_GENERATOR%" ^
      -DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
      -DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
      -DBUILD_STATIC_LIBS=1 ^
      -DBUILD_SHARED_LIBS=1 ^
      -DALPS_ENABLE_MPI=OFF ^
      -DALPS_BUILD_APPLICATIONS=ON ^
      -DALPS_BUILD_EXAMPLES=OFF ^
      -DBOOST_ROOT="%PREFIX%" ^
      -DBoost_NO_SYSTEM_PATHS=ON ^
      -DBOOST_INCLUDEDIR="%LIBRARY_INC%" ^
      -DBOOST_LIBRARYDIR="%LIBRARY_BIN%" ^
      -DLAPACK_FOUND=TRUE ^
      -DBLAS_LIBRARY="%SRC_DIR%\ext\lib\blas.lib" ^
      -DLAPACK_LIBRARY="%SRC_DIR%\ext\lib\lapack.lib" ^
      -DPYTHON_EXECUTABLE="%PYTHON%" ^
      -DPYTHON_INCLUDE_DIR:PATH="%PREFIX%/include" ^
      -DPYTHON_LIBRARY:FILEPATH="%PYTHON_LIBRARY%" ^
      -DPYTHON_NUMPY_INCLUDE_DIR:PATH="%SP_DIR%/numpy/core/include" ^
      ..
if errorlevel 1 exit 1

type CMakeCache.txt

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

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

ctest --output-on-failure
if errorlevel 1 exit 1

:: Move pyalps to site packages
move %LIBRARY_LIB%\pyalps "%SP_DIR%"

dir "%LIBRARY_BIN%"

:: Compile clapack
%PYTHON% %RECIPE_DIR%\get_clapack_src.py
if errorlevel 1 exit 1

mkdir build_clapack
if errorlevel 1 exit 1
cd build_clapack
if errorlevel 1 exit 1

cmake ^
    -G "%CMAKE_GENERATOR%" ^
    -DCMAKE_INSTALL_PREFIX="%SRC_DIR%\ext" ^
    -DBoost_ROOT_DIR="%LIBRARY_INC%" ^
    ../clapack
if errorlevel 1 exit 1

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

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

:: Start actual ALPS build
cd %SRC_DIR%
if errorlevel 1 exit 1

mkdir build
if errorlevel 1 exit 1

cd build
if errorlevel 1 exit 1

set PYTHON_LIBRARY=%PREFIX%\libs\python%PY_VER:~0,1%%PY_VER:~2,1%.lib

cmake ^
      -Wno-dev ^
      -G "%CMAKE_GENERATOR%" ^
      -DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
      -DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
      -DBUILD_STATIC_LIBS=1 ^
      -DBUILD_SHARED_LIBS=1 ^
      -DALPS_ENABLE_MPI=OFF ^
      -DALPS_BUILD_APPLICATIONS=ON ^
      -DALPS_BUILD_EXAMPLES=OFF ^
      -DBOOST_ROOT="%PREFIX%" ^
      -DBoost_NO_SYSTEM_PATHS=ON ^
      -DBOOST_INCLUDEDIR="%LIBRARY_INC%" ^
      -DBOOST_LIBRARYDIR="%LIBRARY_LIB%" ^
      -DLAPACK_FOUND=TRUE ^
      -DBLAS_LIBRARY="%SRC_DIR%\ext\lib\blas.lib" ^
      -DLAPACK_LIBRARY="%SRC_DIR%\ext\lib\lapack.lib" ^
      -DPYTHON_EXECUTABLE="%PYTHON%" ^
      -DPYTHON_INCLUDE_DIR:PATH="%PREFIX%/include" ^
      -DPYTHON_LIBRARY:FILEPATH="%PYTHON_LIBRARY%" ^
      -DPYTHON_NUMPY_INCLUDE_DIR:PATH="%SP_DIR%/numpy/core/include" ^
      ..
if errorlevel 1 exit 1

type CMakeCache.txt

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

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

ctest --output-on-failure
if errorlevel 1 exit 1

:: Move pyalps to site packages
move %LIBRARY_LIB%\pyalps "%SP_DIR%"

use LIBRARY_LIB for Boost

use LIBRARY_LIB for Boost


@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements.  See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License.  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.

if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem Script to digest password using the algorithm specified
rem
rem $Id$
rem ---------------------------------------------------------------------------

rem Guess CATALINA_HOME if not defined
if not "%CATALINA_HOME%" == "" goto gotHome
set CATALINA_HOME=.
if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome
set CATALINA_HOME=..
:gotHome
if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome

set "EXECUTABLE=%CATALINA_HOME%\bin\tool-wrapper.bat"

rem Check that target executable exists
if exist "%EXECUTABLE%" goto okExec
echo Cannot find "%EXECUTABLE%"
echo This file is needed to run this program
goto end
:okExec

rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgs

call "%EXECUTABLE%" -server org.apache.catalina.realm.RealmBase %CMD_LINE_ARGS%

:end

@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements.  See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License.  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.

if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem Script to digest password using the algorithm specified
rem
rem $Id$
rem ---------------------------------------------------------------------------

rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome
if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome

set "EXECUTABLE=%CATALINA_HOME%\bin\tool-wrapper.bat"

rem Check that target executable exists
if exist "%EXECUTABLE%" goto okExec
echo Cannot find "%EXECUTABLE%"
echo This file is needed to run this program
goto end
:okExec

rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgs

call "%EXECUTABLE%" -server org.apache.catalina.realm.RealmBase %CMD_LINE_ARGS%

:end

Make Windows shell scripts for individual
commands consistent.

git-svn-id: 79cef5a5a257cc9dbe40a45ac190115b4780e2d0@1137559 13f79535-47bb-0310-9956-ffa450edef68