@echo off
REM /!\ THIS SCRIPT SUPPOSE A FIXED PATH FOR PYTHON /!\
REM Each blocks could be triggered independently (i.e. commenting others)
REM run it as:
REM cmd /c tools\release\build_delivery_win.cmd all

REM make few tools available
set PATH=%PATH%;tools;tools\win
set PRG=%0

REM Print version
make.exe print-OR_TOOLS_VERSION | tee.exe build.log

:: Display help if no argument
if "%1"=="" (
call :PRINT_HELP
exit /B %ERRORLEVEL%
)

if "%1"=="help" (
call :PRINT_HELP
exit /B %ERRORLEVEL%
)

if "%ORTOOLS_TOKEN%"=="" (
echo ORTOOLS_TOKEN: NOT FOUND | tee.exe -a build.log
exit /B 1
)

FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-parse --abbrev-ref HEAD`) DO (SET BRANCH=%%F)
FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-parse --verify HEAD`) DO (SET SHA1=%%F)
echo BRANCH: %BRANCH% | tee.exe -a build.log
echo SHA1: %SHA1% | tee.exe -a build.log

md export

if "%1"=="java" (
call :BUILD_CXX
call :BUILD_JAVA
exit /B %ERRORLEVEL%
)

if "%1"=="dotnet" (
call :BUILD_CXX
call :BUILD_DOTNET
exit /B %ERRORLEVEL%
)

if "%1"=="python" (
call :BUILD_CXX
call :BUILD_PYTHON
exit /B %ERRORLEVEL%
)

if "%1"=="archive" (
call :BUILD_CXX
call :BUILD_JAVA
call :BUILD_DOTNET
call :BUILD_ARCHIVE
exit /B %ERRORLEVEL%
)

if "%1"=="examples" (
call :BUILD_EXAMPLES
exit /B %ERRORLEVEL%
)

if "%1"=="all" (
call :BUILD_CXX
call :BUILD_JAVA
call :BUILD_DOTNET
call :BUILD_ARCHIVE
call :BUILD_EXAMPLES
call :BUILD_PYTHON
exit /B %ERRORLEVEL%
)

if "%1"=="reset" (
echo clean everything... | tee.exe -a build.log
make.exe clean || exit 1
make.exe clean_third_party || exit 1
rm.exe -rf export
del or-tools.snk
for %%i in (*.zip) DO del %%i
for %%i in (*.whl) DO del %%i
for %%i in (*.log) DO del %%i
exit /B %ERRORLEVEL%
)

echo unknow target %1
exit /B 1

:PRINT_HELP
echo NAME
echo   %PRG% - Build delivery using the local host system.
echo SYNOPSIS
echo   %PRG% [help] dotnet^|java^|python^|archive^|examples^|all^|reset
echo DESCRIPTION
echo   Build Google OR-Tools deliveries.
echo   You MUST define the following variables before running this script:
echo   * ORTOOLS_TOKEN: secret use to decrypt key to sign dotnet and java package.
echo.
echo OPTIONS
echo   help: show this help text (default)
echo   dotnet: Build dotnet packages
echo   java: Build java packages
echo   python: Build python packages
echo   archive: Build archive
echo   examples: Build examples archives
echo   all: build everything
echo   reset: delete all artifacts and suppress cache file
echo.
echo EXAMPLES
echo   cmd /c %PRG%
exit /B 0

:BUILD_CXX
title Build C++
set HASH=
for /F "tokens=* delims=" %%x in (build_cxx.log) do (set HASH=%%x)
if "%HASH%"=="%BRANCH% %SHA1%" (
echo C++ build seems up to date, skipping
exit /B 0
)

REM Check C++
which.exe cmake || exit 1
which.exe cmake | tee.exe -a build.log

REM clean everything
echo clean everything... | tee.exe -a build.log
make.exe clean_third_party || exit 1
make.exe clean || exit 1

REM THIRD PARTY
echo make third_party: ... | tee.exe -a build.log
make.exe third_party WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make third_party: DONE | tee.exe -a build.log

echo make cc: ... | tee.exe -a build.log
make.exe cc WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make cc: DONE | tee.exe -a build.log
REM make.exe test_cc WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
REM echo make test_cc: DONE | tee.exe -a build.log

echo make fz: ... | tee.exe -a build.log
make.exe fz WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make fz: DONE | tee.exe -a build.log

echo %BRANCH% %SHA1%>build_cxx.log
exit /B 0

:BUILD_JAVA
title Build Java
set HASH=
for /F "tokens=* delims=" %%x in (build_java.log) do (set HASH=%%x)
if "%HASH%"=="%BRANCH% %SHA1%" (
echo Java build seems up to date, skipping
exit /B 0
)

REM Check Java
echo JAVA_HOME: %JAVA_HOME% | tee.exe -a build.log
which.exe java || exit 1
which.exe java | tee.exe -a build.log
which.exe mvn || exit 1
which.exe mvn | tee.exe -a build.log

which.exe gpg || exit 1
which.exe gpg | tee.exe -a build.log
which.exe openssl || exit 1
which.exe openssl | tee.exe -a build.log

REM Install Java GPG
echo Install Java GPG: ... | tee.exe -a build.log
openssl aes-256-cbc -iter 42 -pass pass:%ORTOOLS_TOKEN% -in tools\release\private-key.gpg.enc -out private-key.gpg -d
gpg --batch --import private-key.gpg
del private-key.gpg
mkdir -p %userprofile%/.m2
openssl aes-256-cbc -iter 42 -pass pass:%ORTOOLS_TOKEN% -in tools\release\settings.xml.enc -out %userprofile%/.m2/settings.xml -d
echo Install Java GPG: DONE | tee -a build.log

echo make java: ... | tee.exe -a build.log
make.exe java WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make java: DONE | tee.exe -a build.log
REM make.exe test_java WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
REM echo make test_java: DONE | tee.exe -a build.log

for %%i in (temp_java\ortools-win32-x86-64\target\*.jar*) do (
  echo Copy %%i to export... | tee.exe -a build.log
  copy %%i export\.
  echo Copy %%i to export...DONE | tee.exe -a build.log
)
for %%i in (temp_java\ortools-java\target\*.jar*) do (
  echo Copy %%i to export... | tee.exe -a build.log
  copy %%i export\.
  echo Copy %%i to export...DONE | tee.exe -a build.log
)
echo %BRANCH% %SHA1%>build_java.log
exit /B 0

:BUILD_DOTNET
title Build .Net
set HASH=
for /F "tokens=* delims=" %%x in (build_dotnet.log) do (set HASH=%%x)
if "%HASH%"=="%BRANCH% %SHA1%" (
echo .Net build seems up to date, skipping
exit /B 0
)

REM Check .Net
which.exe dotnet || exit 1
which.exe dotnet | tee.exe -a build.log

REM Install .Net snk
echo Install .Net snk | tee.exe -a build.log
openssl aes-256-cbc -iter 42 -pass pass:%ORTOOLS_TOKEN% -in tools\release\or-tools.snk.enc -out or-tools.snk -d
set DOTNET_SNK=or-tools.snk

echo make dotnet: ... | tee.exe -a build.log
make.exe dotnet WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make dotnet: DONE | tee.exe -a build.log
REM make.exe test_dotnet WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
REM echo make test_dotnet: DONE | tee.exe -a build.log

for %%i in (packages\*nupkg*) do (
  echo Copy %%i to export... | tee.exe -a build.log
  copy %%i export\.
  echo Copy %%i to export...DONE | tee.exe -a build.log
)
echo %BRANCH% %SHA1%>build_dotnet.log
exit /B 0

REM Create Archive
:BUILD_ARCHIVE
title Build archives
set HASH=
for /F "tokens=* delims=" %%x in (build_archive.log) do (set HASH=%%x)
if "%HASH%"=="%BRANCH% %SHA1%" (
echo Archive build seems up to date, skipping
exit /B 0
)

make.exe archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make archive: DONE | tee.exe -a build.log
make.exe test_archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make test_archive: DONE | tee.exe -a build.log
make.exe fz_archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make fz_archive: DONE | tee.exe -a build.log
make.exe test_fz_archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make test_fz_archive: DONE | tee.exe -a build.log

for %%i in (or-tools_*VisualStudio2019-64bit*.zip) do (
  echo Move %%i to export... | tee.exe -a build.log
  move %%i export\.
  echo Move %%i to export...DONE | tee.exe -a build.log
)
echo %BRANCH% %SHA1%>build_archive.log
exit /B 0

REM Build Examples Archives
:BUILD_EXAMPLES
title Build examples
set HASH=
for /F "tokens=* delims=" %%x in (build_examples.log) do (set HASH=%%x)
if "%HASH%"=="%BRANCH% %SHA1%" (
echo Examples build seems up to date, skipping
exit /B 0
)

rm.exe -rf temp *.zip || exit 1
echo Build examples archives... | tee.exe -a build.log
echo   C++ examples archive... | tee.exe -a build.log
make.exe cc_examples_archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo   Python examples archive... | tee.exe -a build.log
make.exe python_examples_archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo   Java examples archive... | tee.exe -a build.log
make.exe java_examples_archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo   .Net examples archive... | tee.exe -a build.log
make.exe dotnet_examples_archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo DONE | tee.exe -a build.log

for %%i in (or-tools_*_examples_*.zip) do (
  echo Move %%i to export... | tee.exe -a build.log
  move %%i export\.
  echo Move %%i to export...DONE | tee.exe -a build.log
)
echo %BRANCH% %SHA1%>build_examples.log
exit /B 0

REM PYTHON 3.6,3.7,3.8,3.9
:BUILD_PYTHON
title Build Python
set HASH=
for /F "tokens=* delims=" %%x in (build_python.log) do (set HASH=%%x)
if "%HASH%"=="%BRANCH% %SHA1%" (
echo Python build seems up to date, skipping
exit /B 0
)

for %%v in (6 7 8 9) do (
  title Build Python 3.%%v
  REM Check Python
  which.exe C:\python3%%v-64\python.exe || exit 1
  echo C:\python3%%v-64\python.exe: FOUND | tee.exe -a build.log
  C:\python3%%v-64\python.exe -m pip install --user absl-py mypy-protobuf
  set PATH=%PATH%;%userprofile%\appdata\roaming\python\python3%%v\Scripts
  set PATH=%PATH%;C:\python3%%v-64\Scripts

  echo Cleaning Python... | tee.exe -a build.log
 make.exe clean_python WINDOWS_PATH_TO_PYTHON=c:\python3%%v-64
  echo Cleaning Python...DONE | tee.exe -a build.log

  REM make.exe python WINDOWS_PATH_TO_PYTHON=c:\python3%%v-64 || exit 1
  REM echo make python3.%%v: DONE | tee.exe -a build.log
  REM make.exe test_python WINDOWS_PATH_TO_PYTHON=c:\python3%%v-64 || exit 1
  REM echo make test_python3.%%v: DONE | tee.exe -a build.log
  echo Rebuild Python3.%%v pypi archive... | tee.exe -a build.log
  make.exe package_python WINDOWS_PATH_TO_PYTHON=c:\python3%%v-64 || exit 1
  echo Rebuild Python3.%%v pypi archive...DONE | tee.exe -a build.log
  echo Test Python3.%%v pypi archive... | tee.exe -a build.log
  make.exe test_package_python WINDOWS_PATH_TO_PYTHON=c:\python3%%v-64 || exit 1
  echo Test Python3.%%v pypi archive...DONE | tee.exe -a build.log

  for %%i in (temp_python3%%v\ortools\dist\*.whl) do (
    echo Copy %%i to export... | tee.exe -a build.log
    copy %%i export\.
    echo Copy %%i to export...DONE | tee.exe -a build.log
  )
)

echo %BRANCH% %SHA1%>build_python.log
exit /B 0

@echo off
REM /!\ THIS SCRIPT SUPPOSE A FIXED PATH FOR PYTHON /!\
REM Each blocks could be triggered independently (i.e. commenting others)
REM run it as:
REM cmd /c tools\release\build_delivery_win.cmd all

REM make few tools available
set PATH=%PATH%;tools;tools\win
set PRG=%0

REM Print version
make.exe print-OR_TOOLS_VERSION | tee.exe build.log

:: Display help if no argument
if "%1"=="" (
call :PRINT_HELP
exit /B %ERRORLEVEL%
)

if "%1"=="help" (
call :PRINT_HELP
exit /B %ERRORLEVEL%
)

if "%ORTOOLS_TOKEN%"=="" (
echo ORTOOLS_TOKEN: NOT FOUND | tee.exe -a build.log
exit /B 1
)

FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-parse --abbrev-ref HEAD`) DO (SET BRANCH=%%F)
FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-parse --verify HEAD`) DO (SET SHA1=%%F)
echo BRANCH: %BRANCH% | tee.exe -a build.log
echo SHA1: %SHA1% | tee.exe -a build.log

md export

if "%1"=="java" (
call :BUILD_CXX
call :BUILD_JAVA
exit /B %ERRORLEVEL%
)

if "%1"=="dotnet" (
call :BUILD_CXX
call :BUILD_DOTNET
exit /B %ERRORLEVEL%
)

if "%1"=="python" (
call :BUILD_CXX
call :BUILD_PYTHON
exit /B %ERRORLEVEL%
)

