@echo off
setlocal

set __BuildArch=x64
set __BuildType=Debug
set __BuildOS=Windows_NT

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

if /i "%1" == "debug"    (set __BuildType=Debug&shift&goto Arg_Loop)
if /i "%1" == "release"  (set __BuildType=Release&shift&goto Arg_Loop)

echo Invalid command line argument: %1
goto Usage

:Usage
echo %0 [OS] [arch] [flavor]
goto :eof

:ArgsDone

set __BuildStr=%__BuildOS%.%__BuildArch%.%__BuildType%

set SCRIPT_DIR=%~dp0
set BIN_DIR=..\bin\tests
set PACKAGE=Microsoft.DotNet.ILToNative
set VERSION=1.0.0-prerelease

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

set NUPKG_UNPACK_DIR=%BIN_DIR%\package
set NUPKG_INSTALL_DIR=%NUPKG_UNPACK_DIR%\install
set TOOLCHAIN_DIR=%NUPKG_INSTALL_DIR%\%PACKAGE%.%VERSION%
set NUPKG_PATH=..\bin\Product\%__BuildStr%\.nuget\%PACKAGE%.%VERSION%.nupkg
set NUGET_PATH=..\packages

echo.
echo -------------------------
echo BEGIN TEST EXECUTION
echo -------------------------

echo Cleaning up %NUPKG_INSTALL_DIR%
rmdir /q /s %NUPKG_INSTALL_DIR%
setlocal enableextensions
mkdir %NUPKG_INSTALL_DIR%
endlocal

if not exist "%NUPKG_PATH%" goto :NoNuPkg

set NUGET_FEED_URL="https://www.myget.org/F/schellap/auth/3e4f1dbe-f43a-45a8-b029-3ad4d25605ac/api/v2"

echo.
echo Installing CoreRT external dependencies
set CORERT_EXT_PACKAGE=Microsoft.DotNet.AppDep
set CORERT_EXT_VERSION=1.0.0-prerelease
%NUGET_PATH%\NuGet.exe install -Source %NUGET_FEED_URL% -OutputDir %NUPKG_INSTALL_DIR% -Version %CORERT_EXT_VERSION% %CORERT_EXT_PACKAGE% -prerelease

echo.
echo Installing ProtoJit from NuGet.
set PROTOJIT_PACKAGE=Microsoft.DotNet.ProtoJit
set PROTOJIT_VERSION=1.0.0-prerelease
%NUGET_PATH%\NuGet.exe install -Source %NUGET_FEED_URL% -OutputDir %NUPKG_INSTALL_DIR% -Version %PROTOJIT_VERSION% %PROTOJIT_PACKAGE% -prerelease

echo.
echo Installing ObjectWriter from NuGet.
set OBJWRITER_PACKAGE=Microsoft.DotNet.ObjectWriter
set OBJWRITER_VERSION=1.0.0-prerelease
%NUGET_PATH%\NuGet.exe install -Source %NUGET_FEED_URL% -OutputDir %NUPKG_INSTALL_DIR% -Version %OBJWRITER_VERSION% %OBJWRITER_PACKAGE% -prerelease

echo.
echo Installing ILToNative from %NUPKG_PATH% into %NUPKG_INSTALL_DIR%.
echo ^<packages^>^<package id="%PACKAGE%" version="%VERSION%"/^>^</packages^> > %NUPKG_UNPACK_DIR%\packages.config
copy /y  %NUPKG_PATH% %NUPKG_UNPACK_DIR% > nul
%NUGET_PATH%\NuGet.exe install %NUPKG_UNPACK_DIR%\packages.config -Source %SCRIPT_DIR%%NUPKG_UNPACK_DIR% -OutputDir %NUPKG_INSTALL_DIR% -prerelease

echo.
set CORERT_EXT_PATH=%NUPKG_INSTALL_DIR%\%CORERT_EXT_PACKAGE%.%CORERT_EXT_VERSION%
set PROTOJIT_PATH=%NUPKG_INSTALL_DIR%\%PROTOJIT_PACKAGE%.%PROTOJIT_VERSION%
set OBJWRITER_PATH=%NUPKG_INSTALL_DIR%\%OBJWRITER_PACKAGE%.%OBJWRITER_VERSION%

if not exist "%CORERT_EXT_PATH%" set CORERT_EXT_PATH=..\..\corert.external

if not exist "%PROTOJIT_PATH%" set PROTOJIT_PATH=%CORERT_EXT_PATH%\Compiler\protojit.dll
if not exist "%PROTOJIT_PATH%" set PROTOJIT_PATH=%CORERT_EXT_PATH%\protojit.dll

if not exist "%OBJWRITER_PATH%" set OBJWRITER_PATH=%CORERT_EXT_PATH%\Compiler\objwriter.dll
if not exist "%OBJWRITER_PATH%" set OBJWRITER_PATH=%CORERT_EXT_PATH%\objwriter.dll

set CORERT_EXT_RUNTIME=%CORERT_EXT_PATH%\Runtime
if not exist "%CORERT_EXT_RUNTIME%" set CORERT_EXT_RUNTIME=%CORERT_EXT_PATH%

if not exist "%CORERT_EXT_RUNTIME%" goto :NoCoreRTExt
if not exist "%PROTOJIT_PATH%" goto :NoCoreRTExt
if not exist "%OBJWRITER_PATH%" goto :NoCoreRTExt

if not exist "%TOOLCHAIN_DIR%\ILToNative.exe" goto :NoILToNative

echo Installing JIT from "%PROTOJIT_PATH%" to "%TOOLCHAIN_DIR%"
copy /y "%PROTOJIT_PATH%" "%TOOLCHAIN_DIR%" > nul

echo Installing Object Writer from "%OBJWRITER_PATH%" to "%TOOLCHAIN_DIR%"
copy /y "%OBJWRITER_PATH%" "%TOOLCHAIN_DIR%" > nul

setlocal enabledelayedexpansion
set __VSProductVersion=140
set __VCBuildArch=x86_amd64
call "!VS%__VSProductVersion%COMNTOOLS!\..\..\VC\vcvarsall.bat" %__VCBuildArch%

echo. > %BIN_DIR%\testResults.tmp
set /a TOTAL_TESTS=0
set /a PASSED_TESTS=0
for /f "delims=" %%a in ('dir /s /aD /b *') do (
    set SOURCE_FILE=%%a\%%~na
    set SOURCE_FILENAME=%%~na
    if exist "!SOURCE_FILE!.cs" (
        call :CompileFile !SOURCE_FILE! !SOURCE_FILENAME!
        set /a TOTAL_TESTS=!TOTAL_TESTS!+1
    )
)

set /a FAILED_TESTS=%TOTAL_TESTS%-%PASSED_TESTS%
echo.

echo ^<?xml version="1.0" encoding="utf-8"?^> > %BIN_DIR%\testResults.xml
echo ^<assemblies^>  >> %BIN_DIR%\testResults.xml
echo ^<assembly name="ILToNative" total="%TOTAL_TESTS%" passed="%PASSED_TESTS%" failed="%FAILED_TESTS%" skipped="0"^>  >> %BIN_DIR%\testResults.xml
type %BIN_DIR%\testResults.tmp >> %BIN_DIR%\testResults.xml
echo ^</assembly^>  >> %BIN_DIR%\testResults.xml
echo ^</assemblies^>  >> %BIN_DIR%\testResults.xml

echo.
set "OUTSTR=TOTAL: %TOTAL_TESTS% PASSED: %PASSED_TESTS%"
if %TOTAL_TESTS% EQU %PASSED_TESTS% (
    powershell -Command Write-Host "%OUTSTR%" -foreground "Black" -background "Green"
) else (
    powershell -Command Write-Host "%OUTSTR%" -foreground "White" -background "Red"
)
endlocal
goto :eof

:NoILToNative
    echo ILToNative.exe not found at %TOOLCHAIN_DIR%, aborting test run.
    goto :eof

:NoCoreRTExt
    echo corert.external path not found %CORERT_EXT_PATH%, aborting test run.
    echo set environment variable CORERT_EXT_PATH to the latest corert external path.
    goto :eof

:NoNuPkg
    echo No nupkg at "%NUPKG_PATH%"
    goto :eof

:CompileFile
    echo.
    echo Compiling directory %~1
    set SOURCE_FILE=%~1
    set SOURCE_FILENAME=%~2
    if exist "!SOURCE_FILE!.S" del "!SOURCE_FILE!.S"
    if exist "!SOURCE_FILE!.compiled.exe" del "!SOURCE_FILE!.compiled.exe"
    if exist "!SOURCE_FILE!.obj" del "!SOURCE_FILE!.obj"
    if exist "!SOURCE_FILE!.exe" del "!SOURCE_FILE!.exe"

    setlocal
    echo.
    echo Begin managed build of !SOURCE_FILE!.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:!SOURCE_FILE!.exe /target:exe /warnaserror+ /utf8output !SOURCE_FILE!.cs

    echo.
    echo Compiling ILToNative !SOURCE_FILE!.exe
    %TOOLCHAIN_DIR%\ILToNative.exe -in !SOURCE_FILE!.exe -r %CORERT_EXT_RUNTIME%\*.dll -out !SOURCE_FILE!.obj -r %TOOLCHAIN_DIR%\sdk\System.Private.Corelib.dll > !SOURCE_FILE!.il2n.log
    endlocal

    link.exe  /ERRORREPORT:PROMPT !SOURCE_FILE!.obj /OUT:"!SOURCE_FILE!.compiled.exe" /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"!SOURCE_FILE!.lib" /MACHINE:X64 ..\bin\Product\%__BuildStr%\lib\Runtime.lib ..\bin\Product\%__BuildStr%\lib\reproNative.lib %MSVCRT_LIB% > !SOURCE_FILE!.link.log

    echo.
    echo Running test !SOURCE_FILENAME!

    call !SOURCE_FILE!.cmd
    IF "%ERRORLEVEL%"=="0" (
        set /a PASSED_TESTS=%PASSED_TESTS%+1
        echo ^<test name="!SOURCE_FILE!" type="Program" method="Main" result="Pass" /^> >> %BIN_DIR%\testResults.tmp
    ) ELSE (
        echo ^<test name="!SOURCE_FILE!" type="Program" method="Main" result="Fail"^> >> %BIN_DIR%\testResults.tmp
        echo ^<failure exception-type="Exit code: %ERRORLEVEL%" ^> >> %BIN_DIR%\testResults.tmp
        echo     ^<message^>See !SOURCE_FILE!.*.log ^</message^> >> %BIN_DIR%\testResults.tmp
        echo ^</failure^> >> %BIN_DIR%\testResults.tmp
        echo ^</test^> >> %BIN_DIR%\testResults.tmp
    )

@echo off
setlocal

set __BuildArch=x64
set __BuildType=Debug
set __BuildOS=Windows_NT

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

if /i "%1" == "debug"    (set __BuildType=Debug&shift&goto Arg_Loop)
if /i "%1" == "release"  (set __BuildType=Release&shift&goto Arg_Loop)

echo Invalid command line argument: %1
goto Usage

:Usage
echo %0 [OS] [arch] [flavor]
goto :eof

:ArgsDone

set __BuildStr=%__BuildOS%.%__BuildArch%.%__BuildType%

set SCRIPT_DIR=%~dp0
set BIN_DIR=..\bin\tests
set PACKAGE=Microsoft.DotNet.ILToNative
set VERSION=1.0.0-prerelease

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

