@echo off
setlocal

if not defined VisualStudioVersion (
    if defined VS140COMNTOOLS (
        call "%VS140COMNTOOLS%\VsDevCmd.bat"
        goto :EnvSet
    )

    echo Error: build.cmd requires Visual Studio 2015.
    exit /b -1
)
:EnvSet

set _DeviceId=
set _Platform=
set _SdkRoot=%ProgramFiles(x86)%\Android\android-sdk
set _NdkRoot=%ProgramData%\Microsoft\AndroidNDK\android-ndk-r10e
set _Verbose=
set _TestsToRun=

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

call :SetProjectRoot %~dp0..\..\

set _GlassPackageName=Microsoft.VisualStudio.Glass
set _GlassPackageVersion=1.0.0

set _GlassDir=%_ProjectRoot%%_GlassPackageName%\

:: Get Glass from NuGet
if NOT exist "%_GlassDir%glass2.exe" echo Getting Glass from NuGet.& call "%_ProjectRoot%tools\NuGet\nuget.exe" install %_GlassPackageName% -Version %_GlassPackageVersion% -ExcludeVersion -OutputDirectory %_ProjectRoot%
if NOT "%ERRORLEVEL%"=="0" echo ERROR: Failed to get Glass from NuGet.& exit /b -1

:: Ensure the project has been built
if NOT exist "%_GlassDir%Microsoft.MIDebugEngine.dll" echo The project has not been built. Building now with default settings.& call %_ProjectRoot%build.cmd
if NOT "%ERRORLEVEL%"=="0" echo ERROR: Failed to build MIEngine project.& exit /b -1

:: Copy libadb.dll to the glass directory
xcopy /Y /D "%VSINSTALLDIR%Common7\IDE\PrivateAssemblies\libadb.dll" "%_GlassDir%"
if not "%ERRORLEVEL%"=="0" echo ERROR: Unable to copy libadb.dll from Visual Studio installation.& exit /b -1

call :EnsureGlassRegisterd
if not "%ERRORLEVEL%"=="0" exit /b -1

call :EnsureLaunchOptionsGenBuilt

:ArgLoopStart
if "%~1"=="" goto ArgLoopEnd
if /i "%~1"=="/DeviceId"    goto SetDeviceId
if /i "%~1"=="/Platform"    goto SetPlatform
if /i "%~1"=="/SdkRoot"     goto SetSdkRoot
if /i "%~1"=="/NdkRoot"     goto SetNdkRoot
if /i "%~1"=="/v"           set _Verbose=1& goto NextArg
if /i "%~1"=="/Tests"       goto SetTests
echo ERROR: Unknown argument '%~1'.&exit /b -1

:NextArg
shift
goto ArgLoopStart

:SetDeviceId
shift
set _DeviceId=%~1
goto :NextArg

:SetPlatform
shift
set _Platform=%~1&
goto :NextArg

:SetSdkRoot
shift
set _SdkRoot=%~1
goto :NextArg

:SetNdkRoot
shift
set _NdkRoot=%~1
goto :NextArg

:SetTests
shift
if "%~1"=="" goto SetTestsDone
set _TestsToRun="%~1" %_TestsToRun%
goto SetTests
:SetTestsDone
goto ArgLoopEnd

:ArgLoopEnd

if NOT exist "%_SdkRoot%" echo ERROR: Android SDK does not exist at "%_SdkRoot%".& exit /b -1
if NOT exist "%_NdkRoot%" echo ERROR: Android NDK does not exist at "%_NdkRoot%".& exit /b -1

if "%_DeviceId%"=="" echo ERROR: DeviceId must be specified. Possible devices are:& "%_AdbExe%" devices &goto Help
if "%_Platform%"=="" echo ERROR: Platform must be specified.& goto Help

set _GlassFlags=-f TestScript.xml -e ErrorLog.xml -s SessionLog.xml -err -nodefaultsetup -nodvt
if not "%_Verbose%"=="1" set _GlassFlags=%_GlassFlags% -q

set _GlassLog=
if NOT "%_Verbose%"=="1" set _GlassLog=^> glass.log

if "%_Verbose%"=="1" (
    echo DeviceId:    %_DeviceId%
    echo Platform:    %_Platform%
    echo SdkRoot:     "%_SdkRoot%"
    echo NdkRoot:     "%_NdkRoot%"
    echo Tests:       %_TestsToRun%
    echo Glass Flags: %_GlassFlags%
)

if "%_TestsToRun%"=="" goto RunAll
goto RunArgs

:RunAll
    set FAILED_TESTS=

    pushd %~dp0\

    for /d %%t in (*) do if exist "%%t\TestScript.xml" call :RunSingleTest "%%t"
    goto ReportResults

:RunArgs
    set FAILED_TESTS=

    pushd %~dp0
    for %%t in (%_TestsToRun%) do call :ValidateArg %%t
    if NOT "%FAILED_TESTS%"=="" exit /b -1
    for %%t in (%_TestsToRun%) do call :RunSingleTest %%t
    goto ReportResults

:ReportResults
    echo ----------------------------------------
    if NOT "%FAILED_TESTS%"=="" goto ReportFailure
    goto ReportSuccess

:ReportFailure
    echo ERROR: Failures detected 'AndroidTest.cmd /DeviceId %_DeviceId% /Platform %_Platform% /Tests %FAILED_TESTS%' to rerun.
    echo.
    exit /b -1

:ReportSuccess
    echo All tests completed succesfully.
    echo.
    exit /b 0

:ValidateArg
    if not exist "%~1" echo ERROR: Test '%~1' does not exist.& set FAILED_TESTS="%~1" %FAILED_TESTS%& exit /b 0
    if not exist "%~1\TestScript.xml" echo ERROR: Test '%~1' does not have a TestScript.xml file.& set FAILED_TESTS="%~1" %FAILED_TESTS%& exit /b 0
    exit /b 0

:RunSingleTest
    pushd "%~1"
    echo Running '%~1'

    ::Build the app
    call msbuild /p:Platform=%_Platform%;VS_NDKRoot="%_NdkRoot%";VS_SDKRoot="%_SdkRoot%";PackageDebugSymbols=true > build.log
    if NOT "%ERRORLEVEL%"=="0" echo ERROR: Failed to build %~1. See build.log for more information.& set FAILED_TESTS="%~1" "%FAILED_TESTS%"& goto RunSingleTestDone

    ::Deploy the app
    call "%_SdkRoot%\platform-tools\adb.exe" -s %_DeviceId% install -r %_Platform%\Debug\%~1.apk > adb.log
    if NOT "%ERRORLEVEL%"=="0" echo ERROR: adb failed for one reason or another.& set FAILED_TESTS="%~1" "%FAILED_TESTS%"& goto RunSingleTestDone

    ::Create temp directory
    if not exist temp mkdir temp

    ::Generate the LaunchOptions
    call %_GlassDir%LaunchOptionsGen.exe LaunchOptions.xml.template "SdkRoot=%_SdkRoot%\ " "NdkRoot=%_NdkRoot%\ " "TargetArchitecture=%_Platform%" "IntermediateDirectory=%~dp1temp\ " "AdditionalSOLibSearchPath=%~dp1%_Platform%\Debug\ " "DeviceId=%_DeviceId%"

    ::Run Glass
    call "%_GlassDir%glass2.exe" %_GlassFlags% %_GlassLog%
    if NOT "%ERRORLEVEL%"=="0" echo ERROR: Test failed. See ErrorLog.xml for more information.& set FAILED_TESTS="%~1" %FAILED_TESTS%

    :RunSingleTestDone
    popd
    exit /b 0

::These are functions called at the beginning

:EnsureGlassRegisterd
REM Check if the key exists. If not, we need to register glass.
reg query HKLM\SOFTWARE\Microsoft\glass\14.0 /v InstallDir /reg:32 1>NUL 2>NUL
if NOT "%ERRORLEVEL%"=="0" goto :RegisterGlass

REM Check if glass is currently registered at a differnt location
set CurrentGlassRegRoot=
for /f "tokens=3* skip=2" %%a in ('reg query HKLM\SOFTWARE\Microsoft\glass\14.0 /v InstallDir /reg:32') do call :SetCurrentGlassRegRoot %%a %%b %%c %%d %%e
if /i "%CurrentGlassRegRoot%"=="%_GlassDir%" goto EOF

:RegisterGlass
echo Running RegisterGlass.cmd...
call "%_GlassDir%RegisterGlass.cmd"
if NOT "%ERRORLEVEL%"=="0" echo ERROR: Unable to register glass. Ensure that this command prompt is elevated.& goto :EOF
call "%~dp0..\RegisterMIEngine.cmd"
if NOT "%ERRORLEVEL%"=="0" echo ERROR: Unable to register MIEngine.& goto :EOF
set ERRORLEVEL=0
goto EOF

:SetCurrentGlassRegRoot
REM %1 contains the glass install root. Unfortunately, if the path to the has spaces in it,
REM these will get broken up with each chunk in a different token. Lets try to put these tokens
REM back together.
set CurrentGlassRegRoot=%1
if "%2"=="%%b" goto EOF
if "%2"=="" goto EOF
if "%2"=="d" goto EOF
set CurrentGlassRegRoot=%1 %2
if "%3"=="%%c" goto EOF
if "%3"=="" goto EOF
if "%3"=="e" goto EOF
set CurrentGlassRegRoot=%1 %2 %3
if "%4"=="%%d" goto EOF
if "%4"=="" goto EOF
set CurrentGlassRegRoot=%1 %2 %3 %4
if "%5"=="%%e" goto EOF
if "%5"=="" goto EOF
set CurrentGlassRegRoot=%1 %2 %3 %4 %5
goto EOF

:EnsureLaunchOptionsGenBuilt
if not exist %_GlassDir%LaunchOptionsGen.exe echo Building LaunchOptionsGen.exe& msbuild /p:Configuration=Release;OutDir=%_GlassDir% /v:quiet %~dp0..\LaunchOptionsGen\LaunchOptionsGen.csproj
exit /b 0

:SetProjectRoot
set _ProjectRoot=%~f1
goto EOF

:Help
echo --- MIEngine Android Test Script ---
echo Usage: androidtest.cmd /DeviceId ^<id^> /Platform ^<platform^> [/SdkRoot ^<path^>] [/NdkRoot ^<path^>] [/v] [/Tests ^<test 1^> [^<test 2^> [...]]]
echo.
echo --- Examples ---
echo Run All Tests:
echo androidtest.cmd /DeviceId 169.254.138.123:5555 /Platform x86
echo.
echo Run two specific tests:
echo androidtest.cmd /DeviceId 169.254.138.123:5555 /Platform x86 /Tests Stepping Exceptions
echo.

if exist "%_SdkRoot%" "%_SdkRoot%\platform-tools\adb.exe" devices -l

:EOF

@echo off
setlocal

if not defined VisualStudioVersion (
    if defined VS140COMNTOOLS (
        call "%VS140COMNTOOLS%\VsDevCmd.bat"
        goto :EnvSet
    )

    echo Error: build.cmd requires Visual Studio 2015.
    exit /b -1
)
:EnvSet

set _DeviceId=
set _Platform=
set _SdkRoot=%ProgramFiles(x86)%\Android\android-sdk
set _NdkRoot=%ProgramData%\Microsoft\AndroidNDK\android-ndk-r10e
set _LoopCount=
set _Verbose=
set _TestsToRun=

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

call :SetProjectRoot %~dp0..\..\

set _GlassPackageName=Microsoft.VisualStudio.Glass
set _GlassPackageVersion=1.0.0

set _GlassDir=%_ProjectRoot%%_GlassPackageName%\

:: Get Glass from NuGet
if NOT exist "%_GlassDir%glass2.exe" echo Getting Glass from NuGet.& call "%_ProjectRoot%tools\NuGet\nuget.exe" install %_GlassPackageName% -Version %_GlassPackageVersion% -ExcludeVersion -OutputDirectory %_ProjectRoot%
if NOT "%ERRORLEVEL%"=="0" echo ERROR: Failed to get Glass from NuGet.& exit /b -1

:: Ensure the project has been built
if NOT exist "%_GlassDir%Microsoft.MIDebugEngine.dll" echo The project has not been built. Building now with default settings.& call %_ProjectRoot%build.cmd
if NOT "%ERRORLEVEL%"=="0" echo ERROR: Failed to build MIEngine project.& exit /b -1

:: Copy libadb.dll to the glass directory
xcopy /Y /D "%VSINSTALLDIR%Common7\IDE\PrivateAssemblies\libadb.dll" "%_GlassDir%"
if not "%ERRORLEVEL%"=="0" echo ERROR: Unable to copy libadb.dll from Visual Studio installation.& exit /b -1