if "%1"=="archive" (
call :BUILD_CXX
call :BUILD_JAVA
call :BUILD_DOTNET
call :BUILD_ARCHIVE
exit /B %ERRORLEVEL%
)

if "%1"=="examples" (
call :BUILD_EXAMPLES
exit /B %ERRORLEVEL%
)

if "%1"=="all" (
call :BUILD_CXX
call :BUILD_JAVA
call :BUILD_DOTNET
call :BUILD_ARCHIVE
call :BUILD_EXAMPLES
call :BUILD_PYTHON
exit /B %ERRORLEVEL%
)

if "%1"=="reset" (
echo clean everything... | tee.exe -a build.log
make.exe clean || exit 1
make.exe clean_third_party || exit 1
rm.exe -rf export
del or-tools.snk
for %%i in (*.zip) DO del %%i
for %%i in (*.whl) DO del %%i
for %%i in (*.log) DO del %%i
exit /B %ERRORLEVEL%
)

echo unknow target %1
exit /B 1

:PRINT_HELP
echo NAME
echo   %PRG% - Build delivery using the local host system.
echo SYNOPSIS
echo   %PRG% [help] dotnet^|java^|python^|archive^|examples^|all^|reset
echo DESCRIPTION
echo   Build Google OR-Tools deliveries.
echo   You MUST define the following variables before running this script:
echo   * ORTOOLS_TOKEN: secret use to decrypt key to sign dotnet and java package.
echo.
echo OPTIONS
echo   help: show this help text (default)
echo   dotnet: Build dotnet packages
echo   java: Build java packages
echo   python: Build python packages
echo   archive: Build archive
echo   examples: Build examples archives
echo   all: build everything
echo   reset: delete all artifacts and suppress cache file
echo.
echo EXAMPLES
echo   cmd /c %PRG%
exit /B 0

:BUILD_CXX
title Build C++
set HASH=
for /F "tokens=* delims=" %%x in (build_cxx.log) do (set HASH=%%x)
if "%HASH%"=="%BRANCH% %SHA1%" (
echo C++ build seems up to date, skipping
exit /B 0
)

REM Check C++
which.exe cmake || exit 1
which.exe cmake | tee.exe -a build.log

REM clean everything
echo clean everything... | tee.exe -a build.log
make.exe clean_third_party || exit 1
make.exe clean || exit 1

REM THIRD PARTY
echo make third_party: ... | tee.exe -a build.log
make.exe third_party WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make third_party: DONE | tee.exe -a build.log

echo make cc: ... | tee.exe -a build.log
make.exe cc WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make cc: DONE | tee.exe -a build.log
REM make.exe test_cc WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
REM echo make test_cc: DONE | tee.exe -a build.log

echo make fz: ... | tee.exe -a build.log
make.exe fz WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make fz: DONE | tee.exe -a build.log

echo %BRANCH% %SHA1%>build_cxx.log
exit /B 0

:BUILD_JAVA
title Build Java
set HASH=
for /F "tokens=* delims=" %%x in (build_java.log) do (set HASH=%%x)
if "%HASH%"=="%BRANCH% %SHA1%" (
echo Java build seems up to date, skipping
exit /B 0
)

REM Check Java
echo JAVA_HOME: %JAVA_HOME% | tee.exe -a build.log
which.exe java || exit 1
which.exe java | tee.exe -a build.log
which.exe mvn || exit 1
which.exe mvn | tee.exe -a build.log

which.exe gpg || exit 1
which.exe gpg | tee.exe -a build.log
which.exe openssl || exit 1
which.exe openssl | tee.exe -a build.log

REM Install Java GPG
echo Install Java GPG: ... | tee.exe -a build.log
openssl aes-256-cbc -iter 42 -pass pass:%ORTOOLS_TOKEN% -in tools\release\private-key.gpg.enc -out private-key.gpg -d
gpg --batch --import private-key.gpg
del private-key.gpg
mkdir -p %userprofile%/.m2
openssl aes-256-cbc -iter 42 -pass pass:%ORTOOLS_TOKEN% -in tools\release\settings.xml.enc -out %userprofile%/.m2/settings.xml -d
echo Install Java GPG: DONE | tee -a build.log

echo make java: ... | tee.exe -a build.log
make.exe java WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make java: DONE | tee.exe -a build.log
REM make.exe test_java WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
REM echo make test_java: DONE | tee.exe -a build.log

for %%i in (temp_java\ortools-win32-x86-64\target\*.jar*) do (
  echo Copy %%i to export... | tee.exe -a build.log
  copy %%i export\.
  echo Copy %%i to export...DONE | tee.exe -a build.log
)
for %%i in (temp_java\ortools-java\target\*.jar*) do (
  echo Copy %%i to export... | tee.exe -a build.log
  copy %%i export\.
  echo Copy %%i to export...DONE | tee.exe -a build.log
)
echo %BRANCH% %SHA1%>build_java.log
exit /B 0

:BUILD_DOTNET
title Build .Net
set HASH=
for /F "tokens=* delims=" %%x in (build_dotnet.log) do (set HASH=%%x)
if "%HASH%"=="%BRANCH% %SHA1%" (
echo .Net build seems up to date, skipping
exit /B 0
)

REM Check .Net
which.exe dotnet || exit 1
which.exe dotnet | tee.exe -a build.log

REM Install .Net snk
echo Install .Net snk | tee.exe -a build.log
openssl aes-256-cbc -iter 42 -pass pass:%ORTOOLS_TOKEN% -in tools\release\or-tools.snk.enc -out or-tools.snk -d
set DOTNET_SNK=or-tools.snk

echo make dotnet: ... | tee.exe -a build.log
make.exe dotnet WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make dotnet: DONE | tee.exe -a build.log
REM make.exe test_dotnet WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
REM echo make test_dotnet: DONE | tee.exe -a build.log

for %%i in (packages\*nupkg*) do (
  echo Copy %%i to export... | tee.exe -a build.log
  copy %%i export\.
  echo Copy %%i to export...DONE | tee.exe -a build.log
)
echo %BRANCH% %SHA1%>build_dotnet.log
exit /B 0

REM Create Archive
:BUILD_ARCHIVE
title Build archives
set HASH=
for /F "tokens=* delims=" %%x in (build_archive.log) do (set HASH=%%x)
if "%HASH%"=="%BRANCH% %SHA1%" (
echo Archive build seems up to date, skipping
exit /B 0
)

make.exe archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make archive: DONE | tee.exe -a build.log
make.exe test_archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make test_archive: DONE | tee.exe -a build.log
make.exe fz_archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make fz_archive: DONE | tee.exe -a build.log
make.exe test_fz_archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo make test_fz_archive: DONE | tee.exe -a build.log

for %%i in (or-tools_*VisualStudio2019-64bit*.zip) do (
  echo Move %%i to export... | tee.exe -a build.log
  move %%i export\.
  echo Move %%i to export...DONE | tee.exe -a build.log
)
echo %BRANCH% %SHA1%>build_archive.log
exit /B 0

REM Build Examples Archives
:BUILD_EXAMPLES
title Build examples
set HASH=
for /F "tokens=* delims=" %%x in (build_examples.log) do (set HASH=%%x)
if "%HASH%"=="%BRANCH% %SHA1%" (
echo Examples build seems up to date, skipping
exit /B 0
)

rm.exe -rf temp *.zip || exit 1
echo Build examples archives... | tee.exe -a build.log
echo   C++ examples archive... | tee.exe -a build.log
make.exe cc_examples_archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo   Python examples archive... | tee.exe -a build.log
make.exe python_examples_archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo   Java examples archive... | tee.exe -a build.log
make.exe java_examples_archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo   .Net examples archive... | tee.exe -a build.log
make.exe dotnet_examples_archive WINDOWS_PATH_TO_PYTHON=c:\python39-64 || exit 1
echo DONE | tee.exe -a build.log

for %%i in (or-tools_*_examples_*.zip) do (
  echo Move %%i to export... | tee.exe -a build.log
  move %%i export\.
  echo Move %%i to export...DONE | tee.exe -a build.log
)
echo %BRANCH% %SHA1%>build_examples.log
exit /B 0

REM PYTHON 3.6,3.7,3.8,3.9
:BUILD_PYTHON
title Build Python
set HASH=
for /F "tokens=* delims=" %%x in (build_python.log) do (set HASH=%%x)
if "%HASH%"=="%BRANCH% %SHA1%" (
echo Python build seems up to date, skipping
exit /B 0
)

for %%v in (6 7 8 9) do (
  title Build Python 3.%%v
  REM Check Python
  which.exe C:\python3%%v-64\python.exe || exit 1
  echo C:\python3%%v-64\python.exe: FOUND | tee.exe -a build.log
  C:\python3%%v-64\python.exe -m pip install --user absl-py mypy-protobuf
  set PATH+=;%userprofile%\appdata\roaming\python\python3%%v\Scripts"
  set PATH+=;C:\python3%%v-64\Scripts"

  echo Cleaning Python... | tee.exe -a build.log
 make.exe clean_python WINDOWS_PATH_TO_PYTHON=c:\python3%%v-64
  echo Cleaning Python...DONE | tee.exe -a build.log

  REM make.exe python WINDOWS_PATH_TO_PYTHON=c:\python3%%v-64 || exit 1
  REM echo make python3.%%v: DONE | tee.exe -a build.log
  REM make.exe test_python WINDOWS_PATH_TO_PYTHON=c:\python3%%v-64 || exit 1
  REM echo make test_python3.%%v: DONE | tee.exe -a build.log
  echo Rebuild Python3.%%v pypi archive... | tee.exe -a build.log
  make.exe package_python WINDOWS_PATH_TO_PYTHON=c:\python3%%v-64 || exit 1
  echo Rebuild Python3.%%v pypi archive...DONE | tee.exe -a build.log
  echo Test Python3.%%v pypi archive... | tee.exe -a build.log
  make.exe test_package_python WINDOWS_PATH_TO_PYTHON=c:\python3%%v-64 || exit 1
  echo Test Python3.%%v pypi archive...DONE | tee.exe -a build.log

  for %%i in (temp_python3%%v\ortools\dist\*.whl) do (
    echo Copy %%i to export... | tee.exe -a build.log
    copy %%i export\.
    echo Copy %%i to export...DONE | tee.exe -a build.log
  )
)

echo %BRANCH% %SHA1%>build_python.log
exit /B 0

Fix windows script

Fix windows script


cd vendors

cd cpp-libface\libface-project
qmake "CONFIG+=%configuration%" libface.pro
nmake.exe
copy %configuration%\face.* ..\..\..\libs
cd ..\..

cd ssdll\src\ssdll
qmake "CONFIG+=%configuration% appveyor" ssdll.pro
nmake.exe
copy %configuration%\ssdll.* ..\..\..\..\libs

cd ..\..\..\..\src

echo "Current directory is:"
echo %cd%

Fix for AppVeyor

Fix for AppVeyor


@ECHO ON
SETLOCAL

::SET VARIABLE
SET VERSION=J7.0.0.2
SET NEXT_VERSION=J7.0.0.3-SNAPSHOT

::STARTING
echo executing in current dir "%~dp0"
CD "%~dp0"

::update version fro all current related project
mvn release:clean release:prepare -Dresume=false -DreleaseVersion=%VERSION% -DdevelopmentVersion=%NEXT_VERSION%
mvn versions:set -DnewVersion=%VERSION% -DprocessAllModules
mvn clean install
mvn versions:commit -DprocessAllModules
git commit
mvn release:perform
GOTO:EOF

## LABEL
:ROLLBACK
mvn release:rollback
mvn versions:revert

:FINISH
ENDLOCAL

add script to update maven version and tag


Add create.bat to create the virtual machine on windows


@REM Copyright (c) Microsoft. All rights reserved.
@REM Licensed under the MIT license. See LICENSE file in the project root for full license information.

@REM -----------------------------------------------------------------------------------------------
@REM -- NOTE: THESE INSTRUCTIONS ARE FOR MICROSOFT INTERNAL USE ONLY FOR SIGNING DLLs
@REM -- Running this script requires the following:
@REM -- 	1. Must be logged into the team's Employee Approval Bypass Authorization account (EABA)
@REM --		2. Machine must be setup for CodeSign
@REM --		3. CodeSignUtility (csu.exe) installed and added to system path
@REM --	Refer to the Microsoft internal site http://codesigninfo for details
@REM -----------------------------------------------------------------------------------------------

@setlocal EnableExtensions EnableDelayedExpansion
@echo off

rem **********************************
rem * Specify the Build Root Folders *
rem **********************************

rem - Specify the Azure SDK client build root
set current-path=%~dp0
set current-path=%current-path:~0,-1%
set client-build-root=%current-path%\..\..
for %%i in ("%client-build-root%") do set client-build-root=%%~fi
echo Client Build root is %client-build-root%

rem -- Clear directories before starting process
del /F /Q %client-build-root%\build\tosign
del /F /Q %client-build-root%\build\signed

rem ******************************************************************
rem * Sign the Managed DLLs with both "Authenticode" & "Strong Name" *
rem ******************************************************************