set NUPKG_UNPACK_DIR=%BIN_DIR%\package
set NUPKG_INSTALL_DIR=%NUPKG_UNPACK_DIR%\install
set TOOLCHAIN_DIR=%NUPKG_INSTALL_DIR%\%PACKAGE%.%VERSION%
set NUPKG_PATH=..\bin\Product\%__BuildStr%\.nuget\%PACKAGE%.%VERSION%.nupkg
set NUGET_PATH=..\packages

echo.
echo -------------------------
echo BEGIN TEST EXECUTION
echo -------------------------

echo Cleaning up %NUPKG_INSTALL_DIR%
rmdir /q /s %NUPKG_INSTALL_DIR%
setlocal enableextensions
mkdir %NUPKG_INSTALL_DIR%
endlocal

if not exist "%NUPKG_PATH%" goto :NoNuPkg

set NUGET_FEED_URL="https://www.myget.org/F/schellap/auth/3e4f1dbe-f43a-45a8-b029-3ad4d25605ac/api/v2"

echo.
echo Installing CoreRT external dependencies
set CORERT_EXT_PACKAGE=Microsoft.DotNet.AppDep
set CORERT_EXT_VERSION=1.0.0-prerelease
%NUGET_PATH%\NuGet.exe install -Source %NUGET_FEED_URL% -OutputDir %NUPKG_INSTALL_DIR% -Version %CORERT_EXT_VERSION% %CORERT_EXT_PACKAGE% -prerelease

echo.
echo Installing ProtoJit from NuGet.
set PROTOJIT_PACKAGE=Microsoft.DotNet.ProtoJit
set PROTOJIT_VERSION=1.0.0-prerelease
%NUGET_PATH%\NuGet.exe install -Source %NUGET_FEED_URL% -OutputDir %NUPKG_INSTALL_DIR% -Version %PROTOJIT_VERSION% %PROTOJIT_PACKAGE% -prerelease

echo.
echo Installing ObjectWriter from NuGet.
set OBJWRITER_PACKAGE=Microsoft.DotNet.ObjectWriter
set OBJWRITER_VERSION=1.0.0-prerelease
%NUGET_PATH%\NuGet.exe install -Source %NUGET_FEED_URL% -OutputDir %NUPKG_INSTALL_DIR% -Version %OBJWRITER_VERSION% %OBJWRITER_PACKAGE% -prerelease

echo.
echo Installing ILToNative from %NUPKG_PATH% into %NUPKG_INSTALL_DIR%.
echo ^<packages^>^<package id="%PACKAGE%" version="%VERSION%"/^>^</packages^> > %NUPKG_UNPACK_DIR%\packages.config
copy /y  %NUPKG_PATH% %NUPKG_UNPACK_DIR% > nul
%NUGET_PATH%\NuGet.exe install %NUPKG_UNPACK_DIR%\packages.config -Source %SCRIPT_DIR%%NUPKG_UNPACK_DIR% -OutputDir %NUPKG_INSTALL_DIR% -prerelease

echo.
set CORERT_EXT_PATH=%NUPKG_INSTALL_DIR%\%CORERT_EXT_PACKAGE%.%CORERT_EXT_VERSION%
set PROTOJIT_PATH=%NUPKG_INSTALL_DIR%\%PROTOJIT_PACKAGE%.%PROTOJIT_VERSION%
set OBJWRITER_PATH=%NUPKG_INSTALL_DIR%\%OBJWRITER_PACKAGE%.%OBJWRITER_VERSION%

if not exist "%CORERT_EXT_PATH%" set CORERT_EXT_PATH=..\..\corert.external

if not exist "%PROTOJIT_PATH%" set PROTOJIT_PATH=%CORERT_EXT_PATH%\Compiler\protojit.dll
if not exist "%PROTOJIT_PATH%" set PROTOJIT_PATH=%CORERT_EXT_PATH%\protojit.dll

if not exist "%OBJWRITER_PATH%" set OBJWRITER_PATH=%CORERT_EXT_PATH%\Compiler\objwriter.dll
if not exist "%OBJWRITER_PATH%" set OBJWRITER_PATH=%CORERT_EXT_PATH%\objwriter.dll

set CORERT_EXT_RUNTIME=%CORERT_EXT_PATH%\Runtime
if not exist "%CORERT_EXT_RUNTIME%" set CORERT_EXT_RUNTIME=%CORERT_EXT_PATH%

if not exist "%CORERT_EXT_RUNTIME%" goto :NoCoreRTExt
if not exist "%PROTOJIT_PATH%" goto :NoCoreRTExt
if not exist "%OBJWRITER_PATH%" goto :NoCoreRTExt

if not exist "%TOOLCHAIN_DIR%\ILToNative.exe" goto :NoILToNative

echo Installing JIT from "%PROTOJIT_PATH%" to "%TOOLCHAIN_DIR%"
copy /y "%PROTOJIT_PATH%" "%TOOLCHAIN_DIR%" > nul

echo Installing Object Writer from "%OBJWRITER_PATH%" to "%TOOLCHAIN_DIR%"
copy /y "%OBJWRITER_PATH%" "%TOOLCHAIN_DIR%" > nul

setlocal enabledelayedexpansion
set __VSProductVersion=140
set __VCBuildArch=x86_amd64
call "!VS%__VSProductVersion%COMNTOOLS!\..\..\VC\vcvarsall.bat" %__VCBuildArch%

echo. > %BIN_DIR%\testResults.tmp
set /a TOTAL_TESTS=0
set /a PASSED_TESTS=0
for /f "delims=" %%a in ('dir /s /aD /b *') do (
    set SOURCE_FILE=%%a\%%~na
    set SOURCE_FILENAME=%%~na
    if exist "!SOURCE_FILE!.cs" (
        call :CompileFile !SOURCE_FILE! !SOURCE_FILENAME!
        set /a TOTAL_TESTS=!TOTAL_TESTS!+1
    )
)

set /a FAILED_TESTS=%TOTAL_TESTS%-%PASSED_TESTS%
echo.

echo ^<?xml version="1.0" encoding="utf-8"?^> > %BIN_DIR%\testResults.xml
echo ^<assemblies^>  >> %BIN_DIR%\testResults.xml
echo ^<assembly name="ILToNative" total="%TOTAL_TESTS%" passed="%PASSED_TESTS%" failed="%FAILED_TESTS%" skipped="0"^>  >> %BIN_DIR%\testResults.xml
echo ^<collection total="%TOTAL_TESTS%" passed="%PASSED_TESTS%" failed="%FAILED_TESTS%" skipped="0"^>  >> %BIN_DIR%\testResults.xml
type %BIN_DIR%\testResults.tmp >> %BIN_DIR%\testResults.xml
echo ^</collection^>  >> %BIN_DIR%\testResults.xml
echo ^</assembly^>  >> %BIN_DIR%\testResults.xml
echo ^</assemblies^>  >> %BIN_DIR%\testResults.xml

echo.
set "OUTSTR=TOTAL: %TOTAL_TESTS% PASSED: %PASSED_TESTS%"
if %TOTAL_TESTS% EQU %PASSED_TESTS% (
    powershell -Command Write-Host "%OUTSTR%" -foreground "Black" -background "Green"
) else (
    powershell -Command Write-Host "%OUTSTR%" -foreground "White" -background "Red"
)
endlocal
goto :eof

:NoILToNative
    echo ILToNative.exe not found at %TOOLCHAIN_DIR%, aborting test run.
    goto :eof

:NoCoreRTExt
    echo corert.external path not found %CORERT_EXT_PATH%, aborting test run.
    echo set environment variable CORERT_EXT_PATH to the latest corert external path.
    goto :eof

:NoNuPkg
    echo No nupkg at "%NUPKG_PATH%"
    goto :eof

:CompileFile
    echo.
    echo Compiling directory %~1
    set SOURCE_FILE=%~1
    set SOURCE_FILENAME=%~2
    if exist "!SOURCE_FILE!.S" del "!SOURCE_FILE!.S"
    if exist "!SOURCE_FILE!.compiled.exe" del "!SOURCE_FILE!.compiled.exe"
    if exist "!SOURCE_FILE!.obj" del "!SOURCE_FILE!.obj"
    if exist "!SOURCE_FILE!.exe" del "!SOURCE_FILE!.exe"

    setlocal
    echo.
    echo Begin managed build of !SOURCE_FILE!.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:!SOURCE_FILE!.exe /target:exe /warnaserror+ /utf8output !SOURCE_FILE!.cs

    echo.
    echo Compiling ILToNative !SOURCE_FILE!.exe
    %TOOLCHAIN_DIR%\ILToNative.exe -in !SOURCE_FILE!.exe -r %CORERT_EXT_RUNTIME%\*.dll -out !SOURCE_FILE!.obj -r %TOOLCHAIN_DIR%\sdk\System.Private.Corelib.dll > !SOURCE_FILE!.il2n.log
    endlocal

    link.exe  /ERRORREPORT:PROMPT !SOURCE_FILE!.obj /OUT:"!SOURCE_FILE!.compiled.exe" /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"!SOURCE_FILE!.lib" /MACHINE:X64 ..\bin\Product\%__BuildStr%\lib\Runtime.lib ..\bin\Product\%__BuildStr%\lib\reproNative.lib %MSVCRT_LIB% > !SOURCE_FILE!.link.log

    echo.
    echo Running test !SOURCE_FILENAME!

    call !SOURCE_FILE!.cmd
    IF "%ERRORLEVEL%"=="0" (
        set /a PASSED_TESTS=%PASSED_TESTS%+1
        echo ^<test name="!SOURCE_FILE!" type="Program" method="Main" result="Pass" /^> >> %BIN_DIR%\testResults.tmp
    ) ELSE (
        echo ^<test name="!SOURCE_FILE!" type="Program" method="Main" result="Fail"^> >> %BIN_DIR%\testResults.tmp
        echo ^<failure exception-type="Exit code: %ERRORLEVEL%" ^> >> %BIN_DIR%\testResults.tmp
        echo     ^<message^>See !SOURCE_FILE!.*.log ^</message^> >> %BIN_DIR%\testResults.tmp
        echo ^</failure^> >> %BIN_DIR%\testResults.tmp
        echo ^</test^> >> %BIN_DIR%\testResults.tmp
    )

Fix XUnit XML format

Fix XUnit XML format


set HERE=%~dp0

echo HERE %HERE%
echo APPVEYOR_PROJECT_NAME %APPVEYOR_PROJECT_NAME%
echo CONFIGURATION %CONFIGURATION%
echo PLATFORM %PLATFORM%
echo APPVEYOR_BUILD_VERSION %APPVEYOR_BUILD_VERSION%
echo APPVEYOR_REPO_COMMIT %APPVEYOR_REPO_COMMIT%
echo APPVEYOR_REPO_COMMIT_MESSAGE  %APPVEYOR_REPO_COMMIT_MESSAGE%
echo APPVEYOR_BUILD_NUMBER  %APPVEYOR_BUILD_NUMBER%

7z a %HERE%.zip %HERE%\bin\*

%HERE%tools/github-release.exe release ^
                         --user pchalamet ^
                         --repo full-build ^
						 --tag %APPVEYOR_BUILD_VERSION% ^
						 --name "%APPVEYOR_PROJECT_NAME% %CONFIGURATION% %PLATFORM% %APPVEYOR_BUILD_VERSION%" ^
                         --description "%APPVEYOR_REPO_COMMIT% %APPVEYOR_REPO_COMMIT_MESSAGE%" ^
                         --pre-release || goto :ko