call :EnsureGlassRegisterd
if not "%ERRORLEVEL%"=="0" exit /b -1

call :EnsureLaunchOptionsGenBuilt

:ArgLoopStart
if "%~1"=="" goto ArgLoopEnd
if /i "%~1"=="/DeviceId"    goto SetDeviceId
if /i "%~1"=="/Platform"    goto SetPlatform
if /i "%~1"=="/SdkRoot"     goto SetSdkRoot
if /i "%~1"=="/NdkRoot"     goto SetNdkRoot
if /i "%~1"=="/v"           set _Verbose=1& goto NextArg
if /i "%~1"=="/Loop"        goto SetLoop
if /i "%~1"=="/Tests"       goto SetTests
echo ERROR: Unknown argument '%~1'.&exit /b -1

:NextArg
shift
goto ArgLoopStart

:SetDeviceId
shift
set _DeviceId=%~1
goto :NextArg

:SetPlatform
shift
set _Platform=%~1&
goto :NextArg

:SetSdkRoot
shift
set _SdkRoot=%~1
goto :NextArg

:SetNdkRoot
shift
set _NdkRoot=%~1
goto :NextArg

:SetLoop
shift
set _LoopCount=%~1
goto :NextArg

:SetTests
shift
if "%~1"=="" goto SetTestsDone
set _TestsToRun="%~1" %_TestsToRun%
goto SetTests
:SetTestsDone
goto ArgLoopEnd

:ArgLoopEnd

if NOT exist "%_SdkRoot%" echo ERROR: Android SDK does not exist at "%_SdkRoot%".& exit /b -1
if NOT exist "%_NdkRoot%" echo ERROR: Android NDK does not exist at "%_NdkRoot%".& exit /b -1

if "%_DeviceId%"=="" echo ERROR: DeviceId must be specified. Possible devices are:& "%_AdbExe%" devices &goto Help
if "%_Platform%"=="" echo ERROR: Platform must be specified.& goto Help

set _GlassFlags=-f TestScript.xml -e ErrorLog.xml -s SessionLog.xml -err -nodefaultsetup -nodvt
if not "%_Verbose%"=="1" set _GlassFlags=%_GlassFlags% -q

set _GlassLog=
if NOT "%_Verbose%"=="1" set _GlassLog=^> glass.log

if "%_Verbose%"=="1" (
    echo DeviceId:    %_DeviceId%
    echo Platform:    %_Platform%
    echo SdkRoot:     "%_SdkRoot%"
    echo NdkRoot:     "%_NdkRoot%"
    echo Tests:       %_TestsToRun%
    echo Glass Flags: %_GlassFlags%
)

if "%_TestsToRun%"=="" goto RunAll
goto RunArgs

:RunAll
    set FAILED_TESTS=

    pushd %~dp0\
    for /d %%t in (*) do if exist "%%t\TestScript.xml" call :RunSingleTest "%%t"
    goto ReportResults

:RunArgs
    set FAILED_TESTS=

    pushd %~dp0
    for %%t in (%_TestsToRun%) do call :ValidateArg %%t
    if NOT "%FAILED_TESTS%"=="" exit /b -1
    for %%t in (%_TestsToRun%) do call :RunSingleTest %%t
    goto ReportResults

:ReportResults
    echo ----------------------------------------
    if NOT "%FAILED_TESTS%"=="" goto ReportFailure
    goto ReportSuccess

:ReportFailure
    echo ERROR: Failures detected 'AndroidTest.cmd /DeviceId %_DeviceId% /Platform %_Platform% /Tests %FAILED_TESTS%' to rerun.
    echo.
    exit /b -1

:ReportSuccess
    echo All tests completed succesfully.
    echo.
    exit /b 0

:ValidateArg
    if not exist "%~1" echo ERROR: Test '%~1' does not exist.& set FAILED_TESTS="%~1" %FAILED_TESTS%& exit /b 0
    if not exist "%~1\TestScript.xml" echo ERROR: Test '%~1' does not have a TestScript.xml file.& set FAILED_TESTS="%~1" %FAILED_TESTS%& exit /b 0
    exit /b 0

:RunSingleTest
    if "%_LoopCount%"=="" goto RunSingleTestOnce
    set _ContinueRunningTests=true
    FOR /L %%l IN (1,1,%_LoopCount%) DO call :RunSingleTestInLoop %*
    goto EOF

:RunSingleTestInLoop
    if NOT "%_ContinueRunningTests%"=="true" goto EOF
    call :RunSingleTestOnce %*
    if NOT "%LastTestSucceeded%"=="true" set _ContinueRunningTests=false
    goto EOF

:RunSingleTestOnce
    pushd "%~1"
    echo Running '%~1'
    set LastTestSucceeded=false

    ::Build the app
    call msbuild /p:Platform=%_Platform%;VS_NDKRoot="%_NdkRoot%";VS_SDKRoot="%_SdkRoot%";PackageDebugSymbols=true > build.log
    if NOT "%ERRORLEVEL%"=="0" echo ERROR: Failed to build %~1. See build.log for more information.& set FAILED_TESTS="%~1" "%FAILED_TESTS%"& goto RunSingleTestDone

    ::Deploy the app
    call "%_SdkRoot%\platform-tools\adb.exe" -s %_DeviceId% install -r %_Platform%\Debug\%~1.apk > adb.log
    if NOT "%ERRORLEVEL%"=="0" echo ERROR: adb failed for one reason or another.& set FAILED_TESTS="%~1" "%FAILED_TESTS%"& goto RunSingleTestDone

    ::Create temp directory
    if not exist temp mkdir temp

    ::Generate the LaunchOptions
    call %_GlassDir%LaunchOptionsGen.exe LaunchOptions.xml.template "SdkRoot=%_SdkRoot%\ " "NdkRoot=%_NdkRoot%\ " "TargetArchitecture=%_Platform%" "IntermediateDirectory=%~dp1temp\ " "AdditionalSOLibSearchPath=%~dp1%_Platform%\Debug\ " "DeviceId=%_DeviceId%"

    ::Run Glass
    call "%_GlassDir%glass2.exe" %_GlassFlags% %_GlassLog%
    if NOT "%ERRORLEVEL%"=="0" echo ERROR: Test failed. See ErrorLog.xml for more information.& set FAILED_TESTS="%~1" %FAILED_TESTS%& goto RunSingleTestDone

    set LastTestSucceeded=true

    :RunSingleTestDone
    popd
    exit /b 0

::These are functions called at the beginning

:EnsureGlassRegisterd
REM Check if the key exists. If not, we need to register glass.
reg query HKLM\SOFTWARE\Microsoft\glass\14.0 /v InstallDir /reg:32 1>NUL 2>NUL
if NOT "%ERRORLEVEL%"=="0" goto :RegisterGlass

REM Check if glass is currently registered at a differnt location
set CurrentGlassRegRoot=
for /f "tokens=3* skip=2" %%a in ('reg query HKLM\SOFTWARE\Microsoft\glass\14.0 /v InstallDir /reg:32') do call :SetCurrentGlassRegRoot %%a %%b %%c %%d %%e
if /i "%CurrentGlassRegRoot%"=="%_GlassDir%" goto EOF

:RegisterGlass
echo Running RegisterGlass.cmd...
call "%_GlassDir%RegisterGlass.cmd"
if NOT "%ERRORLEVEL%"=="0" echo ERROR: Unable to register glass. Ensure that this command prompt is elevated.& goto :EOF
call "%~dp0..\RegisterMIEngine.cmd"
if NOT "%ERRORLEVEL%"=="0" echo ERROR: Unable to register MIEngine.& goto :EOF
set ERRORLEVEL=0
goto EOF

:SetCurrentGlassRegRoot
REM %1 contains the glass install root. Unfortunately, if the path to the has spaces in it,
REM these will get broken up with each chunk in a different token. Lets try to put these tokens
REM back together.
set CurrentGlassRegRoot=%1
if "%2"=="%%b" goto EOF
if "%2"=="" goto EOF
if "%2"=="d" goto EOF
set CurrentGlassRegRoot=%1 %2
if "%3"=="%%c" goto EOF
if "%3"=="" goto EOF
if "%3"=="e" goto EOF
set CurrentGlassRegRoot=%1 %2 %3
if "%4"=="%%d" goto EOF
if "%4"=="" goto EOF
set CurrentGlassRegRoot=%1 %2 %3 %4
if "%5"=="%%e" goto EOF
if "%5"=="" goto EOF
set CurrentGlassRegRoot=%1 %2 %3 %4 %5
goto EOF

:EnsureLaunchOptionsGenBuilt
if not exist %_GlassDir%LaunchOptionsGen.exe echo Building LaunchOptionsGen.exe& msbuild /p:Configuration=Release;OutDir=%_GlassDir% /v:quiet %~dp0..\LaunchOptionsGen\LaunchOptionsGen.csproj
exit /b 0

:SetProjectRoot
set _ProjectRoot=%~f1
goto EOF

:Help
echo --- MIEngine Android Test Script ---
echo Usage: androidtest.cmd /DeviceId ^<id^> /Platform ^<platform^> [/SdkRoot ^<path^>] [/NdkRoot ^<path^>] [/v] [/Loop ^<num_iterations^>] [/Tests ^<test 1^> [^<test 2^> [...]]]
echo.
echo --- Examples ---
echo Run All Tests:
echo androidtest.cmd /DeviceId 169.254.138.123:5555 /Platform x86
echo.
echo Run two specific tests:
echo androidtest.cmd /DeviceId 169.254.138.123:5555 /Platform x86 /Tests Stepping Exceptions
echo.

if exist "%_SdkRoot%" "%_SdkRoot%\platform-tools\adb.exe" devices -l

:EOF

Add basic looping support to AndroidTest.cmd

I was trying to track down some test flakyness, and so I needed some basic looping support in AndroidTest.cmd. This adds it. The '/Loop ###' can now be used to run a test repeatedly. We will stop running the test if it fails.


@echo off

set BOOST_ROOT=D:/dev/boost_1_74_0
set BOOST_LIBRARYDIR=D:/dev/boost_1_74_0/lib64-msvc-14.0
set INCLUDE=%BOOST_ROOT%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
set QL_DIR=%CD%\QuantLib
set QLEXT_DIR=%CD%\QuantLib-Ext
set BUILD_TYPE=Release
set ADDRESS_MODEL=Win64
set MSVC_RUNTIME=dynamic
set VS_VERSION=Visual Studio 14 2015

cd QuantLib

if exist build (
  rem build folder already exists.
) else (
  mkdir build
)

if %ADDRESS_MODEL%==Win64 (
  set PLATFORM=x64
) else (
  set PLATFORM=Win32
)

cd build

if %ADDRESS_MODEL%==Win64 (
  cmake -G "%VS_VERSION% %ADDRESS_MODEL%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=%QL_DIR% -DMSVC_RUNTIME=%MSVC_RUNTIME% --target install ..
) else (
  cmake -G "%VS_VERSION%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=%QL_DIR% -DMSVC_RUNTIME=%MSVC_RUNTIME% --target install ..
)

if %errorlevel% neq 0 exit /b 1

msbuild QuantLib.sln /m:%NUMBER_OF_PROCESSORS% /p:Configuration=%BUILD_TYPE% /p:Platform=%PLATFORM%
msbuild INSTALL.vcxproj /m:%NUMBER_OF_PROCESSORS% /p:Configuration=%BUILD_TYPE% /p:Platform=%PLATFORM%

if %errorlevel% neq 0 exit /b 1

cd ..\bin

quantlib-test-suite --log_level=message --build_info=true

if %errorlevel% neq 0 exit /b 1

cd ..\..\QuantLib-Ext

if exist build (
  rem build folder already exists.
) else (
  mkdir build
)

cd build

if %ADDRESS_MODEL%==Win64 (
  cmake -G "%VS_VERSION% %ADDRESS_MODEL%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=%QLEXT_DIR% -DMSVC_RUNTIME=%MSVC_RUNTIME% --target install ..
) else (
  cmake -G "%VS_VERSION%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=%QLEXT_DIR% -DMSVC_RUNTIME=%MSVC_RUNTIME% --target install ..
)

if %errorlevel% neq 0 exit /b 1

msbuild QuantLibExt.sln /m:%NUMBER_OF_PROCESSORS% /p:Configuration=%BUILD_TYPE% /p:Platform=%PLATFORM%
msbuild INSTALL.vcxproj /m:%NUMBER_OF_PROCESSORS% /p:Configuration=%BUILD_TYPE% /p:Platform=%PLATFORM%

if %errorlevel% neq 0 exit /b 1

cd ..\bin

quantlibext-test-suite --log_level=message --build_info=true

if %errorlevel% neq 0 exit /b 1