rem -- Copy the managed dlls to the "tosign" Folder for signing
xcopy /q /y /R %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client\bin\Release_Delay_Sign\Microsoft.Azure.Devices.Client.dll %client-build-root%\build\tosign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client.PCL\bin\Release_Delay_Sign\Microsoft.Azure.Devices.Client.PCL.dll %client-build-root%\build\tosign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client.WinRT\bin\Release_Delay_Sign\Microsoft.Azure.Devices.Client.winmd %client-build-root%\build\tosign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\csharp\service\Microsoft.Azure.Devices\bin\Release_Delay_Sign\Microsoft.Azure.Devices.dll %client-build-root%\build\tosign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

rem -- Auto-sign the managed dlls placed in the "tosign" Folder
csu.exe /s=True /w=True /i=%client-build-root%\build\tosign /o=%client-build-root%\build\signed /c1=72 /c2=401 /d="Signing Azure IoT Managed Client binaries"
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

rem -- Copy the signed managed dlls back to their respective build output directories
xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.Client.dll %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client\bin\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.Client.dll %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client\obj\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.Client.PCL.dll %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client.PCL\bin\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.Client.PCL.dll %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client.PCL\obj\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.Client.winmd %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client.WinRT\bin\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.Client.winmd %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client.WinRT\obj\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.dll %client-build-root%\csharp\service\Microsoft.Azure.Devices\bin\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.dll %client-build-root%\csharp\service\Microsoft.Azure.Devices\obj\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

rem -- Clean directories
del /F /Q %client-build-root%\build\tosign
del /F /Q %client-build-root%\build\signed

@REM Copyright (c) Microsoft. All rights reserved.
@REM Licensed under the MIT license. See LICENSE file in the project root for full license information.

@REM -----------------------------------------------------------------------------------------------
@REM -- NOTE: THESE INSTRUCTIONS ARE FOR MICROSOFT INTERNAL USE ONLY FOR SIGNING DLLs
@REM -- Running this script requires the following:
@REM -- 	1. Must be logged into the team's Employee Approval Bypass Authorization account (EABA)
@REM --		2. Machine must be setup for CodeSign
@REM --		3. CodeSignUtility (csu.exe) installed and added to system path
@REM --	Refer to the Microsoft internal site http://codesigninfo for details
@REM -----------------------------------------------------------------------------------------------

@setlocal EnableExtensions EnableDelayedExpansion
@echo off

rem **********************************
rem * Specify the Build Root Folders *
rem **********************************

rem - Specify the Azure SDK client build root
set current-path=%~dp0
set current-path=%current-path:~0,-1%
set client-build-root=%current-path%\..\..
for %%i in ("%client-build-root%") do set client-build-root=%%~fi
echo Client Build root is %client-build-root%

rem -- Clear directories before starting process
del /F /Q %client-build-root%\build\tosign
del /F /Q %client-build-root%\build\signed

rem ******************************************************************
rem * Sign the Managed DLLs with both "Authenticode" & "Strong Name" *
rem ******************************************************************

rem -- Copy the managed dlls to the "tosign" Folder for signing
xcopy /q /y /R %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client\bin\Release_Delay_Sign\Microsoft.Azure.Devices.Client.dll %client-build-root%\build\tosign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client.PCL\bin\Release_Delay_Sign\Microsoft.Azure.Devices.Client.PCL.dll %client-build-root%\build\tosign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client.WinRT\bin\Release_Delay_Sign\Microsoft.Azure.Devices.Client.winmd %client-build-root%\build\tosign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\csharp\service\Microsoft.Azure.Devices\bin\Release_Delay_Sign\Microsoft.Azure.Devices.dll %client-build-root%\build\tosign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\csharp\service\Microsoft.Azure.Devices.Uwp\bin\Release_Delay_Sign\Microsoft.Azure.Devices.Uwp.dll %client-build-root%\build\tosign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

rem -- Auto-sign the managed dlls placed in the "tosign" Folder
csu.exe /s=True /w=True /i=%client-build-root%\build\tosign /o=%client-build-root%\build\signed /c1=72 /c2=401 /d="Signing Azure IoT Managed Client binaries"
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

rem -- Copy the signed managed dlls back to their respective build output directories
xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.Client.dll %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client\bin\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.Client.dll %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client\obj\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.Client.PCL.dll %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client.PCL\bin\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.Client.PCL.dll %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client.PCL\obj\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.Client.winmd %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client.WinRT\bin\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.Client.winmd %client-build-root%\csharp\device\Microsoft.Azure.Devices.Client.WinRT\obj\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.dll %client-build-root%\csharp\service\Microsoft.Azure.Devices\bin\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.dll %client-build-root%\csharp\service\Microsoft.Azure.Devices\obj\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.Uwp.dll %client-build-root%\csharp\service\Microsoft.Azure.Devices.Uwp\bin\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

xcopy /q /y /R %client-build-root%\build\signed\Microsoft.Azure.Devices.Uwp.dll %client-build-root%\csharp\service\Microsoft.Azure.Devices.Uwp\obj\Release_Delay_Sign\
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

rem -- Clean directories
del /F /Q %client-build-root%\build\tosign
del /F /Q %client-build-root%\build\signed

Add Microsoft.Azure.Devices.Uwp.dll in auto-sign script.


"%R%" CMD INSTALL --build . %R_ARGS%
IF %ERRORLEVEL% NEQ 0 exit /B 1

Update bld.bat

Update bld.bat


remove publish from normal build and run tests scripts


@echo off
yasm 1spf.asm -o 1spf.bin
yasm 1spf2.asm -o 1spf2.bin
yasm 1spf_intermittent.asm -o 1spf_intermittent.bin -l 1spf_intermittent.lst
yasm 1spf2_intermittent.asm -o 1spf2_intermittent.bin
yasm visible_lockstep.asm -o visible_lockstep.bin
yasm 1spf3.asm -o 1spf3.bin
yasm 1spf4.asm -o 1spf4.bin
yasm 1spf4_single.asm -o 1spf4_single.bin
yasm 1spf_unrolled.asm -o 1spf_unrolled.bin
yasm rose.asm -o r.com -l rcom.lst
copy /b r.com+\pictures\reenigne\cga2ntsc\rose_out_rgbi.dat rose.com
yasm rose.asm -o r.bin -dbin=1 -l r.lst
copy /b r.bin+\pictures\reenigne\cga2ntsc\rose_out_rgbi.dat rose.bin
yasm 1spf_newstart.asm -o 1spf_newstart.bin -l 1spf_newstart.lst
yasm 1spf_newstart2.asm -o 1spf_newstart2.bin -l 1spf_newstart2.lst
yasm start_address_latch.asm -o start_address_latch.bin
yasm 1spf_nolockstep.asm -o 1spf_nolockstep.bin -l 1spf_nolockstep.lst
yasm 1spf_horizontal.asm -o 1spf_horizontal.bin
yasm lake.asm -o l.com -l lcom.lst
copy /b l.com+\lake_test_demo.bin lake.com
yasm lake.asm -o l.bin -dbin=1 -l l.lst
copy /b l.bin+\lake_test_demo.bin lake.bin
yasm coppers.asm -o coppers.com -l ccom.lst
yasm coppers.asm -o coppers.bin -dbin=1 -l c.lst
nasm wibble.asm -o wibble.obj -f obj -l wibble.lst
..\..\..\..\Projects\Code\8088mph\tools\2obj\2obj b /s ..\..\..\..\Projects\Code\8088mph\wibble\t\wibdata.dat wibdata.obj .HUGE:wibdata
rem ..\..\..\..\Projects\Code\8088mph\tools\2obj\2obj b /s ..\..\..\..\Pictures\reenigne\cga2ntsc\clown_cropped1_out.dat clown.obj .TINY:clown
rem C:\msvc\bin\link wibble.obj clown.obj wibdata.obj, wibble.exe, wibble.map,, /NOLOGO /ONERROR:NOEXE /NOI /NOE
C:\msvc\bin\link wibble.obj wibdata.obj, wibble.exe, wibble.map,, /NOLOGO /ONERROR:NOEXE /NOI /NOE

@echo off
yasm 1spf.asm -o 1spf.bin
yasm 1spf2.asm -o 1spf2.bin
yasm 1spf_intermittent.asm -o 1spf_intermittent.bin -l 1spf_intermittent.lst
yasm 1spf2_intermittent.asm -o 1spf2_intermittent.bin
yasm visible_lockstep.asm -o visible_lockstep.bin
yasm 1spf3.asm -o 1spf3.bin
yasm 1spf4.asm -o 1spf4.bin
yasm 1spf4_single.asm -o 1spf4_single.bin
yasm 1spf_unrolled.asm -o 1spf_unrolled.bin
yasm rose.asm -o r.com -l rcom.lst
copy /b r.com+\pictures\reenigne\cga2ntsc\rose_out_rgbi_stretch.dat rose.com
yasm rose.asm -o r.bin -dbin=1 -l r.lst
copy /b r.bin+\pictures\reenigne\cga2ntsc\rose_out_rgbi_stretch.dat rose.bin
yasm 1spf_newstart.asm -o 1spf_newstart.bin -l 1spf_newstart.lst
yasm 1spf_newstart2.asm -o 1spf_newstart2.bin -l 1spf_newstart2.lst
yasm start_address_latch.asm -o start_address_latch.bin
yasm 1spf_nolockstep.asm -o 1spf_nolockstep.bin -l 1spf_nolockstep.lst
yasm 1spf_horizontal.asm -o 1spf_horizontal.bin
yasm lake.asm -o l.com -l lcom.lst
copy /b l.com+\lake_test_demo.bin lake.com
yasm lake.asm -o l.bin -dbin=1 -l l.lst
copy /b l.bin+\lake_test_demo.bin lake.bin
yasm coppers.asm -o coppers.com -l ccom.lst
yasm coppers.asm -o coppers.bin -dbin=1 -l c.lst
nasm wibble.asm -o wibble.obj -f obj -l wibble.lst
..\..\..\..\Projects\Code\8088mph\tools\2obj\2obj b /s ..\..\..\..\Projects\Code\8088mph\wibble\t\wibdata.dat wibdata.obj .HUGE:wibdata
rem ..\..\..\..\Projects\Code\8088mph\tools\2obj\2obj b /s ..\..\..\..\Pictures\reenigne\cga2ntsc\clown_cropped1_out.dat clown.obj .TINY:clown
rem C:\msvc\bin\link wibble.obj clown.obj wibdata.obj, wibble.exe, wibble.map,, /NOLOGO /ONERROR:NOEXE /NOI /NOE
C:\msvc\bin\link wibble.obj wibdata.obj, wibble.exe, wibble.map,, /NOLOGO /ONERROR:NOEXE /NOI /NOE

Fix rose build

Fix rose build


call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
echo on

SET SdksFolderPath=C:/SDKs

REM Please set "Assume Unchanged" to these files with your git client.
xcopy /E /D /Y /Q "Projects\cartographer" "..\Projects\cartographer\"

REM call Pthread.cmd
REM call GoogleTest.cmd
REM call Lua.cmd
REM call Protobuf.cmd

cd ..\Projects
rmdir /S /Q cartographer_build_x64
mkdir cartographer_build_x64

cd cartographer_build_x64