%HERE%tools/github-release.exe upload ^
                     --user pchalamet ^
					 --repo full-build ^
                     --tag %APPVEYOR_BUILD_VERSION% ^
                     --name "%APPVEYOR_PROJECT_NAME%-net45-anycpu-%APPVEYOR_BUILD_NUMBER%.zip" ^
                     --file %HERE%FullBuild.zip || goto :ko

:ok
exit /b 0

:ko
exit /b 5

set HERE=%~dp0

echo HERE %HERE%
echo APPVEYOR_PROJECT_NAME %APPVEYOR_PROJECT_NAME%
echo CONFIGURATION %CONFIGURATION%
echo PLATFORM %PLATFORM%
echo APPVEYOR_BUILD_VERSION %APPVEYOR_BUILD_VERSION%
echo APPVEYOR_REPO_COMMIT %APPVEYOR_REPO_COMMIT%
echo APPVEYOR_REPO_COMMIT_MESSAGE  %APPVEYOR_REPO_COMMIT_MESSAGE%
echo APPVEYOR_BUILD_NUMBER  %APPVEYOR_BUILD_NUMBER%

7z a %HERE%\FullBuild.zip %HERE%\bin\*

%HERE%tools/github-release.exe release ^
                         --user pchalamet ^
                         --repo full-build ^
						 --tag %APPVEYOR_BUILD_VERSION% ^
						 --name "%APPVEYOR_PROJECT_NAME% %CONFIGURATION% %PLATFORM% %APPVEYOR_BUILD_VERSION%" ^
                         --description "%APPVEYOR_REPO_COMMIT% %APPVEYOR_REPO_COMMIT_MESSAGE%" ^
                         --pre-release || goto :ko

%HERE%tools/github-release.exe upload ^
                     --user pchalamet ^
					 --repo full-build ^
                     --tag %APPVEYOR_BUILD_VERSION% ^
                     --name "%APPVEYOR_PROJECT_NAME%-net45-anycpu-%APPVEYOR_BUILD_NUMBER%.zip" ^
                     --file %HERE%FullBuild.zip || goto :ko

:ok
exit /b 0

:ko
exit /b 5

fix zip name

fix zip name


@echo off
rem Assign current time and date to a file without modifying the file.
rem
rem author:  Olivier Wenger <https://github.com/ouly>
rem version: 1.0.0, 2014-11-06
rem see:     http://technet.microsoft.com/en-us/library/bb490886.aspx

IF "%~1"=="" (
    echo Missing argument.
    goto error
)

IF "%~1"=="/?" (
    echo Assign current time and date to a file without modifying the file.
    echo.
    echo TOUCH file
    echo.
    echo   file         File to touch.
    goto end
)

copy /b /y "%~1"+,,

:end
exit /B 0
:error
exit /B 1

rem END OF FILE

Create touch.bat

Create touch.bat


mkdir build
cd build

cmake ^
    -G "NMake Makefiles" ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True ^
    -DBUILD_TESTING=ON ^
    %SRC_DIR%
if errorlevel 1 exit 1

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

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

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

mkdir build
cd build

cmake ^
    -G "NMake Makefiles" ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True ^
    -DBUILD_TESTING=ON ^
    -DIGN_UTILS_VENDOR_CLI11=OFF ^
    %SRC_DIR%
if errorlevel 1 exit 1

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

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

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

Update bld.bat

Update bld.bat


:: Copyright 2012 The Go Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style
:: license that can be found in the LICENSE file.
@echo off

setlocal

if exist make.bat goto ok
echo all.bat must be run from go\src
:: cannot exit: would kill parent command interpreter
goto end
:ok

set OLDPATH=%PATH%
call make.bat --no-banner --no-local
if %GOBUILDFAIL%==1 goto end
call run.bat --no-rebuild --no-local
if %GOBUILDFAIL%==1 goto end
go tool dist banner
set PATH=%OLDPATH%

:end
if x%GOBUILDEXIT%==x1 exit %GOBUILDFAIL%

:: Copyright 2012 The Go Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style
:: license that can be found in the LICENSE file.
@echo off

setlocal

if exist make.bat goto ok
echo all.bat must be run from go\src
:: cannot exit: would kill parent command interpreter
goto end
:ok

set OLDPATH=%PATH%
call make.bat --no-banner --no-local
if %GOBUILDFAIL%==1 goto end
call run.bat --no-rebuild --no-local
if %GOBUILDFAIL%==1 goto end
:: we must restore %PATH% before running "dist banner" so that the latter
:: can get the original %PATH% and give suggestion to add %GOROOT%/bin
:: to %PATH% if necessary.
set PATH=%OLDPATH%
%GOTOOLDIR%/dist banner

:end
if x%GOBUILDEXIT%==x1 exit %GOBUILDFAIL%

src/all.bat: fix banner
we need to restore %PATH% before calling "dist banner", so that
it could suggest the user to add %GOROOT%/bin to %PATH% if necessary.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6525049


@echo on
choco install -y --allowEmptyChecksum firefox googlechrome wget notepadplusplus sublimetext3 mono monodevelop gtksharp visualstudiocode p4merge dotnet4.5 nodejs.install conemu dejavufonts ag
call refreshenv

wget -c https://cygwin.com/setup-x86_64.exe
setup-x86_64.exe -R "C:\cygwin64" -s http://mirror.switch.ch/ftp/mirror/cygwin/ -q -g -P curl,zsh,git,vim,wget,xz,tar,gawk,bzip2,subversion,zlib,fontconfig,clang,cmake,lua,perl,the_silver_searcher,gnupg,patch,zlib-devel,openssl-devel,libyaml-devel,libyaml0_2,sqlite3,make,libtool,autoconf,automake,bison,m4,mingw64-i686-gcc-core,mingw64-x86_64-gcc-core,patch,cygwin32-readline,libcrypt-devel,libcrypt0

set script_path=%~dp0
set repo_path=%script_path%\..\
set bash=c:\cygwin64\bin\bash.exe --login -c

for /f "delims=" %%A in ('%bash% "cd `cygpath $HOMEPATH`/dev/dotfiles && git rev-parse --abbrev-ref HEAD"') do set "branch=%%A"
%bash% 'echo "branch is $branch"'
%bash% "cp -vr `cygpath $HOMEPATH`/.ssh $HOME/"
%bash% "export OUTER_CLONE=`cygpath $repo_path` && $script_path/build_insider.sh"

@echo on
choco install -y --allowEmptyChecksum firefox googlechrome wget notepadplusplus sublimetext3 mono monodevelop gtksharp visualstudiocode p4merge dotnet4.5 nodejs.install conemu dejavufonts ag golang
call refreshenv

wget -c https://cygwin.com/setup-x86_64.exe
setup-x86_64.exe -R "C:\cygwin64" -s http://mirror.switch.ch/ftp/mirror/cygwin/ -q -g -P curl,zsh,git,vim,wget,xz,tar,gawk,bzip2,subversion,zlib,fontconfig,clang,cmake,lua,perl,the_silver_searcher,gnupg,patch,zlib-devel,openssl-devel,libyaml-devel,libyaml0_2,sqlite3,make,libtool,autoconf,automake,bison,m4,mingw64-i686-gcc-core,mingw64-x86_64-gcc-core,patch,cygwin32-readline,libcrypt-devel,libcrypt0

set script_path=%~dp0
set repo_path=%script_path%\..\
set bash=c:\cygwin64\bin\bash.exe --login -c

for /f "delims=" %%A in ('%bash% "cd `cygpath $HOMEPATH`/dev/dotfiles && git rev-parse --abbrev-ref HEAD"') do set "branch=%%A"
%bash% 'echo "branch is $branch"'
%bash% "cp -vr `cygpath $HOMEPATH`/.ssh $HOME/"
%bash% "export OUTER_CLONE=`cygpath $repo_path` && $script_path/build_insider.sh"

Install golang on windows, as needed by fzf


### application.bat - 2015 - Merel ###
version = "2.0.0"
echo "version ${version}"

update major version

update major version


call git add .
call git commit -am %2
call git push
call git checkout master
call git pull
call git merge %1
call git push
call git checkout %1

call git add .
call git commit -am %1
call git push

fix calendar non month day click

fix calendar non month day click


pushd tomahawk
cinst tomahawk -source "%cd%" -force
cpack
popd

pushd tomahawk
cpack
cinst tomahawk -source "%cd%" -force
popd

fix pack script

fix pack script


@echo off
SETLOCAL EnableDelayedExpansion

set failed=0

cd bin
for /r "." %%a in (tst_*.exe) do (
  "%%~fa"
  if not ERRORLEVEL 0 (
    echo Test FAILED: "%%~fa"
    set failed=1
  )
)
cd ..
if %failed% EQU 1 (
  echo ERROR: At least one unit test failed!
  if "%HOPSAN_BUILD_SCRIPT_NOPAUSE%" == "" (
    pause
  )
  exit /B 1
)

echo All tests passed
if "%HOPSAN_BUILD_SCRIPT_NOPAUSE%" == "" (
  pause
)

Add unit test bat script

Add unit test bat script


@ECHO OFF

REM ----------------------------------------------------------------------
REM PHP version 5
REM ----------------------------------------------------------------------
REM Copyright (c) 1997-2004 The PHP Group
REM ----------------------------------------------------------------------
REM  This source file is subject to version 3.0 of the PHP license,
REM  that is bundled with this package in the file LICENSE, and is
REM  available at through the world-wide-web at
REM  http://www.php.net/license/3_0.txt.
REM  If you did not receive a copy of the PHP license and are unable to
REM  obtain it through the world-wide-web, please send a note to
REM  license@php.net so we can mail you a copy immediately.
REM ----------------------------------------------------------------------
REM  Authors:     Alexander Merz (alexmerz@php.net)
REM ----------------------------------------------------------------------
REM
REM  Last updated 3/13/2004 ($Id$ is not replaced if the file is binary)

REM change this lines to match the paths of your system
REM -------------------

@ECHO OFF
:: Check PEAR global ENV, set them if they do not exist
IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=@include_path@"
IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=@bin_dir@"
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=@php_bin@"

:: Check Folders and files
IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR
IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2
IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR
IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR
:: launch pearcmd
GOTO RUN
:PEAR_INSTALL_ERROR
ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_INSTALL_DIR%
GOTO END
:PEAR_INSTALL_ERROR2
ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
ECHO pearcmd.php could not be found there.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_INSTALL_DIR%
GOTO END
:PEAR_BIN_ERROR
ECHO PHP_PEAR_BIN_DIR is not set correctly.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_BIN_DIR%
GOTO END
:PEAR_PHPBIN_ERROR
ECHO PHP_PEAR_PHP_BIN is not set correctly.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_PHP_BIN%
GOTO END
:RUN
"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d register_argc_argv=On -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
:END
@ECHO ON

@ECHO OFF

REM ----------------------------------------------------------------------
REM PHP version 5
REM ----------------------------------------------------------------------
REM Copyright (c) 1997-2004 The PHP Group
REM ----------------------------------------------------------------------
REM  This source file is subject to version 3.0 of the PHP license,
REM  that is bundled with this package in the file LICENSE, and is
REM  available at through the world-wide-web at
REM  http://www.php.net/license/3_0.txt.
REM  If you did not receive a copy of the PHP license and are unable to
REM  obtain it through the world-wide-web, please send a note to
REM  license@php.net so we can mail you a copy immediately.
REM ----------------------------------------------------------------------
REM  Authors:     Alexander Merz (alexmerz@php.net)
REM ----------------------------------------------------------------------
REM
REM  Last updated 3/13/2004 ($Id$ is not replaced if the file is binary)

REM change this lines to match the paths of your system
REM -------------------