cd ..\..\examples\c++

if exist build (
  rem build folder already exists.
) else (
  mkdir build
)

cd build

if %ADDRESS_MODEL%==Win64 (
  cmake -G "%VS_VERSION% %ADDRESS_MODEL%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=%QLEXT_DIR% -DMSVC_RUNTIME=%MSVC_RUNTIME% --target install ..
) else (
  cmake -G "%VS_VERSION%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=%QLEXT_DIR% -DMSVC_RUNTIME=%MSVC_RUNTIME% --target install ..
)

if %errorlevel% neq 0 exit /b 1

msbuild Examples.sln /m:%NUMBER_OF_PROCESSORS% /p:Configuration=%BUILD_TYPE% /p:Platform=%PLATFORM%

if %errorlevel% neq 0 exit /b 1

cd ..\..\..\QuantLib-SWIG\Python

python setup.py wrap

if %MSVC_RUNTIME% neq static (
  if %BUILD_TYPE% neq Release (
    python setup.py build --debug
  ) else (
    python setup.py build
  )
) else (
  if %BUILD_TYPE% neq Release (
    python setup.py build --static --debug
  ) else (
    python setup.py build --static
  )
)

python setup.py bdist_wheel

if %errorlevel% neq 0 exit /b 1

cd ..\..

@echo on

@echo off

set BOOST_ROOT=D:/dev/boost_1_74_0
set BOOST_LIBRARYDIR=D:/dev/boost_1_74_0/lib64-msvc-14.2
set INCLUDE=%BOOST_ROOT%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
set QL_DIR=%CD%\QuantLib
set QLEXT_DIR=%CD%\QuantLib-Ext
set BUILD_TYPE=Release
set ADDRESS_MODEL=Win64
set MSVC_RUNTIME=dynamic
set VS_VERSION=Visual Studio 16 2019

cd QuantLib

if exist build (
  rem build folder already exists.
) else (
  mkdir build
)

if %ADDRESS_MODEL%==Win64 (
  set PLATFORM=x64
) else (
  set PLATFORM=Win32
)

cd build

cmake -G "%VS_VERSION%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=%QL_DIR% -DMSVC_RUNTIME=%MSVC_RUNTIME% --target install ..

if %errorlevel% neq 0 exit /b 1

msbuild QuantLib.sln /m:%NUMBER_OF_PROCESSORS% /p:Configuration=%BUILD_TYPE% /p:Platform=%PLATFORM%
msbuild INSTALL.vcxproj /m:%NUMBER_OF_PROCESSORS% /p:Configuration=%BUILD_TYPE% /p:Platform=%PLATFORM%

if %errorlevel% neq 0 exit /b 1

cd ..\bin

rem quantlib-test-suite --log_level=message --build_info=true

if %errorlevel% neq 0 exit /b 1

cd ..\..\QuantLib-Ext

if exist build (
  rem build folder already exists.
) else (
  mkdir build
)

cd build

cmake -G "%VS_VERSION%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=%QLEXT_DIR% -DMSVC_RUNTIME=%MSVC_RUNTIME% --target install ..

if %errorlevel% neq 0 exit /b 1

msbuild QuantLibExt.sln /m:%NUMBER_OF_PROCESSORS% /p:Configuration=%BUILD_TYPE% /p:Platform=%PLATFORM%
msbuild INSTALL.vcxproj /m:%NUMBER_OF_PROCESSORS% /p:Configuration=%BUILD_TYPE% /p:Platform=%PLATFORM%

if %errorlevel% neq 0 exit /b 1

cd ..\bin

quantlibext-test-suite --log_level=message --build_info=true

if %errorlevel% neq 0 exit /b 1

cd ..\..\examples\c++

if exist build (
  rem build folder already exists.
) else (
  mkdir build
)

cd build
cmake -G "%VS_VERSION%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=%QLEXT_DIR% -DMSVC_RUNTIME=%MSVC_RUNTIME% --target install ..

if %errorlevel% neq 0 exit /b 1

msbuild Examples.sln /m:%NUMBER_OF_PROCESSORS% /p:Configuration=%BUILD_TYPE% /p:Platform=%PLATFORM%

if %errorlevel% neq 0 exit /b 1

cd ..\..\..\QuantLib-SWIG\Python

python setup.py wrap

if %MSVC_RUNTIME% neq static (
  if %BUILD_TYPE% neq Release (
    python setup.py build --debug
  ) else (
    python setup.py build
  )
) else (
  if %BUILD_TYPE% neq Release (
    python setup.py build --static --debug
  ) else (
    python setup.py build --static
  )
)

python setup.py bdist_wheel

if %errorlevel% neq 0 exit /b 1

cd ..\..

@echo on

build scripts change

build scripts change


"C:\program files (x86)\Unity\Editor\Unity.exe" -projectPath %~dp0../unity -quit -batchmode -executeMethod BuildPackage.BuildUnityPackage
@pause

build script

build script


Add onara.bat

Add onara.bat


@echo off
echo *** %~n0 ...
echo *** %SrcDir%
echo.
call %~dp0\_init.bat %1 %2 %3

SET MergeName=FotoMapa-2019
::SET MergeParams=-vrtnodata 0

echo VRT...
gdalbuildvrt %MergeParams% %MergeName%.vrt *%SrcExt%

:: -te xmin ymin xmax ymax
SET ExtWybrz=-te 410000 765000 465000 777000
SET ExtZatoka=-te 455000 743000 500000 777000
SET ExtTrm=-te 455000 710000 503000 750000
SET ExtZw=-te 490000 695000 555000 735000

echo.
echo Merge Wybrzeze...
gdalwarp -wm 1024 -multi %ExtWybrz%  %TiffOpts% %MergeName%.vrt ..\%MergeName%-wybrz%SrcExt%

echo.
echo Merge Zatoka...
gdalwarp -wm 1024 -multi %ExtZatoka% %TiffOpts% %MergeName%.vrt ..\%MergeName%-zatoka%SrcExt%

echo.
echo Merge Trojmiasto...
gdalwarp -wm 1024 -multi %ExtTrm%    %TiffOpts% %MergeName%.vrt ..\%MergeName%-trm%SrcExt%

echo.
echo Merge Zalew wislany...
gdalwarp -wm 1024 -multi %ExtZw%     %TiffOpts% %MergeName%.vrt ..\%MergeName%-zw%SrcExt%

echo.
echo.

call %~dp0\raster-pyramid.bat ..\%MergeName%-wybrz%SrcExt%
call %~dp0\raster-pyramid.bat ..\%MergeName%-zatoka%SrcExt%
call %~dp0\raster-pyramid.bat ..\%MergeName%-trm%SrcExt%
call %~dp0\raster-pyramid.bat ..\%MergeName%-zw%SrcExt%

echo.
echo %~n0 finished.
timeout 30

@echo off
echo *** %~n0 ...
echo *** %SrcDir%
echo.
call %~dp0\_init.bat %1 %2 %3

SET MergeName=FotoMapa-2019
::SET MergeParams=-vrtnodata 0

echo VRT...
gdalbuildvrt %MergeParams% %MergeName%.vrt *%SrcExt%

:: -te xmin ymin xmax ymax
SET ExtWybrz=-te 345000 745000 465000 777000
SET ExtZatoka=-te 455000 743000 500000 777000
SET ExtTrm=-te 455000 710000 503000 750000
SET ExtZw=-te 490000 695000 555000 735000

echo.
echo Merge Wybrzeze...
gdalwarp -wm 1024 -multi %ExtWybrz%  %TiffOpts% %MergeName%.vrt ..\%MergeName%-wybrz%SrcExt%

echo.
echo Merge Zatoka...
gdalwarp -wm 1024 -multi %ExtZatoka% %TiffOpts% %MergeName%.vrt ..\%MergeName%-zatoka%SrcExt%

echo.
echo Merge Trojmiasto...
gdalwarp -wm 1024 -multi %ExtTrm%    %TiffOpts% %MergeName%.vrt ..\%MergeName%-trm%SrcExt%

echo.
echo Merge Zalew wislany...
gdalwarp -wm 1024 -multi %ExtZw%     %TiffOpts% %MergeName%.vrt ..\%MergeName%-zw%SrcExt%

echo.
echo.

call %~dp0\raster-pyramid.bat ..\%MergeName%-wybrz%SrcExt%
call %~dp0\raster-pyramid.bat ..\%MergeName%-zatoka%SrcExt%
call %~dp0\raster-pyramid.bat ..\%MergeName%-trm%SrcExt%
call %~dp0\raster-pyramid.bat ..\%MergeName%-zw%SrcExt%

echo.
echo %~n0 finished.
timeout 30

add umsl extent

add umsl extent


@setlocal
@set BUILD=%1

@if "%BUILD:~-7%" == "_vmware" (
  set boxname=%BUILD:~0,-7%
  set template=%BUILD:~0,-7%
  set builder=vmware-iso
  set spec=vmware
)
@if "%BUILD:~-7%" == "_vcloud" (
  set boxname=%BUILD:~0,-7%
  set template=%BUILD%
  set builder=vmware-iso
  set spec=vcloud
)
@if "%BUILD:~-11%" == "_virtualbox" (
  set boxname=%BUILD:~0,-11%
  set template=%BUILD:~0,-11%
  set builder=virtualbox-iso
  set spec=virtualbox
)

@if "%spec%x"=="x" (
  echo Wrong build parameter!
  goto :EOF
)

@echo.
@echo boxname = %boxname%
@echo template = %template%
@echo builder = %builder%
@echo spec = %spec%
@echo.

if exist output-%builder% (
  rmdir /S /Q output-%builder%
)
if exist "C:\Windows\system32\config\systemprofile\VirtualBox VMs\packer-%builder%" (
  rmdir /S /Q "C:\Windows\system32\config\systemprofile\VirtualBox VMs\packer-%builder%"
)
if exist "C:\Windows\system32\config\systemprofile\VirtualBox VMs\%template%" (
  rmdir /S /Q "C:\Windows\system32\config\systemprofile\VirtualBox VMs\%template%"
)

packer build --only=%builder% %template%.json
if ERRORLEVEL 1 goto :EOF

if exist %~dp0\test-box-%spec%.bat (
  call %~dp0\test-box-%spec%.bat %boxname%_%spec%.box %boxname%
)

@setlocal
@set BUILD=%1
@set debug=

@if "%1x"=="--debugx" (
  shift
  set debug=--debug
)

@if "%BUILD:~-7%" == "_vmware" (
  set boxname=%BUILD:~0,-7%
  set template=%BUILD:~0,-7%
  set builder=vmware-iso
  set spec=vmware
)
@if "%BUILD:~-7%" == "_vcloud" (
  set boxname=%BUILD:~0,-7%
  set template=%BUILD%
  set builder=vmware-iso
  set spec=vcloud
)
@if "%BUILD:~-11%" == "_virtualbox" (
  set boxname=%BUILD:~0,-11%
  set template=%BUILD:~0,-11%
  set builder=virtualbox-iso
  set spec=virtualbox
)

@if "%spec%x"=="x" (
  echo Wrong build parameter!
  goto :EOF
)

@echo.
@echo boxname = %boxname%
@echo template = %template%
@echo builder = %builder%
@echo spec = %spec%
@echo.

if exist output-%builder% (
  rmdir /S /Q output-%builder%
)
if exist "C:\Windows\system32\config\systemprofile\VirtualBox VMs\packer-%builder%" (
  rmdir /S /Q "C:\Windows\system32\config\systemprofile\VirtualBox VMs\packer-%builder%"
)
if exist "C:\Windows\system32\config\systemprofile\VirtualBox VMs\%template%" (
  rmdir /S /Q "C:\Windows\system32\config\systemprofile\VirtualBox VMs\%template%"
)

packer build --only=%builder% %template%.json
if ERRORLEVEL 1 goto :EOF

if exist %~dp0\test-box-%spec%.bat (
  call %~dp0\test-box-%spec%.bat %debug% %boxname%_%spec%.box %boxname%
)

Add --debug

Add --debug


@java -Xbootclasspath/a:.;nqp-runtime.jar;3rdparty/asm/asm-4.1.jar nqp %*

@java -Xbootclasspath/a:.;nqp-runtime.jar;3rdparty/asm/asm-4.1.jar;3rdparty/jline/jline-1.0.jar nqp %*

Fix Windows runner to load jline JAR.

Fix Windows runner to load jline JAR.


@echo off
setlocal
set KSPDIR=G:\KSP\1.4.4_test
cd %~dp0
rd KSP
rd %KSPDIR%\GameData\BetterLoadSaveGame
mklink /J KSP %KSPDIR%
mklink /J %KSPDIR%\GameData\BetterLoadSaveGame GameData\BetterLoadSaveGame
endlocal