cmake.exe ../cartographer -G "Visual Studio 14 2015 Win64" ^
-DCMAKE_CONFIGURATION_TYPES:STRING="Release" ^
-DCMAKE_CXX_FLAGS:STRING="/DWIN32 /D_WINDOWS /D_USE_MATH_DEFINES /W3 /GR /EHsc /I\"%SdksFolderPath%/GerHobbelt/pthread-win32\" /I\"%SdksFolderPath%/lua/lua/include\" /I\"../win32\"" ^
-DCMAKE_EXE_LINKER_FLAGS:STRING="/machine:x64 /LIBPATH:\"C:/SDKs/boost_1_64_0/lib64-msvc-14.1\" /LIBPATH:\"C:/SDKs/google/glog/lib\" /LIBPATH:\"C:/SDKs/GerHobbelt/pthread-win32/bin/x64_MSVC2015.Release\"" ^
-Dgflags_DIR:PATH="%SdksFolderPath%/gflags/gflags/lib/cmake/gflags" ^
-DGFLAGS_NAMESPACE:STRING="google" ^
-Dglog_DIR:PATH="%SdksFolderPath%/google/glog/lib/cmake/glog" ^
-Dglog_INCLUDE_DIRS:PATH="%SdksFolderPath%/google/glog/include" ^
-DEIGEN_INCLUDE_DIR:PATH="%SdksFolderPath%/eigen/eigen3/include/eigen3" ^
-DEIGEN3_INCLUDE_DIR:PATH="%SdksFolderPath%/eigen/eigen3/include/eigen3" ^
-DEigen3_DIR:PATH="%SdksFolderPath%/eigen/eigen3/share/eigen3/cmake" ^
-DCeres_DIR:PATH="%SdksFolderPath%/ceres-solver/ceres-solver/CMake" ^
-DGTEST_INCLUDE_DIRS:PATH="%SdksFolderPath%/google/googletest/include" ^
-DGMOCK_INCLUDE_DIRS:PATH="%SdksFolderPath%/google/googletest/include" ^
-DGMOCK_LIBRARIES:FILEPATH="%SdksFolderPath%/google/googletest/lib" ^
-Dgmock_build_tests:BOOL=FALSE ^
-DBOOST_INCLUDEDIR:PATH="%SdksFolderPath%/boost_1_64_0" ^
-DBOOST_LIBRARYDIR:PATH="%SdksFolderPath%/boost_1_64_0/lib64-msvc-14.1" ^
-DBOOST_ROOT:PATH="%SdksFolderPath%/boost_1_64_0/boost" ^
-DBoost_IOSTREAMS_LIBRARY_DEBUG:FILEPATH="boost_iostreams-vc141-mt-gd-1_64.lib" ^
-DBoost_IOSTREAMS_LIBRARY_RELEASE:FILEPATH="boost_iostreams-vc141-mt-1_64.lib" ^
-DBoost_REGEX_LIBRARY_DEBUG:FILEPATH="boost_regex-vc141-mt-gd-1_64.lib" ^
-DBoost_REGEX_LIBRARY_RELEASE:FILEPATH="boost_regex-vc141-mt-1_64.lib" ^
-DLUA_INCLUDE_PREFIX="%SdksFolderPath%/lua/lua/include" ^
-DLUA_INCLUDE_DIR="%SdksFolderPath%/lua/lua/include" ^
-DLUA_LIBRARIES="%SdksFolderPath%/lua/lua/lib" ^
-DLUA_LIBRARY:FILEPATH="%SdksFolderPath%/lua/lua/lib/lua.lib" ^
-DProtobuf_SRC_ROOT_FOLDER:PATH="../../protobuf/src" ^
-DProtobuf_INCLUDE_DIR:PATH="%SdksFolderPath%/google/protobuf/include" ^
-DProtobuf_LIBRARIES:PATH="%SdksFolderPath%/google/protobuf/lib" ^
-DProtobuf_PROTOC_EXECUTABLE:FILEPATH="%SdksFolderPath%/google/protobuf/bin/protoc.exe" ^
-DProtobuf_LITE_LIBRARY_RELEASE:FILEPATH="%SdksFolderPath%/google/protobuf/lib/libprotobuf-lite.lib" ^
-DProtobuf_PROTOC_LIBRARY_RELEASE:FILEPATH="%SdksFolderPath%/google/protobuf/lib/libprotoc.lib" ^
-DGTK3_INCLUDE_DIRS:PATH="../../gtkPlusBuiltFilesForWindows/gtk-build/gtk/x64/include" ^
-DGTK3_LIBRARY_DIRS:FILEPATH="../../gtkPlusBuiltFilesForWindows/gtk-build/gtk/x64/lib" ^
-Dgtest_build_samples:BOOL=FALSE ^
-Dgtest_build_tests:BOOL=FALSE ^
-Dgtest_disable_pthreads:BOOL=TRUE ^
-Dgtest_force_shared_crt:BOOL=FALSE ^
-DCARTOGRAPHER_CONFIGURATION_FILES_DIRECTORY:PATH="../../cartographer/configuration_files" ^
-DCMAKE_INSTALL_PREFIX:PATH="%SdksFolderPath%/googlecartographer/cartographer"

echo ^
-DTHREADS_PTHREADS_INCLUDE_DIR:PATH="%SdksFolderPath%/GerHobbelt/pthread-win32" ^
-DTHREADS_PTHREADS_LIBRARY_DIR:PATH="%SdksFolderPath%/GerHobbelt/pthread-win32/bin/x64_MSVC2015.Release" ^
-DBoost_DIR:PATH="%SdksFolderPath%/boost_1_64_0" ^
-DBoost_INCLUDE_DIR:PATH="%SdksFolderPath%/boost_1_64_0" ^
-DBoost_LIBRARY_DIR:PATH="%SdksFolderPath%/boost_1_64_0/lib64-msvc-14.1" ^

copy "..\..\cartographer-windows\Projects\cartographer_build_x64\AllFiles.cmake" .

cmake.exe .
REM cmake.exe --build "." --target "ALL_BUILD" --config "Release"
REM cmake.exe --build "." --target "RUN_TESTS" --config "Release"
REM cmake.exe --build "." --target "INSTALL" --config "Release"

cd /d "%~dp0"

call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
echo on

SET SdksFolderPath=C:/SDKs

REM Please set "Assume Unchanged" to these files with your git client.
xcopy /E /D /Y /Q "Projects\cartographer" "..\Projects\cartographer\"
copy "C:\SDKs\boost_1_64_0\lib64-msvc-14.1\libboost_zlib-vc141-mt-1_64.lib" "C:\SDKs\boost_1_64_0\lib64-msvc-14.1\libboost_zlib-vc140-mt-1_64.lib"
copy "C:\SDKs\boost_1_64_0\lib64-msvc-14.1\libboost_iostreams-vc141-mt-1_64.lib" "C:\SDKs\boost_1_64_0\lib64-msvc-14.1\libboost_iostreams-vc140-mt-1_64.lib"

REM call Pthread.cmd
REM call GoogleTest.cmd
REM call Lua.cmd
REM call Protobuf.cmd

cd ..\Projects
rmdir /S /Q cartographer_build_x64
mkdir cartographer_build_x64

cd cartographer_build_x64

cmake.exe ../cartographer -G "Visual Studio 14 2015 Win64" ^
-DCMAKE_CONFIGURATION_TYPES:STRING="Release" ^
-DCMAKE_CXX_FLAGS:STRING="/DWIN32 /D_WINDOWS /D_USE_MATH_DEFINES /W3 /GR /EHsc /I\"%SdksFolderPath%/GerHobbelt/pthread-win32\" /I\"%SdksFolderPath%/lua/lua/include\" /I\"../win32\"" ^
-DCMAKE_EXE_LINKER_FLAGS:STRING="/machine:x64 /LIBPATH:\"C:/SDKs/boost_1_64_0/lib64-msvc-14.1\" /LIBPATH:\"C:/SDKs/google/glog/lib\" /LIBPATH:\"C:/SDKs/GerHobbelt/pthread-win32/bin/x64_MSVC2015.Release\"" ^
-Dgflags_DIR:PATH="%SdksFolderPath%/gflags/gflags/lib/cmake/gflags" ^
-DGFLAGS_NAMESPACE:STRING="google" ^
-Dglog_DIR:PATH="%SdksFolderPath%/google/glog/lib/cmake/glog" ^
-Dglog_INCLUDE_DIRS:PATH="%SdksFolderPath%/google/glog/include" ^
-DEIGEN_INCLUDE_DIR:PATH="%SdksFolderPath%/eigen/eigen3/include/eigen3" ^
-DEIGEN3_INCLUDE_DIR:PATH="%SdksFolderPath%/eigen/eigen3/include/eigen3" ^
-DEigen3_DIR:PATH="%SdksFolderPath%/eigen/eigen3/share/eigen3/cmake" ^
-DCeres_DIR:PATH="%SdksFolderPath%/ceres-solver/ceres-solver/CMake" ^
-DGTEST_INCLUDE_DIRS:PATH="%SdksFolderPath%/google/googletest/include" ^
-DGMOCK_INCLUDE_DIRS:PATH="%SdksFolderPath%/google/googletest/include" ^
-DGMOCK_LIBRARIES:FILEPATH="%SdksFolderPath%/google/googletest/lib" ^
-Dgmock_build_tests:BOOL=FALSE ^
-DBOOST_INCLUDEDIR:PATH="%SdksFolderPath%/boost_1_64_0" ^
-DBOOST_LIBRARYDIR:PATH="%SdksFolderPath%/boost_1_64_0/lib64-msvc-14.1" ^
-DBOOST_ROOT:PATH="%SdksFolderPath%/boost_1_64_0/boost" ^
-DBoost_DIR:PATH="%SdksFolderPath%/boost_1_64_0" ^
-DBoost_INCLUDE_DIR:PATH="%SdksFolderPath%/boost_1_64_0" ^
-DBoost_LIBRARY_DIR:PATH="%SdksFolderPath%/boost_1_64_0/lib64-msvc-14.1" ^
-DBoost_IOSTREAMS_LIBRARY_DEBUG:FILEPATH="libboost_iostreams-vc141-mt-sgd-1_64.lib" ^
-DBoost_IOSTREAMS_LIBRARY_RELEASE:FILEPATH="libboost_iostreams-vc141-mt-s-1_64.lib" ^
-DBoost_REGEX_LIBRARY_DEBUG:FILEPATH="libboost_regex-vc141-mt-sgd-1_64.lib" ^
-DBoost_REGEX_LIBRARY_RELEASE:FILEPATH="libboost_regex-vc141-mt-s-1_64.lib" ^
-DLUA_INCLUDE_PREFIX="%SdksFolderPath%/lua/lua/include" ^
-DLUA_INCLUDE_DIR="%SdksFolderPath%/lua/lua/include" ^
-DLUA_LIBRARIES="%SdksFolderPath%/lua/lua/lib" ^
-DLUA_LIBRARY:FILEPATH="%SdksFolderPath%/lua/lua/lib/lua.lib" ^
-DProtobuf_SRC_ROOT_FOLDER:PATH="../../protobuf/src" ^
-DProtobuf_INCLUDE_DIR:PATH="%SdksFolderPath%/google/protobuf/include" ^
-DProtobuf_LIBRARIES:PATH="%SdksFolderPath%/google/protobuf/lib" ^
-DProtobuf_PROTOC_EXECUTABLE:FILEPATH="%SdksFolderPath%/google/protobuf/bin/protoc.exe" ^
-DProtobuf_LITE_LIBRARY_RELEASE:FILEPATH="%SdksFolderPath%/google/protobuf/lib/libprotobuf-lite.lib" ^
-DProtobuf_PROTOC_LIBRARY_RELEASE:FILEPATH="%SdksFolderPath%/google/protobuf/lib/libprotoc.lib" ^
-DGTK3_INCLUDE_DIRS:PATH="../../gtkPlusBuiltFilesForWindows/gtk-build/gtk/x64/include" ^
-DGTK3_LIBRARY_DIRS:FILEPATH="../../gtkPlusBuiltFilesForWindows/gtk-build/gtk/x64/lib" ^
-Dgtest_build_samples:BOOL=FALSE ^
-Dgtest_build_tests:BOOL=FALSE ^
-Dgtest_disable_pthreads:BOOL=TRUE ^
-Dgtest_force_shared_crt:BOOL=FALSE ^
-DCARTOGRAPHER_CONFIGURATION_FILES_DIRECTORY:PATH="../../cartographer/configuration_files" ^
-DCMAKE_INSTALL_PREFIX:PATH="%SdksFolderPath%/googlecartographer/cartographer"

echo ^
-DTHREADS_PTHREADS_INCLUDE_DIR:PATH="%SdksFolderPath%/GerHobbelt/pthread-win32" ^
-DTHREADS_PTHREADS_LIBRARY_DIR:PATH="%SdksFolderPath%/GerHobbelt/pthread-win32/bin/x64_MSVC2015.Release" ^

copy "..\..\cartographer-windows\Projects\cartographer_build_x64\AllFiles.cmake" .

cmake.exe . -G "Visual Studio 14 2015 Win64"
cmake.exe --build "." --target "ALL_BUILD" --config "Release"
REM cmake.exe --build "." --target "RUN_TESTS" --config "Release"
REM cmake.exe --build "." --target "INSTALL" --config "Release"

cd /d "%~dp0"

Update Cartographer.cmd

Update Cartographer.cmd

 * Now it can generate project files, but it uses various fake ways and the project files still have link errors.


DEL c:\Users\Administrator\go\src\github.com\pivotal-cf-experimental\GATS\cf.exe
bitsadmin.exe /transfer "DownloadStableCLI" https://s3.amazonaws.com/go-cli/builds/cf-windows-amd64.exe c:\Users\Administrator\go\src\github.com\pivotal-cf-experimental\GATS\cf.exe

go get -u github.com/pivotal-cf-experimental/GATS/...

SET GATSPATH=%GOPATH%\src\github.com\pivotal-cf-experimental\GATS
SET PATH=%PATH%;%GATSPATH%;C:\Program Files\cURL\bin
SET CONFIG=%CD%\config.json
SET LOCAL_GOPATH=%GATSPATH%\Godeps\_workspace
MKDIR %LOCAL_GOPATH%\bin
SET GOPATH=%LOCAL_GOPATH%;%GOPATH%
SET PATH=%LOCAL_GOPATH%\bin;%PATH%

go install -v github.com/onsi/ginkgo/ginkgo
ginkgo.exe -r -slowSpecThreshold=120 ./gats

DEL c:\Users\Administrator\go\src\github.com\pivotal-cf-experimental\GATS\cf.exe
bitsadmin.exe /transfer "DownloadStableCLI" https://s3.amazonaws.com/go-cli/builds/cf-windows-amd64.exe c:\Users\Administrator\go\src\github.com\pivotal-cf-experimental\GATS\cf.exe

go get -u github.com/pivotal-cf-experimental/GATS/...

SET GATSPATH=%GOPATH%\src\github.com\pivotal-cf-experimental\GATS
SET PATH=%GATSPATH%;%PATH%;C:\Program Files\cURL\bin
SET CONFIG=%CD%\config.json
SET LOCAL_GOPATH=%GATSPATH%\Godeps\_workspace
MKDIR %LOCAL_GOPATH%\bin
SET GOPATH=%LOCAL_GOPATH%;%GOPATH%
SET PATH=%LOCAL_GOPATH%\bin;%PATH%