@ECHO OFF
:: Check PEAR global ENV, set them if they do not exist
IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=@include_path@"
IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=@bin_dir@"
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=@php_bin@"

:: Check Folders and files
IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR
IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2
IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR
IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR
:: launch pearcmd
GOTO RUN
:PEAR_INSTALL_ERROR
ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_INSTALL_DIR%
GOTO END
:PEAR_INSTALL_ERROR2
ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
ECHO pearcmd.php could not be found there.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_INSTALL_DIR%
GOTO END
:PEAR_BIN_ERROR
ECHO PHP_PEAR_BIN_DIR is not set correctly.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_BIN_DIR%
GOTO END
:PEAR_PHPBIN_ERROR
ECHO PHP_PEAR_PHP_BIN is not set correctly.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_PHP_BIN%
GOTO END
:RUN
"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
:END
@ECHO ON

fix bug #1153: PEAR command doesn't work after upgrading

reverting earlier fix - people must have register_argc_argv=on set in php.ini for PEAR to work.


@echo off
title MyFleetGirls
cd /d %~dp0

REM ϐ JAVA_HOME ܂ MFG_JAVA_HOME ݒ肳Ă PATH ɒǉݒ
if Defined JAVA_HOME path %JAVA_HOME%\bin\;%HOME%
if Defined MFG_JAVA_HOME path %MYFFLEETGIRSL_JAVA_HOME%\bin\;%HOME%

REM java R}hs݊mF
java -version 1> NUL 2> NUL
if ErrorLevel 1 goto JavaError

REM update.jar Ŋ֘At@CXVAMyFleetGirls.jar ( clinet { ) s
java -jar update.jar
java -jar MyFleetGirls.jar
echo "MyFleetGirls I܂"
pause > NUL
EXIT 0

:JavaError
echo "JAVA ^C܂łBREADME.txt QƂAK؂ɓ邩ϐ̐ݒsĂB"
pause > NUL
EXIT 1

@echo off
title MyFleetGirls
SET MFG_HOME=%~dp0
If Defined b2eprogrampathname set MFG_HOME=%b2eprogrampathname%
cd /d %MGF_HOME%

REM ϐ JAVA_HOME ܂ MFG_JAVA_HOME ݒ肳Ă PATH ɒǉݒ
If Defined JAVA_HOME path %JAVA_HOME%\bin\;%PATH%
If Defined MFG_JAVA_HOME path %MFG_JAVA_HOME%\bin\;%PATH%

REM java R}hs݊mF
java.exe -version 2> NUL
If ErrorLevel 1 goto JavaError