@echo off
setlocal
set KSPDIR=G:\KSP\1.7.0
cd %~dp0
echo Remove old root link
rd KSP
echo Remove old output link
rd %KSPDIR%\GameData\BetterLoadSaveGame
echo Create new root link
mklink /J KSP %KSPDIR%
echo Create new output link
mklink /J %KSPDIR%\GameData\BetterLoadSaveGame GameData\BetterLoadSaveGame
endlocal

Tweak link script

Tweak link script


Add patch.bat to launch patch.ps1 easily.


@echo on

set APPVEYOR_CI=1

:: Check prerequisites
if not '%VisualStudioVersion%' == '' goto vsversionset
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\common7\ide\devenv.exe" set VisualStudioVersion=14.0
if exist "%ProgramFiles%\Microsoft Visual Studio 14.0\common7\ide\devenv.exe" set VisualStudioVersion=14.0
if not '%VisualStudioVersion%' == '' goto vsversionset
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\common7\ide\devenv.exe" set VisualStudioVersion=12.0
if exist "%ProgramFiles%\Microsoft Visual Studio 12.0\common7\ide\devenv.exe" set VisualStudioVersion=12.0

:vsversionset
if '%VisualStudioVersion%' == '' echo Error: Could not find an installation of Visual Studio && goto :eof

if exist "%ProgramFiles(x86)%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe" set _msbuildexe="%ProgramFiles(x86)%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe"
if exist "%ProgramFiles%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe"      set _msbuildexe="%ProgramFiles%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe"
if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe. && goto :eof

set _ngenexe="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ngen.exe"
if not exist %_ngenexe% echo Error: Could not find ngen.exe. && goto :failure

.\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages
@if ERRORLEVEL 1 echo Error: Nuget restore failed  && goto :failure

:: Build
%_msbuildexe% src\fsharp-proto-build.proj
@if ERRORLEVEL 1 echo Error: compiler proto build failed && goto :failure

%_ngenexe% install Proto\net40\bin\fsc-proto.exe
@if ERRORLEVEL 1 echo Error: NGen of proto failed  && goto :failure

%_msbuildexe% src/fsharp-library-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library build failed && goto :failure

%_msbuildexe% src/fsharp-compiler-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: compiler build failed && goto :failure

%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable47 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library portable47 build failed && goto :failure

%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable7 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library portable7 build failed && goto :failure

%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable78 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library portable78 build failed && goto :failure

%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable259 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library portable259 build failed && goto :failure

%_msbuildexe% src/fsharp-compiler-unittests-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: compiler unittests build failed && goto :failure

%_msbuildexe% src/fsharp-library-unittests-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure

%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable47 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed portable47 && goto :failure

%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable7 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed portable7 && goto :failure

%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable78 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed portable78 && goto :failure

%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable259 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed portable259 && goto :failure

%_msbuildexe% vsintegration\fsharp-vsintegration-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: VS integration build failed && goto :failure

%_msbuildexe% vsintegration\fsharp-vsintegration-unittests-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: VS integration unit tests build failed && goto :failure

@echo on
call src\update.cmd release -ngen

@echo on
call tests\BuildTestTools.cmd release
@if ERRORLEVEL 1 echo Error: 'tests\BuildTestTools.cmd release' failed && goto :failure

@echo on
pushd tests

call RunTests.cmd release fsharp Smoke
@if ERRORLEVEL 1 type testresults\fsharp_failures.log && echo Error: 'RunTests.cmd release fsharp Smoke' failed && goto :failure

call RunTests.cmd release fsharpqa Smoke
@if ERRORLEVEL 1 type testresults\fsharpqa_failures.log && echo Error: 'RunTests.cmd release fsharpqa Smoke' failed && goto :failure

call RunTests.cmd release compilerunit
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd release compilerunit' failed && goto :failure

call RunTests.cmd release coreunit
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd release coreunit' failed && goto :failure

popd

goto :eof

:failure
exit /b 1

@echo on

set APPVEYOR_CI=1

:: Check prerequisites
if not '%VisualStudioVersion%' == '' goto vsversionset
if exist "%VS140COMNTOOLS%..\ide\devenv.exe" set VisualStudioVersion=14.0
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\common7\ide\devenv.exe" set VisualStudioVersion=14.0
if exist "%ProgramFiles%\Microsoft Visual Studio 14.0\common7\ide\devenv.exe" set VisualStudioVersion=14.0
if not '%VisualStudioVersion%' == '' goto vsversionset
if exist "%VS120COMNTOOLS%..\ide\devenv.exe" set VisualStudioVersion=12.0
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\common7\ide\devenv.exe" set VisualStudioVersion=12.0
if exist "%ProgramFiles%\Microsoft Visual Studio 12.0\common7\ide\devenv.exe" set VisualStudioVersion=12.0

:vsversionset
if '%VisualStudioVersion%' == '' echo Error: Could not find an installation of Visual Studio && goto :eof

if exist "%ProgramFiles(x86)%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe" set _msbuildexe="%ProgramFiles(x86)%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe"
if exist "%ProgramFiles%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe"      set _msbuildexe="%ProgramFiles%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe"
if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe. && goto :eof

set _ngenexe="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ngen.exe"
if not exist %_ngenexe% echo Error: Could not find ngen.exe. && goto :failure

.\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages
@if ERRORLEVEL 1 echo Error: Nuget restore failed  && goto :failure

:: Build
%_msbuildexe% src\fsharp-proto-build.proj
@if ERRORLEVEL 1 echo Error: compiler proto build failed && goto :failure

%_ngenexe% install Proto\net40\bin\fsc-proto.exe
@if ERRORLEVEL 1 echo Error: NGen of proto failed  && goto :failure

%_msbuildexe% src/fsharp-library-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library build failed && goto :failure

%_msbuildexe% src/fsharp-compiler-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: compiler build failed && goto :failure

%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable47 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library portable47 build failed && goto :failure

%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable7 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library portable7 build failed && goto :failure

%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable78 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library portable78 build failed && goto :failure

%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable259 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library portable259 build failed && goto :failure

%_msbuildexe% src/fsharp-compiler-unittests-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: compiler unittests build failed && goto :failure

%_msbuildexe% src/fsharp-library-unittests-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure

%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable47 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed portable47 && goto :failure

%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable7 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed portable7 && goto :failure

%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable78 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed portable78 && goto :failure

%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable259 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: library unittests build failed portable259 && goto :failure

%_msbuildexe% vsintegration\fsharp-vsintegration-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: VS integration build failed && goto :failure

%_msbuildexe% vsintegration\fsharp-vsintegration-unittests-build.proj /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: VS integration unit tests build failed && goto :failure

@echo on
call src\update.cmd release -ngen

@echo on
call tests\BuildTestTools.cmd release
@if ERRORLEVEL 1 echo Error: 'tests\BuildTestTools.cmd release' failed && goto :failure

@echo on
pushd tests

call RunTests.cmd release fsharp Smoke
@if ERRORLEVEL 1 type testresults\fsharp_failures.log && echo Error: 'RunTests.cmd release fsharp Smoke' failed && goto :failure

call RunTests.cmd release fsharpqa Smoke
@if ERRORLEVEL 1 type testresults\fsharpqa_failures.log && echo Error: 'RunTests.cmd release fsharpqa Smoke' failed && goto :failure

call RunTests.cmd release compilerunit
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd release compilerunit' failed && goto :failure

call RunTests.cmd release coreunit
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd release coreunit' failed && goto :failure

popd

goto :eof

:failure
exit /b 1

add in environment variable check for VS installed in non-default locations