go install -v github.com/onsi/ginkgo/ginkgo
ginkgo.exe -r -slowSpecThreshold=120 ./gats

Add GATSPATH to beginning of PATH.

Add GATSPATH to beginning of PATH.

- Ensure that the correct cf version is being used.


@rem Fetches (and builds if necessary) external dependencies

@rem Assume we start inside the Python source directory
cd ..
call "%VS90COMNTOOLS%vsvars32.bat"

@rem bzip
if not exist bzip2-1.0.3 svn export http://svn.python.org/projects/external/bzip2-1.0.3

@rem Sleepycat db
@rem Remove VS 2003 builds
if exist db-4.4.20 if not exist db-4.4.20\build_win32\this_is_for_vs9 (
   echo Removing old build
   rd /s/q db-4.4.20
)
if not exist db-4.4.20 svn export http://svn.python.org/projects/external/db-4.4.20-vs9 db-4.4.20

@rem OpenSSL
if not exist openssl-0.9.8g (
  if exist openssl-0.9.8a rd /s/q openssl-0.9.8a
  svn export http://svn.python.org/projects/external/openssl-0.9.8g
)

@rem tcltk
if not exist tcl8.4.18.1 (
   if exist tcltk rd /s/q tcltk
   if exist tcl8.4.12 rd /s/q tcl8.4.12
   if exist tk8.4.12 rd /s/q tk8.4.12
   if exist tcl8.4.16 rd /s/q tcl8.4.16
   if exist tk8.4.16 rd /s/q tk8.4.16
   svn export http://svn.python.org/projects/external/tcl-8.4.18.1
   svn export http://svn.python.org/projects/external/tk-8.4.18.1
   cd tcl-8.4.18.1
   nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=../../tcltk64 clean all install
   cd ..\..
   cd tk-8.4.18.1
   nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=../../tcltk64 TCLDIR=../../tcl-8.4.18.1 clean all install
)

@rem sqlite
if not exist sqlite-source-3.3.4 svn export http://svn.python.org/projects/external/sqlite-source-3.3.4

@rem Fetches (and builds if necessary) external dependencies

@rem Assume we start inside the Python source directory
cd ..
call "%VS90COMNTOOLS%vsvars32.bat"

@rem bzip
if not exist bzip2-1.0.3 svn export http://svn.python.org/projects/external/bzip2-1.0.3

@rem Sleepycat db
@rem Remove VS 2003 builds
if exist db-4.4.20 if not exist db-4.4.20\build_win32\this_is_for_vs9 (
   echo Removing old build
   rd /s/q db-4.4.20
)
if not exist db-4.4.20 svn export http://svn.python.org/projects/external/db-4.4.20-vs9 db-4.4.20

@rem OpenSSL
if not exist openssl-0.9.8g (
  if exist openssl-0.9.8a rd /s/q openssl-0.9.8a
  svn export http://svn.python.org/projects/external/openssl-0.9.8g
)

@rem tcltk
if not exist tcl-8.4.18.1 (
   if exist tcltk rd /s/q tcltk
   if exist tcl8.4.12 rd /s/q tcl8.4.12
   if exist tk8.4.12 rd /s/q tk8.4.12
   if exist tcl8.4.16 rd /s/q tcl8.4.16
   if exist tk8.4.16 rd /s/q tk8.4.16
   svn export http://svn.python.org/projects/external/tcl-8.4.18.1
   svn export http://svn.python.org/projects/external/tk-8.4.18.1
)
cd tcl-8.4.18.1\win
nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=../../tcltk64 clean all install
cd ..\..
cd tk-8.4.18.1\win
nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=../../tcltk64 TCLDIR=../../tcl-8.4.18.1 clean all install

@rem sqlite
if not exist sqlite-source-3.3.4 svn export http://svn.python.org/projects/external/sqlite-source-3.3.4

Fix the tcl-8.4.18.1 path and make sure we cd into the right directory when building tcl/tk.


### test_app.bat - 2015 - Thibault ROGER ###
version = "2.0.0"

echo "version ${version}"

update major version

update major version


@echo off

@rem Find java.exe
if defined JAVA_HOME (
    goto findJavaFromJavaHome
)

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

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

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

if exist "%JAVA_EXE%" goto continue

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

:continue
if "%1" == "-help" goto help
if "%1" == "--help" goto help
if "%1" == "/?" goto help

set COLA_HOME=%~dp0/..
set APP_NAME=%1
set RUN_MODE=%2
set JVM_ARGS=
set RUN_ARGS=
set DEBUG_PORT=
set JAR_FILE=*cola-%APP_NAME%-?.?.?.jar

if ""%RUN_MODE%"" == ""debug"" (
	setlocal enabledelayedexpansion
	set DEBUG_PORT=%3
	set JVM_ARGS=-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=!DEBUG_PORT!,suspend=n
	goto debug
)

:loop
set pn=%3
set pv=%4
if not "%pn%" == "" (
	if "%pn%" == "-Djvm.args" (
		set "JVM_ARGS=%pv:"=%"
	) else if "%pn%" == "-Drun.args" (
		set "RUN_ARGS=%pv:"=%"
	) else (
		goto paramError
	)
    shift
    shift
    goto :loop
)

if ""%RUN_MODE%"" == ""start"" goto start
if ""%RUN_MODE%"" == ""stop"" goto stop
if ""%RUN_MODE%"" == ""develop"" goto develop
goto paramError

:start
:debug
echo Looking for "%JAR_FILE:~1%" ....

for /R %COLA_HOME% %%i in (%JAR_FILE%) do (
	setlocal enabledelayedexpansion
	set filePath=%%i
	if not "!filePath:~-12!" == "-javadoc.jar" (
		if not "!filePath:~-12!" == "-sources.jar" (
			echo [Jar_File]:!filePath!
			"%JAVA_EXE%" %JVM_ARGS% -javaagent:%COLA_HOME%/lib/aspectjweaver-1.8.5.jar -Dorg.aspectj.tracing.enabled=false -Daj.weaving.verbose=false -Dorg.aspectj.weaver.showWeaveInfo=false -jar !filePath! %RUN_ARGS%
			if not "%ERRORLEVEL%"=="0" (goto javaError)
			pause
		)
	)
)
echo ERROR: Jar file is not exist.
goto end

:stop
echo WARN: Application can not be stop in Windows OS. Please look at the task list below.
tasklist /fi "imagename eq java.exe"
goto end

:develop
:findMaven
@rem Find Mvn.cmd
if defined M2_HOME (
    goto findMavenFromM2Home
)

set MAVEN_CMD=mvn.cmd
%MAVEN_CMD% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto runmvn

echo.
echo Error: M2_HOME is not set and no 'mvn' command could be found in your PATH.
echo.
echo Please set the M2_HOME variable in your environment to match the
echo location of the Maven installation.
goto end

:findMavenFromM2Home
set M2_HOME=%M2_HOME:"=%
set MAVEN_CMD=%M2_HOME%/bin/mvn.cmd

if exist "%MAVEN_CMD%" goto runmvn

echo.
echo Error: M2_HOME is set to an invalid directory: %M2_HOME%
echo.
echo Please set the M2_HOME variable in your environment to match the
echo location of the Maven installation.
goto end

:runmvn
echo Looking for "%APP_NAME%" Maven folder ....

set s=
for /R "%COLA_HOME%" %%s in (%APP_NAME%) do (
	if exist "%%s\pom.xml" (
		setlocal enabledelayedexpansion
		echo [Maven_Folder]:%%s
		cd %%s
		if not "%RUN_ARGS%" == "" (set s=-Drun.arguments="%RUN_ARGS: =,%")
		if not "%JVM_ARGS%" == "" (set s=!s! -Djvm.argments="%JVM_ARGS%")
		%MAVEN_CMD% spring-boot:run !s!
		if not "%ERRORLEVEL%"=="0" (goto mvnError)
		pause
	)
)
echo ERROR: "%APP_NAME%" Maven folder is not exist.
goto end

:javaError
echo.
echo ERROR: Illegal java command.
echo Command Prompt: %JAVA_EXE% %JVM_ARGS% -javaagent:%COLA_HOME%/lib/aspectjweaver-1.8.5.jar -Dorg.aspectj.tracing.enabled=false -Daj.weaving.verbose=false -Dorg.aspectj.weaver.showWeaveInfo=false -jar !filePath! %RUN_ARGS%
goto end

:mvnError
echo.
echo ERROR: Illegal mvn command.
echo Command Prompt: %MVN_CMD% spring-boot:run !s!
goto end

:help
echo.
echo Usage:  cola app-name [start ^| stop ^| develop ^| debug] [debug remote port] [-Djvm.args="..."] [-Drun.args="..."]
echo.
echo Sample:
echo         1.if you want to start cola-discovery application node.
echo           cola registry start
echo.
echo         2.if you want to stop cola-discovery application node.
echo           cola registry stop
echo.
echo         3.if you want to debug cola-discovery application node.
echo           cola discovery debug 9000
echo.
echo         4.if you want to start cola-discovery application node via develop mode.
echo           cola registry develop
echo.
echo         5.if you want to add arguments to cola-discovery application node.
echo           cola registry start -Drun.args="--server.port=8080 --spring.application.name=test" -Djvm.args="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=9000,suspend=n"
goto end

:paramError
echo.
echo ERROR: Illegal Parameters
echo Please use '-help' for more information.

:end
endlocal

@echo off

@rem Find java.exe
if defined JAVA_HOME (
    goto findJavaFromJavaHome
)

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

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

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

if exist "%JAVA_EXE%" goto continue

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

:continue
if "%1" == "-help" goto help
if "%1" == "--help" goto help
if "%1" == "/?" goto help

set COLA_HOME=%~dp0/..
set APP_NAME=%1
set RUN_MODE=%2
set JVM_ARGS=
set RUN_ARGS=
set DEBUG_PORT=
set JAR_FILE=*%APP_NAME%-?.?.?.jar

if ""%RUN_MODE%"" == ""debug"" (
	setlocal enabledelayedexpansion
	set DEBUG_PORT=%3
	set JVM_ARGS=-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=!DEBUG_PORT!,suspend=n
	goto debug
)

:loop
set pn=%3
set pv=%4
if not "%pn%" == "" (
	if "%pn%" == "-Djvm.args" (
		set "JVM_ARGS=%pv:"=%"
	) else if "%pn%" == "-Drun.args" (
		set "RUN_ARGS=%pv:"=%"
	) else (
		goto paramError
	)
    shift
    shift
    goto :loop
)

if ""%RUN_MODE%"" == ""start"" goto start
if ""%RUN_MODE%"" == ""stop"" goto stop
if ""%RUN_MODE%"" == ""develop"" goto develop
goto paramError

:start
:debug
echo Looking for "%JAR_FILE:~1%" ....

for /R %COLA_HOME% %%i in (%JAR_FILE%) do (
	setlocal enabledelayedexpansion
	set filePath=%%i
	if not "!filePath:~-12!" == "-javadoc.jar" (
		if not "!filePath:~-12!" == "-sources.jar" (
			echo [Jar_File]:!filePath!
			"%JAVA_EXE%" %JVM_ARGS% -javaagent:%COLA_HOME%/lib/aspectjweaver-1.8.5.jar -Dorg.aspectj.tracing.enabled=false -Daj.weaving.verbose=false -Dorg.aspectj.weaver.showWeaveInfo=false -jar !filePath! %RUN_ARGS%
			if not "%ERRORLEVEL%"=="0" (goto javaError)
			pause
		)
	)
)
echo ERROR: Jar file is not exist.
goto end

:stop
echo WARN: Application can not be stop in Windows OS. Please look at the task list below.
tasklist /fi "imagename eq java.exe"
goto end

:develop
:findMaven
@rem Find Mvn.cmd
if defined M2_HOME (
    goto findMavenFromM2Home
)

set MAVEN_CMD=mvn.cmd
call %MAVEN_CMD% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto runmvn

echo.
echo Error: M2_HOME is not set and no 'mvn' command could be found in your PATH.
echo.
echo Please set the M2_HOME variable in your environment to match the
echo location of the Maven installation.
goto end

:findMavenFromM2Home
set M2_HOME=%M2_HOME:"=%
set MAVEN_CMD=%M2_HOME%/bin/mvn.cmd

if exist "%MAVEN_CMD%" goto runmvn

echo.
echo Error: M2_HOME is set to an invalid directory: %M2_HOME%
echo.
echo Please set the M2_HOME variable in your environment to match the
echo location of the Maven installation.
goto end

:runmvn
echo Looking for "%APP_NAME%" Maven folder ....

set s=
for /R "%COLA_HOME%" %%s in (%APP_NAME%) do (
	if exist "%%s\pom.xml" (
		setlocal enabledelayedexpansion
		echo [Maven_Folder]:%%s
		cd %%s
		if not "%RUN_ARGS%" == "" (set s=-Drun.arguments="%RUN_ARGS: =,%")
		if not "%JVM_ARGS%" == "" (set s=!s! -Djvm.argments="%JVM_ARGS%")
		%MAVEN_CMD% spring-boot:run !s!
		if not "%ERRORLEVEL%"=="0" (goto mvnError)
		pause
	)
)
echo ERROR: "%APP_NAME%" Maven folder is not exist.
goto end

