@echo off

rem Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
rem or more contributor license agreements. Licensed under the Elastic License;
rem you may not use this file except in compliance with the Elastic License.

REM .in.bat <java main class> [args,..]

SETLOCAL

if NOT DEFINED JAVA_HOME goto err

set JAVA_CMD=%1
if "%JAVA_CMD%" == "" goto err_java_cmd

REM fix args
for /f "usebackq tokens=1*" %%i in (`echo %*`) DO @ set params=%%j
SHIFT

set SCRIPT_DIR=%~dp0
for %%I in ("%SCRIPT_DIR%..\..") do set ES_HOME=%%~dpfI

REM ***** JAVA options *****

if "%ES_MIN_MEM%" == "" (
set ES_MIN_MEM=256m
)

if "%ES_MAX_MEM%" == "" (
set ES_MAX_MEM=1g
)

if NOT "%ES_HEAP_SIZE%" == "" (
set ES_MIN_MEM=%ES_HEAP_SIZE%
set ES_MAX_MEM=%ES_HEAP_SIZE%
)

set JAVA_OPTS=%JAVA_OPTS% -Xms%ES_MIN_MEM% -Xmx%ES_MAX_MEM%

if NOT "%ES_HEAP_NEWSIZE%" == "" (
  set JAVA_OPTS=%JAVA_OPTS% -Xmn%ES_HEAP_NEWSIZE%
)

if NOT "%ES_DIRECT_SIZE%" == "" (
  set JAVA_OPTS=%JAVA_OPTS% -XX:MaxDirectMemorySize=%ES_DIRECT_SIZE%
)

set JAVA_OPTS=%JAVA_OPTS% -Xss256k

REM Enable aggressive optimizations in the JVM
REM    - Disabled by default as it might cause the JVM to crash
REM set JAVA_OPTS=%JAVA_OPTS% -XX:+AggressiveOpts

set JAVA_OPTS=%JAVA_OPTS% -XX:+UseParNewGC
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC

set JAVA_OPTS=%JAVA_OPTS% -XX:CMSInitiatingOccupancyFraction=75
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseCMSInitiatingOccupancyOnly

REM When running under Java 7
REM JAVA_OPTS=%JAVA_OPTS% -XX:+UseCondCardMark

REM GC logging options -- uncomment to enable
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDetails
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCTimeStamps
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintClassHistogram
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintTenuringDistribution
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCApplicationStoppedTime
REM JAVA_OPTS=%JAVA_OPTS% -Xloggc:/var/log/elasticsearch/gc.log

REM Causes the JVM to dump its heap on OutOfMemory.
set JAVA_OPTS=%JAVA_OPTS% -XX:+HeapDumpOnOutOfMemoryError
REM The path to the heap dump location, note directory must exists and have enough
REM space for a full heap dump.
REM JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof

REM Disables explicit GC
set JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC
REM Avoid empty elements in classpath to make JarHell happy
if "%ES_CLASSPATH%" == "" (
  set ES_CLASSPATH=%ES_HOME%/lib/*;%ES_HOME%/plugins/xpack/*
) else (
  set ES_CLASSPATH=%ES_CLASSPATH%;%ES_HOME%/lib/*;%ES_HOME%/plugins/xpack/*
)
set ES_PARAMS=-Des.path.home="%ES_HOME%"

SET HOSTNAME=%COMPUTERNAME%

"%JAVA_HOME%\bin\java" %JAVA_OPTS% %ES_JAVA_OPTS% %ES_PARAMS% -cp "%ES_CLASSPATH%" %JAVA_CMD% %PARAMS%
goto finally

:err
echo JAVA_HOME environment variable must be set!
ENDLOCAL
EXIT /B 1
:err_java_cmd
echo Can not call .in.bat without specifying a main java class
ENDLOCAL
EXIT /B 1

:finally
ENDLOCAL

@echo off

rem Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
rem or more contributor license agreements. Licensed under the Elastic License;
rem you may not use this file except in compliance with the Elastic License.

REM .in.bat <java main class> [args,..]

SETLOCAL

if NOT DEFINED JAVA_HOME goto err

set JAVA_CMD=%1
if "%JAVA_CMD%" == "" goto err_java_cmd

REM fix args
for /f "usebackq tokens=1*" %%i in (`echo %*`) DO @ set params=%%j
SHIFT

set SCRIPT_DIR=%~dp0
for %%I in ("%SCRIPT_DIR%..\..") do set ES_HOME=%%~dpfI

REM ***** JAVA options *****

if "%ES_MIN_MEM%" == "" (
set ES_MIN_MEM=256m
)

if "%ES_MAX_MEM%" == "" (
set ES_MAX_MEM=1g
)

if NOT "%ES_HEAP_SIZE%" == "" (
set ES_MIN_MEM=%ES_HEAP_SIZE%
set ES_MAX_MEM=%ES_HEAP_SIZE%
)

set JAVA_OPTS=%JAVA_OPTS% -Xms%ES_MIN_MEM% -Xmx%ES_MAX_MEM%

if NOT "%ES_HEAP_NEWSIZE%" == "" (
  set JAVA_OPTS=%JAVA_OPTS% -Xmn%ES_HEAP_NEWSIZE%
)

if NOT "%ES_DIRECT_SIZE%" == "" (
  set JAVA_OPTS=%JAVA_OPTS% -XX:MaxDirectMemorySize=%ES_DIRECT_SIZE%
)

set JAVA_OPTS=%JAVA_OPTS% -Xss256k

REM Enable aggressive optimizations in the JVM
REM    - Disabled by default as it might cause the JVM to crash
REM set JAVA_OPTS=%JAVA_OPTS% -XX:+AggressiveOpts

set JAVA_OPTS=%JAVA_OPTS% -XX:+UseParNewGC
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC

set JAVA_OPTS=%JAVA_OPTS% -XX:CMSInitiatingOccupancyFraction=75
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseCMSInitiatingOccupancyOnly

REM When running under Java 7
REM JAVA_OPTS=%JAVA_OPTS% -XX:+UseCondCardMark

REM GC logging options -- uncomment to enable
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDetails
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCTimeStamps
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintClassHistogram
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintTenuringDistribution
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCApplicationStoppedTime
REM JAVA_OPTS=%JAVA_OPTS% -Xloggc:/var/log/elasticsearch/gc.log

REM Causes the JVM to dump its heap on OutOfMemory.
set JAVA_OPTS=%JAVA_OPTS% -XX:+HeapDumpOnOutOfMemoryError
REM The path to the heap dump location, note directory must exists and have enough
REM space for a full heap dump.
REM JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof

REM Disables explicit GC
set JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC
REM Avoid empty elements in classpath to make JarHell happy
if "%ES_CLASSPATH%" == "" (
  set ES_CLASSPATH=%ES_HOME%/lib/*;%ES_HOME%/plugins/x-pack/*
) else (
  set ES_CLASSPATH=%ES_CLASSPATH%;%ES_HOME%/lib/*;%ES_HOME%/plugins/x-pack/*
)
set ES_PARAMS=-Des.path.home="%ES_HOME%"

SET HOSTNAME=%COMPUTERNAME%

"%JAVA_HOME%\bin\java" %JAVA_OPTS% %ES_JAVA_OPTS% %ES_PARAMS% -cp "%ES_CLASSPATH%" %JAVA_CMD% %PARAMS%
goto finally

:err
echo JAVA_HOME environment variable must be set!
ENDLOCAL
EXIT /B 1
:err_java_cmd
echo Can not call .in.bat without specifying a main java class
ENDLOCAL
EXIT /B 1

:finally
ENDLOCAL

change xpack -> x-pack in in.bat

change xpack -> x-pack in in.bat

Leftover from elastic/elasticsearch#1799

Original commit: elastic/x-pack-elasticsearch@00d8bfea4e7f1a7e6e72c39cb21a0b6ffa1508a9


@echo off

:: --------------------------------
:: Find Current Working Directory
:: --------------------------------

SET DIR=%~dp0
ECHO Current Working Directory %DIR%

:: Strip trailing backslash
set DIR1=%DIR:~0,-1%

::  ~dp does not work for regular environment variables:
::  set ParentDirectory=%Directory:~dp%  set ParentDirectory=%Directory:~dp%
::  ~dp only works for batch file parameters and loop indexes
  for %%d in (%DIR1%) do set PARENTDIR=%%~dpd

ECHO Parent Directory is %PARENTDIR%

SET ROOT=%PARENTDIR%source\openwarpgui\
ECHO Root Directory is %ROOT%

::---------------------------------------------------------------------------------------------------------------
:: Find Platform Architecture (32bit or 64bit)
::--------------------------------------------------------------------------------------------------------------

ECHO Checking Platform Architecture
SET "flag="
if defined ProgramFiles(x86) (

    @echo Some 64-bit work
    SET "flag=64"
    SET CURL=%DIR%curl\x64

) else (

    @echo Some 32-bit work
    SET "flag=32"
    SET	CURL=%DIR%curl\win32
)
ECHO OS Architecture %FLAG%
ECHO CURL path is: %CURL%
ECHO Setting curl to PATH
SET PATH=%PATH%;%CURL%

:: -------------------------------------------------------------------------
:: Download and Install 7Zip (To extract other software during installation) only installing x86 version
:: -------------------------------------------------------------------------
	:7zip
	7z 2>NUL
	if errorlevel 0 goto 7ZInstalled
	:: if 7zip is installed already, don't download it.

	ECHO If not installed, use 7za
	SET 7ZA=%DIR%7za
	SET PATH=%PATH%;%7ZA%
	goto MinGw

	:7ZInstalled
	ECHO 7Z is installed already
::-----------------------------------
:: Download and Extract MINGW 4.8.1
::-----------------------------------
	:MinGw
	SET MINGW_ROOT=C:\mingw64\
	IF EXIST C:\mingw64\ (goto MinGwInstalled)

	ECHO Downloading MINGW 4.8.1
	curl -O https://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/64-bit/threads-posix/sjlj/x64-4.8.1-release-posix-sjlj-rev5.7z/download

	ECHO Extracting MINGW
	7z x x64-4.8.1-release-posix-sjlj-rev5.7z -oC:\

	ECHO Setting Environment Variables
	SET PATH=%PATH%;%MINGW_ROOT%bin;%MINGW_ROOT%lib
	goto cmake

	:MinGwInstalled
	ECHO MinGw is installed already
	ECHO Setting Environment Variables
	SET PATH=%PATH%;%MINGW_ROOT%bin;%MINGW_ROOT%lib

:: ---------------------------------------------------------------------------
:: Copy Blas and Lapack from install_script folder to bundled/simulations/libs
:: ---------------------------------------------------------------------------

	ECHO Copying BlAS and LAPACK

	:: Is this step required ?
	IF %flag%==32 ( copy %DIR%\blas\win32\libblas.dll %ROOT%bundled\simulation\libs )
	IF %flag%==32 (copy %DIR%\lapack\win32\liblapack.dll %ROOT%bundled\simulation\libs )

	:: copy to MinGw Folder
	IF %flag%==32 copy %DIR%\blas\win32\libblas.dll %MINGW_ROOT%lib
	IF %flag%==32 copy %DIR%\lapack\win32\liblapack.dll %MINGW_ROOT%lib

	:: Is this step required ?
	IF %flag%==64 copy %DIR%\blas\x64\libblas.dll %ROOT%bundled\simulation\libs
	IF %flag%==64 copy %DIR%\lapack\x64\liblapack.dll %ROOT%bundled\simulation\libs

	:: copy to MinGw Folder
	IF %flag%==64 copy %DIR%\blas\x64\libblas.dll %MINGW_ROOT%lib
	IF %flag%==64 copy %DIR%\lapack\x64\liblapack.dll %MINGW_ROOT%lib
:: -----------------------------------------------
:: Download and Install CMAKE
:: -----------------------------------------------
	:cmake
	::cmake --version 2>NUL
	::if errorlevel 0 goto CMAKEInstalled

	SET CMAKE=C:\cmake-2.8.12.2-win32-x86\bin
	IF EXIST C:\cmake-2.8.12.2-win32-x86\ (goto CMAKEInstalled)

	ECHO Downloading CMAKE 2.8
	curl -O https://cmake.org/files/v2.8/cmake-2.8.12.2-win32-x86.zip

	ECHO Extracting CMAKE
	7z x cmake-2.8.12.2-win32-x86.zip -oC:\

	SET CMAKE=C:\cmake-2.8.12.2-win32-x86\bin
	ECHO Setting Environment Variables for CMAKE
	SET PATH=%PATH%;%CMAKE%
	goto gfortranBuild

	:CMAKEInstalled
	ECHO CMake is installed already
	SET PATH=%PATH%;%CMAKE%
	ECHO PATH IS %PATH%

:: ----------------------------------
:: Making GFortran Build Folder
:: ----------------------------------
	:gfortranBuild
	CD %PARENTDIR%
	ECHO Creating new GFortran build folder
	RMDIR source\NemohImproved\Nemoh\gFortranBuildWindows /S /Q
	MKDIR source\NemohImproved\Nemoh\gFortranBuildWindows
	CD %PARENTDIR%source\NemohImproved\Nemoh\gFortranBuildWindows
	::CD source
	goto build
	:: delete this folder on new installation
:: -----------------------------------------------
:: Build libnemoh.dll and libnemoh.dll.a
:: -----------------------------------------------
	:build
	cmake -DCMAKE_Fortran_COMPILER="gfortran" "%PARENTDIR%source\NemohImproved\Nemoh" -G "MinGW Makefiles"
	::cmake -DCMAKE_Fortran_COMPILER="gfortran" "%PARENTDIR%source/NemohImproved/Nemoh/" -G "MinGW MakeFiles"
	::cmake -DCMAKE_Fortran_COMPILER="gfortran" "%PARENTDIR%source/NemohImproved/Nemoh/"
	mingw32-make

	CD %DIR%
:: ------------------------------------------------------------------------
:: Copy libnemoh.dll and libnemoh.dll.a from simulation\libs to MinGw\lib
:: -----------------------------------------------------------------------
	ECHO "Copying libnemoh.dll"
	copy %ROOT%bundled\simulation\libs\libnemoh.dll %MINGW_ROOT%lib
	copy %ROOT%bundled\simulation\libs\libnemoh.dll %MINGW_ROOT%lib
	copy %ROOT%bundled\simulation\libs\libnemoh.dll %MINGW_ROOT%lib
	copy %ROOT%bundled\simulation\libs\libnemoh.dll %MINGW_ROOT%lib

:: Download and Install Anaconda 2
:: ----------------------------------------------------

	ECHO Downloading Anaconda
	SET ANACONDA=C:\Anaconda2
	IF EXIST C:\Anaconda2 goto :AnacondaInstalled

	::curl -O https://repo.continuum.io/archive/.winzip/Anaconda2-4.1.1-Windows-x86_64.zip
	ECHO Extracting Anaconda
	7z x %DIR%Anaconda2-4.1.1-Windows-x86_64.zip -oC:\

	ECHO Installing Anaconda
	Anaconda2-4.1.1-Windows-x86_64.exe

	ECHO Setting Env for Anaconda
	SET ANACONDA=C:\Anaconda2

	:AnacondaInstalled
	ECHO "Anaconda Installed already "
	SET PATH=%PATH%;%ANACONDA%;%ANACONDA%\Scripts
:: ----------------------------------------
:: Install CherryPy and other requirements
:: -----------------------------------------

	ECHO Instally CherryPy and other requirements

	%ANACONDA%\Scripts\pip install -r %ROOT%requirements.txt

:: --------------------------------
:: Install ParaView
:: ---------------------------------

:: -------------------------------
:: Set Path variable
:: -----------------------------

:: Finally SET the path so that it can be used later !
::SETX PATH "%PATH%;%ANACONDA%;%ANACONDA%\Scripts /m

ECHO "OpenWarp Installation Steps are complete, Check the logs for possible errors ! "

:: ------------------------------
:: Execute UI
:: ------------------------------
	ECHO "RUNNING OPENWARP"
	CD %ROOT%
	python main.py

@echo off

:: --------------------------------
:: Find Current Working Directory
:: --------------------------------

SET DIR=%~dp0
ECHO Current Working Directory %DIR%

:: Strip trailing backslash
set DIR1=%DIR:~0,-1%

::  ~dp does not work for regular environment variables:
::  set ParentDirectory=%Directory:~dp%  set ParentDirectory=%Directory:~dp%
::  ~dp only works for batch file parameters and loop indexes
  for %%d in (%DIR1%) do set PARENTDIR=%%~dpd

ECHO Parent Directory is %PARENTDIR%

SET ROOT=%PARENTDIR%source\openwarpgui\
ECHO Root Directory is %ROOT%

::---------------------------------------------------------------------------------------------------------------
:: Find Platform Architecture (32bit or 64bit)
::--------------------------------------------------------------------------------------------------------------

ECHO Checking Platform Architecture
SET "flag="
if defined ProgramFiles(x86) (

    @echo Some 64-bit work
    SET "flag=64"
    SET CURL=%DIR%curl\x64

) else (

    @echo Some 32-bit work
    SET "flag=32"
    SET	CURL=%DIR%curl\x86
)
ECHO OS Architecture %FLAG%
ECHO CURL path is: %CURL%
ECHO Setting curl to PATH
SET PATH=%PATH%;%CURL%

:: -------------------------------------------------------------------------
:: Download and Install 7Zip (To extract other software during installation) only installing x86 version
:: -------------------------------------------------------------------------
	:7zip
	IF EXIST C:\Program Files\7-zip\ (goto :7ZInstalled)
	:: if 7zip is installed already, don't download it.

	ECHO If not installed, use 7za
	SET 7ZA=%DIR%7za
	SET PATH=%PATH%;%7ZA%
	goto MinGw

	:7ZInstalled
	ECHO 7Z is installed already
::-----------------------------------
:: Download and Extract MINGW 4.8.1
::-----------------------------------
	:MinGw
	SET MINGW_ROOT=C:\mingw64\
	IF EXIST C:\mingw64\ (goto MinGwInstalled)

	ECHO Downloading MINGW 4.8.1
	curl -O https://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/64-bit/threads-posix/sjlj/x64-4.8.1-release-posix-sjlj-rev5.7z/download

	ECHO Extracting MINGW
	7z x x64-4.8.1-release-posix-sjlj-rev5.7z -oC:\

	ECHO Setting Environment Variables
	SET PATH=%PATH%;%MINGW_ROOT%bin;%MINGW_ROOT%lib
	goto cmake

	:MinGwInstalled
	ECHO MinGw is installed already
	ECHO Setting Environment Variables
	SET PATH=%PATH%;%MINGW_ROOT%bin;%MINGW_ROOT%lib

:: ---------------------------------------------------------------------------
:: Copy Blas and Lapack from install_script folder to bundled/simulations/libs
:: ---------------------------------------------------------------------------

	ECHO Copying BlAS and LAPACK

	:: Is this step required ?
	IF %flag%==32 ( copy %DIR%\blas\win32\libblas.dll %ROOT%bundled\simulation\libs )
	IF %flag%==32 (copy %DIR%\lapack\win32\liblapack.dll %ROOT%bundled\simulation\libs )

	:: copy to MinGw Folder
	IF %flag%==32 copy %DIR%\blas\win32\libblas.dll %MINGW_ROOT%lib
	IF %flag%==32 copy %DIR%\lapack\win32\liblapack.dll %MINGW_ROOT%lib

	:: Is this step required ?
	IF %flag%==64 copy %DIR%\blas\x64\libblas.dll %ROOT%bundled\simulation\libs
	IF %flag%==64 copy %DIR%\lapack\x64\liblapack.dll %ROOT%bundled\simulation\libs

	:: copy to MinGw Folder
	IF %flag%==64 copy %DIR%\blas\x64\libblas.dll %MINGW_ROOT%lib
	IF %flag%==64 copy %DIR%\lapack\x64\liblapack.dll %MINGW_ROOT%lib
:: -----------------------------------------------
:: Download and Install CMAKE
:: -----------------------------------------------
	:cmake
	::cmake --version 2>NUL
	::if errorlevel 0 goto CMAKEInstalled

	SET CMAKE=C:\cmake-2.8.12.2-win32-x86\bin
	IF EXIST C:\cmake-2.8.12.2-win32-x86\ (goto CMAKEInstalled)

	ECHO Downloading CMAKE 2.8
	curl -O https://cmake.org/files/v2.8/cmake-2.8.12.2-win32-x86.zip

	ECHO Extracting CMAKE
	7z x cmake-2.8.12.2-win32-x86.zip -oC:\

	SET CMAKE=C:\cmake-2.8.12.2-win32-x86\bin
	ECHO Setting Environment Variables for CMAKE
	SET PATH=%PATH%;%CMAKE%
	goto gfortranBuild

	:CMAKEInstalled
	ECHO CMake is installed already
	SET PATH=%PATH%;%CMAKE%
	ECHO PATH IS %PATH%

:: ----------------------------------
:: Making GFortran Build Folder
:: ----------------------------------
	:gfortranBuild
	CD %PARENTDIR%
	ECHO Creating new GFortran build folder
	RMDIR source\NemohImproved\Nemoh\gFortranBuildWindows /S /Q
	MKDIR source\NemohImproved\Nemoh\gFortranBuildWindows
	CD %PARENTDIR%source\NemohImproved\Nemoh\gFortranBuildWindows
	::CD source
	goto build
	:: delete this folder on new installation
:: -----------------------------------------------
:: Build libnemoh.dll and libnemoh.dll.a
:: -----------------------------------------------
	:build
	cmake -DCMAKE_Fortran_COMPILER="gfortran" "%PARENTDIR%source\NemohImproved\Nemoh" -G "MinGW Makefiles"
	::cmake -DCMAKE_Fortran_COMPILER="gfortran" "%PARENTDIR%source/NemohImproved/Nemoh/" -G "MinGW MakeFiles"
	::cmake -DCMAKE_Fortran_COMPILER="gfortran" "%PARENTDIR%source/NemohImproved/Nemoh/"
	mingw32-make

	CD %DIR%
:: ------------------------------------------------------------------------
:: Copy libnemoh.dll and libnemoh.dll.a from simulation\libs to MinGw\lib
:: -----------------------------------------------------------------------
	ECHO "Copying libnemoh.dll"
	copy %ROOT%bundled\simulation\libs\libnemoh.dll %MINGW_ROOT%lib
	copy %ROOT%bundled\simulation\libs\libnemoh.dll %MINGW_ROOT%lib
	copy %ROOT%bundled\simulation\libs\libnemoh.dll %MINGW_ROOT%lib
	copy %ROOT%bundled\simulation\libs\libnemoh.dll %MINGW_ROOT%lib

:: Download and Install Anaconda 2
:: ----------------------------------------------------

	ECHO Downloading Anaconda
	SET ANACONDA=C:\Anaconda2
	IF EXIST C:\Anaconda2 goto :AnacondaInstalled

	::curl -O https://repo.continuum.io/archive/.winzip/Anaconda2-4.1.1-Windows-x86_64.zip
	ECHO Extracting Anaconda
	7z x %DIR%Anaconda2-4.1.1-Windows-x86_64.zip -oC:\

	ECHO Installing Anaconda
	Anaconda2-4.1.1-Windows-x86_64.exe

	ECHO Setting Env for Anaconda
	SET ANACONDA=C:\Anaconda2

	:AnacondaInstalled
	ECHO "Anaconda Installed already "
	SET PATH=%PATH%;%ANACONDA%;%ANACONDA%\Scripts
:: ----------------------------------------
:: Install CherryPy and other requirements
:: -----------------------------------------

	ECHO Instally CherryPy and other requirements

	%ANACONDA%\Scripts\pip install -r %ROOT%requirements.txt --upgrade

	:: Remove this later on, I was getting vrvasall.bat missing
	:: pip install upgrade setuptools "<-- this command is not working "
	:: pip install setuptools --no-use-wheel --upgrade (<-- not helping )

	:: psycopyg windows (need to have Git installed for it ! )
	::pip install git+https://github.com/nwcell/psycopg2-windows.git@win64-py27#egg=psycopg2
:: --------------------------------
:: Install ParaView
:: ---------------------------------

:: --------------------------------
:: Build Setup.py
:: -------------------------------

	ECHO Building setup.py
	python %ROOT%\nemoh\setup.py cleanall
	python %ROOT%\nemoh\setup.py build_ext --inplace

:: -------------------------------
:: Set Path variable
:: -----------------------------

:: Finally SET the path so that it can be used later !
::SETX PATH "%PATH%;%ANACONDA%;%ANACONDA%\Scripts /m

ECHO "OpenWarp Installation Steps are complete, Check the logs for possible errors ! "

:: ------------------------------
:: Execute UI
:: ------------------------------
	ECHO "RUNNING OPENWARP"
	CD %ROOT%
	python main.py

Support for windowsx86 and 7zip

Windows: Support for windowsx86 and 7zip


@echo off
SETLOCAL

IF #%1 == # GOTO :NOFILE
SET testName=%1

IF #%2 NEQ # GOTO :BADCANRY

SET cppName=test_rt.cpp

g++ --std=gnu++14 -g -DTEST=%testName% %cppName% && a

GOTO :EOF

:NOFILE
ECHO Should give a test number, e.g. 1
EXIT /B 255

:BADCANRY
ECHO Don't know what to do with so many parameters
EXIT /B 255

@echo off
SETLOCAL

IF #%1 == # GOTO :NOFILE
SET testName=%1

IF #%2 NEQ # GOTO :BADCANRY

SET cppName=bits/test_rt.cpp

g++ --std=gnu++14 -g -I. -I./bits -DTEST=%testName% %cppName% && a

GOTO :EOF

:NOFILE
ECHO Should give a test number, e.g. 1
EXIT /B 255

:BADCANRY
ECHO Don't know what to do with so many parameters
EXIT /B 255

add include paths in testrt.bat

add include paths in testrt.bat


cd /d %~dp0
REM ************************************************************
REM IMPORTANT!
REM Kidoju.WebApp is the original project where any modifications
REM of locked read-only files should be completed.
REM ************************************************************

REM ------------------------------------------------------------
REM Root files
REM ------------------------------------------------------------

REM copy all dot files
ATTRIB -R .\.*
COPY ..\..\Kidoju\Kidoju.Webapp\.* .\ /Y
ATTRIB +R .\.*

REM build.cmd and BUILD.md
ATTRIB -R .\build.*
COPY ..\..\Kidoju\Kidoju.Webapp\build.* .\ /Y
ATTRIB +R .\build.*

REM TODO Coverage

REM Dockerfile
ATTRIB -R .\Dockerfile
COPY ..\..\Kidoju\Kidoju.Webapp\Dockerfile .\ /Y
ATTRIB +R .\Dockerfile

REM gruntfile.js
ATTRIB -R .\gruntfile.js
COPY ..\..\Kidoju\Kidoju.Webapp\gruntfile.js .\ /Y
ATTRIB +R .\gruntfile.js

REM LICENSE
ATTRIB -R .\LICENSE-GPLv3
COPY ..\..\Kidoju\Kidoju.Webapp\LICENSE-GPLv3 .\ /Y
ATTRIB +R .\LICENSE-GPLv3

REM setup.cmd
ATTRIB -R .\setup.cmd
COPY ..\..\Kidoju\Kidoju.Webapp\setup.cmd .\ /Y
ATTRIB +R .\setup.cmd

REM UPDATE.md
ATTRIB -R .\UPDATE.md
COPY ..\..\Kidoju\Kidoju.Webapp\UPDATE.md .\ /Y
ATTRIB +R .\UPDATE.md

REM webpack
REM ATTRIB -R .\webpack.config.js
REM COPY ..\..\Kidoju\Kidoju.Webapp\webpack.config.js .\ /Y
REM ATTRIB +R .\webpack.config.js

REM ------------------------------------------------------------
REM Javascript files
REM ------------------------------------------------------------

REM Copy ./js/cultures files
XCOPY ..\..\Kidoju\Kidoju.Webapp\js\cultures\*.*  .\js\cultures\ /C /E /I /R /Y
ATTRIB +R .\js\cultures\*.* /S

REM Copy ./js/vendor files
XCOPY ..\..\Kidoju\Kidoju.Webapp\js\vendor\bootstrap\*.* .\js\vendor\bootstrap\ /C /E /I /R /Y
ATTRIB +R .\js\vendor\bootstrap\*.* /S
XCOPY ..\..\Kidoju\Kidoju.Webapp\js\vendor\kendo\*.* .\js\vendor\kendo\ /C /E /I /R /Y
ATTRIB +R .\js\vendor\kendo\*.* /S
XCOPY ..\..\Kidoju\Kidoju.Webapp\js\vendor\logentries\*.* .\js\vendor\logentries\ /C /E /I /R /Y
ATTRIB +R .\js\vendor\logentries\*.* /S

REM ./js/app.common.js
ATTRIB -R .\js\app.common.js
COPY ..\..\Kidoju\Kidoju.Webapp\js\app.common.js .\js\ /Y
ATTRIB +R .\js\app.common.js

REM ./js/app.error.js
ATTRIB -R .\js\app.error.js
COPY ..\..\Kidoju\Kidoju.Webapp\js\app.error.js .\js\ /Y
ATTRIB +R .\js\app.error.js

REM ./js/app.init.js
ATTRIB -R .\js\app.init.js
COPY ..\..\Kidoju\Kidoju.Webapp\js\app.init.js .\js\ /Y
ATTRIB +R .\js\app.init.js

REM ./js/app.locale.js
ATTRIB -R .\js\app.i18n.js
COPY ..\..\Kidoju\Kidoju.Webapp\js\app.i18n.js .\js\ /Y
ATTRIB +R .\js\app.i18n.js

REM ./js/app.logger.js
ATTRIB -R .\js\app.logger.js
COPY ..\..\Kidoju\Kidoju.Webapp\js\app.logger.js .\js\ /Y
ATTRIB +R .\js\app.logger.js

REM ./js/app.support.js
ATTRIB -R .\js\app.support.js
COPY ..\..\Kidoju\Kidoju.Webapp\js\app.support.js .\js\ /Y
ATTRIB +R .\js\app.support.js

REM ./js/app.theme.js
ATTRIB -R .\js\app.theme.js
COPY ..\..\Kidoju\Kidoju.Webapp\js\app.theme.js .\js\ /Y
ATTRIB +R .\js\app.theme.js

REM ------------------------------------------------------------
REM Styles
REM ------------------------------------------------------------

REM Copy fonts
XCOPY ..\..\Kidoju\Kidoju.WebFonts\dist\fonts\*.* .\styles\fonts\ /C /E /I /R /Y
ATTRIB +R .\styles\fonts\*.* /S

REM Copy images
COPY .\graphics\memba.home.jpg .\styles\images\jumbotron.jpg
ATTRIB +R .\styles\images\*.* /S

REM Copy ./js/vendor files
XCOPY ..\..\Kidoju\Kidoju.Webapp\styles\vendor\bootstrap\*.* .\styles\vendor\bootstrap\ /C /E /I /R /Y
ATTRIB +R .\styles\vendor\bootstrap\*.* /S
XCOPY ..\..\Kidoju\Kidoju.Webapp\styles\vendor\fonts\*.* .\styles\vendor\fonts\ /C /E /I /R /Y
ATTRIB +R .\styles\vendor\fonts\*.* /S
XCOPY ..\..\Kidoju\Kidoju.Webapp\styles\vendor\kendo\*.* .\styles\vendor\kendo\ /C /E /I /R /Y
ATTRIB +R .\styles\vendor\kendo\*.* /S

REM Copy theme files
ATTRIB -R .\styles\app.*.less
COPY ..\..\Kidoju\Kidoju.Webapp\styles\app.mixins.less .\styles\ /Y
ATTRIB +R .\styles\app.mixins.less
COPY ..\..\Kidoju\Kidoju.Webapp\styles\app.page.common.less .\styles\ /Y
ATTRIB +R .\styles\app.page.common.less
COPY ..\..\Kidoju\Kidoju.Webapp\styles\app.template.less .\styles\ /Y
ATTRIB +R .\styles\app.template.less
COPY ..\..\Kidoju\Kidoju.Webapp\styles\app.theme.*.less .\styles\ /Y
ATTRIB +R .\styles\app.theme.*.less

REM ------------------------------------------------------------
REM Tests
REM ------------------------------------------------------------

REM Copy ./test/node/lib files
ATTRIB -R .\test\node\lib\*.*
COPY ..\..\Kidoju\Kidoju.Webapp\test\node\lib\error.test.js .\test\node\lib /Y
ATTRIB +R .\test\node\lib\error.test.js
COPY ..\..\Kidoju\Kidoju.Webapp\test\node\lib\logger.test.js .\test\node\lib /Y
ATTRIB +R .\test\node\lib\logger.test.js
COPY ..\..\Kidoju\Kidoju.Webapp\test\node\lib\url.test.js .\test\node\lib /Y
ATTRIB +R .\test\node\lib\url.test.js
COPY ..\..\Kidoju\Kidoju.Webapp\test\node\lib\utils.test.js .\test\node\lib /Y
ATTRIB +R .\test\node\lib\utils.test.js

REM Copy ./test/vendor files
XCOPY ..\..\Kidoju\Kidoju.Webapp\test\vendor  .\test\vendor /C /E /I /R /Y
ATTRIB +R .\test\vendor\*.* /S

REM ------------------------------------------------------------
REM Web modules (webpack)
REM ------------------------------------------------------------

REM Copy web_modules
XCOPY ..\..\Kidoju\Kidoju.Webapp\web_modules\*.*  .\web_modules /C /E /I /R /Y
ATTRIB +R .\web_modules\*.* /S

REM ------------------------------------------------------------
REM Web Application
REM ------------------------------------------------------------

REM Copy ./webapp/config files
ATTRIB -R .\webapp\config\index.js
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\config\index.js .\webapp\config /Y
ATTRIB +R .\webapp\config\index.js

REM Copy ./webapp/lib files
ATTRIB -R .\webapp\lib\*.*
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\lib\error.js .\webapp\lib /Y
ATTRIB +R .\webapp\lib\error.js
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\lib\logger.js .\webapp\lib /Y
ATTRIB +R .\webapp\lib\logger.js
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\lib\url.js .\webapp\lib /Y
ATTRIB +R .\webapp\lib\url.js
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\lib\utils.js .\webapp\lib /Y
ATTRIB +R .\webapp\lib\utils.js

REM Copy ./webapp/middleware files
ATTRIB -R .\webapp\middleware\*.*
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\middleware\error.js .\webapp\middleware /Y
ATTRIB +R .\webapp\middleware\error.js
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\middleware\language.js .\webapp\middleware /Y
ATTRIB +R .\webapp\middleware\language.js
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\middleware\notFound.js .\webapp\middleware /Y
ATTRIB +R .\webapp\middleware\notFound.js

REM Copy ./webapp/views files
ATTRIB -R .\webapp\views\*.*
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\views\error.ejs .\webapp\views /Y
ATTRIB +R .\webapp\views\error.ejs
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\views\footer.ejs .\webapp\views /Y
ATTRIB +R .\webapp\views\footer.ejs

REM Copy ./webapp/server.js
ATTRIB -R .\webapp\server.js
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\server.js .\webapp\ /Y
ATTRIB +R .\webapp\server.js

cd /d %~dp0
REM ************************************************************
REM IMPORTANT!
REM Kidoju.WebApp is the original project where any modifications
REM of locked read-only files should be completed.
REM ************************************************************

REM ------------------------------------------------------------
REM Root files
REM ------------------------------------------------------------

REM copy all dot files
ATTRIB -R .\.*
COPY ..\..\Kidoju\Kidoju.Webapp\.* .\ /Y
ATTRIB +R .\.*

REM build.cmd and BUILD.md
ATTRIB -R .\build.*
COPY ..\..\Kidoju\Kidoju.Webapp\build.* .\ /Y
ATTRIB +R .\build.*

REM TODO Coverage

REM Dockerfile
ATTRIB -R .\Dockerfile
COPY ..\..\Kidoju\Kidoju.Webapp\Dockerfile .\ /Y
ATTRIB +R .\Dockerfile

REM gruntfile.js
ATTRIB -R .\gruntfile.js
COPY ..\..\Kidoju\Kidoju.Webapp\gruntfile.js .\ /Y
ATTRIB +R .\gruntfile.js

REM LICENSE
ATTRIB -R .\LICENSE-GPLv3
COPY ..\..\Kidoju\Kidoju.Webapp\LICENSE-GPLv3 .\ /Y
ATTRIB +R .\LICENSE-GPLv3

REM setup.cmd
ATTRIB -R .\setup.cmd
COPY ..\..\Kidoju\Kidoju.Webapp\setup.cmd .\ /Y
ATTRIB +R .\setup.cmd

REM UPDATE.md
ATTRIB -R .\UPDATE.md
COPY ..\..\Kidoju\Kidoju.Webapp\UPDATE.md .\ /Y
ATTRIB +R .\UPDATE.md

REM webpack
REM ATTRIB -R .\webpack.config.js
REM COPY ..\..\Kidoju\Kidoju.Webapp\webpack.config.js .\ /Y
REM ATTRIB +R .\webpack.config.js

REM ------------------------------------------------------------
REM Javascript files
REM ------------------------------------------------------------

REM Copy ./js/cultures files
XCOPY ..\..\Kidoju\Kidoju.Webapp\js\cultures\*.*  .\js\cultures\ /C /E /I /R /Y
ATTRIB +R .\js\cultures\*.* /S

REM Copy ./js/vendor files
XCOPY ..\..\Kidoju\Kidoju.Webapp\js\vendor\bootstrap\*.* .\js\vendor\bootstrap\ /C /E /I /R /Y
ATTRIB +R .\js\vendor\bootstrap\*.* /S
XCOPY ..\..\Kidoju\Kidoju.Webapp\js\vendor\kendo\*.* .\js\vendor\kendo\ /C /E /I /R /Y
ATTRIB +R .\js\vendor\kendo\*.* /S
XCOPY ..\..\Kidoju\Kidoju.Webapp\js\vendor\logentries\*.* .\js\vendor\logentries\ /C /E /I /R /Y
ATTRIB +R .\js\vendor\logentries\*.* /S

REM ./js/app.common.js
ATTRIB -R .\js\app.common.js
COPY ..\..\Kidoju\Kidoju.Webapp\js\app.common.js .\js\ /Y
ATTRIB +R .\js\app.common.js

REM ./js/app.error.js
ATTRIB -R .\js\app.error.js
COPY ..\..\Kidoju\Kidoju.Webapp\js\app.error.js .\js\ /Y
ATTRIB +R .\js\app.error.js

REM ./js/app.init.js
ATTRIB -R .\js\app.init.js
COPY ..\..\Kidoju\Kidoju.Webapp\js\app.init.js .\js\ /Y
ATTRIB +R .\js\app.init.js

REM ./js/app.locale.js
ATTRIB -R .\js\app.i18n.js
COPY ..\..\Kidoju\Kidoju.Webapp\js\app.i18n.js .\js\ /Y
ATTRIB +R .\js\app.i18n.js

REM ./js/app.logger.js
ATTRIB -R .\js\app.logger.js
COPY ..\..\Kidoju\Kidoju.Webapp\js\app.logger.js .\js\ /Y
ATTRIB +R .\js\app.logger.js

REM ./js/app.support.js
ATTRIB -R .\js\app.support.js
COPY ..\..\Kidoju\Kidoju.Webapp\js\app.support.js .\js\ /Y
ATTRIB +R .\js\app.support.js

REM ./js/app.theme.js
ATTRIB -R .\js\app.theme.js
COPY ..\..\Kidoju\Kidoju.Webapp\js\app.theme.js .\js\ /Y
ATTRIB +R .\js\app.theme.js

REM ------------------------------------------------------------
REM Styles
REM ------------------------------------------------------------

REM Copy fonts
XCOPY ..\..\Kidoju\Kidoju.WebFonts\dist\fonts\*.* .\styles\fonts\ /C /E /I /R /Y
ATTRIB +R .\styles\fonts\*.* /S

REM Copy images
COPY .\graphics\memba.home.jpg .\styles\images\jumbotron.jpg
ATTRIB +R .\styles\images\*.* /S

REM Copy ./js/vendor files
XCOPY ..\..\Kidoju\Kidoju.Webapp\styles\vendor\bootstrap\*.* .\styles\vendor\bootstrap\ /C /E /I /R /Y
ATTRIB +R .\styles\vendor\bootstrap\*.* /S
XCOPY ..\..\Kidoju\Kidoju.Webapp\styles\vendor\fonts\*.* .\styles\vendor\fonts\ /C /E /I /R /Y
ATTRIB +R .\styles\vendor\fonts\*.* /S
XCOPY ..\..\Kidoju\Kidoju.Webapp\styles\vendor\kendo\*.* .\styles\vendor\kendo\ /C /E /I /R /Y
ATTRIB +R .\styles\vendor\kendo\*.* /S

REM Copy theme files
ATTRIB -R .\styles\app.*.less
COPY ..\..\Kidoju\Kidoju.Webapp\styles\app.mixins.less .\styles\ /Y
ATTRIB +R .\styles\app.mixins.less
COPY ..\..\Kidoju\Kidoju.Webapp\styles\app.page.common.less .\styles\ /Y
ATTRIB +R .\styles\app.page.common.less
COPY ..\..\Kidoju\Kidoju.Webapp\styles\app.page.error.less .\styles\ /Y
ATTRIB +R .\styles\app.page.error.less
COPY ..\..\Kidoju\Kidoju.Webapp\styles\app.template.less .\styles\ /Y
ATTRIB +R .\styles\app.template.less
COPY ..\..\Kidoju\Kidoju.Webapp\styles\app.theme.*.less .\styles\ /Y
ATTRIB +R .\styles\app.theme.*.less

REM ------------------------------------------------------------
REM Tests
REM ------------------------------------------------------------

REM Copy ./test/node/lib files
ATTRIB -R .\test\node\lib\*.*
COPY ..\..\Kidoju\Kidoju.Webapp\test\node\lib\error.test.js .\test\node\lib /Y
ATTRIB +R .\test\node\lib\error.test.js
COPY ..\..\Kidoju\Kidoju.Webapp\test\node\lib\logger.test.js .\test\node\lib /Y
ATTRIB +R .\test\node\lib\logger.test.js
COPY ..\..\Kidoju\Kidoju.Webapp\test\node\lib\url.test.js .\test\node\lib /Y
ATTRIB +R .\test\node\lib\url.test.js
COPY ..\..\Kidoju\Kidoju.Webapp\test\node\lib\utils.test.js .\test\node\lib /Y
ATTRIB +R .\test\node\lib\utils.test.js

REM Copy ./test/vendor files
XCOPY ..\..\Kidoju\Kidoju.Webapp\test\vendor  .\test\vendor /C /E /I /R /Y
ATTRIB +R .\test\vendor\*.* /S

REM ------------------------------------------------------------
REM Web modules (webpack)
REM ------------------------------------------------------------

REM Copy web_modules
XCOPY ..\..\Kidoju\Kidoju.Webapp\web_modules\*.*  .\web_modules /C /E /I /R /Y
ATTRIB +R .\web_modules\*.* /S

REM ------------------------------------------------------------
REM Web Application
REM ------------------------------------------------------------

REM Copy ./webapp/config files
ATTRIB -R .\webapp\config\index.js
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\config\index.js .\webapp\config /Y
ATTRIB +R .\webapp\config\index.js

REM Copy ./webapp/lib files
ATTRIB -R .\webapp\lib\*.*
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\lib\error.js .\webapp\lib /Y
ATTRIB +R .\webapp\lib\error.js
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\lib\logger.js .\webapp\lib /Y
ATTRIB +R .\webapp\lib\logger.js
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\lib\url.js .\webapp\lib /Y
ATTRIB +R .\webapp\lib\url.js
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\lib\utils.js .\webapp\lib /Y
ATTRIB +R .\webapp\lib\utils.js

REM Copy ./webapp/middleware files
ATTRIB -R .\webapp\middleware\*.*
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\middleware\error.js .\webapp\middleware /Y
ATTRIB +R .\webapp\middleware\error.js
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\middleware\language.js .\webapp\middleware /Y
ATTRIB +R .\webapp\middleware\language.js
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\middleware\notFound.js .\webapp\middleware /Y
ATTRIB +R .\webapp\middleware\notFound.js

REM Copy ./webapp/views files
ATTRIB -R .\webapp\views\*.*
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\views\error.ejs .\webapp\views /Y
ATTRIB +R .\webapp\views\error.ejs
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\views\footer.ejs .\webapp\views /Y
ATTRIB +R .\webapp\views\footer.ejs

REM Copy ./webapp/server.js
ATTRIB -R .\webapp\server.js
COPY ..\..\Kidoju\Kidoju.Webapp\webapp\server.js .\webapp\ /Y
ATTRIB +R .\webapp\server.js

Copy app.page.error.less too

Copy app.page.error.less too


Add echo off for win script

Add echo off for win script


echo ON

if "%PY3K%" == "1" (
  2to3 --output-dir=src/py3 -W -n src/py
  rmdir src/py /s /q
  move src/py3 src/py
  2to3 --output-dir=test3 -W -n test
  rmdir test /s /q
  move test3 test
)

python setup.py install

Update bld.bat

Update bld.bat


@echo off
setlocal enableextensions

goto entry

:usage
  echo usage: bolt [-h^|--help] [-V^|--version]
  echo     or bolt MODE [^<args^>]
  echo.
  echo modes:
  echo   init
  echo   build
  echo   test
  echo   help
  echo.
  echo For usage/help on a specific module, use:
  echo   bolt help MODE

  exit /b 0

:fail_usage
  echo.
  call :usage
  exit /b 1

:fail
  exit /b 1

:version
  for /F " delims=" %%i in (%base%version) do set v=%%i
  echo bolt %v%
  exit /b 0

:entry

set base=%~dp0

if "%~1"=="" echo error: must specify mode. && goto fail_usage

set mode=%~1
shift

if "%mode%"=="init" goto done_mode_validation
if "%mode%"=="build" goto done_mode_validation
if "%mode%"=="test" goto done_mode_validation
if "%mode%"=="help" goto done_mode_validation
if "%mode%"=="-h" call :usage && exit /b 0
if "%mode%"=="--help" call :usage && exit /b 0
if "%mode%"=="-V" call :version && exit /b 0
if "%mode%"=="--version" call :version && exit /b 0

echo invalid mode [%mode%], must be one of init^|build^|test^|help
goto fail_usage

:done_mode_validation

if not "%mode%"=="help" goto run_mode

set help_mode=true
set mode=%~1

if "%mode%"=="init" goto run_mode
if "%mode%"=="build" goto run_mode
if "%mode%"=="test" goto run_mode

echo help requires argument: bolt help MODE, where MODE is one of init^|build^|test
exit /b 2

:run_mode

call %base%bolt-%mode%.subr.bat
exit /b %errorlevel%

Add implementation of bolt script

Add implementation of bolt script


@echo off
:# Start Windows Notepad
:# Do not use %* to remain compatible with Windows 95
start notepad.exe %1 %2 %3 %4

@echo off
:##############################################################################
:#                                                                            #
:#  Filename        n.bat	                                              #
:#                                                                            #
:#  Description     Start Windows Notepad				      #
:#                                                                            #
:#  Notes 	    Keep compatibility with Windows 95                        #
:#                                                                            #
:#  History                                                                   #
:#   1990s      JFL Created this script.			              #
:#   2019-04-09 JFL Work around trailing spaces issue in Windows 10 v 2019-03.#
:#                                                                            #
:##############################################################################

:# Keep compatibility with Windows 95
if not "%OS%"=="Windows_NT" goto :start_95

:start_nt
:# In Windows 10 version 2019-03, notepad always appends .txt when creating a file if there are trailing spaces
start notepad.exe %*
exit /b

:start_95
:# Do not use %* to remain compatible with Windows 95
start notepad.exe %1 %2 %3 %4


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

:: ----------------------
:: KUDU Deployment Script
:: Version: 0.1.11
:: ----------------------

:: 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

:: #region ORCHARD ENVIRONMENTAL VARIABLES
:: ------------
SET SITE_DIR=%~dp0%..
SET DEPLOYMENT_SOURCE=%~dp0%.
SET DEPLOYMENT_TARGET=%SITE_DIR%\wwwroot
SET DEPLOYMENT_TEMP="%DEPLOYMENT_SOURCE%\build\precompiled"
SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
:: #endregion ORCHARD ENVIRONMENTAL VARIABLES
:: ---------------

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
)
IF NOT DEFINED DEPLOYMENT_TEMP (
  SET DEPLOYMENT_TEMP=%temp%\___deployTemp%random%
  SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
)

IF DEFINED CLEAN_LOCAL_DEPLOYMENT_TEMP (
  IF EXIST "%DEPLOYMENT_TEMP%" rd /s /q "%DEPLOYMENT_TEMP%"
  mkdir "%DEPLOYMENT_TEMP%"
)

IF NOT DEFINED MSBUILD_PATH (
  SET MSBUILD_PATH=%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
)

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

echo Handling .NET Web Application deployment.

:: 1. Restore NuGet packages
IF /I "src\Orchard.sln" NEQ "" (
  call :ExecuteCmd nuget restore "%DEPLOYMENT_SOURCE%\src\Orchard.sln"
  IF !ERRORLEVEL! NEQ 0 goto error
)

:: 2. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\Orchard.proj" /nologo /verbosity:m /t:Precompiled /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="%DEPLOYMENT_SOURCE%\src\\" %SCM_BUILD_ARGS%
) ELSE (
  call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\Orchard.proj" /nologo /verbosity:m /t:Build /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="%DEPLOYMENT_SOURCE%\src\\" %SCM_BUILD_ARGS%
)

IF !ERRORLEVEL! NEQ 0 goto error

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

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

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

goto end

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

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

:: ----------------------
:: KUDU Deployment Script
:: Version: 0.1.11
:: ----------------------

:: 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

:: #region ORCHARD ENVIRONMENTAL VARIABLES
:: ------------
SET SITE_DIR=%~dp0%..
SET DEPLOYMENT_SOURCE=%~dp0%.
SET DEPLOYMENT_TARGET=%SITE_DIR%\wwwroot
SET DEPLOYMENT_TEMP="%DEPLOYMENT_SOURCE%\build\precompiled"
SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
:: ---------------
:: #endregion ORCHARD ENVIRONMENTAL VARIABLES

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
)
IF NOT DEFINED DEPLOYMENT_TEMP (
  SET DEPLOYMENT_TEMP=%temp%\___deployTemp%random%
  SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
)

IF DEFINED CLEAN_LOCAL_DEPLOYMENT_TEMP (
  IF EXIST "%DEPLOYMENT_TEMP%" rd /s /q "%DEPLOYMENT_TEMP%"
  mkdir "%DEPLOYMENT_TEMP%"
)

IF NOT DEFINED MSBUILD_PATH (
  SET MSBUILD_PATH=%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
)

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

echo Handling .NET Web Application deployment.

:: 1. Restore NuGet packages
IF /I "src\Orchard.sln" NEQ "" (
  call :ExecuteCmd nuget restore "%DEPLOYMENT_SOURCE%\src\Orchard.sln"
  IF !ERRORLEVEL! NEQ 0 goto error
)

:: 2. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\Orchard.proj" /nologo /verbosity:m /t:Precompiled /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="%DEPLOYMENT_SOURCE%\src\\" %SCM_BUILD_ARGS%
) ELSE (
  call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\Orchard.proj" /nologo /verbosity:m /t:Build /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="%DEPLOYMENT_SOURCE%\src\\" %SCM_BUILD_ARGS%
)

IF !ERRORLEVEL! NEQ 0 goto error

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

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

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

goto end

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

Change comment layout.

Change comment layout.


git add -A
git commit -am "Update for webiste"
git push -u origin master
pause

git add -A
git commit -am "Update for webiste"
git pull --rebase
git push -u origin master
pause

Update for webiste

Update for webiste


REM Based on, and thanks to, https://github.com/shanselman/march-is-for-makers/blob/master/getruby.cmd

@echo ON

REM Put Ruby in Path
REM You can also use %TEMP% but it is cleared on site restart. Tools is persistent.
SET PATH=%PATH%;D:\home\site\deployments\tools\r\ruby-2.2.2-x64-mingw32\bin

SET _7ZIP="%PROGRAMFILES%\7-Zip\7z.exe"
if not exist %_7ZIP% SET _7ZIP=d:\7zip\7za

REM I am in the repository folder
pushd D:\home\site\deployments\tools
if not exist r md r
cd r
if exist ruby-2.2.2-x64-mingw32 goto end

echo No Ruby, need to get it!

REM Get Ruby and Rails
curl -o ruby222.zip -L http://dl.bintray.com/oneclick/rubyinstaller/ruby-2.2.2-x64-mingw32.7z?direct
REM Azure puts 7zip here!
echo START Unzipping Ruby
%_7ZIP% x -y ruby222.zip > rubyout
echo DONE Unzipping Ruby

REM Get DevKit to build Ruby native gems
REM If you don't need DevKit, rem this out.
curl -o DevKit.zip http://cdn.rubyinstaller.org/archives/devkits/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
echo START Unzipping DevKit
%_7ZIP% x -y -oDevKit DevKit.zip > devkitout
echo DONE Unzipping DevKit

REM Init DevKit
ruby DevKit\dk.rb init

REM Tell DevKit where Ruby is
echo --- > config.yml
echo - D:/home/site/deployments/tools/r/ruby-2.2.2-x64-mingw32 >> config.yml

REM Setup DevKit
ruby DevKit\dk.rb install

popd

:end

REM Need to be in Repository
cd %DEPLOYMENT_SOURCE%
cd

call gem install bundler

echo Bundler install (not update!)
call bundle install

cd %DEPLOYMENT_SOURCE%
cd

REM KuduSync is after this!

Remove comment.

Remove comment.


@echo off
set OLDDIR=%CD%
cd /d %~dp0
REM ============================================
echo *** Generating a Windows GPAC installer ***
REM ============================================

:begin
IF "%1"=="win32" GOTO next
IF "%1"=="x64" GOTO next
echo You must specified target architecture : win32 or x64
GOTO Abort

:next
echo:
REM ============================================
echo Check NSIS is in your PATH
REM ============================================

if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
    setlocal enabledelayedexpansion
    SET PRGROOT=!programfiles(x86^)!
    setlocal disabledelayedexpansion
)
if "%PROCESSOR_ARCHITECTURE%" == "x86" (
    setlocal enabledelayedexpansion
    SET PRGROOT=!programfiles!
    setlocal disabledelayedexpansion
)

set NSIS_EXEC="%PRGROOT%\NSIS\makensis.exe"
if not exist "%PRGROOT%\NSIS\makensis.exe" echo   NSIS couldn't be found at default location %NSIS_EXEC%
if not exist "%PRGROOT%\NSIS\makensis.exe" goto Abort
echo   Found NSIS at default location %NSIS_EXEC%

echo:
REM ============================================
echo Retrieving version/revision information
REM ============================================
if not exist include/gpac/revision.h echo   version couldn't be found - check include/gpac/revision.h exists
if not exist include/gpac/revision.h goto Abort

REM check if found a local commit which has not been pushed
for /f "delims=" %%a in ('git diff FETCH_HEAD') do @set diff=%%a
echo diff = %diff%
if not "%diff%"=="" echo Local and remote revisions not in sync, consider pushing or pulling changes

REM execute git and check if the result if found within revision.h
for /f "delims=" %%a in ('git describe --tags --long') do @set VERSION=%%a
for /f "delims=" %%a in ('git describe --tags --abbrev^=0') do @set TAG=%%a-
for /f "delims=" %%a in ('git rev-parse --abbrev-ref HEAD') do @set BRANCH=%%a
REM remove anotated tag from VERSION
setlocal enabledelayedexpansion
call set VERSION=%%VERSION:!TAG!=%%
setlocal disabledelayedexpansion
SET VarRevisionGIT=%VERSION%-%BRANCH%
for /f "delims=" %%i in ('type include\gpac\revision.h ^| findstr /i /r "%VarRevisionGIT%"') do Set VarRevisionBuild=%%i
echo VarRevisionBuild = %VarRevisionBuild%
echo VarRevisionGIT  = %VarRevisionGIT%
if !"%VarRevisionBuild%"==!"%VarRevisionGIT%" echo   local revision and last build revision are not congruent - please consider rebuilding before generating an installer
if !"%VarRevisionBuild%"==!"%VarRevisionGIT%" goto Abort

move packagers\win32_64\nsis\default.out packagers\win32_64\nsis\default.out_
echo Name "GPAC Framework ${GPAC_VERSION} for %1 revision %VarRevisionGIT%" > packagers\win32_64\nsis\default.out
echo OutFile "gpac-${GPAC_VERSION}-rev%VarRevisionGIT%-%1.exe" >> packagers\win32_64\nsis\default.out
IF "%1"=="x64" echo !define IS_WIN64 >> packagers\win32_64\nsis\default.out

echo:
REM ============================================
echo Executing NSIS
REM ============================================
call %NSIS_EXEC% packagers\win32_64\nsis\gpac_installer.nsi

echo:
REM ============================================
echo Removing temporary files
REM ============================================
move packagers\win32_64\nsis\default.out_ packagers\win32_64\nsis\default.out

echo:
REM ============================================
echo Windows GPAC installer generated - goodbye!
REM ============================================
REM LeaveBatchSuccess
set VarRevisionGIT=
set VarRevisionBuild=
cd /d %OLDDIR%
exit/b 0

:RevisionAbort
echo Local revision and remote revision are not congruent; you may have local commit
echo Please consider pushing your commit before generating an installer

:Abort
echo:
echo  *** ABORTING: CHECK ERROR MESSAGES ABOVE ***

REM LeaveBatchError
set VarRevisionBuild=
cd /d %OLDDIR%
exit/b 1

@echo off
set OLDDIR=%CD%
cd /d %~dp0
REM ============================================
echo *** Generating a Windows GPAC installer ***
REM ============================================

:begin
IF "%1"=="win32" GOTO next
IF "%1"=="x64" GOTO next
echo You must specified target architecture : win32 or x64
GOTO Abort

:next
echo:
REM ============================================
echo Check NSIS is in your PATH
REM ============================================

if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
    setlocal enabledelayedexpansion
    SET PRGROOT=!programfiles(x86^)!
    setlocal disabledelayedexpansion
)
if "%PROCESSOR_ARCHITECTURE%" == "x86" (
    setlocal enabledelayedexpansion
    SET PRGROOT=!programfiles!
    setlocal disabledelayedexpansion
)

set NSIS_EXEC="%PRGROOT%\NSIS\makensis.exe"
if not exist "%PRGROOT%\NSIS\makensis.exe" echo   NSIS couldn't be found at default location %NSIS_EXEC%
if not exist "%PRGROOT%\NSIS\makensis.exe" goto Abort
echo   Found NSIS at default location %NSIS_EXEC%

echo:
REM ============================================
echo Retrieving version/revision information
REM ============================================
if not exist include/gpac/revision.h echo   version couldn't be found - check include/gpac/revision.h exists
if not exist include/gpac/revision.h goto Abort

REM check if found a local commit which has not been pushed
for /f "delims=" %%a in ('git diff FETCH_HEAD') do @set diff=%%a
echo diff = %diff%
if not "%diff%"=="" echo Local and remote revisions not in sync, consider pushing or pulling changes

REM execute git and check if the result if found within revision.h
for /f "delims=" %%a in ('git describe --tags --long') do @set VERSION=%%a
for /f "delims=" %%a in ('git describe --tags --abbrev^=0') do @set TAG=%%a-
for /f "delims=" %%a in ('git rev-parse --abbrev-ref HEAD') do @set BRANCH=%%a
REM remove anotated tag from VERSION
setlocal enabledelayedexpansion
call set VERSION=%%VERSION:!TAG!=%%
setlocal disabledelayedexpansion
SET VarRevisionGIT=%VERSION%-%BRANCH%
for /f "delims=" %%i in ('type include\gpac\revision.h ^| findstr /i /r "%VarRevisionGIT%"') do Set VarRevisionBuild=%%i
echo VarRevisionBuild = %VarRevisionBuild%
echo VarRevisionGIT  = %VarRevisionGIT%
if !"%VarRevisionBuild%"==!"%VarRevisionGIT%" echo   local revision and last build revision are not congruent - please consider rebuilding before generating an installer
if !"%VarRevisionBuild%"==!"%VarRevisionGIT%" goto Abort

move packagers\win32_64\nsis\default.out packagers\win32_64\nsis\default.out_
echo Name "GPAC Framework ${GPAC_VERSION} for %1 revision %VarRevisionGIT%" > packagers\win32_64\nsis\default.out
echo OutFile "gpac-${GPAC_VERSION}-rev%VarRevisionGIT%-%1.exe" >> packagers\win32_64\nsis\default.out
IF "%1"=="x64" echo !define IS_WIN64 >> packagers\win32_64\nsis\default.out

echo:
REM ============================================
echo Executing NSIS
REM ============================================
call %NSIS_EXEC% packagers\win32_64\nsis\gpac_installer.nsi
IF %ERRORLEVEL% NEQ 0 GOTO Abort

echo:
REM ============================================
echo Removing temporary files
REM ============================================
move packagers\win32_64\nsis\default.out_ packagers\win32_64\nsis\default.out

echo:
REM ============================================
echo Windows GPAC installer generated - goodbye!
REM ============================================
REM LeaveBatchSuccess
set VarRevisionGIT=
set VarRevisionBuild=
cd /d %OLDDIR%
exit/b 0

:RevisionAbort
echo Local revision and remote revision are not congruent; you may have local commit
echo Please consider pushing your commit before generating an installer

:Abort
echo:
echo  *** ABORTING: CHECK ERROR MESSAGES ABOVE ***

REM LeaveBatchError
set VarRevisionBuild=
cd /d %OLDDIR%
exit/b 1

add return code check on nsis script call


@echo off
"C:\Program Files\Docker Toolbox\docker-machine" env default --shell cmd > %TEMP%/set-docker-env.bat
call %TEMP%\set-docker-env.bat
del %TEMP%\set-docker-env.bat

@echo on
"C:\Program Files\Docker Toolbox\docker.exe" run --rm --name duraark-pc2bim -v /c/Users/duraark-storage:/duraark-storage ubo/pc2bim pc2bim --input /duraark-storage/%1 --output /duraark-storage/%1.ifc

@echo off
"C:\Program Files\Docker Toolbox\docker-machine" env default --shell cmd > %TEMP%/set-docker-env.bat
call %TEMP%\set-docker-env.bat
del %TEMP%\set-docker-env.bat

@echo on
"C:\Program Files\Docker Toolbox\docker.exe" run --rm --name duraark-pc2bim -v /c/Users/duraark-storage:/duraark-storage ubo/pc2bim pc2bim --input /duraark-storage/%1 --output /duraark-storage/%2

Update 'duraark-pc2bim.bat' to additionally take a second argument to specify output filen ame


@SETLOCAL
@ECHO OFF

WHERE cmake > nul: 2>&1
IF ERRORLEVEL 1 (
    echo ERROR! CMake not found. Install from https://cmake.org/download/
    exit /b 1
)

IF NOT EXIST .build mkdir .build
cd .build

CALL :exec cmake .. -Wdev -Werror=dev -Wdeprecated -Werror=deprecated -G "Visual Studio 15 2017"
IF ERRORLEVEL 1 GOTO :EOF

CALL :exec cmake --build . -- /verbosity:minimal /nologo
IF ERRORLEVEL 1 GOTO :EOF

set CTEST_OUTPUT_ON_FAILURE=1
CALL :exec ctest --parallel 4
IF ERRORLEVEL 1 GOTO :EOF

GOTO :EOF

    :exec
echo.
echo %~nx0: %*
%*

@SETLOCAL
@ECHO OFF

WHERE cmake > nul: 2>&1
IF ERRORLEVEL 1 (
    echo ERROR! CMake not found. Install from https://cmake.org/download/
    exit /b 1
)

IF NOT EXIST .build mkdir .build
cd .build

CALL :exec cmake .. -Wdev -Werror=dev -Wdeprecated -Werror=deprecated -G "Visual Studio 16 2019"
IF ERRORLEVEL 1 GOTO :EOF

CALL :exec cmake --build . -- /verbosity:minimal /nologo
IF ERRORLEVEL 1 GOTO :EOF

set CTEST_OUTPUT_ON_FAILURE=1
CALL :exec ctest --parallel 4
IF ERRORLEVEL 1 GOTO :EOF

GOTO :EOF

    :exec
echo.
echo %~nx0: %*
%*

Use VS2019

Use VS2019


@ECHO OFF
SETLOCAL
SET EL=0

ECHO =========== %~f0 ===========

ECHO platform^: %platform%
ECHO configuration^: %configuration%

SET MSBUILD_VERBOSITY=normal
IF NOT "%1"=="" SET MSBUILD_VERBOSITY=%1
ECHO MSBUILD_VERBOSITY^: %MSBUILD_VERBOSITY%

SET PATH=C:\Program Files\7-Zip;%PATH%
SET PATH=c:\python27;%PATH%
SET PATH="C:\Program Files (x86)\MSBuild\14.0\bin";%PATH%
SET PATH=%~dp0deps\protobuf;%PATH%

REM add unix style "find" to front of PATH
REM used to glob files in gyp
IF DEFINED APPVEYOR SET PATH=C:\Program Files\Git\usr\bin;%PATH%
IF NOT DEFINED APPVEYOR SET PATH=%GIT_INSTALL_ROOT%\bin;%PATH%
WHERE find

IF EXIST %configuration% ECHO deleting %configuration% && RD /Q /S %configuration%
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

IF EXIST protozero.sln DEL protozero.sln
IF EXIST protozero.sdf DEL protozero.sdf
DEL *.vcxproj
DEL *.vcxproj.filters

IF exist deps\gyp (ECHO gyp already cloned) ELSE (git clone --quiet --depth 1 https://chromium.googlesource.com/external/gyp.git deps/gyp)
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET protobuf_sdk=protozero-dep-protobuf-2.6.1.7z
IF EXIST %protobuf_sdk% (ECHO protobuf already downloaded) ELSE (ECHO downloading protobuf ... && powershell Invoke-WebRequest https://mapbox.s3.amazonaws.com/windows-builds/windows-build-deps/$env:protobuf_sdk -OutFile $pwd\$env:protobuf_sdk)
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF EXIST deps\protobuf (ECHO protobuf already extracted) ELSE (CALL 7z x -y %protobuf_sdk% | %windir%\system32\FIND "ing archive")
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

FOR /F %%x in ('find test/ -name "testcase.proto"') DO "deps\protobuf\%platform%\%configuration%\protoc" --cpp_out=. %%x
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

REM note windows requires --generator-output to be absolute
python deps/gyp/gyp_main.py gyp/protozero.gyp --depth=. -f msvs -G msvs_version=2015
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET MSBUILD_PLATFORM=%platform%
IF /I "%MSBUILD_PLATFORM%" == "x86" set MSBUILD_PLATFORM=Win32

msbuild gyp/protozero.sln ^
/nologo ^
/maxcpucount:%NUMBER_OF_PROCESSORS% ^
/p:BuildInParellel=true ^
/p:Configuration=%configuration%;Platform=%MSBUILD_PLATFORM% ^
/verbosity:%MSBUILD_VERBOSITY% ^
/consoleloggerparameters:Summary
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO running %configuration%\%platform%\tests.exe ...
%configuration%\%platform%\tests.exe
:: IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO running %configuration%\%platform%\writer_tests.exe ...
%configuration%\%platform%\writer_tests.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

GOTO DONE

:ERROR
ECHO ~~~~~~~~~ ERROR  %~f0 ~~~~~~~~~~~
SET EL=%ERRORLEVEL%
ECHO ERRORLEVEL^: %EL%

:DONE

ECHO DONE %~f0 %platform% %configuration%
EXIT /B %EL%

@ECHO OFF
SETLOCAL
SET EL=0

ECHO =========== %~f0 ===========

ECHO platform^: %platform%
ECHO configuration^: %configuration%

SET MSBUILD_VERBOSITY=normal
IF NOT "%1"=="" SET MSBUILD_VERBOSITY=%1
ECHO MSBUILD_VERBOSITY^: %MSBUILD_VERBOSITY%

SET PATH=C:\Program Files\7-Zip;%PATH%
SET PATH=c:\python27;%PATH%
SET PATH="C:\Program Files (x86)\MSBuild\14.0\bin";%PATH%
SET PATH=%~dp0deps\protobuf;%PATH%

REM add unix style "find" to front of PATH
REM used to glob files in gyp
IF DEFINED APPVEYOR SET PATH=C:\Program Files\Git\usr\bin;%PATH%
IF NOT DEFINED APPVEYOR SET PATH=%GIT_INSTALL_ROOT%\bin;%PATH%
WHERE find

IF EXIST %configuration% ECHO deleting %configuration% && RD /Q /S %configuration%
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

IF EXIST protozero.sln DEL protozero.sln
IF EXIST protozero.sdf DEL protozero.sdf
DEL *.vcxproj
DEL *.vcxproj.filters

IF exist deps\gyp (ECHO gyp already cloned) ELSE (git clone --quiet --depth 1 https://chromium.googlesource.com/external/gyp.git deps/gyp)
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET protobuf_sdk=protozero-dep-protobuf-2.6.1.7z
IF EXIST %protobuf_sdk% (ECHO protobuf already downloaded) ELSE (ECHO downloading protobuf ... && powershell Invoke-WebRequest https://mapbox.s3.amazonaws.com/windows-builds/windows-build-deps/$env:protobuf_sdk -OutFile $pwd\$env:protobuf_sdk)
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF EXIST deps\protobuf (ECHO protobuf already extracted) ELSE (CALL 7z x -y %protobuf_sdk% | %windir%\system32\FIND "ing archive")
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

FOR /F %%x in ('find test/ -name "testcase.proto"') DO "deps\protobuf\%platform%\%configuration%\protoc" --cpp_out=. %%x
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

REM note windows requires --generator-output to be absolute
python deps/gyp/gyp_main.py gyp/protozero.gyp --depth=. -f msvs -G msvs_version=2015
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET MSBUILD_PLATFORM=%platform%
IF /I "%MSBUILD_PLATFORM%" == "x86" set MSBUILD_PLATFORM=Win32

msbuild gyp/protozero.sln ^
/nologo ^
/maxcpucount:%NUMBER_OF_PROCESSORS% ^
/p:BuildInParellel=true ^
/p:Configuration=%configuration%;Platform=%MSBUILD_PLATFORM% ^
/verbosity:%MSBUILD_VERBOSITY% ^
/consoleloggerparameters:Summary
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO running gyp\%configuration%\%platform%\tests.exe ...
gyp\%configuration%\%platform%\tests.exe
:: IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO running gyp\%configuration%\%platform%\writer_tests.exe ...
gyp\%configuration%\%platform%\writer_tests.exe
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

GOTO DONE

:ERROR
ECHO ~~~~~~~~~ ERROR  %~f0 ~~~~~~~~~~~
SET EL=%ERRORLEVEL%
ECHO ERRORLEVEL^: %EL%

:DONE

ECHO DONE %~f0 %platform% %configuration%
EXIT /B %EL%

fix moar paths

fix moar paths


@echo off

echo.
echo == Copy
echo.

set ZIP="..\build-tools\7zip\7z.exe"
set EXTRACTED_DIR="..\extracted"
set TARGET_DIR="..\repackage"
set LIBS="..\libs\"

echo.
echo === Prepare repackaging folder %TARGET_DIR%
echo.

pushd extracted

if not exist %TARGET_DIR% (mkdir %TARGET_DIR%)

echo Python27
rem include Python from Appveyor
xcopy /SIQY C:\Python27 "%TARGET_DIR%\Python27"

echo Python27.dll
rem add the mising python27.dll to the python folder
copy C:\Windows\SysWOW64\python27.dll "%TARGET_DIR%\Python27"

echo Fife-Engine
move "%EXTRACTED_DIR%\Python27\*" "%TARGET_DIR%\Python27"

echo Unknown-Horizons
move "%EXTRACTED_DIR%\unknown-horizons" "%TARGET_DIR%"

echo Copy needed dlls installer
copy "%LIBS%\vc_redist.x86.exe" "%TARGET_DIR%"

popd

@echo off

echo.
echo == Copy
echo.

set ZIP="..\build-tools\7zip\7z.exe"
set EXTRACTED_DIR="..\extracted"
set TARGET_DIR="..\repackage"
set LIBS="..\libs\"

echo.
echo === Prepare repackaging folder %TARGET_DIR%
echo.

pushd extracted

if not exist %TARGET_DIR% (mkdir %TARGET_DIR%)

echo Python27
rem include Python from Appveyor
xcopy /SIQY C:\Python27 "%TARGET_DIR%\Python27"

echo Python27.dll
rem add the mising python27.dll to the python folder
copy C:\Windows\SysWOW64\python27.dll "%TARGET_DIR%\Python27"

echo Fife-Engine
move "%EXTRACTED_DIR%\Python27\Lib\site-packages\fife" "%TARGET_DIR%\Python27\Lib\site-packages\fife"
move "%EXTRACTED_DIR%\Python27\Lib\site-packages\libfife-0.4.1-py2.7.egg-info" "%TARGET_DIR%\Python27\Lib\site-packages\libfife-0.4.1-py2.7.egg-info"
dir "%EXTRACTED_DIR%\Python27\Lib\site-packages\"

echo Unknown-Horizons
move "%EXTRACTED_DIR%\unknown-horizons" "%TARGET_DIR%"

echo Copy needed dlls installer
copy "%LIBS%\vc_redist.x86.exe" "%TARGET_DIR%"

popd

Update 3-copy.bat

Update 3-copy.bat


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

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

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

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

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

:SelectNodeVersion

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

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

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

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

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

goto :EOF

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

:Deployment
echo Handling node.js deployment.

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

:: 2. Select node version
call :SelectNodeVersion

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

:: 4. Install grunt-cli
IF EXIST "%DEPLOYMENT_TARGET%\Gruntfile.js" (
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd !NPM_CMD! install grunt-cli -g
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

:: 5. Install bower and bower packages
IF EXIST "%DEPLOYMENT_TARGET%\bower.json" (
  pushd "%DEPLOYMENT_TARGET%"
  :: install bower
  call :ExecuteCmd !NPM_CMD! install bower -g
  IF !ERRORLEVEL! NEQ 0 goto error
  :: run bower-install grunt task
  call :ExecuteCmd grunt bower-install
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

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

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

goto end

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

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

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

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

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

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

:SelectNodeVersion

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

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

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

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

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

goto :EOF

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

:Deployment
echo Handling node.js deployment.

:: 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" (
  echo Installing npm packages...
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd !NPM_CMD! install
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

:: 4. Install grunt-cli
IF EXIST "%DEPLOYMENT_TARGET%\Gruntfile.js" (
  echo Installing grunt-cli...
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd !NPM_CMD! install grunt-cli -g
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

:: 5. Install bower and bower packages
IF EXIST "%DEPLOYMENT_TARGET%\bower.json" (
  pushd "%DEPLOYMENT_TARGET%"
  echo Installing bower...
  call :ExecuteCmd !NPM_CMD! install bower -g
  IF !ERRORLEVEL! NEQ 0 goto error
  echo Running bower-install grunt task...
  call :ExecuteCmd grunt bower-install
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

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

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

goto end

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

add logging to the deployment script

add logging to the deployment script


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

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

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

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

:: 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
)
IF NOT DEFINED DEPLOYMENT_TEMP (
  SET DEPLOYMENT_TEMP=%temp%\___deployTemp%random%
  SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
)

IF DEFINED CLEAN_LOCAL_DEPLOYMENT_TEMP (
  IF EXIST "%DEPLOYMENT_TEMP%" rd /s /q "%DEPLOYMENT_TEMP%"
  mkdir "%DEPLOYMENT_TEMP%"
)

IF DEFINED MSBUILD_PATH goto MsbuildPathDefined
SET MSBUILD_PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe
:MsbuildPathDefined

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

echo Handling .NET Web Application deployment.

:: 1. Restore NuGet packages
IF /I "Demo.sln" NEQ "" (
  call :ExecuteCmd nuget restore "%DEPLOYMENT_SOURCE%\Demo.sln"
  IF !ERRORLEVEL! NEQ 0 goto error
)

:: 2. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\Demo\Demo.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
) ELSE (
  call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\Demo\Demo.csproj" /nologo /verbosity:m /t:Build /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
)

IF !ERRORLEVEL! NEQ 0 goto error

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

:: 4. Install Bower packages
IF EXIST "%DEPLOYMENT_TARGET%\bower.json" (
  pushd "%DEPLOYMENT_TARGET%"
  call bower install
  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.

add deploy script to Azure

add deploy script to Azure


powershell.exe .\script\deploy.ps1 staff development "1.0.1.0" -Force -NoCampfire

powershell.exe .\script\deploy.ps1 staff development %1 -Force -NoCampfire

Tweak helper script

Tweak helper script


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

:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.6
:: ----------------------

:: 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
)
IF NOT DEFINED DEPLOYMENT_TEMP (
  SET DEPLOYMENT_TEMP=%temp%\___deployTemp%random%
  SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
)

IF DEFINED CLEAN_LOCAL_DEPLOYMENT_TEMP (
  IF EXIST "%DEPLOYMENT_TEMP%" rd /s /q "%DEPLOYMENT_TEMP%"
  mkdir "%DEPLOYMENT_TEMP%"
)

IF DEFINED MSBUILD_PATH goto MsbuildPathDefined
SET MSBUILD_PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe
:MsbuildPathDefined

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

echo Handling backend WebApi project.

:: 1. Restore NuGet packages
IF /I "AzureFunctions.sln" NEQ "" (
  call :ExecuteCmd nuget restore "%DEPLOYMENT_SOURCE%\AzureFunctions.sln"
  IF !ERRORLEVEL! NEQ 0 goto error
)

:: 2. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\AzureFunctions\AzureFunctions.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
) ELSE (
  call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\AzureFunctions\AzureFunctions.csproj" /nologo /verbosity:m /t:Build /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
)

IF !ERRORLEVEL! NEQ 0 goto error

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

echo Handling frontend Angular2 project.

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

:: 5. Select node version
:: call :SelectNodeVersion

:: 6. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
  pushd "%DEPLOYMENT_TARGET%"

  call :ExecuteCmd npm install
  IF !ERRORLEVEL! NEQ 0 goto error

  call :ExecuteCmd npm run typings install
  IF !ERRORLEVEL! NEQ 0 goto error

  call :ExecuteCmd npm install -g jspm
  IF !ERRORLEVEL! NEQ 0 (
	call :ExecuteCmd npm install -g jspm
	IF !ERRORLEVEL! NEQ 0 goto error
  )

  call :ExecuteCmd jspm install
  IF !ERRORLEVEL! NEQ 0 goto error

  call :ExecuteCmd npm run tsc
  IF !ERRORLEVEL! NEQ 0 goto error

  call :ExecuteCmd rm index.html
  IF !ERRORLEVEL! NEQ 0 goto error

  call :ExecuteCmd ren index.html.prod index.html
  IF !ERRORLEVEL! NEQ 0 goto error

  call :ExecuteCmd jspm bundle-sfx app sfx/app.js
  IF !ERRORLEVEL! NEQ 0 goto error

  popd
)

:: 7. Install bower
IF EXIST "%DEPLOYMENT_TARGET%\bower.json" (
  pushd "%DEPLOYMENT_TARGET%"

  call :ExecuteCmd bower install
  IF !ERRORLEVEL! NEQ 0 goto error

  popd
)

:: 8. Copy templates-update webjob
SET WEBJOB_PATH=%HOME%\site\wwwroot\App_Data\jobs\triggered\templates-update
IF NOT EXIST "%WEBJOB_PATH%" (
  mkdir "%WEBJOB_PATH%"
)

copy "%DEPLOYMENT_SOURCE%\WebJobs\templates-update\templates-update.cmd" "%WEBJOB_PATH%"
copy "%DEPLOYMENT_SOURCE%\WebJobs\templates-update\settings.job" "%WEBJOB_PATH%"

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
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.6
:: ----------------------

:: 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
)
IF NOT DEFINED DEPLOYMENT_TEMP (
  SET DEPLOYMENT_TEMP=%temp%\___deployTemp%random%
  SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
)

IF DEFINED CLEAN_LOCAL_DEPLOYMENT_TEMP (
  IF EXIST "%DEPLOYMENT_TEMP%" rd /s /q "%DEPLOYMENT_TEMP%"
  mkdir "%DEPLOYMENT_TEMP%"
)

IF DEFINED MSBUILD_PATH goto MsbuildPathDefined
SET MSBUILD_PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe
:MsbuildPathDefined

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

echo Handling backend WebApi project.

:: 1. Restore NuGet packages
IF /I "AzureFunctions.sln" NEQ "" (
  call :ExecuteCmd nuget restore "%DEPLOYMENT_SOURCE%\AzureFunctions.sln"
  IF !ERRORLEVEL! NEQ 0 goto error
)

:: 2. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\AzureFunctions\AzureFunctions.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
) ELSE (
  call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\AzureFunctions\AzureFunctions.csproj" /nologo /verbosity:m /t:Build /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
)

IF !ERRORLEVEL! NEQ 0 goto error

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

echo Handling frontend Angular2 project.

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

:: 5. Create lastCommit, packageJsonLastCommit, bowerLastCommit, typingsLastCommit vars
  pushd "%DEPLOYMENT_SOURCE%"

  call :ExecuteCmd git log -n 1 > latestCommit.txt
  IF !ERRORLEVEL! NEQ 0 goto error
  SET /p lastCommit=<lastCommit.txt
  DEL lastCommit.txt

  call :ExecuteCmd git log -n 1 -- AzureFunctions.Client\package.json > packageJsonLastCommit.txt
  IF !ERRORLEVEL! NEQ 0 goto error
  SET /p packageJsonLastCommit=<packageJsonLastCommit.txt
  DEL packageJsonLastCommit.txt

  call :ExecuteCmd git log -n 1 -- AzureFunctions.Client\bower.json > bowerLastCommit.txt
  IF !ERRORLEVEL! NEQ 0 goto error
  SET /p bowerLastCommit=<bowerLastCommit.txt
  DEL bowerLastCommit.txt

  call :ExecuteCmd git log -n 1 -- AzureFunctions.Client\typings.json > typingsLastCommit.txt
  IF !ERRORLEVEL! NEQ 0 goto error
  SET /p typingsLastCommit=<typingsLastCommit.txt
  DEL typingsLastCommit.txt

  popd

:: 6. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
  pushd "%DEPLOYMENT_TARGET%"

  SET NPM_TOOLS="%HOME%\npm_tools"

  IF NOT EXIST "%NPM_TOOLS%" (
    mkdir "%NPM_TOOLS%"
  )

  SET PATH=%PATH%;%NPM_TOOLS%

  IF NOT EXIST "%NPM_TOOLS%\jspm.cmd" (
    call :ExecuteCmd npm config set prefix "D:\home\npm_tools"
    IF !ERRORLEVEL! NEQ 0 goto error

    call :ExecuteCmd npm install -g jspm
    IF !ERRORLEVEL! NEQ 0 (
      call :ExecuteCmd npm install -g jspm
      IF !ERRORLEVEL! NEQ 0 goto error
    )
  )

  SET res=F
  IF NOT "%packageJsonLastCommit%" == "%lastCommit%" SET res=T
  IF NOT EXIST "node_modules" SET res=T
  IF "%res%"=="T" (
    call :ExecuteCmd npm install
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  SET res=F
  IF NOT "%packageJsonLastCommit%" == "%lastCommit%" SET res=T
  IF NOT EXIST "jspm_packages" SET res=T
  IF "%res%"=="T" (
    call :ExecuteCmd jspm install
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  SET res=F
  IF NOT "%typingsLastCommit%" == "%lastCommit%" SET res=T
  IF NOT EXIST "typings" SET res=T
  IF "%res%"=="T" (
    call :ExecuteCmd npm run typings install
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  call :ExecuteCmd npm run tsc
  IF !ERRORLEVEL! NEQ 0 goto error

  call :ExecuteCmd rm index.html
  IF !ERRORLEVEL! NEQ 0 goto error

  call :ExecuteCmd ren index.html.prod index.html
  IF !ERRORLEVEL! NEQ 0 goto error

  call :ExecuteCmd jspm bundle-sfx app sfx/app.js
  IF !ERRORLEVEL! NEQ 0 goto error

  popd
)

:: 7. Install bower
IF EXIST "%DEPLOYMENT_TARGET%\bower.json" (
  pushd "%DEPLOYMENT_TARGET%"

  SET res=F
  IF NOT "%bowerLastCommit%" == "%lastCommit%" SET res=T
  IF NOT EXIST "bower_components" SET res=T
  IF "%res%"=="T" (
    call :ExecuteCmd bower install
    IF !ERRORLEVEL! NEQ 0 goto error
  )
  popd
)

:: 8. Copy templates-update webjob
SET WEBJOB_PATH=%HOME%\site\wwwroot\App_Data\jobs\triggered\templates-update
IF NOT EXIST "%WEBJOB_PATH%" (
  mkdir "%WEBJOB_PATH%"
)

copy "%DEPLOYMENT_SOURCE%\WebJobs\templates-update\templates-update.cmd" "%WEBJOB_PATH%"
copy "%DEPLOYMENT_SOURCE%\WebJobs\templates-update\settings.job" "%WEBJOB_PATH%"

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
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.

Make deployment faster

Make deployment faster


mkdir "%PREFIX%\include\"
if errorlevel 1 exit 1
mkdir "%PREFIX%\bin\"
if errorlevel 1 exit 1
mkdir "%PREFIX%\lib\"
if errorlevel 1 exit 1

cd src
if errorlevel 1 exit 1
nmake -f Makefile.msvc.x64.in
if errorlevel 1 exit 1

cp mecab.h "%PREFIX%\include\"
if errorlevel 1 exit 1

cp libmecab.dll "%PREFIX%\lib\"
if errorlevel 1 exit 1
cp libmecab.lib "%PREFIX%\lib\"
if errorlevel 1 exit 1

cp mecab.exe "%PREFIX%\bin\"
if errorlevel 1 exit 1
cp mecab-cost-train.exe "%PREFIX%\bin\"
if errorlevel 1 exit 1
cp mecab-dict-gen.exe "%PREFIX%\bin\"
if errorlevel 1 exit 1
cp mecab-dict-index.exe "%PREFIX%\bin\"
if errorlevel 1 exit 1
cp mecab-system-eval.exe "%PREFIX%\bin\"
if errorlevel 1 exit 1
cp mecab-test-gen.exe "%PREFIX%\bin\"
if errorlevel 1 exit 1

if errorlevel 1 exit /b 1

mkdir "%PREFIX%\include\"
if errorlevel 1 exit 1
mkdir "%PREFIX%\bin\"
if errorlevel 1 exit 1
mkdir "%PREFIX%\lib\"
if errorlevel 1 exit 1

cd src
if errorlevel 1 exit 1
nmake -f Makefile.msvc.x64.in
if errorlevel 1 exit 1

cp mecab.h "%PREFIX%\include\"
if errorlevel 1 exit 1

cp libmecab.* "%PREFIX%\lib\"
if errorlevel 1 exit 1

cp *.exe "%PREFIX%\bin\"
if errorlevel 1 exit 1

if errorlevel 1 exit /b 1

simplify windows build script.

simplify windows build script.


echo "create VS 2022 project files for NaoTHSoccer"
premake5 --Test vs2022

pause

add convenience script for vs2022

add convenience script for vs2022


@echo off

::
:: Composer CLI Shortcut
::

:: call composer
"php.exe" "composer.phar" %*

pause

@echo off

::
:: Composer CLI Shortcut
::

:: call composer
"%~dp0php.exe" "%~dp0composer.phar" %*

pause

fix composer.phar wasn't found, when called from outside folder


add tmp.bat

add tmp.bat


REM Copyright (c) 2017-2020, Patrick Pelissier
REM All rights reserved.
REM
REM Redistribution and use in source and binary forms, with or without
REM modification, are permitted provided that the following conditions are met:
REM + Redistributions of source code must retain the above copyright
REM   notice, this list of conditions and the following disclaimer.
REM + Redistributions in binary form must reproduce the above copyright
REM   notice, this list of conditions and the following disclaimer in the
REM   documentation and/or other materials provided with the distribution.
REM
REM THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
REM EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
REM WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
REM DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
REM DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
REM (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
REM LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
REM ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
REM (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
REM SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

REM Execute the test suite for Microsoft Visual Studio
REM
REM Load Micosoft Visual Studio environement file.
IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" (
    call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
)
IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" (
    call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
)

REM Remove previous results
DEL *.log *.dat

REM List the expected failure (compiler internal error)
set "expectedFailure1=test-msnapshot.c"
set "expectedFailure2=test-none.c"

echo "Compiler full version:"
cl /Bv
clang-cl /Bv

echo " "

REM Perform for each test
for %%f in (test-*.c) do (
    echo =================================================
    echo Testing %%f
    REM Copy the test file as a C++ file as CL.EXE only support C++ file
    copy %%f test.cpp
    if ERRORLEVEL 1 EXIT /B 1
    REM Compile the test suite
    REM /Zc:preprocessor is mandatory to have a compliant preprocessor
    REM /Zc:__cplusplus is needed to report the real value of __cplusplus, so that M*LIB uses the C++ atomic, and not its emulation.
    REM Enable warnings and basic optimization
    REM Inform M*LIB to use Annex K
    echo Compiling %%f
    cl.exe /I.. /O2 /W3 /std:c++14 /Zc:__cplusplus /Zc:preprocessor /D__STDC_WANT_LIB_EXT1__ test.cpp > %%f.log 2>&1
    if ERRORLEVEL 1 (
        echo *** BUILD ERROR for %%f *** >> %%f.log
        type %%f.log
        if /i "%%f" NEQ "%expectedFailure1%" if /i "%%f" NEQ "%expectedFailure2%" EXIT /B 1
        )
    REM Execute it
    echo Running %%f
    test.exe >> %%f.log 2>&1
    if ERRORLEVEL 1 (
        echo *** RUNTIME ERROR for %%f ***  >> %%f.log
        type %%f.log
        if /i "%%f" NEQ "%expectedFailure%" EXIT /B 1
    ) ELSE (
        echo Test OK for %%f  >> %%f.log
    )
    type %%f.log
)
echo "All tests passed (except %expectedFailure%)"
exit /B 0

REM Copyright (c) 2017-2020, Patrick Pelissier
REM All rights reserved.
REM
REM Redistribution and use in source and binary forms, with or without
REM modification, are permitted provided that the following conditions are met:
REM + Redistributions of source code must retain the above copyright
REM   notice, this list of conditions and the following disclaimer.
REM + Redistributions in binary form must reproduce the above copyright
REM   notice, this list of conditions and the following disclaimer in the
REM   documentation and/or other materials provided with the distribution.
REM
REM THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
REM EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
REM WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
REM DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
REM DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
REM (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
REM LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
REM ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
REM (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
REM SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

REM Execute the test suite for Microsoft Visual Studio
REM
REM Load Micosoft Visual Studio environement file.
IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" (
    call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
)
IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" (
    call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
)

REM Remove previous results
DEL *.log *.dat

REM List the expected failure (compiler internal error)
set "expectedFailure1=test-msnapshot.c"
set "expectedFailure2=test-none.c"

echo "Compiler full version:"
cl /Bv

echo " "

REM Perform for each test
for %%f in (test-*.c) do (
    echo =================================================
    echo Testing %%f
    REM Copy the test file as a C++ file as CL.EXE only support C++ file
    copy %%f test.cpp
    if ERRORLEVEL 1 EXIT /B 1
    REM Compile the test suite
    REM /Zc:preprocessor is mandatory to have a compliant preprocessor
    REM /Zc:__cplusplus is needed to report the real value of __cplusplus, so that M*LIB uses the C++ atomic, and not its emulation.
    REM Enable warnings and basic optimization
    REM Inform M*LIB to use Annex K
    echo Compiling %%f
    cl.exe /I.. /O2 /W3 /std:c++14 /Zc:__cplusplus /Zc:preprocessor /D__STDC_WANT_LIB_EXT1__ test.cpp > %%f.log 2>&1
    if ERRORLEVEL 1 (
        echo *** BUILD ERROR for %%f *** >> %%f.log
        type %%f.log
        if /i "%%f" NEQ "%expectedFailure1%" if /i "%%f" NEQ "%expectedFailure2%" EXIT /B 1
        )
    REM Execute it
    echo Running %%f
    test.exe >> %%f.log 2>&1
    if ERRORLEVEL 1 (
        echo *** RUNTIME ERROR for %%f ***  >> %%f.log
        type %%f.log
        if /i "%%f" NEQ "%expectedFailure%" EXIT /B 1
    ) ELSE (
        echo Test OK for %%f  >> %%f.log
    )
    type %%f.log
)
echo "All tests passed (except %expectedFailure%)"
exit /B 0

Remove clang-cl as it is not available

Remove clang-cl as it is not available


set project=clibdpa

rem //expected build dir structure
set buildexp=build\\Visual_Studio_12_2013\\x86

set currentdir=%cd%
set builddir=.\\%buildexp%

mkdir %builddir%

rem //get path to clibcdc libs
set clibcdc=..\\clibcdc\\%buildexp%
pushd %clibcdc%
set clibcdc=%cd%
popd

rem //get path to clibspi libs
set clibspi=..\\clibspi\\%buildexp%
pushd %clibspi%
set clibspi=%cd%
popd

rem //get path to cutils libs
set cutils=..\\cutils\\%buildexp%
pushd %cutils%
set cutils=%cd%
popd

rem //launch cmake to generate build environment
pushd %builddir%
cmake -G "Visual Studio 12 2013" -Dclibcdc_DIR:PATH=%clibcdc% -Dclibspi_DIR:PATH=%clibspi% -Dcutils_DIR:PATH=%cutils% %currentdir%
popd

rem //build from generated build environment
cmake --build %builddir%

set project=clibdpa

rem //expected build dir structure
set buildexp=build\\Visual_Studio_14_2015\\x86

set currentdir=%cd%
set builddir=.\\%buildexp%

mkdir %builddir%

rem //get path to clibcdc libs
set clibcdc=..\\clibcdc\\%buildexp%
pushd %clibcdc%
set clibcdc=%cd%
popd

rem //get path to clibspi libs
set clibspi=..\\clibspi\\%buildexp%
pushd %clibspi%
set clibspi=%cd%
popd

rem //get path to cutils libs
set cutils=..\\cutils\\%buildexp%
pushd %cutils%
set cutils=%cd%
popd

rem //launch cmake to generate build environment
pushd %builddir%
cmake -G "Visual Studio 14 2015" -Dclibcdc_DIR:PATH=%clibcdc% -Dclibspi_DIR:PATH=%clibspi% -Dcutils_DIR:PATH=%cutils% %currentdir%
popd

rem //build from generated build environment
cmake --build %builddir%

Fix for MSVS2015

Fix for MSVS2015

Signed-off-by: Roman3349 <6b7cbc66756660b4790b3af1ec1507653acaa035@centrum.cz>