mkdir ../../../../../Java
powershell Expand-Archive ../../../../../*.zip -DestinationPath ../../../../../Java

Add a script to extract the java jre zip file


@echo off
setlocal
set rebarscript=%0
escript.exe %rebarscript:.bat=% %*

@echo off
setlocal
set rebarscript=%~f0
escript.exe "%rebarscript:.bat=%" %*

Fix rebar.bat path handling

Fix rebar.bat path handling

Use "%~f0" to get the full path of rebat.bat to correctly locate the
rebar script. Also put the script name in quotes when passing it to
escript.exe to correctly handle paths with spaces.


@echo off
REM install qmake feature file pointing to the current directory

echo QCA_INCDIR = %CD%\include > crypto.prf
echo QCA_LIBDIR = %CD%\lib >> crypto.prf
type crypto.prf.in >> crypto.prf
copy crypto.prf %QTDIR%\mkspecs\features

echo Installed crypto.prf as a qmake feature.

@echo off
REM install qmake feature file pointing to the current directory

if not defined QTDIR goto err

echo QCA_INCDIR = "%CD%\include" > crypto.prf
echo QCA_LIBDIR = "%CD%\lib" >> crypto.prf
type crypto.prf.in >> crypto.prf
copy crypto.prf "%QTDIR%\mkspecs\features"

echo Installed crypto.prf as a qmake feature.
goto end

:err
echo Error: QTDIR not set (example: set QTDIR=C:\Qt\4.2.3).
goto end

:end

support paths with spaces by quoting properly.
throw error if QTDIR is not set.
blah, convert to unix line endings to satisfy KDE SVN.  we might need to
post-process this file to DOS line endings before shipping.

svn path=/trunk/kdesupport/qca/; revision=808870


setlocal
call settings.bat

git clone https://github.com/alex85k/osm2pgsql.git osm2pgsql-cpp
cd osm2pgsql-cpp
git checkout msvc-september30-cpp
cd build-cmake

set CMAKE_PREFIX_PATH=%PREFIX%;C:\Program Files\PostgreSQL\9.3

copy CMakeLists.txt ..
%CMAKE% ..  -DBOOST_ROOT=%BOOST_ROOT% -DBoost_USE_STATIC_LIBS=ON -DBUILD_PBF=ON
%ER%
%MAKEC% install
%ER%

cd ../..

mkdir osm2pgsql-cpp-bin
copy /y osm2pgsql-cpp\build-cmake\osm2pgsql.exe osm2pgsql-cpp-bin
copy /y osm2pgsql-cpp\default.style osm2pgsql-cpp-bin
copy /y osm2pgsql-cpp\style.lua osm2pgsql-cpp-bin
copy /y %PREFIX%\bin\lua.dll osm2pgsql-cpp-bin
copy /y %PREFIX%\bin\libxml2.dll osm2pgsql-cpp-bin
copy /y %PREFIX%\bin\geos.dll osm2pgsql-cpp-bin
copy /y "C:\Program Files\PostgreSQL\9.3\bin\libpq.dll" osm2pgsql-cpp-bin
copy /y "C:\Program Files\PostgreSQL\9.3\bin\libintl-8.dll" osm2pgsql-cpp-bin
copy /y "C:\Program Files\PostgreSQL\9.3\bin\libeay32.dll" osm2pgsql-cpp-bin
copy /y "C:\Program Files\PostgreSQL\9.3\bin\ssleay32.dll" osm2pgsql-cpp-bin

setlocal
call settings.bat

git clone https://github.com/alex85k/osm2pgsql.git osm2pgsql-cpp
cd osm2pgsql-cpp
git checkout msvc-october1-cpp
cd build-cmake

copy CMakeLists.txt ..

if "%compiler%" == "MINGW" (
   SET "PATH=%MSYSDIR%;%PREFIX%\bin;%PATH%"
) else (
   set CMAKE_PREFIX_PATH=%PREFIX%;C:\Program Files\PostgreSQL\9.3
)

%CMAKE% ..  -DBOOST_ROOT=%BOOST_ROOT% -DBoost_USE_STATIC_LIBS=ON -DBUILD_PBF=ON -DBUILD_TESTS=ON
%ER%
%MAKEC% install
%ER%

cd ../..

mkdir osm2pgsql-cpp-bin
copy /y osm2pgsql-cpp\build-cmake\*.exe osm2pgsql-cpp-bin
copy /y osm2pgsql-cpp\default.style osm2pgsql-cpp-bin
copy /y osm2pgsql-cpp\style.lua osm2pgsql-cpp-bin
copy /y %PREFIX%\bin\libxml2.dll osm2pgsql-cpp-bin

if "%compiler%" == "MINGW" (
  copy /y "%PREFIX%\lib\libpq.dll" osm2pgsql-cpp-bin
  copy /y "c:\mingw64\bin\libgcc*.dll" osm2pgsql-cpp-bin
  copy /y "c:\mingw64\bin\libstd*.dll" osm2pgsql-cpp-bin
  copy /y "c:\mingw64\bin\libwinp*.dll" osm2pgsql-cpp-bin
  copy /y %PREFIX%\bin\liblua.dll osm2pgsql-cpp-bin
  copy /y %PREFIX%\bin\libgeos.dll osm2pgsql-cpp-bin
  copy /y %PREFIX%\bin\libproj*.dll osm2pgsql-cpp-bin
  copy /y %PREFIX%\bin\zlib1.dll osm2pgsql-cpp-bin
) else (
  copy /y %PREFIX%\bin\lua.dll osm2pgsql-cpp-bin
  copy /y %PREFIX%\bin\geos.dll osm2pgsql-cpp-bin
  copy /y "C:\Program Files\PostgreSQL\9.3\bin\libpq.dll" osm2pgsql-cpp-bin
  copy /y "C:\Program Files\PostgreSQL\9.3\bin\libintl-8.dll" osm2pgsql-cpp-bin
  copy /y "C:\Program Files\PostgreSQL\9.3\bin\libeay32.dll" osm2pgsql-cpp-bin
  copy /y "C:\Program Files\PostgreSQL\9.3\bin\ssleay32.dll" osm2pgsql-cpp-bin
)

cd osm2pgsql-cpp/build-cmake
  set PATH=%CD%/../../osm2pgsql-bin;%PATH%
  ctest -VV
cd ../..

build osm2pgsql supports mingw

build osm2pgsql supports mingw


REM -N DO NOT START SHELL
REM -v VERBOSE
REM -L <local_port>:<distant_host>:<distant_port> <putty config>

plink -v -N -L 9201:localhost:9200 "active-data-frontend"

REM -N DO NOT START SHELL
REM -v VERBOSE
REM -L <local_port>:<distant_host>:<distant_port> <putty config>

plink -v -N -L 9201:localhost:9200 "ActiveData-frontend"

fix plink

fix plink


@rem if we don't have nmake in the path, we need to run setup
where nmake.exe 2> NUL
if %ERRORLEVEL% GTR 0 set need_setup=1

@rem if we don't have the include path set, we need to run setup
if not defined INCLUDE set need_setup=1

@rem run setup if we need to
if %need_setup% == 1 call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64

@rem Allow python build to succeed:
@rem http://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat
SET VS90COMNTOOLS=%VS120COMNTOOLS%

@rem finally, run make
nmake /nologo /s /f winbuild\Makefile %1

@rem if we don't have nmake in the path, we need to run setup
where nmake.exe 2> NUL
if %ERRORLEVEL% GTR 0 set need_setup=1

@rem if we don't have the include path set, we need to run setup
if not defined INCLUDE set need_setup=1

@rem run setup if we need to
if %need_setup% == 1 call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64

@rem Allow python build to succeed:
@rem http://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat
SET VS90COMNTOOLS=%VS120COMNTOOLS%

where python.exe 2> NUL
if %ERRORLEVEL% GTR 0 set PATH=c:\Python27;%PATH%

where php.exe 2> NUL
if %ERRORLEVEL% GTR 0 set PATH=c:\php;%PATH%

@rem finally, run make
nmake /nologo /s /f winbuild\Makefile %1

Adjust windows build script some more

Adjust windows build script some more

Make a guess about php and python locations


@echo off

if [%appveyor_repo_branch%]==[release] (
  set build_options=--configuration Release
) else if defined appveyor_build_number (
  set build_options=--configuration Release --version-suffix ci%appveyor_build_number%
) else (
  set build_options=--configuration Release --version-suffix yolo
)

@echo off

if [%appveyor_repo_branch%]==[release] (
  set build_options=--configuration Release --version-suffix rc1
) else if defined appveyor_build_number (
  set build_options=--configuration Release --version-suffix ci%appveyor_build_number%
) else (
  set build_options=--configuration Release --version-suffix yolo
)

Set version-suffix to rc1

Set version-suffix to rc1


Update build_nuget_packages.cmd

Update build_nuget_packages.cmd

Removed reference to a NuGet executable in the current directory.


@echo off
rem # This is the equivalent of a Makefile in Windows.
rem # This should be functionally equivalent to the Makefile found in the
rem # same directory.

set TAG=[tt]
set REQS=%CD%\reqs
set DEVREQS="%REQS%\requirements-dev.txt"
set TT_PYPI_NAME=ttable

if /I "%~1"=="" @echo You must specify a target. & exit /b
if /I "%~1"=="clean" call :clean & exit /b
if /I "%~1"=="py-version" call :py-version & exit /b
if /I "%~1"=="install-tt" call :install-tt & exit /b
if /I "%~1"=="install-reqs" call :install-reqs & exit /b
if /I "%~1"=="uninstall-tt" call :uninstall-tt & exit /b
if /I "%~1"=="uninstall-reqs" call :uninstall-reqs & exit /b
if /I "%~1"=="write-reqs" call :write-reqs & exit /b
if /I "%~1"=="check-dev-env" call :check-dev-env & exit /b
if /I "%~1"=="test-sdist" call :test-sdist & exit /b
if /I "%~1"=="test-bdist-wheel" call :test-bdist-wheel & exit /b
if /I "%~1"=="test-dist" call :test-dist & exit /b
if /I "%~1"=="test" call :test & exit /b
if /I "%~1"=="init" call :init & exit /b
if /I "%~1"=="test-all" call :test-all & exit /b
if /I "%~1"=="upload" call :upload & exit /b
@echo Unknown target called. & exit /b 1

:clean
@echo %TAG% Cleaning environment...
del /s /q *.pyc >nul 2>&1
rmdir /s /q build >nul 2>&1
rmdir /s /q dist >nul 2>&1
rmdir /s /q %TT_PYPI_NAME%.egg-info >nul 2>&1
@echo %TAG% OK.
@echo.
exit /b

:py-version
@echo ----------------------------
@echo Running with Python version:
@echo ----------------------------
@echo.
python --version
@echo.
@echo ----------------------------
@echo.

:install-tt
@echo %TAG% Installing tt...
pip install --upgrade --editable . >nul 2>&1
where tt >nul 2>&1 || @echo %TAG% Installation of tt failed & exit /b 1
@echo %TAG% OK.
@echo.
exit /b

:install-reqs
@echo %TAG% Installing dev requirements from %DEVREQS%...
pip install --upgrade -r %DEVREQS% >nul 2>&1
@echo %TAG% OK.
@echo.
exit /b

:uninstall-tt
@echo %TAG% Uninstalling tt...
where tt >nul 2>&1 || @echo %TAG% Cancelled uninstall; tt is already not installed. & @echo. & exit /b 0
pip uninstall --yes %TT_PYPI_NAME% >nul 2>&1
where tt >nul 1 2>&1 && @echo %TAG% Failed uninstall. & @echo. & exit /b 1
@echo %TAG% OK.
@echo.
exit /b

:uninstall-reqs
@echo %TAG% Uninstalling all tt dev requirements...
pip uninstall --yes -r %DEVREQS% >nul 2>&1
@echo %TAG% OK.
@echo.
exit /b

:write-reqs
@echo %TAG% Updating %DEVREQS% with the current environment's installed packages
pip freeze > %DEVREQS%
@echo %TAG% OK.
@echo %TAG% New contents of %DEVREQS% are:
type %DEVREQS%
exit /b

:init
@echo %TAG% Beginning initialization of tt for testing...
@echo.
call :uninstall-tt
call :install-reqs
call :install-tt
exit /b

:test
call :init
@echo %TAG% Running tests...
@echo.
python -m unittest discover -s tt || exit /b
@echo.
exit /b

:test-sdist
call :uninstall-reqs
call :uninstall-tt
call :clean
@echo %TAG% Beginning test of source distribution...
python setup.py sdist >nul 2>&1
for %%f in (dist\*.zip) do set SDIST=%%f
pip install --force-reinstall --upgrade %SDIST% >nul 2>&1
where tt >nul 2>&1 || (@echo tt did not install properly from source dist. & exit /b 1)
@echo %TAG% OK.
@echo.
exit /b

:test-bdist-wheel
call :uninstall-reqs
call :uninstall-tt
call :clean
@echo %TAG% Beginning test of binary wheel distribution...
python setup.py bdist_wheel >nul 2>&1
for %%f in (dist\*.whl) do set WHLDIST=%%f
pip install --force-reinstall --upgrade %WHLDIST% >nul 2>&1
where tt >nul 2>&1 || (@echo tt did not install properly from wheel dist. & exit /b 1)
@echo %TAG% OK.
@echo.
exit /b

:test-dist
call :test-sdist
call :test-bdist-wheel
exit /b

:test-all
call :py-version || exit /b
call :test || exit /b
call :test-dist || exit /b
exit /b

:upload
call :check-dev-env || exit /b
call :test-all || (@echo Cancelling upload; tests failed. & exit /b 1)
@echo python setup.py register

python setup.py sdist --formats=zip
python setup.py sdist --formats=gztar
python setup.py bdist_wheel
python setup.py build --plat-name=win32 bdist_msi
python setup.py build --plat-name=win-amd64 bdist_msi

for %%f in (dist\*) do @echo python setup.py upload %%f
exit /b

@ECHO off

REM # This should be functionally equivalent to the Makefile found in the
REM # same directory.

SET TAG=[tt]
SET REQS=%CD%\reqs
SET DEVREQS="%REQS%\requirements-dev.txt"
SET TT_PYPI_NAME=ttable

IF NOT "x%1"=="x" CALL :%1 || EXIT /B 1
EXIT /B 0

:clean
ECHO %TAG% Cleaning environment...
DEL /s /q *.pyc >nul 2>&1
RD /s /q build >nul 2>&1
RD /s /q dist >nul 2>&1
RD /s /q %TT_PYPI_NAME%.egg-info >nul 2>&1
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:py-version
ECHO ----------------------------
ECHO Running with Python version:
ECHO ----------------------------
ECHO.
python --version
ECHO.
ECHO ----------------------------
ECHO.
EXIT /B 0

:install-tt
ECHO %TAG% Installing tt...
pip install --upgrade --editable . >nul 2>&1
CALL where tt >nul 2>&1 || (ECHO %TAG% Installation of tt failed. & ECHO. & EXIT /b 1)
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:install-reqs
ECHO %TAG% Installing dev requirements from %DEVREQS%...
pip install --upgrade -r %DEVREQS% >nul 2>&1
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:uninstall-tt
ECHO %TAG% Uninstalling tt...
CALL where tt >nul 2>&1 || (ECHO %TAG% Cancelled uninstall; tt is already not installed. & ECHO. & EXIT /B 0)
pip uninstall --yes %TT_PYPI_NAME% >nul 2>&1
CALL where tt >nul 1 2>&1 && (ECHO %TAG% Failed uninstall. & ECHO. & EXIT /B 1)
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:uninstall-reqs
ECHO %TAG% Uninstalling all tt dev requirements...
pip uninstall --yes -r %DEVREQS% >nul 2>&1
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:write-reqs
ECHO %TAG% Updating %DEVREQS% with the current environment's installed packages
pip freeze > %DEVREQS%
ECHO %TAG% OK.
ECHO %TAG% New contents of %DEVREQS% are:
TYPE %DEVREQS%
EXIT /B 0

:init
ECHO %TAG% Beginning initialization of tt for testing...
ECHO.
CALL :uninstall-tt || EXIT /B 1
CALL :install-reqs || EXIT /B 1
CALL :install-tt || EXIT /B 1
EXIT /B 0

:test
CALL :init || EXIT /B 1
ECHO %TAG% Running tests...
ECHO.
CALL python -m unittest discover -s tt || EXIT /B 1
ECHO.
EXIT /B 0

:test-sdist
CALL :uninstall-reqs
CALL :uninstall-tt
CALL :clean
ECHO %TAG% Beginning test of source distribution...
python setup.py sdist >nul 2>&1
FOR %%f IN (dist\*.zip) DO SET SDIST=%%f
pip install --force-reinstall --upgrade %SDIST% >nul 2>&1
CALL where tt >nul 2>&1 || (ECHO %TAG% tt did not install properly from source dist. & EXIT /B 1)
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:test-bdist-wheel
CALL :uninstall-reqs || EXIT /B 1
CALL :uninstall-tt || EXIT /B 1
CALL :clean || EXIT /B 1
ECHO %TAG% Beginning test of binary wheel distribution...
python setup.py bdist_wheel >nul 2>&1
FOR %%f IN (dist\*.whl) DO SET WHLDIST=%%f
pip install --force-reinstall --upgrade %WHLDIST% >nul 2>&1
CALL where tt >nul 2>&1 || (ECHO %TAG% tt did not install properly from wheel dist. & EXIT /B 1)
ECHO %TAG% OK.
ECHO.
EXIT /B 0

:test-dist
CALL :test-sdist || EXIT /B 1
CALL :test-bdist-wheel || EXIT /B 1
EXIT /B 0

:test-all
CALL :py-version || EXIT /B 1
CALL :test || EXIT /B 1
CALL :test-dist || EXIT /B 1
EXIT /B 0

:upload
CALL :check-dev-env || EXIT /b 1
CALL :test-all || (ECHO Cancelling upload; tests failed. & EXIT /b 1)
ECHO python setup.py register

python setup.py sdist --formats=zip
python setup.py sdist --formats=gztar
python setup.py bdist_wheel
python setup.py build --plat-name=win32 bdist_msi
python setup.py build --plat-name=win-amd64 bdist_msi

FOR %%f IN (dist\*) DO ECHO python setup.py upload %%f
EXIT /B 0

Restructure make.bat to avoid false positives in error codes


mkdir build
cd build

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

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

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

:: Test.
ctest -C Release
if errorlevel 1 exit 1

mkdir build
cd build

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

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

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

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

Update bld.bat

Update bld.bat


improve java setting in shellenv.bat

improve java setting in shellenv.bat


@echo off
setlocal
set in_files=*.wmv
set out_folder=

for %%f in (%in_files%) do (
echo %%~f
echo pass 1
rem "bin\x264.2538kMod.x86_64.exe" %%~f --opencl --input-res 1920x1080 --fps 30001/1001 --force-cfr --profile high --level 4.1 --pass 1 --qpmin 22 --qpmax 32 --qpstep 4 --bitrate 1200 --ratetol 10 --fade-compensate 1.0 --ipratio 1.4 --pbratio 1.3 --ref 6 --mixed-refs --mbtree 1 --no-fast-pskip --fgo 10 --scenecut 40 --keyint 300 --min-keyint 30 --rc-lookahead 120 --open-gop --bframes 9 --b-pyramid normal --b-adapt 1 --direct auto --8x8dct --no-dct-decimate --me umh --merange 24 --aq-mode 1 --aq-strength 1 --subme 9 --cabac --trellis 0 --weightp 2 --no-psy --cqm flat --sar 1:1 --deblock 1:1 --colormatrix bt709 --partitions i4x4,i8x8,p8x8,b8x8 --threads auto --lookahead-threads 2 --mvrange-thread -1 --sync-lookahead 150 --thread-input --demuxer-threads 1 --non-deterministic --cplxblur 20 --video-filter resize:width=1280,height=720,method=spline --output %out_folder%%%~nf.264 --stats %out_folder%%%~nf.stats --index %%~nf.index --opencl-clbin %out_folder%x264.clbin
echo pass 2
"bin\x264.2538kMod.x86_64.exe" %%~f --opencl --input-res 1920x1080 --fps 30001/1001 --force-cfr --profile high --level 4.1 --pass 2 --qpmin 22 --qpmax 32 --qpstep 4 --bitrate 1300 --ratetol 10 --fade-compensate 1.0 --ipratio 1.4 --pbratio 1.3 --ref 6 --mixed-refs --mbtree 1 --no-fast-pskip --fgo 10 --scenecut 40 --keyint 300 --min-keyint 30 --rc-lookahead 120 --open-gop --bframes 9 --b-pyramid normal --b-adapt 1 --direct auto --8x8dct --no-dct-decimate --me umh --merange 24 --aq-mode 1 --aq-strength 1 --subme 9 --cabac --trellis 0 --weightp 2 --no-psy --cqm flat --sar 1:1 --deblock 1:1 --colormatrix bt709 --partitions i4x4,i8x8,p8x8,b8x8 --threads auto --lookahead-threads 1 --mvrange-thread -1 --sync-lookahead 150 --thread-input --demuxer-threads 1 --non-deterministic --cplxblur 20 --video-filter resize:width=1280,height=720,method=spline --output %out_folder%%%~nf.264 --stats %out_folder%%%~nf.stats --index %%~nf.index --opencl-clbin %out_folder%x264.clbin

REM "mkvtoolnix\mkvmerge.exe" -o "%%~nf.new.mkv" "--default-track" "0:yes" "--forced-track" "0:no" "--aspect-ratio" "0:16/9" "--default-duration" "0:23.976fps" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "%%~nf.264" ")" "--language" "0:jpn" "--default-track" "0:yes" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "%%~nf.ogg" ")" "--track-order" "0:0,1:0"
rem "bin\ffmpeg.exe" -y -i %%~f -vn -map 0:0 -c:a flac %out_folder%%%~nf.flac
rem "bin\qaac64.exe" %%~nf.flac -v256 -o %%~nf.m4a
rem "bin\ffmpeg.exe" -y -i %out_folder%%%~nf.264 -i %out_folder%%%~nf.m4a -map 0:0 -map 1:0 -vcodec copy -acodec copy -shortest %out_folder%%%~nf.mp4
)

pause

Create encode-video.cmd

Create encode-video.cmd

compress all videos in %in_files% with x264 cli encoder


@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements.  See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License.  You may obtain a copy of the License at
rem
rem     http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.

rem This script creates the directory structure required for running Tomcat
rem in a separate directory by pointing %CATALINA_BASE% to it. It copies the
rem conf directory from %CATALINA_HOME%, and creates empty directories for
rem bin, lib, logs, temp, webapps, and work.
rem
rem If the file %CATALINA_HOME%/bin/setenv.sh exists then it is copied to
rem the target directory as well.
rem
rem Usage: makebase <path-to-target-directory>

setlocal

rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome

if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto EOF
:okHome

rem first arg is the target directory
set BASE_TGT=%1

if %BASE_TGT%.==. (
    rem target directory not provided; exit
    echo Usage: makebase ^<path-to-target-directory^>
    goto :EOF
)

if exist %BASE_TGT% (
  rem target directory exists
  echo Target directory exists

    rem exit if target directory is not empty
    for /F %%i in ('dir /b "%BASE_TGT%\*.*"') do (
        echo Target directory is not empty
        goto :EOF
    )
) else (
    rem create the target directory
    mkdir %BASE_TGT%
)

rem create empty directories
for %%d in (bin, lib, logs, temp, webapps, work) do (
    mkdir "%BASE_TGT%\%%d"
)

rem copy conf directory
robocopy %CATALINA_HOME%\conf %BASE_TGT%\conf > nul

rem copy setenv.bat if exists
robocopy %CATALINA_HOME%\bin %BASE_TGT%\bin setenv.bat > nul

echo Created CATALINA_BASE directory at %BASE_TGT%

echo Attention: The ports in conf\server.xml might be bound by a
echo            different instance. Please review your config files
echo            and update them where necessary.

:EOF

@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements.  See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License.  You may obtain a copy of the License at
rem
rem     http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.

rem This script creates the directory structure required for running Tomcat
rem in a separate directory by pointing %CATALINA_BASE% to it. It copies the
rem conf directory from %CATALINA_HOME%, and creates empty directories for
rem bin, lib, logs, temp, webapps, and work.
rem
rem If the file %CATALINA_HOME%/bin/setenv.sh exists then it is copied to
rem the target directory as well.
rem
rem Usage: makebase <path-to-target-directory>

setlocal

rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome

if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto EOF
:okHome

rem first arg is the target directory
set BASE_TGT=%1

if "%BASE_TGT%."==. (
    rem target directory not provided; exit
    echo Usage: makebase ^<path-to-target-directory^>
    goto :EOF
)

if exist "%BASE_TGT%" (
  rem target directory exists
  echo Target directory exists

    rem exit if target directory is not empty
    for /F %%i in ('dir /b "%BASE_TGT%\*.*"') do (
        echo Target directory is not empty
        goto :EOF
    )
) else (
    rem create the target directory
    mkdir "%BASE_TGT%"
)

rem create empty directories
for %%d in (bin, lib, logs, temp, webapps, work) do (
    mkdir "%BASE_TGT%\%%d"
)

rem copy conf directory
robocopy "%CATALINA_HOME%\conf" "%BASE_TGT%\conf" > nul

rem copy setenv.bat if exists
robocopy "%CATALINA_HOME%\bin" "%BASE_TGT%\bin" setenv.bat > nul

echo Created CATALINA_BASE directory at "%BASE_TGT%"

echo Attention: The ports in conf\server.xml might be bound by a
echo            different instance. Please review your config files
echo            and update them where necessary.

:EOF

Add "..." when using variables that may contain spaces

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


# Copyright 2009 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.

# ugly hack to deal with whitespaces in $GOROOT
nullstring :=
space := $(nullstring) # a space at the end
QUOTED_GOROOT:=$(subst $(space),\ ,$(GOROOT))

include $(QUOTED_GOROOT)/src/Make.common

PREREQ+=$(patsubst %,%.make,$(DEPS))

all: $(TARG)

$(TARG): _go_.$O $(OFILES)
	$(QUOTED_GOBIN)/$(LD) -o $@ _go_.$O $(OFILES)

_go_.$O: $(GOFILES) $(PREREQ)
	$(QUOTED_GOBIN)/$(GC) -o $@ $(GOFILES)

install: $(QUOTED_GOBIN)/$(TARG)

$(QUOTED_GOBIN)/$(TARG): $(TARG)
	cp -f $(TARG) $(QUOTED_GOBIN)

CLEANFILES+=$(TARG)

nuke: clean
	rm -f $(QUOTED_GOBIN)/$(TARG)

# Copyright 2009 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.

all: $(TARG)

# ugly hack to deal with whitespaces in $GOROOT
nullstring :=
space := $(nullstring) # a space at the end
QUOTED_GOROOT:=$(subst $(space),\ ,$(GOROOT))

include $(QUOTED_GOROOT)/src/Make.common

PREREQ+=$(patsubst %,%.make,$(DEPS))

$(TARG): _go_.$O $(OFILES)
	$(QUOTED_GOBIN)/$(LD) -o $@ _go_.$O $(OFILES)

_go_.$O: $(GOFILES) $(PREREQ)
	$(QUOTED_GOBIN)/$(GC) -o $@ $(GOFILES)

install: $(QUOTED_GOBIN)/$(TARG)

$(QUOTED_GOBIN)/$(TARG): $(TARG)
	cp -f $(TARG) $(QUOTED_GOBIN)

CLEANFILES+=$(TARG)

nuke: clean
	rm -f $(QUOTED_GOBIN)/$(TARG)

Make.cmd: make 'all' the default target (was 'clean': BUG)

R=rsc
CC=golang-dev
http://codereview.appspot.com/661041


@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements.  See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License.  You may obtain a copy of the License at
rem
rem     http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.

if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem Start/Stop Script for the CATALINA Server
rem
rem Environment Variable Prequisites
rem
rem   CATALINA_HOME   May point at your Catalina "build" directory.
rem
rem   CATALINA_BASE   (Optional) Base directory for resolving dynamic portions
rem                   of a Catalina installation.  If not present, resolves to
rem                   the same directory that CATALINA_HOME points to.
rem
rem   CATALINA_OPTS   (Optional) Java runtime options used when the "start",
rem                   or "run" command is executed.
rem
rem   CATALINA_TMPDIR (Optional) Directory path location of temporary directory
rem                   the JVM should use (java.io.tmpdir).  Defaults to
rem                   %CATALINA_BASE%\temp.
rem
rem   JAVA_HOME       Must point at your Java Development Kit installation.
rem                   Required to run the with the "debug" argument.
rem
rem   JRE_HOME        Must point at your Java Runtime installation.
rem                   Defaults to JAVA_HOME if empty.
rem
rem   JAVA_OPTS       (Optional) Java runtime options used when the "start",
rem                   "stop", or "run" command is executed.
rem
rem   JPDA_TRANSPORT  (Optional) JPDA transport used when the "jpda start"
rem                   command is executed. The default is "dt_shmem".
rem
rem   JPDA_ADDRESS    (Optional) Java runtime options used when the "jpda start"
rem                   command is executed. The default is "jdbconn".
rem
rem   JPDA_SUSPEND    (Optional) Java runtime options used when the "jpda start"
rem                   command is executed. Specifies whether JVM should suspend
rem                   execution immediately after startup. Default is "n".
rem
rem   JPDA_OPTS       (Optional) Java runtime options used when the "jpda start"
rem                   command is executed. If used, JPDA_TRANSPORT, JPDA_ADDRESS,
rem                   and JPDA_SUSPEND are ignored. Thus, all required jpda
rem                   options MUST be specified. The default is:
rem
rem                   -agentlib:jdwp=transport=%JPDA_TRANSPORT%,
rem                       address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%
rem
rem   LOGGING_CONFIG  (Optional) Override Tomcat's logging config file
rem                   Example (all one line)
rem                   set LOGGING_CONFIG="-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties"
rem
rem   LOGGING_MANAGER (Optional) Override Tomcat's logging manager
rem                   Example (all one line)
rem                   set LOGGING_CONFIG="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
rem
rem
rem
rem $Id$
rem ---------------------------------------------------------------------------

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

rem Ensure that any user defined CLASSPATH variables are not used on startup,
rem but allow them to be specified in setenv.bat, in rare case when it is needed.
set CLASSPATH=

rem Get standard environment variables
if "%CATALINA_BASE%" == "" goto gotSetenvHome
if exist "%CATALINA_BASE%\bin\setenv.bat" call "%CATALINA_BASE%\bin\setenv.bat"
goto gotSetenvBase
:gotSetenvHome
if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat"
:gotSetenvBase

rem Get standard Java environment variables
if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath
echo Cannot find "%CATALINA_HOME%\bin\setclasspath.bat"
echo This file is needed to run this program
goto end
:okSetclasspath
set "BASEDIR=%CATALINA_HOME%"
call "%CATALINA_HOME%\bin\setclasspath.bat" %1
if errorlevel 1 goto end

rem Add on extra jar file to CLASSPATH
rem Note that there are no quotes as we do not want to introduce random
rem quotes into the CLASSPATH
if "%CLASSPATH%" == "" goto emptyClasspath
set "CLASSPATH=%CLASSPATH%;"
:emptyClasspath
set "CLASSPATH=%CLASSPATH%%CATALINA_HOME%\bin\bootstrap.jar"

if not "%CATALINA_BASE%" == "" goto gotBase
set "CATALINA_BASE=%CATALINA_HOME%"
:gotBase

if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir
set "CATALINA_TMPDIR=%CATALINA_BASE%\temp"
:gotTmpdir

rem Add tomcat-juli.jar to classpath
rem tomcat-juli.jar can be over-ridden per instance
if not exist "%CATALINA_BASE%\bin\tomcat-juli.jar" goto juliClasspathHome
set "CLASSPATH=%CLASSPATH%;%CATALINA_BASE%\bin\tomcat-juli.jar"
goto juliClasspathDone
:juliClasspathHome
set "CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\tomcat-juli.jar"
:juliClasspathDone

if not "%LOGGING_CONFIG%" == "" goto noJuliConfig
set LOGGING_CONFIG=-Dnop
if not exist "%CATALINA_BASE%\conf\logging.properties" goto noJuliConfig
set LOGGING_CONFIG=-Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties"
:noJuliConfig
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%

if not "%LOGGING_MANAGER%" == "" goto noJuliManager
set LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
:noJuliManager
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%

rem ----- Execute The Requested Command ---------------------------------------

echo Using CATALINA_BASE:   "%CATALINA_BASE%"
echo Using CATALINA_HOME:   "%CATALINA_HOME%"
echo Using CATALINA_TMPDIR: "%CATALINA_TMPDIR%"
if ""%1"" == ""debug"" goto use_jdk
echo Using JRE_HOME:        "%JRE_HOME%"
goto java_dir_displayed
:use_jdk
echo Using JAVA_HOME:       "%JAVA_HOME%"
:java_dir_displayed
echo Using CLASSPATH:       "%CLASSPATH%"

set _EXECJAVA=%_RUNJAVA%
set MAINCLASS=org.apache.catalina.startup.Bootstrap
set ACTION=start
set SECURITY_POLICY_FILE=
set DEBUG_OPTS=
set JPDA=

if not ""%1"" == ""jpda"" goto noJpda
set JPDA=jpda
if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport
set JPDA_TRANSPORT=dt_socket
:gotJpdaTransport
if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
set JPDA_ADDRESS=8000
:gotJpdaAddress
if not "%JPDA_SUSPEND%" == "" goto gotJpdaSuspend
set JPDA_SUSPEND=n
:gotJpdaSuspend
if not "%JPDA_OPTS%" == "" goto gotJpdaOpts
set JPDA_OPTS=-agentlib:jdwp=transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%
:gotJpdaOpts
shift
:noJpda

if ""%1"" == ""debug"" goto doDebug
if ""%1"" == ""run"" goto doRun
if ""%1"" == ""start"" goto doStart
if ""%1"" == ""stop"" goto doStop
if ""%1"" == ""version"" goto doVersion

echo Usage:  catalina ( commands ... )
echo commands:
echo   debug             Start Catalina in a debugger
echo   debug -security   Debug Catalina with a security manager
echo   jpda start        Start Catalina under JPDA debugger
echo   run               Start Catalina in the current window
echo   run -security     Start in the current window with security manager
echo   start             Start Catalina in a separate window
echo   start -security   Start in a separate window with security manager
echo   stop              Stop Catalina
echo   version           What version of tomcat are you running?
goto end

:doDebug
shift
set _EXECJAVA=%_RUNJDB%
set DEBUG_OPTS=-sourcepath "%CATALINA_HOME%\..\..\java"
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set "SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy"
goto execCmd

:doRun
shift
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set "SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy"
goto execCmd

:doStart
shift
if not "%OS%" == "Windows_NT" goto noTitle
set _EXECJAVA=start "Tomcat" %_RUNJAVA%
goto gotTitle
:noTitle
set _EXECJAVA=start %_RUNJAVA%
:gotTitle
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set "SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy"
goto execCmd

:doStop
shift
set ACTION=stop
set CATALINA_OPTS=
goto execCmd

:doVersion
%_EXECJAVA% -classpath "%CATALINA_HOME%\lib\catalina.jar" org.apache.catalina.util.ServerInfo
goto end

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

rem Execute Java with the applicable properties
if not "%JPDA%" == "" goto doJpda
if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doSecurity
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doJpda
if not "%SECURITY_POLICY_FILE%" == "" goto doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %JPDA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %JPDA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end

:end

@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements.  See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License.  You may obtain a copy of the License at
rem
rem     http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.

if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem Start/Stop Script for the CATALINA Server
rem
rem Environment Variable Prequisites
rem
rem   CATALINA_HOME   May point at your Catalina "build" directory.
rem
rem   CATALINA_BASE   (Optional) Base directory for resolving dynamic portions
rem                   of a Catalina installation.  If not present, resolves to
rem                   the same directory that CATALINA_HOME points to.
rem
rem   CATALINA_OPTS   (Optional) Java runtime options used when the "start",
rem                   or "run" command is executed.
rem
rem   CATALINA_TMPDIR (Optional) Directory path location of temporary directory
rem                   the JVM should use (java.io.tmpdir).  Defaults to
rem                   %CATALINA_BASE%\temp.
rem
rem   JAVA_HOME       Must point at your Java Development Kit installation.
rem                   Required to run the with the "debug" argument.
rem
rem   JRE_HOME        Must point at your Java Runtime installation.
rem                   Defaults to JAVA_HOME if empty.
rem
rem   JAVA_OPTS       (Optional) Java runtime options used when the "start",
rem                   "stop", or "run" command is executed.
rem
rem   JPDA_TRANSPORT  (Optional) JPDA transport used when the "jpda start"
rem                   command is executed. The default is "dt_shmem".
rem
rem   JPDA_ADDRESS    (Optional) Java runtime options used when the "jpda start"
rem                   command is executed. The default is "jdbconn".
rem
rem   JPDA_SUSPEND    (Optional) Java runtime options used when the "jpda start"
rem                   command is executed. Specifies whether JVM should suspend
rem                   execution immediately after startup. Default is "n".
rem
rem   JPDA_OPTS       (Optional) Java runtime options used when the "jpda start"
rem                   command is executed. If used, JPDA_TRANSPORT, JPDA_ADDRESS,
rem                   and JPDA_SUSPEND are ignored. Thus, all required jpda
rem                   options MUST be specified. The default is:
rem
rem                   -agentlib:jdwp=transport=%JPDA_TRANSPORT%,
rem                       address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%
rem
rem   LOGGING_CONFIG  (Optional) Override Tomcat's logging config file
rem                   Example (all one line)
rem                   set LOGGING_CONFIG="-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties"
rem
rem   LOGGING_MANAGER (Optional) Override Tomcat's logging manager
rem                   Example (all one line)
rem                   set LOGGING_CONFIG="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
rem
rem   TITLE           (Optional) Specify the title of Tomcat window. The default
rem                   TITLE is Tomcat if it's not specified.
rem                   Example (all one line)
rem                   set TITLE=Tomcat.Cluster#1.Server#1 [%DATE% %TIME%]
rem
rem
rem
rem $Id$
rem ---------------------------------------------------------------------------

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

rem Ensure that any user defined CLASSPATH variables are not used on startup,
rem but allow them to be specified in setenv.bat, in rare case when it is needed.
set CLASSPATH=

rem Get standard environment variables
if "%CATALINA_BASE%" == "" goto gotSetenvHome
if exist "%CATALINA_BASE%\bin\setenv.bat" call "%CATALINA_BASE%\bin\setenv.bat"
goto gotSetenvBase
:gotSetenvHome
if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat"
:gotSetenvBase

rem Get standard Java environment variables
if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath
echo Cannot find "%CATALINA_HOME%\bin\setclasspath.bat"
echo This file is needed to run this program
goto end
:okSetclasspath
set "BASEDIR=%CATALINA_HOME%"
call "%CATALINA_HOME%\bin\setclasspath.bat" %1
if errorlevel 1 goto end

rem Add on extra jar file to CLASSPATH
rem Note that there are no quotes as we do not want to introduce random
rem quotes into the CLASSPATH
if "%CLASSPATH%" == "" goto emptyClasspath
set "CLASSPATH=%CLASSPATH%;"
:emptyClasspath
set "CLASSPATH=%CLASSPATH%%CATALINA_HOME%\bin\bootstrap.jar"

if not "%CATALINA_BASE%" == "" goto gotBase
set "CATALINA_BASE=%CATALINA_HOME%"
:gotBase

if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir
set "CATALINA_TMPDIR=%CATALINA_BASE%\temp"
:gotTmpdir

rem Add tomcat-juli.jar to classpath
rem tomcat-juli.jar can be over-ridden per instance
if not exist "%CATALINA_BASE%\bin\tomcat-juli.jar" goto juliClasspathHome
set "CLASSPATH=%CLASSPATH%;%CATALINA_BASE%\bin\tomcat-juli.jar"
goto juliClasspathDone
:juliClasspathHome
set "CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\tomcat-juli.jar"
:juliClasspathDone

if not "%LOGGING_CONFIG%" == "" goto noJuliConfig
set LOGGING_CONFIG=-Dnop
if not exist "%CATALINA_BASE%\conf\logging.properties" goto noJuliConfig
set LOGGING_CONFIG=-Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties"
:noJuliConfig
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%

if not "%LOGGING_MANAGER%" == "" goto noJuliManager
set LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
:noJuliManager
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%

rem ----- Execute The Requested Command ---------------------------------------

echo Using CATALINA_BASE:   "%CATALINA_BASE%"
echo Using CATALINA_HOME:   "%CATALINA_HOME%"
echo Using CATALINA_TMPDIR: "%CATALINA_TMPDIR%"
if ""%1"" == ""debug"" goto use_jdk
echo Using JRE_HOME:        "%JRE_HOME%"
goto java_dir_displayed
:use_jdk
echo Using JAVA_HOME:       "%JAVA_HOME%"
:java_dir_displayed
echo Using CLASSPATH:       "%CLASSPATH%"

set _EXECJAVA=%_RUNJAVA%
set MAINCLASS=org.apache.catalina.startup.Bootstrap
set ACTION=start
set SECURITY_POLICY_FILE=
set DEBUG_OPTS=
set JPDA=

if not ""%1"" == ""jpda"" goto noJpda
set JPDA=jpda
if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport
set JPDA_TRANSPORT=dt_socket
:gotJpdaTransport
if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
set JPDA_ADDRESS=8000
:gotJpdaAddress
if not "%JPDA_SUSPEND%" == "" goto gotJpdaSuspend
set JPDA_SUSPEND=n
:gotJpdaSuspend
if not "%JPDA_OPTS%" == "" goto gotJpdaOpts
set JPDA_OPTS=-agentlib:jdwp=transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%
:gotJpdaOpts
shift
:noJpda

if ""%1"" == ""debug"" goto doDebug
if ""%1"" == ""run"" goto doRun
if ""%1"" == ""start"" goto doStart
if ""%1"" == ""stop"" goto doStop
if ""%1"" == ""version"" goto doVersion

echo Usage:  catalina ( commands ... )
echo commands:
echo   debug             Start Catalina in a debugger
echo   debug -security   Debug Catalina with a security manager
echo   jpda start        Start Catalina under JPDA debugger
echo   run               Start Catalina in the current window
echo   run -security     Start in the current window with security manager
echo   start             Start Catalina in a separate window
echo   start -security   Start in a separate window with security manager
echo   stop              Stop Catalina
echo   version           What version of tomcat are you running?
goto end

:doDebug
shift
set _EXECJAVA=%_RUNJDB%
set DEBUG_OPTS=-sourcepath "%CATALINA_HOME%\..\..\java"
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set "SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy"
goto execCmd

:doRun
shift
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set "SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy"
goto execCmd

:doStart
shift
if not "%OS%" == "Windows_NT" goto noTitle
if "%TITLE%" == "" set TITLE=Tomcat
set _EXECJAVA=start "%TITLE%" %_RUNJAVA%
goto gotTitle
:noTitle
set _EXECJAVA=start %_RUNJAVA%
:gotTitle
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set "SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy"
goto execCmd

:doStop
shift
set ACTION=stop
set CATALINA_OPTS=
goto execCmd

:doVersion
%_EXECJAVA% -classpath "%CATALINA_HOME%\lib\catalina.jar" org.apache.catalina.util.ServerInfo
goto end

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

rem Execute Java with the applicable properties
if not "%JPDA%" == "" goto doJpda
if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doSecurity
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doJpda
if not "%SECURITY_POLICY_FILE%" == "" goto doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %JPDA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %JPDA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end

:end

Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48464
Provide an option to specify the command window title
Patch provided by LiuYan

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


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

rem  ============================================
rem
rem  Drop a JMX file on this batch script, and it
rem  will load it in the GUI.
rem
rem  Only the first parameter is used.
rem  Only works for Win2k.
rem
rem  ============================================

if "%OS%"=="Windows_NT" goto WinNT
echo "Sorry, this command file requires Windows NT/ 2000"
goto END
:WinNT

rem change to the directory in which this script resides, i.e. bin
cd %~dp0

jmeter -t %1

:END@echo off

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

rem  ============================================
rem
rem  Drop a JMX file on this batch script, and it
rem  will load it in the GUI.
rem
rem  Only the first parameter is used.
rem  Only works for Win2k.
rem
rem  ============================================

if "%OS%"=="Windows_NT" goto WinNT
echo "Sorry, this command file requires Windows NT/ 2000 / XP"
pause
goto END
:WinNT

rem change to the directory in which this script resides, i.e. bin
cd /D %~dp0

jmeter -t %1

:END

Remove duplication of old contents (how did that happen?)

git-svn-id: https://svn.apache.org/repos/asf/jakarta/jmeter/trunk@325312 13f79535-47bb-0310-9956-ffa450edef68

Former-commit-id: 4a46fe987f8a42ab6eeb6522af83d51b1f2bac8f


support use repo in windows command line


@echo ON

curl -L -O "https://github.com/opencv/opencv_contrib/archive/%PKG_VERSION%.tar.gz"
%PYTHON% -c "import tarfile, os; with tarfile.open(os.environ['PKG_VERSION'] + '.tar.gz', 'r:gz'): tar.extractall()"

rem Patches apply only to opencv_contrib so we have to apply them now (after source download above)
rem Fixed: https://github.com/opencv/opencv_contrib/blob/6cd8e9f556c8c55c05178dec05d5277ae00020d9/modules/tracking/src/trackerKCF.cpp#L669
git apply --whitespace=fix -p0 "%RECIPE_DIR%\kcftracker.patch"
rem Fixed: https://github.com/opencv/opencv_contrib/blob/master/modules/text/src/ocr_beamsearch_decoder.cpp#L569
git apply --whitespace=fix -p0 "%RECIPE_DIR%\ocr_beamsearch_decoder.patch"
rem Fixed: https://github.com/opencv/opencv_contrib/blob/master/modules/text/src/ocr_hmm_decoder.cpp#L985
git apply --whitespace=fix -p0 "%RECIPE_DIR%\ocr_hmm_decoder.patch"
rem Fixed: https://github.com/opencv/opencv_contrib/blob/master/modules/dpm/src/dpm_nms.cpp#L43
git apply --whitespace=fix -p0 "%RECIPE_DIR%\dpm.patch"

mkdir build
cd build

if "%PY3K%" == "0" (
    echo "Copying stdint.h for windows"
    copy "%LIBRARY_INC%\stdint.h" %SRC_DIR%\modules\calib3d\include\stdint.h
    copy "%LIBRARY_INC%\stdint.h" %SRC_DIR%\modules\videoio\include\stdint.h
    copy "%LIBRARY_INC%\stdint.h" %SRC_DIR%\modules\highgui\include\stdint.h
)

for /F "tokens=1,2 delims=. " %%a in ("%PY_VER%") do (
   set "PY_MAJOR=%%a"
   set "PY_MINOR=%%b"
)
set PY_LIB=python%PY_MAJOR%%PY_MINOR%.lib

cmake .. -LAH -G "NMake Makefiles"                                             ^
    -DWITH_EIGEN=1                                                             ^
    -DBUILD_TESTS=0                                                            ^
    -DBUILD_DOCS=0                                                             ^
    -DBUILD_PERF_TESTS=0                                                       ^
    -DBUILD_ZLIB=0                                                             ^
    -DBUILD_opencv_bioinspired=0                                               ^
    -DBUILD_TIFF=0                                                             ^
    -DBUILD_PNG=0                                                              ^
    -DBUILD_OPENEXR=1                                                          ^
    -DBUILD_JASPER=1                                                           ^
    -DBUILD_JPEG=0                                                             ^
    -DWITH_CUDA=0                                                              ^
    -DWITH_OPENCL=0                                                            ^
    -DWITH_OPENNI=0                                                            ^
    -DWITH_FFMPEG=0                                                            ^
    -DWITH_VTK=0                                                               ^
    -DINSTALL_C_EXAMPLES=0                                                     ^
    -DOPENCV_EXTRA_MODULES_PATH=%SRC_DIR%\opencv_contrib-%PKG_VERSION%\modules ^
    -DCMAKE_BUILD_TYPE="Release"                                               ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX%                                    ^
    -DEXECUTABLE_OUTPUT_PATH=%LIBRARY_BIN%                                     ^
    -DLIBRARY_OUTPUT_PATH=%LIBRARY_BIN%                                        ^
    -DPYTHON%PY_MAJOR%_EXECUTABLE=%PREFIX%\python                              ^
    -DPYTHON_INCLUDE_DIR=%PREFIX%\include                                      ^
    -DPYTHON_PACKAGES_PATH=%SP_DIR%                                            ^
    -DPYTHON_LIBRARY=%PREFIX%\libs\%PY_LIB%                                    ^
    -DPYTHON%PY_MAJOR%_NUMPY_INCLUDE_DIRS=%SP_DIR%\numpy\core\include
if errorlevel 1 exit 1

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

if "%ARCH%" == "32" ( set "OPENCV_ARCH=86")
if "%ARCH%" == "64" ( set "OPENCV_ARCH=64")

robocopy %LIBRARY_PREFIX%\x%OPENCV_ARCH%\vc%VS_MAJOR%\ %LIBRARY_PREFIX%\ *.* /E
if %ERRORLEVEL% GEQ 8 exit 1

rem Remove files installed in the wrong locations
rd /S /Q "%LIBRARY_BIN%\Release"
rd /S /Q "%LIBRARY_PREFIX%\x%OPENCV_ARCH%"
rem RD is a bit horrible and doesn't return an errorcode properly, so
rem the errorcode from robocopy is propagated (which is non-zero), so we
rem forcibly exit 0 here
exit 0

@echo ON

curl -L -O "https://github.com/opencv/opencv_contrib/archive/%PKG_VERSION%.tar.gz"
%PYTHON% -c "import tarfile, os; tar = tarfile.open(os.environ['PKG_VERSION'] + '.tar.gz', 'r:gz'); tar.extractall(); tar.close()"

rem Patches apply only to opencv_contrib so we have to apply them now (after source download above)
rem Fixed: https://github.com/opencv/opencv_contrib/blob/6cd8e9f556c8c55c05178dec05d5277ae00020d9/modules/tracking/src/trackerKCF.cpp#L669
git apply --whitespace=fix -p0 "%RECIPE_DIR%\kcftracker.patch"
rem Fixed: https://github.com/opencv/opencv_contrib/blob/master/modules/text/src/ocr_beamsearch_decoder.cpp#L569
git apply --whitespace=fix -p0 "%RECIPE_DIR%\ocr_beamsearch_decoder.patch"
rem Fixed: https://github.com/opencv/opencv_contrib/blob/master/modules/text/src/ocr_hmm_decoder.cpp#L985
git apply --whitespace=fix -p0 "%RECIPE_DIR%\ocr_hmm_decoder.patch"
rem Fixed: https://github.com/opencv/opencv_contrib/blob/master/modules/dpm/src/dpm_nms.cpp#L43
git apply --whitespace=fix -p0 "%RECIPE_DIR%\dpm.patch"

mkdir build
cd build

if "%PY3K%" == "0" (
    echo "Copying stdint.h for windows"
    copy "%LIBRARY_INC%\stdint.h" %SRC_DIR%\modules\calib3d\include\stdint.h
    copy "%LIBRARY_INC%\stdint.h" %SRC_DIR%\modules\videoio\include\stdint.h
    copy "%LIBRARY_INC%\stdint.h" %SRC_DIR%\modules\highgui\include\stdint.h
)

for /F "tokens=1,2 delims=. " %%a in ("%PY_VER%") do (
   set "PY_MAJOR=%%a"
   set "PY_MINOR=%%b"
)
set PY_LIB=python%PY_MAJOR%%PY_MINOR%.lib

cmake .. -LAH -G "NMake Makefiles"                                             ^
    -DWITH_EIGEN=1                                                             ^
    -DBUILD_TESTS=0                                                            ^
    -DBUILD_DOCS=0                                                             ^
    -DBUILD_PERF_TESTS=0                                                       ^
    -DBUILD_ZLIB=0                                                             ^
    -DBUILD_opencv_bioinspired=0                                               ^
    -DBUILD_TIFF=0                                                             ^
    -DBUILD_PNG=0                                                              ^
    -DBUILD_OPENEXR=1                                                          ^
    -DBUILD_JASPER=1                                                           ^
    -DBUILD_JPEG=0                                                             ^
    -DWITH_CUDA=0                                                              ^
    -DWITH_OPENCL=0                                                            ^
    -DWITH_OPENNI=0                                                            ^
    -DWITH_FFMPEG=0                                                            ^
    -DWITH_VTK=0                                                               ^
    -DINSTALL_C_EXAMPLES=0                                                     ^
    -DOPENCV_EXTRA_MODULES_PATH=%SRC_DIR%\opencv_contrib-%PKG_VERSION%\modules ^
    -DCMAKE_BUILD_TYPE="Release"                                               ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX%                                    ^
    -DEXECUTABLE_OUTPUT_PATH=%LIBRARY_BIN%                                     ^
    -DLIBRARY_OUTPUT_PATH=%LIBRARY_BIN%                                        ^
    -DPYTHON%PY_MAJOR%_EXECUTABLE=%PREFIX%\python                              ^
    -DPYTHON_INCLUDE_DIR=%PREFIX%\include                                      ^
    -DPYTHON_PACKAGES_PATH=%SP_DIR%                                            ^
    -DPYTHON_LIBRARY=%PREFIX%\libs\%PY_LIB%                                    ^
    -DPYTHON%PY_MAJOR%_NUMPY_INCLUDE_DIRS=%SP_DIR%\numpy\core\include
if errorlevel 1 exit 1

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

if "%ARCH%" == "32" ( set "OPENCV_ARCH=86")
if "%ARCH%" == "64" ( set "OPENCV_ARCH=64")

robocopy %LIBRARY_PREFIX%\x%OPENCV_ARCH%\vc%VS_MAJOR%\ %LIBRARY_PREFIX%\ *.* /E
if %ERRORLEVEL% GEQ 8 exit 1

rem Remove files installed in the wrong locations
rd /S /Q "%LIBRARY_BIN%\Release"
rd /S /Q "%LIBRARY_PREFIX%\x%OPENCV_ARCH%"
rem RD is a bit horrible and doesn't return an errorcode properly, so
rem the errorcode from robocopy is propagated (which is non-zero), so we
rem forcibly exit 0 here
exit 0

Fix bad Python syntax

Fix bad Python syntax


if "%1"=="" goto default_value_python:
set pythonexe="%1"
%pythonexe% setup.py write_version
goto custom_python:

:default_value_python:
set pythonexe="c:\Python34_x64\python"
:custom_python:
%pythonexe% -u setup.py build_script
if %errorlevel% neq 0 exit /b %errorlevel%

if "%1"=="" goto default_value_python:
set pythonexe="%1"
%pythonexe% setup.py write_version
goto custom_python:

:default_value_python:
set pythonexe="c:\Python35_x64\python"
:custom_python:
%pythonexe% -u setup.py build_script
if %errorlevel% neq 0 exit /b %errorlevel%

update build_script

update build_script


update build_script

update build_script