:javaError
echo.
echo ERROR: Illegal java command.
echo Command Prompt: %JAVA_EXE% %JVM_ARGS% -javaagent:%COLA_HOME%/lib/aspectjweaver-1.8.5.jar -Dorg.aspectj.tracing.enabled=false -Daj.weaving.verbose=false -Dorg.aspectj.weaver.showWeaveInfo=false -jar !filePath! %RUN_ARGS%
goto end

:mvnError
echo.
echo ERROR: Illegal mvn command.
echo Command Prompt: %MVN_CMD% spring-boot:run !s!
goto end

:help
echo.
echo Usage:  cola app-name [start ^| stop ^| develop ^| debug] [debug remote port] [-Djvm.args="..."] [-Drun.args="..."]
echo.
echo Sample:
echo         1.if you want to start cola-discovery application node.
echo           cola registry start
echo.
echo         2.if you want to stop cola-discovery application node.
echo           cola registry stop
echo.
echo         3.if you want to debug cola-discovery application node.
echo           cola discovery debug 9000
echo.
echo         4.if you want to start cola-discovery application node via develop mode.
echo           cola registry develop
echo.
echo         5.if you want to add arguments to cola-discovery application node.
echo           cola registry start -Drun.args="--server.port=8080 --spring.application.name=test" -Djvm.args="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=9000,suspend=n"
goto end

:paramError
echo.
echo ERROR: Illegal Parameters
echo Please use '-help' for more information.

:end
endlocal

update by james.shi 2018/10/08

update by james.shi 2018/10/08


@echo off

set LEIN_VERSION=1.4.0-RC1

setLocal EnableDelayedExpansion

rem LEIN_JAR and LEIN_HOME variables can be set manually.

if "x%LEIN_JAR%" == "x" (
    set LEIN_DIR=%~dp0
    set LEIN_JAR=!LEIN_DIR!leiningen-%LEIN_VERSION%-standalone.jar
)

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

if "x%LEIN_HOME%" == "x" (
    set LEIN_HOME=%USERPROFILE%\.lein
)

set ORIGINAL_PWD=%CD%
call :FIND_DIR_CONTAINING_UPWARDS project.clj
if "%DIR_CONTAINING%" neq "" cd "%DIR_CONTAINING%"

set LEIN_PLUGINS="
for %%j in (".\lib\dev\*.jar") do (
    set LEIN_PLUGINS=!LEIN_PLUGINS!;%%~fj
)
set LEIN_PLUGINS=!LEIN_PLUGINS!"

set LEIN_USER_PLUGINS="
for %%j in ("%LEIN_HOME%\plugins\*.jar") do (
    set LEIN_USER_PLUGINS=!LEIN_USER_PLUGINS!;%%~fj
)
set LEIN_USER_PLUGINS=!LEIN_USER_PLUGINS!"

set CLASSPATH=%LEIN_USER_PLUGINS%;%LEIN_PLUGINS%;test;src;"%CLASSPATH%"

if exist "%~f0\..\..\src\leiningen\core.clj" (
    rem Running from source checkout.
    call :SET_LEIN_ROOT "%~f0\..\.."

    set LEIN_LIBS="
    for %%j in ("!LEIN_ROOT!\lib\*") do set LEIN_LIBS=!LEIN_LIBS!;%%~fj
    set LEIN_LIBS=!LEIN_LIBS!"

    if "x!LEIN_LIBS!" == "x" if not exist "%LEIN_JAR%" goto NO_DEPENDENCIES

    set CLASSPATH="!LEIN_ROOT!\src";"!LEIN_ROOT!\resources";!LEIN_LIBS!;%CLASSPATH%;"%LEIN_JAR%"
) else (
    rem Not running from a checkout.
    if not exist "%LEIN_JAR%" goto NO_LEIN_JAR
    set CLASSPATH="%LEIN_JAR%";%CLASSPATH%
)

if not "x%DEBUG%" == "x" echo CLASSPATH=%CLASSPATH%
rem ##################################################

if not "x%INSIDE_EMACS%" == "x" goto SKIP_JLINE
if "x%1" == "xrepl"             goto SET_JLINE
if "x%1" == "xinteractive"      goto SET_JLINE
if "x%1" == "xint"              goto SET_JLINE
goto :SKIP_JLINE

:SET_JLINE
set JLINE=jline.ConsoleRunner
:SKIP_JLINE

if "x%JAVA_CMD%" == "x" set JAVA_CMD="java"

%JAVA_CMD% -client %JAVA_OPTS% -Dleiningen.original.pwd="%ORIGINAL_PWD%" ^
 -cp %CLASSPATH% %JLINE% clojure.main -e "(use 'leiningen.core)(-main)" NUL %*
goto EOF

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

:NO_DEPENDENCIES
echo.
echo Leiningen is missing its dependencies.
echo Please see "Building" in the README.
echo.
goto EOF

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

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

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

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

:SET_LEIN_ROOT
set LEIN_ROOT=%~f1
goto EOF

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

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

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

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

:GET_PARENT_PATH
set PARENT_PATH=%~f1
goto :EOF

:EOF

@echo off

set LEIN_VERSION=1.4.0-RC1

setLocal EnableDelayedExpansion

rem LEIN_JAR and LEIN_HOME variables can be set manually.

if "x%LEIN_JAR%" == "x" (
    set LEIN_DIR=%~dp0
    set LEIN_JAR=!LEIN_DIR!leiningen-%LEIN_VERSION%-standalone.jar
)

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

if "x%LEIN_HOME%" == "x" (
    set LEIN_HOME=%USERPROFILE%\.lein
)

set ORIGINAL_PWD=%CD%
call :FIND_DIR_CONTAINING_UPWARDS project.clj
if "%DIR_CONTAINING%" neq "" cd "%DIR_CONTAINING%"

set LEIN_PLUGINS="
for %%j in (".\lib\dev\*.jar") do (
    set LEIN_PLUGINS=!LEIN_PLUGINS!;%%~fj
)
set LEIN_PLUGINS=!LEIN_PLUGINS!"

set LEIN_USER_PLUGINS="
for %%j in ("%LEIN_HOME%\plugins\*.jar") do (
    set LEIN_USER_PLUGINS=!LEIN_USER_PLUGINS!;%%~fj
)
set LEIN_USER_PLUGINS=!LEIN_USER_PLUGINS!"

set CLASSPATH=%LEIN_USER_PLUGINS%;%LEIN_PLUGINS%;test;src;"%CLASSPATH%"

if exist "%~f0\..\..\src\leiningen\core.clj" (
    rem Running from source checkout.
    call :SET_LEIN_ROOT "%~f0\..\.."

    set LEIN_LIBS="
    for %%j in ("!LEIN_ROOT!\lib\*") do set LEIN_LIBS=!LEIN_LIBS!;%%~fj
    set LEIN_LIBS=!LEIN_LIBS!"

    if "x!LEIN_LIBS!" == "x" if not exist "%LEIN_JAR%" goto NO_DEPENDENCIES

    set CLASSPATH="!LEIN_ROOT!\src";"!LEIN_ROOT!\resources";!LEIN_LIBS!;%CLASSPATH%;"%LEIN_JAR%"
) else (
    rem Not running from a checkout.
    if not exist "%LEIN_JAR%" goto NO_LEIN_JAR
    set CLASSPATH="%LEIN_JAR%";%CLASSPATH%
)

if not "x%DEBUG%" == "x" echo CLASSPATH=%CLASSPATH%
rem ##################################################

if not "x%INSIDE_EMACS%" == "x" goto SKIP_JLINE
if "x%1" == "xrepl"             goto SET_JLINE
if "x%1" == "xinteractive"      goto SET_JLINE
if "x%1" == "xint"              goto SET_JLINE
goto :SKIP_JLINE

:SET_JLINE
set JLINE=jline.ConsoleRunner
:SKIP_JLINE

if "x%JAVA_CMD%" == "x" set JAVA_CMD="java"
set CLOJURE_JAR=%USERPROFILE%\.m2\repository\org\clojure\clojure\1.2.0\clojure-1.2.0.jar

%JAVA_CMD% -client %JAVA_OPTS% -Xbootclasspath/a:"%CLOJURE_JAR%" ^
 -Dleiningen.original.pwd="%ORIGINAL_PWD%" ^
 -cp %CLASSPATH% %JLINE% clojure.main -e "(use 'leiningen.core)(-main)" NUL %*
goto EOF

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

:NO_DEPENDENCIES
echo.
echo Leiningen is missing its dependencies.
echo Please see "Building" in the README.
echo.
goto EOF

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

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

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

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

:SET_LEIN_ROOT
set LEIN_ROOT=%~f1
goto EOF

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

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

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

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

:GET_PARENT_PATH
set PARENT_PATH=%~f1
goto :EOF

:EOF

Use the -Xbootclasspath trick in lein.bat.

This cuts lein startup time from 2.5 seconds
down to 1.5 on Vista.


@echo off
set ROMVERSION=0
title Compiling AEVILIA GB version 1.%ROMVERSION%
echo === COMPILATION ===
rgbasm -E -p 0xFF -o obj/main.o			 main.asm
rgbasm -E -p 0xFF -o obj/battle.o		 battle.asm
rgbasm -E -p 0xFF -o obj/engine.o		 engine.asm
rgbasm -E -p 0xFF -o obj/home.o			 home.asm
rgbasm -E -p 0xFF -o obj/gfx.o			 gfx.asm
rgbasm -E -p 0xFF -o obj/maps.o			 maps.asm
rgbasm -E -p 0xFF -o obj/save.o			 save.asm
rgbasm -E -p 0xFF -o obj/sound.o		 sound.asm
rgbasm -E -p 0xFF -o obj/tileset.o		 tileset.asm
echo.
echo COMPILATION DONE
echo.
echo.
echo === LINKING ===
rgblink -m bin/Aevilia.map -n bin/Aevilia.sym -o bin/aevilia.gbc obj/main.o obj/battle.o obj/engine.o obj/home.o obj/gfx.o obj/maps.o obj/save.o obj/sound.o obj/tileset.o
echo.
echo LINKING DONE
echo.
echo.
echo === FIXING ===
rgbfix -Cjv -i ISSO -k 42 -l 0x33 -m 0x1B -n %ROMVERSION% -p 0xFF -r 0x04 -t AEVILIA bin/aevilia.gbc
echo.
echo FIXING DONE
echo.
echo.
echo FILES READY !
pause

@echo off
set ROMVERSION=0
title Compiling AEVILIA GB version 1.%ROMVERSION%

if NOT exist bin/	mkdir bin
if NOT exist obj/	mkdir obj

echo === COMPILATION ===
rgbasm -E -p 0xFF -o obj/main.o			 main.asm
rgbasm -E -p 0xFF -o obj/battle.o		 battle.asm
rgbasm -E -p 0xFF -o obj/engine.o		 engine.asm
rgbasm -E -p 0xFF -o obj/home.o			 home.asm
rgbasm -E -p 0xFF -o obj/gfx.o			 gfx.asm
rgbasm -E -p 0xFF -o obj/maps.o			 maps.asm
rgbasm -E -p 0xFF -o obj/save.o			 save.asm
rgbasm -E -p 0xFF -o obj/sound.o		 sound.asm
rgbasm -E -p 0xFF -o obj/tileset.o		 tileset.asm
echo.
echo COMPILATION DONE
echo.
echo.

echo === LINKING ===
rgblink -m bin/Aevilia.map -n bin/Aevilia.sym -o bin/aevilia.gbc obj/main.o obj/battle.o obj/engine.o obj/home.o obj/gfx.o obj/maps.o obj/save.o obj/sound.o obj/tileset.o
echo.
echo LINKING DONE
echo.
echo.

echo === FIXING ===
rgbfix -Cjv -i ISSO -k 42 -l 0x33 -m 0x1B -n %ROMVERSION% -p 0xFF -r 0x04 -t AEVILIA bin/aevilia.gbc
echo.
echo FIXING DONE
echo.
echo.

echo FILES READY !
pause

Make Windows compiler script create bin and obj dirs


:: Start with bootstrap
cd .\tools\build
dir .
CALL .\bootstrap.bat
IF errorlevel 1 exit 1
dir .
CALL .\bootstrap.bat mingw
IF errorlevel 1 exit 1
dir .

:: cd ..\..
:: dir .
:: CALL .\tools\build\b2.exe install toolset=gcc --prefix=%LIBRARY_PREFIX%
:: dir .
:: set PATH=%PATH%;%LIBRARY_BIN%

:: Build step
:: CALL b2 install ^
::     --build-dir=buildboost ^
::     --prefix=%LIBRARY_PREFIX% ^
::     toolset=gcc ^
::     address-model=%ARCH% ^
::     variant=release ^
::     threading=multi ^
::     link=shared ^
::     -j%CPU_COUNT% ^
::     -s ZLIB_INCLUDE="%LIBRARY_INC%" ^
::     -s ZLIB_LIBPATH="%LIBRARY_LIB%" ^
::     --with-python
:: IF errorlevel 1 exit 1

:: :: Install fix-up for a non version-specific boost include
:: move %LIBRARY_INC%\boost-1_61\boost %LIBRARY_INC%
:: IF errorlevel 1 exit 1