REM update.jar Ŋ֘At@CXVAMyFleetGirls.jar ( clinet { ) s
java.exe -jar update.jar
java.exe -jar MyFleetGirls.jar
echo MyFleetGirls I܂
pause > NUL
EXIT 0

:JavaError
echo JAVA ^C܂łBREADME.txt QƂ邩Aϐ̐ݒsĂB
pause > NUL
EXIT 1

fix typo

fix typo


rem @echo off
rem
rem Compile keymanweb and copy compiled javascript and resources to output folder
rem

rem Get build version -- if not building in TeamCity, then always use 300

if "%BUILD_NUMBER%"=="" (
  set BUILD=300
) else (
  set BUILD=%BUILD_NUMBER%
)

if "%1" == "-ui"   goto ui
if "%1" == "-test" goto web
if not "%1" == "" goto help

:web

rem
rem Check dependencies before build
rem

if "%CLOSURECOMPILERPATH%"=="" set CLOSURECOMPILERPATH=..\tools
if "%JAVA%"=="" set JAVA=java

set compiler=%CLOSURECOMPILERPATH%\compiler.jar
set compilecmd="%JAVA%" -jar "%compiler%"

if not exist %compiler% (
  echo File %compiler% does not exist: have you set the environment variable CLOSURECOMPILERPATH?
  exit /B 1
)

echo Compiling build %BUILD%
echo.

rem Compile supplementary plane string handing extensions
echo Compile SMP string extensions
del ..\output\kmw-smpstring.js 2>nul
%compilecmd% --js kmwstring.js --compilation_level SIMPLE_OPTIMIZATIONS --js_output_file ..\output\kmw-smpstring.js --warning_level VERBOSE
if not exist ..\output\kmw-smpstring.js goto fail

rem Compile KeymanWeb code modules for native keymanweb use, stubbing out and removing references to debug functions
echo Compile Keymanweb

del ..\output\kmwtemp.js 2>nul
%compilecmd% --define __BUILD__=%BUILD% --externs kmwreleasestub.js --js kmwbase.js --js keymanweb.js --js kmwosk.js --js kmwnative.js --js kmwcallback.js --js kmwkeymaps.js --js kmwlayout.js --js kmwinit.js --compilation_level SIMPLE_OPTIMIZATIONS  --js_output_file ..\output\kmwtemp.js --warning_level VERBOSE
if not exist ..\output\kmwtemp.js goto fail

echo Append SMP string extensions to Keymanweb
copy /B ..\output\kmw-smpstring.js+..\output\kmwtemp.js ..\output\keymanweb.js
del ..\output\kmwtemp.js

if "%1" == "-test" goto done

rem Update any changed resources

echo Copy or update resources
xcopy resources\*.* ..\output\resources /D /E /Y  >nul

rem Update build number if successful
echo.
echo KeymanWeb 2 build %BUILD% compiled and saved.
echo.
rem echo %BUILD% >version.txt

goto done

rem Compile UI code modules (TODO: add date testing, only recompile if needed)

:ui

echo Compile ToolBar UI
del ..\output\kmuitoolbar.js 2>nul
%compilecmd% --js kmwuitoolbar.js --externs kmwreleasestub.js --compilation_level ADVANCED_OPTIMIZATIONS --js_output_file ..\output\kmwuitoolbar.js --warning_level VERBOSE --output_wrapper "(function() {%%output%%}());"
if not exist ..\output\kmwuitoolbar.js goto fail

echo Compile Toggle UI
del ..\output\kmuitoggle.js 2>nul
%compilecmd% --js kmwuitoggle.js --externs kmwreleasestub.js --compilation_level SIMPLE_OPTIMIZATIONS --js_output_file ..\output\kmwuitoggle.js --warning_level VERBOSE --output_wrapper "(function() {%%output%%}());"
if not exist ..\output\kmwuitoggle.js goto fail

echo Compile Float UI
del ..\output\kmuifloat.js 2>nul
%compilecmd% --js kmwuifloat.js --externs kmwreleasestub.js --compilation_level ADVANCED_OPTIMIZATIONS --js_output_file ..\output\kmwuifloat.js --warning_level VERBOSE --output_wrapper "(function() {%%output%%}());"
if not exist ..\output\kmwuifloat.js goto fail

echo Compile Button UI
del ..\output\kmuibutton.js 2>nul
%compilecmd% --js kmwuibutton.js --externs kmwreleasestub.js --compilation_level SIMPLE_OPTIMIZATIONS --js_output_file ..\output\kmwuibutton.js --warning_level VERBOSE --output_wrapper "(function() {%%output%%}());"
if not exist ..\output\kmwuibutton.js goto fail

echo User interface modules compiled and saved.
goto done

:fail
echo.
echo Build failed
goto done

:help
echo.
echo Usage: build       to compile keymanweb application code to output folder
echo        build -ui   to compile desktop user interface modules to output folder
echo        build -test to compile for testing without copying resources or
echo                    updating the saved version number.

:done
echo.

@echo off
rem
rem Compile keymanweb and copy compiled javascript and resources to output folder
rem

rem Get build version -- if not building in TeamCity, then always use 300

if "%BUILD_NUMBER%"=="" (
  set BUILD=300
) else (
  set BUILD=%BUILD_NUMBER%
)

if "%1" == "-ui"   goto ui
if "%1" == "-test" goto web
if not "%1" == "" goto help

:web

rem
rem Check dependencies before build
rem

if "%CLOSURECOMPILERPATH%"=="" set CLOSURECOMPILERPATH=..\tools
if "%JAVA%"=="" set JAVA=java

set compiler=%CLOSURECOMPILERPATH%\compiler.jar
set compilecmd="%JAVA%" -jar "%compiler%"

if not exist %compiler% (
  echo File %compiler% does not exist: have you set the environment variable CLOSURECOMPILERPATH?
  exit /B 1
)

echo Compiling build %BUILD%
echo.

if not exist ..\output mkdir ..\output

rem Compile supplementary plane string handing extensions
echo Compile SMP string extensions
del ..\output\kmw-smpstring.js 2>nul
%compilecmd% --js kmwstring.js --compilation_level SIMPLE_OPTIMIZATIONS --js_output_file ..\output\kmw-smpstring.js --warning_level VERBOSE
if not exist ..\output\kmw-smpstring.js goto fail

rem Compile KeymanWeb code modules for native keymanweb use, stubbing out and removing references to debug functions
echo Compile Keymanweb

del ..\output\kmwtemp.js 2>nul
%compilecmd% --define __BUILD__=%BUILD% --externs kmwreleasestub.js --js kmwbase.js --js keymanweb.js --js kmwosk.js --js kmwnative.js --js kmwcallback.js --js kmwkeymaps.js --js kmwlayout.js --js kmwinit.js --compilation_level SIMPLE_OPTIMIZATIONS  --js_output_file ..\output\kmwtemp.js --warning_level VERBOSE
if not exist ..\output\kmwtemp.js goto fail

echo Append SMP string extensions to Keymanweb
copy /B ..\output\kmw-smpstring.js+..\output\kmwtemp.js ..\output\keymanweb.js
del ..\output\kmwtemp.js

if "%1" == "-test" goto done

rem Update any changed resources

echo Copy or update resources
xcopy resources\*.* ..\output\resources /D /E /Y  >nul

rem Update build number if successful
echo.
echo KeymanWeb 2 build %BUILD% compiled and saved.
echo.
rem echo %BUILD% >version.txt

goto done

rem Compile UI code modules (TODO: add date testing, only recompile if needed)

:ui

echo Compile ToolBar UI
del ..\output\kmuitoolbar.js 2>nul
%compilecmd% --js kmwuitoolbar.js --externs kmwreleasestub.js --compilation_level ADVANCED_OPTIMIZATIONS --js_output_file ..\output\kmwuitoolbar.js --warning_level VERBOSE --output_wrapper "(function() {%%output%%}());"
if not exist ..\output\kmwuitoolbar.js goto fail

echo Compile Toggle UI
del ..\output\kmuitoggle.js 2>nul
%compilecmd% --js kmwuitoggle.js --externs kmwreleasestub.js --compilation_level SIMPLE_OPTIMIZATIONS --js_output_file ..\output\kmwuitoggle.js --warning_level VERBOSE --output_wrapper "(function() {%%output%%}());"
if not exist ..\output\kmwuitoggle.js goto fail

echo Compile Float UI
del ..\output\kmuifloat.js 2>nul
%compilecmd% --js kmwuifloat.js --externs kmwreleasestub.js --compilation_level ADVANCED_OPTIMIZATIONS --js_output_file ..\output\kmwuifloat.js --warning_level VERBOSE --output_wrapper "(function() {%%output%%}());"
if not exist ..\output\kmwuifloat.js goto fail

echo Compile Button UI
del ..\output\kmuibutton.js 2>nul
%compilecmd% --js kmwuibutton.js --externs kmwreleasestub.js --compilation_level SIMPLE_OPTIMIZATIONS --js_output_file ..\output\kmwuibutton.js --warning_level VERBOSE --output_wrapper "(function() {%%output%%}());"
if not exist ..\output\kmwuibutton.js goto fail

echo User interface modules compiled and saved.
goto done

:fail
echo.
echo Build failed
goto done

:help
echo.
echo Usage: build       to compile keymanweb application code to output folder
echo        build -ui   to compile desktop user interface modules to output folder
echo        build -test to compile for testing without copying resources or
echo                    updating the saved version number.

:done
echo.

Create output folder in build

Create output folder in build


@echo off

setlocal
call "%~dp0zkEnv.cmd"

set ZOO_DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000

set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain
set FOURMAIN=org.apache.zookeeper.client.FourLetterWordMain

set ZOO_TEMP=%TEMP%
set USAGE="%~n0 [four|one|cluster] [args...]"

set CMD=%1
shift

if "%CMD%" == "four" (
	goto :four
) else if "%CMD%" == "one" (
	goto :start_one
) else if "%CMD%" == "cluster" (
	goto :start_cluster
) else (
	goto :usage
)

:usage

echo %USAGE%
goto :end

:four
echo off

set host=%1
set port=%2
set cmd=%3

rem org.apache.zookeeper.server.ServerCnxn.cmd2String
rem conf cons crst dump envi gtmk ruok stmk srst *srvr *stat wchc wchp wchs mntr isro
java "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" -cp "%CLASSPATH%" %FOURMAIN% %host% %port% %cmd%

goto :end

:start_one
echo on

set server_one=%1

start java "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOO_TEMP%\zkcluster\%server_one%\zoo.cfg"

goto :end

:start_cluster
echo on

set server_conf_n=%1
set server_start_n=%2

mkdir %ZOO_TEMP%\zkcluster
copy /Y %~dp0..\conf\zoo_sample.cfg  %ZOO_TEMP%\zkcluster\zoo_template.cfg

echo # >> %ZOO_TEMP%\zkcluster\zoo_template.cfg
for /L %%i in (1, 1, %server_conf_n%) do (
	echo server.%%i=localhost:%%i888:%%i999 >> %ZOO_TEMP%\zkcluster\zoo_template.cfg
)

for /L %%i in (1, 1, %server_conf_n%) do (
	mkdir %ZOO_TEMP%\zkcluster\%%i\
	copy /Y %ZOO_TEMP%\zkcluster\zoo_template.cfg %ZOO_TEMP%\zkcluster\%%i\zoo.cfg

	echo # >>  %ZOO_TEMP%\zkcluster\%%i\zoo.cfg
	rem echo dataDir=${zoo.tmp.dir}/zkcluster/%%i/ >>  %ZOO_TEMP%\zkcluster\%%i\zoo.cfg
	echo dataDir=%ZOO_TEMP:\=/%/zkcluster/%%i/>>  %ZOO_TEMP%\zkcluster\%%i\zoo.cfg

	echo # >>  %ZOO_TEMP%\zkcluster\%%i\zoo.cfg
	echo clientPort=218%%i>>  %ZOO_TEMP%\zkcluster\%%i\zoo.cfg

	echo %%i> %ZOO_TEMP%\zkcluster\%%i\myid
)

for /L %%i in (1, 1, %server_start_n%) do (
	start java "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOO_TEMP%\zkcluster\%%i\zoo.cfg"
)

goto :end

:end

endlocal

Create win-zkServers.bat

Create win-zkServers.bat


cd c:/graphviz-ms
REM variables need to be filled out , Modify only this section
REM *****************************************************
SET VS2008DIR="C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE"
SET buildBaseDir=c:\graphviz-ms\
SET buildDir=%buildBaseDir%graphviz2\
SET targetDir=%buildBaseDir%release\
SET outputDir=c:\graphviz-ms\bin\
SET setupProjectDir=C:\graphviz-ms\graphviz-msi\setup\
SET setupProjectName=setup
SET setupProjectFile=%setupProjectDir%%setupProjectName%.sln
set sourceLibDir=c:\graphviz-ms\add-on\
set sourceUrl=http://www.graphviz.org/pub/graphviz/development/SOURCES/graphviz-working.tar.gz
set wgetPath=C:\wget\bin
set SevenzPath="C:\Program Files\7-Zip"
set pscpPath="C:\Program Files\PuTTY"
set sdkPath="C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin"
PATH=%PATH%;%VS2008DIR%;%wgetPath%;%SevenzPath%;%pscpPath%;%sdkPath%;

REM *****************************************************
REM 84716ny
REM clean up code , if you rpvode source manually comment out this section
REM *****************************************************
rmdir /S /Q %buildBaseDir%graphviz2
rmdir /S /Q %targetDir%
del %buildBaseDir%*.msi
del %buildBaseDir%*.tar
del %buildBaseDir%*.gz
del %buildBaseDir%*.zip
del %outputDir%*.exe
del %outputDir%*.dll
REM *****************************************************
REM Comment out this section to disable source download
REM *****************************************************
wget -O %buildBaseDir%source.tar.gz %sourceUrl%
7z x -y %buildBaseDir%source.tar.gz
7z x -y %buildBaseDir%source.tar
move /Y %buildBaseDir%graphviz-2.31.* graphviz2
REM **************End of source download*****************

xcopy /Y %buildDir%windows\FEATURE %buildDir%\FEATURE\ /S
xcopy /Y %sourceLibDir%GTS %buildDir%lib\GTS\ /S
xcopy /Y %sourceLibDir%release %buildBaseDir%release\ /S
xcopy /Y %sourceLibDir%gd %buildBaseDir%\graphviz2\lib\gd\
xcopy /Y %sourceLibDir%GL %buildBaseDir%\graphviz2\cmd\smyrna\GL\

del %buildDir%libltdl\config.h /q
copy /Y %sourceLibDir%*.lib %targetDir%bin\

REM Copy installed .h files to release\include\graphviz
REM *****************************************************
copy /Y %buildDir%lib\cdt\cdt.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\cgraph\cgraph.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\graph\graph.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\common\arith.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\common\geom.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\common\types.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\common\color.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\common\textpara.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\common\usershape.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\pathplan\pathplan.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\pathplan\pathgeom.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvc.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvcext.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvcjob.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvcommon.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvplugin.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvplugin_render.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvplugin_textlayout.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvplugin_device.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvplugin_layout.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvplugin_loadimage.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\pack\pack.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\xdot\xdot.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvpr\gvpr.h %buildBaseDir%release\include\graphviz

REM Copy few files from source tree for windows build
REM *****************************************************
copy /Y %buildDir%windows\config.h %buildDir%
copy /Y %buildDir%windows\ast_common.h %buildDir%
copy /Y %sourceLibDir%getopt.h %buildDir%
REM copy /Y %sourceLibDir%config.h %buildDir%

REM *****************************************************
REM Build release
REM *****************************************************
devenv %buildDir%graphviz.sln -Clean release
devenv %buildDir%graphviz.sln -Build release -Out %buildDir%releaseLog1.txt
devenv %buildDir%graphviz.sln -Build release -Out %buildDir%releaseLog2.txt
REM *****************************************************
REM Copy release outputs
REM *****************************************************
copy /Y %sourceLibDir%*.*  %targetDir%bin
copy /Y %outputDir%*.exe  %targetDir%bin
copy /Y %outputDir%dot.exe %targetDir%bin\sfdp.exe
copy /Y %outputDir%dot.exe %targetDir%bin\patchwork.exe
copy /Y %outputDir%dot.exe %targetDir%bin\circo.exe
copy /Y %outputDir%dot.exe %targetDir%bin\neato.exe
copy /Y %outputDir%dot.exe %targetDir%bin\fdp.exe
copy /Y %outputDir%dot.exe %targetDir%bin\twopi.exe
copy /Y %outputDir%dot.exe %targetDir%bin\osage.exe
copy /Y %outputDir%gv2gml.exe %targetDir%bin\gml2gv.exe
copy /Y %outputDir%*.dll  %targetDir%bin
copy /Y %outputDir%*.lib  %targetDir%lib\release\lib
copy /Y %outputDir%*.dll  %targetDir%lib\release\dll
REM *****************************************************

REM Run dot -c to generate config6 file. condig6 is shipped in the package
REM *****************************************************
%targetDir%bin\dot -c
REM *****************************************************

REM Build debug
REM *****************************************************
devenv %buildDir%graphviz.sln -Clean debug
devenv %buildDir%graphviz.sln -Build debug -Out %buildDir%debugLog1.txt
devenv %buildDir%graphviz.sln -Build debug -Out %buildDir%debugLog2.txt
copy /Y %outputDir%*.lib  %targetDir%lib\debug\lib
copy /Y %outputDir%*.dll  %targetDir%lib\debug\dll
REM *****************************************************
del %setupProjectDir%Release\%setupProjectName%.msi
del %setupProjectDir%Release\*.msi
devenv %setupProjectFile% -Clean release -Out %buildDir%packagingLog.txt
devenv %setupProjectFile% -Build release -Out %buildDir%packagingLog.txt
COPY /Y %setupProjectDir%Release\%setupProjectName%.msi %buildBaseDir%graphviz-2.31.%date:~10,4%%date:~4,2%%date:~7,2%.msi
REM msitran -a c:\graphviz-ms\addtopath.mst %buildBaseDir%graphviz-2.31.%date:~10,4%%date:~4,2%%date:~7,2%.msi
pscp -q *.msi graphviz-web://data/pub/graphviz/development/windows > pscpLog.txt 2>&1
7z a -tzip c:\graphviz-ms\graphviz.zip c:\graphviz-ms\release
move /Y c:\graphviz-ms\graphviz.zip %buildBaseDir%graphviz-2.31.%date:~10,4%%date:~4,2%%date:~7,2%.zip
pscp -q *.zip graphviz-web://data/pub/graphviz/development/windows >> pscpLog.txt 2>&1

cd c:/graphviz-ms
REM variables need to be filled out , Modify only this section
REM *****************************************************
SET VS2008DIR="C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE"
SET buildBaseDir=c:\graphviz-ms\
SET buildDir=%buildBaseDir%graphviz2\
SET targetDir=%buildBaseDir%release\
SET outputDir=c:\graphviz-ms\bin\
SET setupProjectDir=C:\graphviz-ms\graphviz-msi\setup\
SET setupProjectName=setup
SET setupProjectFile=%setupProjectDir%%setupProjectName%.sln
set sourceLibDir=c:\graphviz-ms\add-on\
set sourceUrl=http://www.graphviz.org/pub/graphviz/development/SOURCES/graphviz-working.tar.gz
set wgetPath=C:\wget\bin
set SevenzPath="C:\Program Files\7-Zip"
set pscpPath="C:\Program Files\PuTTY"
set sdkPath="C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin"
PATH=%PATH%;%VS2008DIR%;%wgetPath%;%SevenzPath%;%pscpPath%;%sdkPath%;

REM *****************************************************
REM 84716ny
REM clean up code , if you rpvode source manually comment out this section
REM *****************************************************
rmdir /S /Q %buildBaseDir%graphviz2
rmdir /S /Q %targetDir%
del %buildBaseDir%*.msi
del %buildBaseDir%*.tar
del %buildBaseDir%*.gz
del %buildBaseDir%*.zip
del %outputDir%*.exe
del %outputDir%*.dll
REM *****************************************************
REM Comment out this section to disable source download
REM *****************************************************
wget -O %buildBaseDir%source.tar.gz %sourceUrl%
7z x -y %buildBaseDir%source.tar.gz
7z x -y %buildBaseDir%source.tar
move /Y %buildBaseDir%graphviz-2.31.* graphviz2
REM **************End of source download*****************

xcopy /Y %buildDir%windows\FEATURE %buildDir%\FEATURE\ /S
xcopy /Y %sourceLibDir%GTS %buildDir%lib\GTS\ /S
xcopy /Y %sourceLibDir%release %buildBaseDir%release\ /S
xcopy /Y %sourceLibDir%gd %buildBaseDir%\graphviz2\lib\gd\
xcopy /Y %sourceLibDir%GL %buildBaseDir%\graphviz2\cmd\smyrna\GL\

del %buildDir%libltdl\config.h /q
copy /Y %sourceLibDir%*.lib %targetDir%bin\

REM Copy installed .h files to release\include\graphviz
REM *****************************************************
copy /Y %buildDir%lib\cdt\cdt.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\cgraph\cgraph.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\graph\graph.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\common\arith.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\common\geom.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\common\types.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\common\color.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\common\textpara.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\common\usershape.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\pathplan\pathplan.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\pathplan\pathgeom.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvc.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvcext.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvcjob.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvcommon.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvplugin.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvplugin_render.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvplugin_textlayout.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvplugin_device.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvplugin_layout.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvc\gvplugin_loadimage.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\pack\pack.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\xdot\xdot.h %buildBaseDir%release\include\graphviz
copy /Y %buildDir%lib\gvpr\gvpr.h %buildBaseDir%release\include\graphviz

REM Copy few files from source tree for windows build
REM *****************************************************
copy /Y %buildDir%windows\config.h %buildDir%
copy /Y %buildDir%windows\ast_common.h %buildDir%
copy /Y %sourceLibDir%getopt.h %buildDir%
REM copy /Y %sourceLibDir%config.h %buildDir%

REM *****************************************************
REM Build release
REM *****************************************************
devenv %buildDir%graphviz.sln -Clean release
devenv %buildDir%graphviz.sln -Build release -Out %buildDir%releaseLog1.txt
devenv %buildDir%graphviz.sln -Build release -Out %buildDir%releaseLog2.txt
REM *****************************************************
REM Copy release outputs
REM *****************************************************
copy /Y %sourceLibDir%*.*  %targetDir%bin
copy /Y %outputDir%*.exe  %targetDir%bin
copy /Y %outputDir%dot.exe %targetDir%bin\sfdp.exe
copy /Y %outputDir%dot.exe %targetDir%bin\patchwork.exe
copy /Y %outputDir%dot.exe %targetDir%bin\circo.exe
copy /Y %outputDir%dot.exe %targetDir%bin\neato.exe
copy /Y %outputDir%dot.exe %targetDir%bin\fdp.exe
copy /Y %outputDir%dot.exe %targetDir%bin\twopi.exe
copy /Y %outputDir%dot.exe %targetDir%bin\osage.exe
copy /Y %outputDir%gv2gml.exe %targetDir%bin\gml2gv.exe
copy /Y %outputDir%*.dll  %targetDir%bin
copy /Y %outputDir%*.lib  %targetDir%lib\release\lib
copy /Y %outputDir%*.dll  %targetDir%lib\release\dll
REM *****************************************************

REM Copy smyrna shared files
xcopy /Y %buildDir%share\gui %targetDir%share\graphviz\smyrna\ /S
REM *****************************************************

REM *****************************************************
REM Run dot -c to generate config6 file. condig6 is shipped in the package
REM *****************************************************
%targetDir%bin\dot -c
REM *****************************************************

REM Build debug
REM *****************************************************
devenv %buildDir%graphviz.sln -Clean debug
devenv %buildDir%graphviz.sln -Build debug -Out %buildDir%debugLog1.txt
devenv %buildDir%graphviz.sln -Build debug -Out %buildDir%debugLog2.txt
copy /Y %outputDir%*.lib  %targetDir%lib\debug\lib
copy /Y %outputDir%*.dll  %targetDir%lib\debug\dll
REM *****************************************************
del %setupProjectDir%Release\%setupProjectName%.msi
del %setupProjectDir%Release\*.msi
devenv %setupProjectFile% -Clean release -Out %buildDir%packagingLog.txt
devenv %setupProjectFile% -Build release -Out %buildDir%packagingLog.txt
COPY /Y %setupProjectDir%Release\%setupProjectName%.msi %buildBaseDir%graphviz-2.31.%date:~10,4%%date:~4,2%%date:~7,2%.msi
REM msitran -a c:\graphviz-ms\addtopath.mst %buildBaseDir%graphviz-2.31.%date:~10,4%%date:~4,2%%date:~7,2%.msi
pscp -q *.msi graphviz-web://data/pub/graphviz/development/windows > pscpLog.txt 2>&1
7z a -tzip c:\graphviz-ms\graphviz.zip c:\graphviz-ms\release
move /Y c:\graphviz-ms\graphviz.zip %buildBaseDir%graphviz-2.31.%date:~10,4%%date:~4,2%%date:~7,2%.zip
pscp -q *.zip graphviz-web://data/pub/graphviz/development/windows >> pscpLog.txt 2>&1

Make sure shared files of smyrna use those from source package


@echo off
@echo .
@echo ..
@echo ...
@echo Running full Build Script, capturing output to buildlog.txt file...
@echo Start Time: %time%
build-support\tools\nant\bin\nant clean package -f:spring.build -D:project.build.sign=true -D:mstest.exe="c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe" -D:package.version=1.3.1 -D:vs-net.mstest.bin.dir="c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE" > buildlog.txt
@echo .
@echo ..
@echo ...
@echo Launching text file viewer to display buildlog.txt contents...
start "ignored but required placeholder window title argument" buildlog.txt
@echo .
@echo ..
@echo ...
@echo ************************
@echo Build Complete!
@echo ************************
@echo End Time: %time%
@echo

Add build release convenience script

Add build release convenience script


rem DEPENDENCIES:
rem   1. Node.js ('npm' binary in PATH)
rem   2. 7zip    ('7z'  binary in PATH)
rem
rem   installer dev mode:  set SKIP_TO_FRONTEND/SKIP_TO_INSTALLER

set MIN_CARDANO_BYTES=20000000
set LIBRESSL_VERSION=2.5.3
set CURL_VERSION=7.54.0
set CARDANO_BRANCH_DEFAULT=cardano-sl-1.0
set DAEDALUS_VERSION_DEFAULT=local-dev-build-%CARDANO_BRANCH_DEFAULT%

set DAEDALUS_VERSION=%1
@if [%DAEDALUS_VERSION%]==[] (@echo WARNING: DAEDALUS_VERSION [argument #1] was not provided, defaulting to %DAEDALUS_VERSION_DEFAULT%
    set DAEDALUS_VERSION=%DAEDALUS_VERSION_DEFAULT%);
set CARDANO_BRANCH=%2
@if [%CARDANO_BRANCH%]==[]   (@echo WARNING: CARDANO_BRANCH [argument #2] was not provided, defaulting to %CARDANO_BRANCH_DEFAULT%
    set CARDANO_BRANCH=%CARDANO_BRANCH_DEFAULT%);

set CURL_URL=https://bintray.com/artifact/download/vszakats/generic/curl-%CURL_VERSION%-win64-mingw.7z
set CURL_BIN=curl-%CURL_VERSION%-win64-mingw\bin
set NSISVER=3.02.1
set NSIS_URL=https://downloads.sourceforge.net/project/nsis/NSIS%%203/%NSISVER%/nsis-%NSISVER%-setup.exe
set NSIS_PATCH_URL=https://downloads.sourceforge.net/project/nsis/NSIS%%203/%NSISVER%/nsis-%NSISVER%-strlen_8192.zip
set CARDANO_URL=https://ci.appveyor.com/api/projects/jagajaga/cardano-sl/artifacts/CardanoSL.zip?branch=%CARDANO_BRANCH%
set LIBRESSL_URL=https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-%LIBRESSL_VERSION%-windows.zip
set DLLS_URL=https://s3.eu-central-1.amazonaws.com/daedalus-ci-binaries/DLLs.zip

@echo Building Daedalus version:  %DAEDALUS_VERSION%
@echo ..with Cardano branch:      %CARDANO_BRANCH%
@echo ..with LibreSSL version:    %LIBRESSL_VERSION%
@echo .

@if not [%SKIP_TO_INSTALLER%]==[] (@echo WARNING: SKIP_TO_INSTALLER set, skipping to frontend packaging
    pushd installers & goto :build_installer)
@if not [%SKIP_TO_FRONTEND%]==[]   (@echo WARNING: SKIP_TO_FRONTEND set, skipping directly to installer rebuild
    pushd installers & goto :build_frontend)

@echo Obtaining curl
powershell -Command "try { Import-Module BitsTransfer; Start-BitsTransfer -Source '%CURL_URL%' -Destination 'curl.7z'; } catch { exit 1; }"
@if %errorlevel% neq 0 (@echo FAILED: couldn't obtain curl from %CURL_URL% using BITS
	popd & exit /b 1)
del /f curl.exe curl-ca-bundle.crt libcurl.dll
7z e curl.7z %CURL_BIN%\curl.exe %CURL_BIN%\curl-ca-bundle.crt %CURL_BIN%\libcurl.dll
@if %errorlevel% neq 0 (@echo FAILED: couldn't extract curl from downloaded archive
	popd & exit /b 1)

@echo Obtaining NSIS %NSISVER% with 8k-string patch
del /f nsis-setup.exe nsis-strlen_8192.zip
curl -o nsis-setup.exe       --location %NSIS_URL%
@if %errorlevel% neq 0 (@echo FAILED: curl -o nsis-setup.exe       --location %NSIS_URL%
    exit /b 1)

curl -o nsis-strlen_8192.zip --location %NSIS_PATCH_URL%
@if %errorlevel% neq 0 (@echo FAILED: curl -o nsis-strlen_8192.zip --location %NSIS_PATCH_URL%
    exit /b 1)

nsis-setup.exe /S /SD
@if %errorlevel% neq 0 (@echo FAILED: nsis-setup.exe /S /SD
    exit /b 1)

7z    x nsis-strlen_8192.zip -o"c:\Program Files (x86)\NSIS" -aoa -r
@if %errorlevel% neq 0 (@echo FAILED: 7z    x nsis-strlen_8192.zip -o"c:\Program Files (x86)\NSIS" -aoa -r
    exit /b 1)

@echo Installing NPM
call npm install
@if %errorlevel% neq 0 (@echo FAILED: npm install
    exit /b 1)

@echo Obtaining Cardano from branch %CARDANO_BRANCH%
rmdir /s/q node_modules\daedalus-client-api 2>nul
mkdir      node_modules\daedalus-client-api

pushd node_modules\daedalus-client-api
    del /f CardanoSL.zip 2>nul
    ..\..\curl --location %CARDANO_URL% -o CardanoSL.zip
    @if %errorlevel% neq 0 (@echo FAILED: couldn't obtain the cardano-sl package
	popd & exit /b 1)
    @for /F "usebackq" %%A in ('CardanoSL.zip') do set size=%%~zA
    if %size% lss %MIN_CARDANO_BYTES% (@echo FAILED: CardanoSL.zip is too small: threshold=%MIN_CARDANO_BYTES%, actual=%size% bytes
        popd & exit /b 1)

    7z x CardanoSL.zip -y
    @if %errorlevel% neq 0 (@echo FAILED: 7z x CardanoSL.zip -y
	popd & exit /b 1)
    del CardanoSL.zip
popd

@echo cardano-sl build-id:
type node_modules\daedalus-client-api\build-id
@echo cardano-sl commit-id:
type node_modules\daedalus-client-api\commit-id
@echo cardano-sl ci-url:
type node_modules\daedalus-client-api\ci-url

move   node_modules\daedalus-client-api\log-config-prod.yaml installers\log-config-prod.yaml
move   node_modules\daedalus-client-api\cardano-node.exe     installers\
move   node_modules\daedalus-client-api\cardano-launcher.exe installers\
move   node_modules\daedalus-client-api\configuration.yaml installers\
move   node_modules\daedalus-client-api\*genesis*.json installers\
del /f node_modules\daedalus-client-api\*.exe

:build_frontend
@echo Packaging frontend
call npm run package -- --icon installers/icons/64x64
@if %errorlevel% neq 0 (@echo FAILED: Failed to package the frontend
	exit /b 1)

pushd installers
    del /f LibreSSL.zip 2>nul
    @echo Obtaining LibreSSL %LIBRESSL_VERSION%
    ..\curl %LIBRESSL_URL% -o LibreSSL.zip
    @if %errorlevel% neq 0 (@echo FAILED: LibreSSL couldn't be obtained
	popd & exit /b 1)
    7z x LibreSSL.zip
    @if %errorlevel% neq 0 (@echo FAILED: LibreSSL couldn't be extracted from downloaded archive
	popd & exit /b 1)
    del LibreSSL.zip
    rmdir /s/q libressl
    move libressl-%LIBRESSL_VERSION%-windows libressl

    @echo Installing stack
    ..\curl --location http://www.stackage.org/stack/windows-x86_64 -o stack.zip
    @if %errorlevel% neq 0 (@echo FAILED: stack couldn't be obtained
	popd & exit /b 1)
    del /f stack.exe 2>nul
    7z x stack.zip stack.exe
    @if %errorlevel% neq 0 (@echo FAILED: couldn't extract stack from the distribution package
	exit /b 1)
    del stack.zip

    @echo Copying DLLs
    @rem TODO: get rocksdb from rocksdb-haskell
    rmdir /s/q DLLs 2>nul
    mkdir      DLLs
    pushd      DLLs
        ..\..\curl --location %DLLS_URL% -o DLLs.zip
        @if %errorlevel% neq 0 (@echo FAILED: couldn't obtain CardanoSL DLL package
		exit /b 1)
        7z x DLLs.zip
        @if %errorlevel% neq 0 (@echo FAILED: 7z x DLLs.zip
		popd & popd & exit /b 1)
        del DLLs.zip
    popd

    @echo Building the installer
    stack setup --no-reinstall > nul
    @if %errorlevel% neq 0 (@echo FAILED: stack setup --no-reinstall
	exit /b 1)

:build_installer
    call ..\scripts\appveyor-retry call stack --no-terminal build -j 2 --exec make-installer
    @if %errorlevel% equ 0 goto :built

    @echo FATAL: persistent failure while building installer with:  call stack --no-terminal build -j 2 --exec make-installer
    exit /b 1
:built
@echo SUCCESS: call stack --no-terminal build -j 2 --exec make-installer
popd

@dir /b/s installers\daedalus*

rem DEPENDENCIES:
rem   1. Node.js ('npm' binary in PATH)
rem   2. 7zip    ('7z'  binary in PATH)
rem
rem   installer dev mode:  set SKIP_TO_FRONTEND/SKIP_TO_INSTALLER

set MIN_CARDANO_BYTES=20000000
set LIBRESSL_VERSION=2.5.3
set CURL_VERSION=7.54.0
set CARDANO_BRANCH_DEFAULT=cardano-sl-1.0
set DAEDALUS_VERSION_DEFAULT=local-dev-build-%CARDANO_BRANCH_DEFAULT%

set DAEDALUS_VERSION=%1
@if [%DAEDALUS_VERSION%]==[] (@echo WARNING: DAEDALUS_VERSION [argument #1] was not provided, defaulting to %DAEDALUS_VERSION_DEFAULT%
    set DAEDALUS_VERSION=%DAEDALUS_VERSION_DEFAULT%);
set CARDANO_BRANCH=%2
@if [%CARDANO_BRANCH%]==[]   (@echo WARNING: CARDANO_BRANCH [argument #2] was not provided, defaulting to %CARDANO_BRANCH_DEFAULT%
    set CARDANO_BRANCH=%CARDANO_BRANCH_DEFAULT%);

set CURL_URL=https://bintray.com/artifact/download/vszakats/generic/curl-%CURL_VERSION%-win64-mingw.7z
set CURL_BIN=curl-%CURL_VERSION%-win64-mingw\bin
set NSISVER=3.02.1
set NSIS_URL=https://downloads.sourceforge.net/project/nsis/NSIS%%203/%NSISVER%/nsis-%NSISVER%-setup.exe
set NSIS_PATCH_URL=https://downloads.sourceforge.net/project/nsis/NSIS%%203/%NSISVER%/nsis-%NSISVER%-strlen_8192.zip
set CARDANO_URL=https://ci.appveyor.com/api/projects/input-output/cardano-sl/artifacts/CardanoSL.zip?branch=%CARDANO_BRANCH%
set LIBRESSL_URL=https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-%LIBRESSL_VERSION%-windows.zip
set DLLS_URL=https://s3.eu-central-1.amazonaws.com/daedalus-ci-binaries/DLLs.zip

@echo Building Daedalus version:  %DAEDALUS_VERSION%
@echo ..with Cardano branch:      %CARDANO_BRANCH%
@echo ..with LibreSSL version:    %LIBRESSL_VERSION%
@echo .

@if not [%SKIP_TO_INSTALLER%]==[] (@echo WARNING: SKIP_TO_INSTALLER set, skipping to frontend packaging
    pushd installers & goto :build_installer)
@if not [%SKIP_TO_FRONTEND%]==[]   (@echo WARNING: SKIP_TO_FRONTEND set, skipping directly to installer rebuild
    pushd installers & goto :build_frontend)

@echo Obtaining curl
powershell -Command "try { Import-Module BitsTransfer; Start-BitsTransfer -Source '%CURL_URL%' -Destination 'curl.7z'; } catch { exit 1; }"
@if %errorlevel% neq 0 (@echo FAILED: couldn't obtain curl from %CURL_URL% using BITS
	popd & exit /b 1)
del /f curl.exe curl-ca-bundle.crt libcurl.dll
7z e curl.7z %CURL_BIN%\curl.exe %CURL_BIN%\curl-ca-bundle.crt %CURL_BIN%\libcurl.dll
@if %errorlevel% neq 0 (@echo FAILED: couldn't extract curl from downloaded archive
	popd & exit /b 1)

@echo Obtaining NSIS %NSISVER% with 8k-string patch
del /f nsis-setup.exe nsis-strlen_8192.zip
curl -o nsis-setup.exe       --location %NSIS_URL%
@if %errorlevel% neq 0 (@echo FAILED: curl -o nsis-setup.exe       --location %NSIS_URL%
    exit /b 1)

curl -o nsis-strlen_8192.zip --location %NSIS_PATCH_URL%
@if %errorlevel% neq 0 (@echo FAILED: curl -o nsis-strlen_8192.zip --location %NSIS_PATCH_URL%
    exit /b 1)

nsis-setup.exe /S /SD
@if %errorlevel% neq 0 (@echo FAILED: nsis-setup.exe /S /SD
    exit /b 1)

7z    x nsis-strlen_8192.zip -o"c:\Program Files (x86)\NSIS" -aoa -r
@if %errorlevel% neq 0 (@echo FAILED: 7z    x nsis-strlen_8192.zip -o"c:\Program Files (x86)\NSIS" -aoa -r
    exit /b 1)

@echo Installing NPM
call npm install
@if %errorlevel% neq 0 (@echo FAILED: npm install
    exit /b 1)

@echo Obtaining Cardano from branch %CARDANO_BRANCH%
rmdir /s/q node_modules\daedalus-client-api 2>nul
mkdir      node_modules\daedalus-client-api

pushd node_modules\daedalus-client-api
    del /f CardanoSL.zip 2>nul
    ..\..\curl --location %CARDANO_URL% -o CardanoSL.zip
    @if %errorlevel% neq 0 (@echo FAILED: couldn't obtain the cardano-sl package
	popd & exit /b 1)
    @for /F "usebackq" %%A in ('CardanoSL.zip') do set size=%%~zA
    if %size% lss %MIN_CARDANO_BYTES% (@echo FAILED: CardanoSL.zip is too small: threshold=%MIN_CARDANO_BYTES%, actual=%size% bytes
        popd & exit /b 1)

    7z x CardanoSL.zip -y
    @if %errorlevel% neq 0 (@echo FAILED: 7z x CardanoSL.zip -y
	popd & exit /b 1)
    del CardanoSL.zip
popd

@echo cardano-sl build-id:
type node_modules\daedalus-client-api\build-id
@echo cardano-sl commit-id:
type node_modules\daedalus-client-api\commit-id
@echo cardano-sl ci-url:
type node_modules\daedalus-client-api\ci-url

move   node_modules\daedalus-client-api\log-config-prod.yaml installers\log-config-prod.yaml
move   node_modules\daedalus-client-api\cardano-node.exe     installers\
move   node_modules\daedalus-client-api\cardano-launcher.exe installers\
move   node_modules\daedalus-client-api\configuration.yaml installers\
move   node_modules\daedalus-client-api\*genesis*.json installers\
del /f node_modules\daedalus-client-api\*.exe

:build_frontend
@echo Packaging frontend
call npm run package -- --icon installers/icons/64x64
@if %errorlevel% neq 0 (@echo FAILED: Failed to package the frontend
	exit /b 1)

pushd installers
    del /f LibreSSL.zip 2>nul
    @echo Obtaining LibreSSL %LIBRESSL_VERSION%
    ..\curl %LIBRESSL_URL% -o LibreSSL.zip
    @if %errorlevel% neq 0 (@echo FAILED: LibreSSL couldn't be obtained
	popd & exit /b 1)
    7z x LibreSSL.zip
    @if %errorlevel% neq 0 (@echo FAILED: LibreSSL couldn't be extracted from downloaded archive
	popd & exit /b 1)
    del LibreSSL.zip
    rmdir /s/q libressl
    move libressl-%LIBRESSL_VERSION%-windows libressl

    @echo Installing stack
    ..\curl --location http://www.stackage.org/stack/windows-x86_64 -o stack.zip
    @if %errorlevel% neq 0 (@echo FAILED: stack couldn't be obtained
	popd & exit /b 1)
    del /f stack.exe 2>nul
    7z x stack.zip stack.exe
    @if %errorlevel% neq 0 (@echo FAILED: couldn't extract stack from the distribution package
	exit /b 1)
    del stack.zip

    @echo Copying DLLs
    @rem TODO: get rocksdb from rocksdb-haskell
    rmdir /s/q DLLs 2>nul
    mkdir      DLLs
    pushd      DLLs
        ..\..\curl --location %DLLS_URL% -o DLLs.zip
        @if %errorlevel% neq 0 (@echo FAILED: couldn't obtain CardanoSL DLL package
		exit /b 1)
        7z x DLLs.zip
        @if %errorlevel% neq 0 (@echo FAILED: 7z x DLLs.zip
		popd & popd & exit /b 1)
        del DLLs.zip
    popd

    @echo Building the installer
    stack setup --no-reinstall > nul
    @if %errorlevel% neq 0 (@echo FAILED: stack setup --no-reinstall
	exit /b 1)

:build_installer
    call ..\scripts\appveyor-retry call stack --no-terminal build -j 2 --exec make-installer
    @if %errorlevel% equ 0 goto :built

    @echo FATAL: persistent failure while building installer with:  call stack --no-terminal build -j 2 --exec make-installer
    exit /b 1
:built
@echo SUCCESS: call stack --no-terminal build -j 2 --exec make-installer
popd

@dir /b/s installers\daedalus*

Rename appveyor account

[DEVOPS-679] Rename appveyor account


@echo off

setlocal
pushd %~dp0%

if errorlevel 1 (
  endlocal
  exit /b %errorlevel%
)

REM see https://github.com/fsprojects/Paket/issues/3065#issuecomment-367829309
powershell -Command {new-itemproperty -path "HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319" -name "SchUseStrongCrypto" -Value 1 -PropertyType "DWord";}
powershell -Command {new-itemproperty -path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319" -name "SchUseStrongCrypto" -Value 1 -PropertyType "DWord"}

.paket\paket.exe restore
if errorlevel 1 (
  endlocal
  exit /b %errorlevel%
)

packages\FAKE\tools\FAKE.exe build.fsx %*
if errorlevel 1 (
  endlocal
  exit /b %errorlevel%
)
endlocal
exit /b 0

@echo off

setlocal
pushd %~dp0%

if errorlevel 1 (
  endlocal
  exit /b %errorlevel%
)

REM see https://github.com/fsprojects/Paket/issues/3065#issuecomment-367829309
REM powershell -Command {new-itemproperty -path "HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319" -name "SchUseStrongCrypto" -Value 1 -PropertyType "DWord";}
REM powershell -Command {new-itemproperty -path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319" -name "SchUseStrongCrypto" -Value 1 -PropertyType "DWord"}

.paket\paket.exe restore
if errorlevel 1 (
  endlocal
  exit /b %errorlevel%
)

packages\FAKE\tools\FAKE.exe build.fsx %*
if errorlevel 1 (
  endlocal
  exit /b %errorlevel%
)
endlocal
exit /b 0

undo workaround for failing paket bootstrapper


REM this will install all of the dependencies used by chartpy, findatapy and finmarketpy (other than the actual libraries themselves)
pip install numpy, pandas, pytz, request, multiprocessing_on_dill, pandas_datareader, quandl, redis, openpxyl, blosc, bokeh, plotly, cufflinks, matplotlib, git+https://github.com/manahl/arctic.git
pip install git+https://github.com/cuemacro/chartpy.git
pip install git+https://github.com/cuemacro/findatapy.git
pip install git+https://github.com/cuemacro/finmarketpy.git

Install packages bat

Install packages bat


@echo ==== STARTING ====
@echo.

@IF EXIST .\dist\ (
    @echo ^=^=^> Remove dist folder:
    @RMDIR /S .\dist
)
@REM ) ELSE (
@REM )

@echo.
@echo ^=^=^> Building app:
@call npm run build

@echo.
@echo ^=^=^> Copying not scanned files:
XCOPY /v .\CNAME .\dist
XCOPY /v .\LICENSE .\dist
XCOPY /v .\README.md .\dist
XCOPY /v .\Makefile .\dist
XCOPY /v .\deploy.bat .\dist

@echo.
@echo ^=^=^> Checkout master branch:
@call git checkout master

@echo.
@echo ^=^=^> Apply dist and clean unwanted files and folders:
@RMDIR /S /Q .\css
@RMDIR /S /Q .\img
@RMDIR /S /Q .\js
@RMDIR /S /Q .\precache-manifest.*
XCOPY /s /v /h /y .\dist\* .\
@RMDIR /S /Q .\dist

@echo.
@echo ^=^=^> Commit changes to master:
@call git add .
@call git commit -m ":rocket: deploy website"
@call git push origin master

@echo.
@echo ^=^=^> Go back to develop:
@call git checkout develop

@echo ==== STARTING ====
@echo.

@IF EXIST .\dist\ (
    @echo ^=^=^> Remove dist folder:
    @RMDIR /S .\dist
)
@REM ) ELSE (
@REM )

@echo.
@echo ^=^=^> Building app:
@call npm run build

@echo.
@echo ^=^=^> Copying not scanned files:
XCOPY /v .\CNAME .\dist
XCOPY /v .\LICENSE .\dist
XCOPY /v .\README.md .\dist
XCOPY /v .\Makefile .\dist
XCOPY /v .\deploy.bat .\dist

@echo.
@echo ^=^=^> Checkout master branch:
@call git checkout master

@echo.
@echo ^=^=^> Apply dist and clean unwanted files and folders:
@RMDIR /S /Q .\css
@RMDIR /S /Q .\img
@RMDIR /S /Q .\js
@del /S /Q .\precache-manifest*.*
XCOPY /s /v /h /y .\dist\* .\
@RMDIR /S /Q .\dist

@echo.
@echo ^=^=^> Commit changes to master:
@call git add .
@call git commit -m ":rocket: deploy website"
@call git push origin master

@echo.
@echo ^=^=^> Go back to develop:
@call git checkout develop

update deploy batch

update deploy batch


@echo off
@cd /d "%~dp0"

echo info: Setup MSBuild environment
call "%VS140COMNTOOLS%VsMSBuildCmd.bat"

echo info: Build Itc4net
msbuild.exe ".\src\Itc4net.sln" /p:Configuration=Release /t:Rebuild
if ERRORLEVEL 1 (
    echo error: Failed to build Itc4net
    goto EXIT
)

echo info: Pack NuGet nuspec
for /f %%a IN ('dir /b *.nuspec') do (
	nuget pack "%%a"
)

echo info: Push NuGet nupkg
set /p APIKEY="Enter NuGet ApiKey:"
for /f %%b IN ('dir /b *.nupkg') do (
	nuget push "%%b" -ApiKey %APIKEY% -Source https://www.nuget.org/api/v2/package
)

mkdir .\build
move /y *.nupkg .\build

:EXIT
pause

@echo off
@cd /d "%~dp0"

echo info: Setup MSBuild environment
set VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools
call "%VS150COMNTOOLS%\VsMSBuildCmd.bat"

echo info: Build Itc4net
msbuild.exe ".\src\Itc4net.sln" /p:Configuration=Release /t:Rebuild
if ERRORLEVEL 1 (
    echo error: Failed to build Itc4net
    goto EXIT
)

echo info: Pack NuGet nuspec
for /f %%a IN ('dir /b *.nuspec') do (
	nuget pack "%%a"
)

echo info: Push NuGet nupkg
set /p APIKEY="Enter NuGet ApiKey:"
for /f %%b IN ('dir /b *.nupkg') do (
	nuget push "%%b" -ApiKey %APIKEY% -Source https://www.nuget.org/api/v2/package
)

mkdir .\build
move /y *.nupkg .\build

:EXIT
pause

Fix deploy script for VS2017

Fix deploy script for VS2017

VS150COMNTOOLS is not defined by VS2017 installer and it looks like this is intentional. So, we define it in the deploy script. The script only works with the "community edition", but should be easy to adapt to "professional" and "enterprise" editions.


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

:: ----------------------
:: KUDU Deployment Script
:: Version: 0.2.2
:: ----------------------

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
goto Deployment

:: Utility Functions
:: -----------------

:SelectNodeVersion

IF DEFINED KUDU_SELECT_NODE_VERSION_CMD (
  :: The following are done only on Windows Azure Websites environment
  call %KUDU_SELECT_NODE_VERSION_CMD% "%DEPLOYMENT_SOURCE%" "%DEPLOYMENT_TARGET%" "%DEPLOYMENT_TEMP%"
  IF !ERRORLEVEL! NEQ 0 goto error

  IF EXIST "%DEPLOYMENT_TEMP%\__nodeVersion.tmp" (
    SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF EXIST "%DEPLOYMENT_TEMP%\__npmVersion.tmp" (
    SET /p NPM_JS_PATH=<"%DEPLOYMENT_TEMP%\__npmVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

  SET NPM_CMD="!NODE_EXE!" "!NPM_JS_PATH!"
) ELSE (
  SET NPM_CMD=npm
  SET NODE_EXE=node
)

goto :EOF

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------

:Deployment
echo Handling node.js deployment.

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

:: 2. Select node version
call :SelectNodeVersion

:: 3. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd !NPM_CMD! install --production
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: Post deployment stub
IF DEFINED POST_DEPLOYMENT_ACTION call "%POST_DEPLOYMENT_ACTION%"
IF !ERRORLEVEL! NEQ 0 goto error

goto end

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

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

:: ----------------------
:: KUDU Deployment Script
:: Version: 0.2.2
:: ----------------------

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
goto Deployment

:: Utility Functions
:: -----------------

:SelectNodeVersion

IF DEFINED KUDU_SELECT_NODE_VERSION_CMD (
  :: The following are done only on Windows Azure Websites environment
  call %KUDU_SELECT_NODE_VERSION_CMD% "%DEPLOYMENT_SOURCE%" "%DEPLOYMENT_TARGET%" "%DEPLOYMENT_TEMP%"
  IF !ERRORLEVEL! NEQ 0 goto error

  IF EXIST "%DEPLOYMENT_TEMP%\__nodeVersion.tmp" (
    SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF EXIST "%DEPLOYMENT_TEMP%\__npmVersion.tmp" (
    SET /p NPM_JS_PATH=<"%DEPLOYMENT_TEMP%\__npmVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

  SET NPM_CMD="!NODE_EXE!" "!NPM_JS_PATH!"
) ELSE (
  SET NPM_CMD=npm
  SET NODE_EXE=node
)

goto :EOF

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------

:Deployment
echo Handling node.js deployment.

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

echo 2. Select node version
call :SelectNodeVersion

echo 3. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd !NPM_CMD! install --production
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

echo 4. Install bower packages
IF EXIST "bower.json" (
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd bower install
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

echo 5. Gulp build
IF EXIST "gulpfile.js (
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd grunt build
  call :ExecuteCmd grunt
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: Post deployment stub
IF DEFINED POST_DEPLOYMENT_ACTION call "%POST_DEPLOYMENT_ACTION%"
IF !ERRORLEVEL! NEQ 0 goto error

goto end

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

fix kudu

fix kudu


@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 ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM     e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------

@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%

@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")

@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre

@setlocal

set ERROR_CODE=0

@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal

@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome

echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init

echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

@REM ==== END VALIDATION ====

:init

set MAVEN_CMD_LINE_ARGS=%MAVEN_CONFIG% %*

@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.

set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir

set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir

:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir

:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"

:endDetectBaseDir

IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig

@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%

:endReadAdditionalConfig

SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"

set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar""
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

# avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in %*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end

:error
set ERROR_CODE=1

:end
@endlocal & set ERROR_CODE=%ERROR_CODE%

if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost

@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause

if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%

exit /B %ERROR_CODE%

@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 ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM     e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------

@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%

@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")

@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre

@setlocal

set ERROR_CODE=0

@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal

@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome

echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init

echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

@REM ==== END VALIDATION ====

:init

set MAVEN_CMD_LINE_ARGS=%MAVEN_CONFIG% %*

@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.

set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir

set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir

:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir

:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"

:endDetectBaseDir

IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig

@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%

:endReadAdditionalConfig

SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"

set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar""
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

@REM avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in %*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end

:error
set ERROR_CODE=1

:end
@endlocal & set ERROR_CODE=%ERROR_CODE%

if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost

@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause

if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%

exit /B %ERROR_CODE%

use @REM instead of # (#27)

use @REM instead of # (#27)

using # in .cmd files as comment issues the following error: `Der Befehl "#" ist entweder falsch geschrieben oder konnte nicht gefunden werden.` aka command not found