:: Move dll's to LIBRARY_BIN
:: move %LIBRARY_LIB%\*vc%LIB_VER%-mt-1_61.dll "%LIBRARY_BIN%"
:: IF errorlevel 1 exit 1
:: Status API Training Shop Blog About

:: Start with bootstrap
cd .\tools\build
dir .
ECHO .\bootstrap.bat
CALL .\bootstrap.bat
IF errorlevel 1 exit 1
dir .
ECHO .\bootstrap.bat mingw
CALL .\bootstrap.bat mingw
IF errorlevel 1 exit 1
ECHO dir .
dir .

:: cd ..\..
:: dir .
:: CALL .\tools\build\b2.exe install toolset=gcc --prefix=%LIBRARY_PREFIX%
:: dir .
:: set PATH=%PATH%;%LIBRARY_BIN%

:: Build step
:: CALL b2 install ^
::     --build-dir=buildboost ^
::     --prefix=%LIBRARY_PREFIX% ^
::     toolset=gcc ^
::     address-model=%ARCH% ^
::     variant=release ^
::     threading=multi ^
::     link=shared ^
::     -j%CPU_COUNT% ^
::     -s ZLIB_INCLUDE="%LIBRARY_INC%" ^
::     -s ZLIB_LIBPATH="%LIBRARY_LIB%" ^
::     --with-python
:: IF errorlevel 1 exit 1

:: :: Install fix-up for a non version-specific boost include
:: move %LIBRARY_INC%\boost-1_61\boost %LIBRARY_INC%
:: IF errorlevel 1 exit 1

:: Move dll's to LIBRARY_BIN
:: move %LIBRARY_LIB%\*vc%LIB_VER%-mt-1_61.dll "%LIBRARY_BIN%"
:: IF errorlevel 1 exit 1
:: Status API Training Shop Blog About

Update bld.bat

Update bld.bat


@echo off
REM Change the code page for UTF8
chcp 65001 >NUL
set PYTHONIOENCODING=cp65001
"%~dp0\python\python.exe" "%~dp0\streamlink-script.py" --ffmpeg-ffmpeg "%~dp0\ffmpeg\ffmpeg.exe" --rtmp-rtmpdump "%~dp0\rtmpdump\rtmpdump.exe" --config "%~dp0\config" %*

@echo off
REM Change the code page for UTF8
chcp 65001 >NUL
set PYTHONIOENCODING=cp65001
"%~dp0\python\python.exe" "%~dp0\streamlink-script.py" --ffmpeg-ffmpeg "%~dp0\ffmpeg\ffmpeg.exe" --config "%~dp0\config" %*

remove rtmpdump argument in batch

remove rtmpdump argument in batch

https://github.com/streamlink/streamlink/pull/4169


@ECHO OFF
@setlocal

set BASEDIR=%~dp0
set APPNAME=blogapp
set APPDIR=%BASEDIR%\%APPNAME%
set DBFILE=%APPDIR%\db\dbfile
set PORT=8800

cd /D %BASEDIR%
call :Which tfenv.bat
if not "%TFENV%" == "" (
  call "%TFENV%"
) else (
  call "..\..\..\tfenv.bat"
)
if "%Platform%" == "X64" (
  set MAKE=nmake VERBOSE=1
  set CL=/MP
) else if "%DevEnvDir%" == "" (
  set MAKE=mingw32-make -j4
) else (
  set MAKE=nmake
  set CL=/MP
)

cd /D %BASEDIR%
rd /Q /S %APPNAME%
tspawn new %APPNAME%
sqlite3.exe %DBFILE% < create_blog_table.sql

cd %APPNAME%
tspawn s blog
tspawn w foo

:: Test in debug mode
call :CMakeBuild Debug
call :CheckWebApp treefrogd

call :QMakeBuild debug
call :CheckWebApp treefrogd
%MAKE% distclean >nul 2>nul

:: Test in release mode
call :CMakeBuild Release
call :CheckWebApp treefrog
%MAKE% clean  >nul 2>nul

call :QMakeBuild release
call :CheckWebApp treefrog
%MAKE% distclean >nul 2>nul

echo.
echo Test OK
call :CleanUp
exit /B 0

::
:: Build by cmake
::
:CMakeBuild
cd /D %APPDIR%
if exist build rd /Q /S build
mkdir build >nul 2>nul
cd build
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=%1 ..
%MAKE%
if ERRORLEVEL 1 (
  echo.
  echo Build Error!
  call ::CleanUp
  exit/ B 1
)
exit /B 0

::
:: Build by qmake
::
:QMakeBuild
cd /D %APPDIR%
qmake -r CONFIG+=%1
%MAKE%
if ERRORLEVEL 1 (
  echo.
  echo Build Error!
  call ::CleanUp
  exit /B 1
)
exit /B 0

::
:: Check WebApp
::
:CheckWebApp
cd /D %APPDIR%
echo.
echo Starting webapp..
set RES=1
"%1" -e dev -d -p %PORT% %APPDIR%
if ERRORLEVEL 1 (
  echo App Start Error!
)

timeout 1 /nobreak >nul
set URL=http://localhost:%PORT%/blog
set CMD=curl -s "%URL%" -w "%%{http_code}" -o nul
set RESCODE=0
for /f "usebackq delims=" %%a in (`%CMD%`) do set RESCODE=%%a
"%1" -k stop %APPDIR%
if ERRORLEVEL 1 (
  "%1" -k abort %APPDIR%
)
timeout 1 /nobreak >nul
if not "%RESCODE%"=="200" (
  echo HTTP request failed
  echo.
  echo App Test Error!
  call ::CleanUp
  exit /B 1
)
echo HTTP request success "%URL%"
exit /B 0

::
:: CleanUp Subroutine
::
:CleanUp
cd /D %BASEDIR%
rd /Q /S %APPNAME%
exit /B 0

:: which cmd
:Which
for %%I in (%1 %1.com %1.exe %1.bat %1.cmd %1.vbs %1.js %1.wsf) do if exist %%~$path:I SET TFENV=%%~$path:I
exit /B

@echo off
@setlocal

set BASEDIR=%~dp0
set APPNAME=blogapp
set APPDIR=%BASEDIR%%APPNAME%
set DBFILE=%APPDIR%\db\dbfile
set PORT=8800
set MAKE=nmake VERBOSE=1

for %%I in (sqlite3.exe) do if exist %%~$path:I set SQLITE=%%~$path:I
if "%SQLITE%" == "" for %%I in (sqlite3-bin.exe) do if exist %%~$path:I set SQLITE=%%~$path:I

cd /D %BASEDIR%
call :Which tfenv.bat
if not "%TFENV%" == "" (
  call "%TFENV%"
) else (
  call "..\..\..\tfenv.bat"
)

cd /D %BASEDIR%
rd /Q /S %APPNAME%
tspawn new %APPNAME%
if "%SQLITE%" == "" (
  echo;
  echo sqlite.exe command not found.
  call :CleanUp
  pause
  exit /B 1
)
"%SQLITE%" %DBFILE% < create_blog_table.sql

cd %APPNAME%
tspawn s blog
tspawn w foo

:: Test in debug mode
call :CMakeBuild Debug
call :CheckWebApp treefrogd

call :QMakeBuild debug
call :CheckWebApp treefrogd
%MAKE% distclean >nul 2>nul

:: Test in release mode
call :CMakeBuild Release
call :CheckWebApp treefrog
%MAKE% clean  >nul 2>nul

call :QMakeBuild release
call :CheckWebApp treefrog
%MAKE% distclean >nul 2>nul

echo;
echo Test OK
call :CleanUp
exit /B 0

::
:: Build by cmake
::
:CMakeBuild
cd /D %APPDIR%
if exist build rd /Q /S build
mkdir build >nul 2>nul
cd build
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=%1 ..
%MAKE%
if ERRORLEVEL 1 (
  echo;
  echo Build Error!
  call :CleanUp
  exit /B 1
)
exit /B 0

::
:: Build by qmake
::
:QMakeBuild
cd /D %APPDIR%
qmake -r CONFIG+=%1
%MAKE%
if ERRORLEVEL 1 (
  echo;
  echo Build Error!
  call :CleanUp
  exit /B 1
)
exit /B 0

::
:: Check WebApp
::
:CheckWebApp
echo on
cd /D %APPDIR%
echo;
echo Starting webapp..
set RES=1
"%1" -e dev -d -p %PORT% %APPDIR%
if ERRORLEVEL 1 (
  echo App Start Error!
)

timeout 1 /nobreak >nul
set URL=http://localhost:%PORT%/blog
set CMD=curl -s "%URL%" -w "%%{http_code}" -o nul
set RESCODE=0
for /f "usebackq delims=" %%a in (`%CMD%`) do set RESCODE=%%a
"%1" -k stop %APPDIR%
if ERRORLEVEL 1 (
  "%1" -k abort %APPDIR%
)
timeout 1 /nobreak >nul
if not "%RESCODE%"=="200" (
  echo HTTP request failed
  echo;
  echo App Test Error!
  call :CleanUp
  exit /B 1
)
echo HTTP request success "%URL%"
exit /B 0

::
:: CleanUp Subroutine
::
:CleanUp
cd /D %BASEDIR%
rd /Q /S %APPNAME%
exit /B 0

:: which cmd
:Which
for %%I in (%1 %1.com %1.exe %1.bat %1.cmd %1.vbs %1.js %1.wsf) do if exist %%~$path:I SET TFENV=%%~$path:I
exit /B

update releasetest batch.

update releasetest batch.


@echo off
@title AvaIre Windows Launcher

setlocal enabledelayedexpansion
set Looping=False

cls

:START
echo.
echo Welcome to AvaIre's window launcher
echo Please select an option to begin:
echo.
echo    1. Start the bot normally
echo    2. Start the bot with automatic restarts
echo    3. Update the bot using the nightly build
echo    9. Exit program
echo.

set /p in="Enter your option: "

if !in! == 1 (
    goto START_BOT
)
if !in! == 2 (
    goto RESTART_LOOP
)
if !in! == 3 (
    goto UPDATE
)
if !in! == 9 (
    goto EOF
) else (
    echo.
    echo     Invalid option given
    goto START
)

:RESTART_LOOP
set Looping=True
goto START_BOT

:START_BOT
java -Dfile.encoding=UTF-8 -jar AvaIre.jar --no-colors
if !Looping! == False (
    goto START
)

echo.
echo Restarting the bot in 5 second, press CTRL + C to cancel the process.
echo.

choice /d y /t 5 > nul
goto START_BOT

:UPDATE
echo.
echo Updating to the latest version using the nightly build
echo Note: The script will download and unzip some files, this
echo might cause your antivirus to see the script as a threat,
echo just make an exception for the script so it can download
echo the updates.
echo.
echo Tasks:

echo|set /p=" - Downloading the nightly-build.jar file... "
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://avairebot.com/nightly-build.jar', 'nightly-build.jar')"
echo Done

echo|set /p=" - Deleting existing AvaIre.jar file... "
rm AvaIre.jar > nul 2> nul
echo Done

echo|set /p=" - Renaming nightly-build.jar to AvaIre.jar... "
ren nightly-build.jar AvaIre.jar > nul 2> nul
echo Done
echo.
echo Ava has been successfully updated, going back to the menu.
GOTO START

:EOF
exit

@echo off
@title AvaIre Windows Launcher

setlocal enabledelayedexpansion
set Looping=False

cls

:START
echo.
echo Welcome to AvaIre's window launcher
echo Please select an option to begin:
echo.
echo    1. Start the bot normally
echo    2. Start the bot with automatic restarts
echo    3. Update the bot using the nightly build
echo    9. Exit program
echo.

set /p in="Enter your option: "

if !in! == 1 (
    goto START_BOT
)
if !in! == 2 (
    goto RESTART_LOOP
)
if !in! == 3 (
    goto UPDATE
)
if !in! == 9 (
    goto EOF
) else (
    echo.
    echo     Invalid option given
    goto START
)

:RESTART_LOOP
set Looping=True
goto START_BOT

:START_BOT
java -Dfile.encoding=UTF-8 -jar AvaIre.jar --no-colors
if !Looping! == False (
    goto START
)

echo.
echo Restarting the bot in 5 second, press CTRL + C to cancel the process.
echo.

choice /d y /t 5 > nul
goto START_BOT

:UPDATE
echo.
echo Updating to the latest version using the nightly build
echo Note: The script will download and unzip some files, this
echo might cause your antivirus to see the script as a threat,
echo just make an exception for the script so it can download
echo the updates.
echo.
echo Tasks:

echo|set /p=" - Downloading the nightly-build.jar file... "
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://avairebot.com/nightly-build.jar', 'nightly-build.jar')"
echo Done

echo|set /p=" - Deleting existing AvaIre.jar file... "
del /f AvaIre.jar > nul 2> nul
echo Done

echo|set /p=" - Renaming nightly-build.jar to AvaIre.jar... "
ren nightly-build.jar AvaIre.jar > nul 2> nul
echo Done
echo.
echo Ava has been successfully updated, going back to the menu.
GOTO START

:EOF
exit

Add support for Windows 8 and lower in the windows script


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

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

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

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

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

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

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

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

Add RVM dependencies under cygwin

Add RVM dependencies under cygwin


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

:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.9
:: ----------------------

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

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

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

:SelectNodeVersion

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

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

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

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

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

goto :EOF

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

:Deployment
echo Handling node.js deployment.

:: 0. Create empty build\index.js to make KuduSync happy
:: see https://github.com/projectkudu/kudu/issues/1753
IF NOT EXIST "%DEPLOYMENT_SOURCE%\build" (
  call :ExecuteCmd mkdir "%DEPLOYMENT_SOURCE%\build"
  call :ExecuteCmd copy NUL "%DEPLOYMENT_SOURCE%\build\index.js"
)

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

:: 2. Select node version
call :SelectNodeVersion

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

:: 4. Run Gulp task
IF EXIST "%DEPLOYMENT_TARGET%\gulpfile.js" (
 pushd "%DEPLOYMENT_TARGET%"
 call .\node_modules\.bin\gulp build --production
 IF !ERRORLEVEL! NEQ 0 goto error
 popd
)

:: 5. Run database migration script
IF EXIST "%DEPLOYMENT_TARGET%\knexfile.js" (
 pushd "%DEPLOYMENT_TARGET%"
 call .\node_modules\.bin\knex migrate:latest --env production
 IF !ERRORLEVEL! NEQ 0 goto error
 popd
)

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

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

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

:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.9
:: ----------------------

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

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

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

:SelectNodeVersion

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

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

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

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

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

goto :EOF

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

:Deployment
echo Handling node.js deployment.

:: 0. Create empty build\index.js to make KuduSync happy
:: see https://github.com/projectkudu/kudu/issues/1753
IF NOT EXIST "%DEPLOYMENT_SOURCE%\build" (
  call :ExecuteCmd mkdir "%DEPLOYMENT_SOURCE%\build"
  call :ExecuteCmd copy NUL "%DEPLOYMENT_SOURCE%\build\index.js"
)

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

:: 2. Select node version
call :SelectNodeVersion

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

:: 4. Run Gulp task
IF EXIST "%DEPLOYMENT_TARGET%\tsconfig.json" (
 pushd "%DEPLOYMENT_TARGET%"
 call .\node_modules\.bin\tsc
 IF !ERRORLEVEL! NEQ 0 goto error
 popd
)

:: 5. Run database migration script
IF EXIST "%DEPLOYMENT_TARGET%\knexfile.js" (
 pushd "%DEPLOYMENT_TARGET%"
 call .\node_modules\.bin\knex migrate:latest --env production
 IF !ERRORLEVEL! NEQ 0 goto error
 popd
)

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

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

Remove gulp from deploy script

Remove gulp from deploy script


@if "%DEBUG%" == "" @echo off
setlocal EnableDelayedExpansion

set SOURCE_DIR=%CD%
set ZLIB_ZIP=%CD%\cppbuild\zlib1211.zip
set BUILD_DIR=%CD%\cppbuild\Release
set ZLIB_BUILD_DIR=%BUILD_DIR%\zlib-build
set ZLIB_INSTALL_DIR=%BUILD_DIR%\zlib64
set EXTRA_CMAKE_ARGS=-DAERON_SYSTEM_TESTS=OFF

for %%o in (%*) do (

    set PROCESSED=0

    if "%%o"=="--help" (
        echo cppbuild-vs.cmd [--c-warnings-as-errors] [--cxx-warnings-as-errors] [--build-aeron-driver]
        exit /b
    )

    if "%%o"=="--c-warnings-as-errors" (
        set EXTRA_CMAKE_ARGS=!EXTRA_CMAKE_ARGS! -DC_WARNINGS_AS_ERRORS=ON
        set PROCESSED=1
    )

    if "%%o"=="--cxx-warnings-as-errors" (
        set EXTRA_CMAKE_ARGS=!EXTRA_CMAKE_ARGS! -DCXX_WARNINGS_AS_ERRORS=ON
        set PROCESSED=1
    )

    if "%%o"=="--build-aeron-driver" (
        echo "Enabling building of aeron driver is now the default"
        set PROCESSED=1
    )

    if "%%o"=="--link-samples-client-shared" (
        set EXTRA_CMAKE_ARGS=!EXTRA_CMAKE_ARGS! -DLINK_SAMPLES_CLIENT_SHARED=ON
        set PROCESSED=1
    )
)

call cppbuild/vs-helper.cmd
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

if EXIST %BUILD_DIR% rd /S /Q %BUILD_DIR%

md %BUILD_DIR%
pushd %BUILD_DIR%
md %ZLIB_BUILD_DIR%
pushd %ZLIB_BUILD_DIR%
7z x %ZLIB_ZIP%
pushd zlib-1.2.11
md build
pushd build

cmake -DCMAKE_INSTALL_PREFIX=%ZLIB_INSTALL_DIR% --config Release ..
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

cmake --build . --target install
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

pushd %BUILD_DIR%
cmake %EXTRA_CMAKE_ARGS% %SOURCE_DIR%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

cmake --build . --config Release
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

ctest -C Release --output-on-failure
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

@if "%DEBUG%" == "" @echo off
setlocal EnableDelayedExpansion

set SOURCE_DIR=%CD%
set ZLIB_ZIP=%CD%\cppbuild\zlib1211.zip
set BUILD_DIR=%CD%\cppbuild\Release
set ZLIB_BUILD_DIR=%BUILD_DIR%\zlib-build
set ZLIB_INSTALL_DIR=%BUILD_DIR%\zlib64
set EXTRA_CMAKE_ARGS=-DAERON_SYSTEM_TESTS=OFF

for %%o in (%*) do (

    set PROCESSED=0

    if "%%o"=="--help" (
        echo cppbuild-vs.cmd [--c-warnings-as-errors] [--cxx-warnings-as-errors] [--build-aeron-driver]
        exit /b
    )

    if "%%o"=="--c-warnings-as-errors" (
        set EXTRA_CMAKE_ARGS=!EXTRA_CMAKE_ARGS! -DC_WARNINGS_AS_ERRORS=ON
        set PROCESSED=1
    )

    if "%%o"=="--cxx-warnings-as-errors" (
        set EXTRA_CMAKE_ARGS=!EXTRA_CMAKE_ARGS! -DCXX_WARNINGS_AS_ERRORS=ON
        set PROCESSED=1
    )

    if "%%o"=="--build-aeron-driver" (
        echo "Enabling building of aeron driver is now the default"
        set PROCESSED=1
    )

    if "%%o"=="--link-samples-client-shared" (
        set EXTRA_CMAKE_ARGS=!EXTRA_CMAKE_ARGS! -DLINK_SAMPLES_CLIENT_SHARED=ON
        set PROCESSED=1
    )
)

call cppbuild/vs-helper.cmd
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

if EXIST %BUILD_DIR% rd /S /Q %BUILD_DIR%

md %BUILD_DIR%
pushd %BUILD_DIR%
md %ZLIB_BUILD_DIR%
pushd %ZLIB_BUILD_DIR%
7z x %ZLIB_ZIP%
pushd zlib-1.2.11
md build
pushd build

cmake -DCMAKE_INSTALL_PREFIX=%ZLIB_INSTALL_DIR% --config Release ..
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

cmake --build . --config Debug --target install
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

pushd %BUILD_DIR%
cmake %EXTRA_CMAKE_ARGS% %SOURCE_DIR%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

cmake --build . --config Release
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

ctest -C Release --output-on-failure
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

set zlib build to Release.

[C]: set zlib build to Release.


### test_app.bat - 2015 - Thibault ROGER ###
version = "2.0.0"

echo "version ${version}"

### test_app.bat - 2015 - Thibault ROGER ###
version = "1.2.0-b"

echo "version ${version}"

update minor alternative version

update minor alternative version


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

set SCRIPT_DIR=%~dp0
if %SCRIPT_DIR:~-1%==\ set SCRIPT_DIR=%SCRIPT_DIR:~0,-1%

for %%I in ("%SCRIPT_DIR%\..") do set "DART_ANALYZER_HOME=%%~fI"
if %DART_ANALYZER_HOME:~-1%==\ set DART_ANALYZER_HOME=%DART_ANALYZER_HOME:~0,-1%

set FOUND_BATCH=0
set FOUND_SDK=0
for %%a in (%*) do (
  if [%%a] == [--batch] set FOUND_BATCH=1
  if [%%a] == [-b] set FOUND_BATCH=1
  if [%%a] == [--dart-sdk]  set FOUND_SDK=1
)

setlocal EnableDelayedExpansion
set DART_SDK=""
if [%FOUND_SDK%] == [0] (
  if exist "%DART_ANALYZER_HOME%\lib\core\core.dart" (
    set DART_SDK=--dart-sdk "%DART_ANALYZER_HOME%"
  ) else (
    for /f %%i in ('echo %DART_ANALYZER_HOME%') do set DART_SDK_HOME=%%~dpi\dart-sdk
    if exist "!DART_SDK_HOME!" (
      set DART_SDK=--dart-sdk !DART_SDK_HOME!
    ) else (
      for /f %%j in ('call echo !DART_SDK_HOME!') do set DART_SDK_HOME=%%~dpj\dart-sdk
      if exist "!DART_SDK_HOME!" (
        set DART_SDK=--dart-sdk !DART_SDK_HOME!
      ) else (
        echo Couldn't find Dart SDK. Specify with --dart-sdk cmdline argument
      )
    )
  )
)
endlocal & set "DART_SDK=%DART_SDK%" & set "DART_SDK_HOME=%DART_SDK_HOME%"

if exist "%DART_SDK_HOME%\util\dartanalyzer\dartanalyzer.jar" (
  set DART_ANALYZER_LIBS="%DART_SDK_HOME%\util\dartanalyzer"
) else if exist "%DART_ANALYZER_HOME%\util\dartanalyzer\dartanalyzer.jar" (
  set DART_ANALYZER_LIBS="%DART_ANALYZER_HOME%\util\dartanalyzer"
) else (
  echo Configuration problem. Couldn't find dartanalyzer.jar.
  exit /b 1
)

setlocal EnableDelayedExpansion
set EXTRA_JVMARGS=-Xss2M
if [%FOUND_BATCH%] == [1] (
  set EXTRA_JVMARGS=!EXTRA_JVMARGS! -client
)
endlocal & set "EXTRA_JVMARGS=%EXTRA_JVMARGS%"

java %EXTRA_JVMARGS% %DART_JVMARGS% -ea -jar "%DART_ANALYZER_LIBS%\dartanalyzer.jar" %DART_SDK% %*

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

set SCRIPT_DIR=%~dp0
if %SCRIPT_DIR:~-1%==\ set SCRIPT_DIR=%SCRIPT_DIR:~0,-1%

for %%I in ("%SCRIPT_DIR%\..") do set "DART_ANALYZER_HOME=%%~fI"
if %DART_ANALYZER_HOME:~-1%==\ set DART_ANALYZER_HOME=%DART_ANALYZER_HOME:~0,-1%

set FOUND_BATCH=0
set FOUND_SDK=0
for %%a in (%*) do (
  if [%%a] == [--batch] set FOUND_BATCH=1
  if [%%a] == [-b] set FOUND_BATCH=1
  if [%%a] == [--dart-sdk]  set FOUND_SDK=1
)

setlocal EnableDelayedExpansion
set DART_SDK=""
if [%FOUND_SDK%] == [0] (
  if exist "%DART_ANALYZER_HOME%\lib\core\core.dart" (
    set DART_SDK=--dart-sdk "%DART_ANALYZER_HOME%"
  ) else (
    for /f %%i in ('echo %DART_ANALYZER_HOME%') do set DART_SDK_HOME=%%~dpi\dart-sdk
    if exist "!DART_SDK_HOME!" (
      set DART_SDK=--dart-sdk !DART_SDK_HOME!
    ) else (
      for /f %%j in ('call echo !DART_SDK_HOME!') do set DART_SDK_HOME=%%~dpj\dart-sdk
      if exist "!DART_SDK_HOME!" (
        set DART_SDK=--dart-sdk !DART_SDK_HOME!
      ) else (
        echo Couldn't find Dart SDK. Specify with --dart-sdk cmdline argument
      )
    )
  )
)
endlocal & set DART_SDK=%DART_SDK% & set DART_SDK_HOME=%DART_SDK_HOME%

if exist "%DART_SDK_HOME%\util\dartanalyzer\dartanalyzer.jar" (
  set DART_ANALYZER_LIBS=%DART_SDK_HOME%\util\dartanalyzer
) else if exist "%DART_ANALYZER_HOME%\util\dartanalyzer\dartanalyzer.jar" (
  set DART_ANALYZER_LIBS=%DART_ANALYZER_HOME%\util\dartanalyzer
) else (
  echo Configuration problem. Couldn't find dartanalyzer.jar.
  exit /b 1
)

setlocal EnableDelayedExpansion
set EXTRA_JVMARGS=-Xss2M
if [%FOUND_BATCH%] == [1] (
  set EXTRA_JVMARGS=!EXTRA_JVMARGS! -client
)
endlocal & set "EXTRA_JVMARGS=%EXTRA_JVMARGS%"

java %EXTRA_JVMARGS% %DART_JVMARGS% -ea -jar "%DART_ANALYZER_LIBS%\dartanalyzer.jar" %DART_SDK% %*

Fix dartanalyzer.bat so it works when there are spaces in the path to dart sdk.

BUG=dartbug.com/10859
R=devoncarew@google.com

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

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