set PATH=C:\Go\bin;%PATH%

set GOPATH=%CD%\gopath;%CD%\concourse
set PATH=%CD%\gopath\bin;%PATH%

set /p FinalVersion=<final-version\version
set /p WorkerVersion=<concourse\src\worker-version\version

mkdir cli-artifacts
move fly-rc\fly_* cli-artifacts

go get github.com/jteeuwen/go-bindata

go build -o go-bindata.exe github.com/jteeuwen/go-bindata/go-bindata

.\go-bindata.exe -pkg bindata -o concourse\src\github.com\concourse\bin\bindata\bindata.go cli-artifacts/...

go build -ldflags "-X main.Version=%FinalVersion% -X github.com/concourse/atc/atccmd.Version=%FinalVersion% -X github.com/concourse/atc/atccmd.WorkerVersion=%WorkerVersion% -X main.WorkerVersion=%WorkerVersion%" -o .\binary\concourse_windows_amd64.exe github.com/concourse/bin/cmd/concourse

certUtil -hashfile .\binary\concourse_windows_amd64.exe SHA1 > .\binary\concourse_windows_amd64.exe.sha1

set PATH=C:\Go\bin;C:\tools\mingw64\bin;%PATH%

set GOPATH=%CD%\gopath;%CD%\concourse
set PATH=%CD%\gopath\bin;%PATH%

set /p FinalVersion=<final-version\version
set /p WorkerVersion=<concourse\src\worker-version\version

mkdir cli-artifacts
move fly-rc\fly_* cli-artifacts

go get github.com/jteeuwen/go-bindata

go build -o go-bindata.exe github.com/jteeuwen/go-bindata/go-bindata

.\go-bindata.exe -pkg bindata -o concourse\src\github.com\concourse\bin\bindata\bindata.go cli-artifacts/...

go build -ldflags "-X main.Version=%FinalVersion% -X github.com/concourse/atc/atccmd.Version=%FinalVersion% -X github.com/concourse/atc/atccmd.WorkerVersion=%WorkerVersion% -X main.WorkerVersion=%WorkerVersion%" -o .\binary\concourse_windows_amd64.exe github.com/concourse/bin/cmd/concourse

certUtil -hashfile .\binary\concourse_windows_amd64.exe SHA1 > .\binary\concourse_windows_amd64.exe.sha1

add gcc to %PATH%

add gcc to %PATH%


mkdir build
cd build

cmake .. -G "Ninja" ^
    -DCMAKE_BUILD_TYPE="Release" ^
    -DINSTALL_DIR_LAYOUT="Unix" ^
    -DCMAKE_PREFIX_PATH:FILEPATH="%PREFIX%" ^
    -DCMAKE_INSTALL_PREFIX:FILEPATH="%LIBRARY_PREFIX%" ^
    -DINSTALL_DIR:FILEPATH="%LIBRARY_PREFIX%" ^
    -DOCC_INCLUDE_DIR:FILEPATH="%LIBRARY_PREFIX%\include\opencascade" ^
    -DOCC_LIBRARY_DIR:FILEPATH="%LIBRARY_PREFIX%\lib" ^
    -DUSE_OCC=ON ^
    -DUSE_PYTHON=ON ^
    -DUSE_GUI=OFF ^
    -DUSE_SUPERBUILD=OFF

if errorlevel 1 exit 1
ninja install
if errorlevel 1 exit 1

mkdir %LIBRARY_PREFIX%\include\netgen -p
rem this line is not correct. There is already a mydef.hpp in the include files
rem better just move the config.h and make FreeCAD-cmake look for a congfig.h instead of
rem a mydefs.hpp
Copy %LIBRARY_PREFIX%\include\include\mydefs.hpp %LIBRARY_PREFIX%\include\netgen\mydefs.hpp

mkdir build
cd build

cmake .. -G "Ninja" ^
    -DCMAKE_BUILD_TYPE="Release" ^
    -DINSTALL_DIR_LAYOUT="Unix" ^
    -DCMAKE_PREFIX_PATH:FILEPATH="%PREFIX%" ^
    -DCMAKE_INSTALL_PREFIX:FILEPATH="%LIBRARY_PREFIX%" ^
    -DINSTALL_DIR:FILEPATH="%LIBRARY_PREFIX%" ^
    -DOCC_INCLUDE_DIR:FILEPATH="%LIBRARY_PREFIX%\include\opencascade" ^
    -DOCC_LIBRARY_DIR:FILEPATH="%LIBRARY_PREFIX%\lib" ^
    -DUSE_OCC=ON ^
    -DUSE_PYTHON=ON ^
    -DUSE_GUI=OFF ^
    -DUSE_SUPERBUILD=OFF

if errorlevel 1 exit 1
ninja install
if errorlevel 1 exit 1

mkdir %LIBRARY_PREFIX%\include\netgen -p
rem this line is not correct. There is already a mydef.hpp in the include files
rem better just move the config.h and make FreeCAD-cmake look for a congfig.h instead of
rem a mydefs.hpp
Copy %SRC_DIR%\libsrc\include\mydefs.hpp %LIBRARY_PREFIX%\include\netgen\mydefs.hpp

update windows script

netgen: update windows script


@echo off
python #enchantDB.py
python #itemDB.py
python #manualformDB.py
python #minimapinfoDB.py
python #raceDB.py
python #characterstyleDB.py
python #faceemotion2DB.py
python #dungeondb2DB.py
python #dungeon_ruinDB.py
python #skilliconDB.py
python #skillinfoDB.py
pause

@echo off
python #enchantDB.py
python #itemDB.py
python #manualformDB.py
python #minimapinfoDB.py
python #raceDB.py
python #titleDB.py
python #characterstyleDB.py
python #faceemotion2DB.py
python #dungeondb2DB.py
python #dungeon_ruinDB.py
python #skilliconDB_Compat.py
python #skillinfoDB.py
python #skillvarDB_Metalware.py
python #fieldquestNoticeDB.py
pause

update batch script add new scripts in run_scripts.bat


::
:: ownCloud
::
:: @author Thomas Müller
:: @author Tobias Ramforth (translated into Windows batch file)
::
:: @copyright 2012, 2013 Thomas Müller thomas.mueller@tmit.eu
::

@echo off

set BASEDIR=%~dp0
set DATADIR=data-autotest

:: create autoconfig for sqlite, mysql, postgresql and mssql
echo ^<?php                                      > .\tests\autoconfig-sqlite.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-sqlite.php
echo  'installed' ^=^> false^,                   >> .\tests\autoconfig-sqlite.php
echo  'dbtype' ^=^> 'sqlite'^,                   >> .\tests\autoconfig-sqlite.php
echo  'dbtableprefix' ^=^> 'oc_'^,               >> .\tests\autoconfig-sqlite.php
echo  'adminlogin' ^=^> 'admin'^,                >> .\tests\autoconfig-sqlite.php
echo  'adminpass' ^=^> 'admin'^,                 >> .\tests\autoconfig-sqlite.php
echo  'directory' ^=^> '%BASEDIR%%DATADIR%'^,    >> .\tests\autoconfig-sqlite.php
echo ^)^;                                        >> .\tests\autoconfig-sqlite.php

echo ^<?php                                      > .\tests\autoconfig-mysql.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-mysql.php
echo   'installed' ^=^> false^,                  >> .\tests\autoconfig-mysql.php
echo   'dbtype' ^=^> 'mysql'^,                   >> .\tests\autoconfig-mysql.php
echo   'dbtableprefix' ^=^> 'oc_'^,              >> .\tests\autoconfig-mysql.php
echo   'adminlogin' ^=^> 'admin'^,               >> .\tests\autoconfig-mysql.php
echo   'adminpass' ^=^> 'admin'^,                >> .\tests\autoconfig-mysql.php
echo   'directory' ^=^> '%BASEDIR%%DATADIR%'^,   >> .\tests\autoconfig-mysql.php
echo   'dbuser' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mysql.php
echo   'dbname' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mysql.php
echo   'dbhost' ^=^> 'localhost'^,               >> .\tests\autoconfig-mysql.php
echo   'dbpass' ^=^> 'owncloud'^,                >> .\tests\autoconfig-mysql.php
echo ^)^;                                        >> .\tests\autoconfig-mysql.php

echo ^<?php                                      > .\tests\autoconfig-pgsql.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-pgsql.php
echo   'installed' ^=^> false^,                  >> .\tests\autoconfig-pgsql.php
echo   'dbtype' ^=^> 'pgsql'^,                   >> .\tests\autoconfig-pgsql.php
echo   'dbtableprefix' ^=^> 'oc_'^,              >> .\tests\autoconfig-pgsql.php
echo   'adminlogin' ^=^> 'admin'^,               >> .\tests\autoconfig-pgsql.php
echo   'adminpass' ^=^> 'admin'^,                >> .\tests\autoconfig-pgsql.php
echo   'directory' ^=^> '%BASEDIR%%DATADIR%'^,   >> .\tests\autoconfig-pgsql.php
echo   'dbuser' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-pgsql.php
echo   'dbname' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-pgsql.php
echo   'dbhost' ^=^> 'localhost'^,               >> .\tests\autoconfig-pgsql.php
echo   'dbpass' ^=^> 'owncloud'^,                >> .\tests\autoconfig-pgsql.php
echo ^)^;                                        >> .\tests\autoconfig-pgsql.php

echo ^<?php                                      > .\tests\autoconfig-mssql.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-mssql.php
echo   'installed' ^=^> false^,                  >> .\tests\autoconfig-mssql.php
echo   'dbtype' ^=^> 'mssql'^,                   >> .\tests\autoconfig-mssql.php
echo   'dbtableprefix' ^=^> 'oc_'^,              >> .\tests\autoconfig-mssql.php
echo   'adminlogin' ^=^> 'admin'^,               >> .\tests\autoconfig-mssql.php
echo   'adminpass' ^=^> 'admin'^,                >> .\tests\autoconfig-mssql.php
echo   'directory' ^=^> '%BASEDIR%%DATADIR%'^,   >> .\tests\autoconfig-mssql.php
echo   'dbuser' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mssql.php
echo   'dbname' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mssql.php
echo   'dbhost' ^=^> 'localhost\sqlexpress'^,    >> .\tests\autoconfig-mssql.php
echo   'dbpass' ^=^> 'owncloud'^,                >> .\tests\autoconfig-mssql.php
echo ^)^;                                        >> .\tests\autoconfig-mssql.php

echo localhost:5432:*:oc_autotest:owncloud > %APPDATA%\postgresql\pgpass.conf

::
:: start test execution
::
if [%1] == [] (
	echo "Running on all database backends"
	call:execute_tests "sqlite"
	call:execute_tests "mysql"
	call:execute_tests "mssql"
	::call:execute_tests "ora"
	call:execute_tests "pgsql"
) else (
	call:execute_tests "%1"
)

goto:eof

:execute_tests
	@echo on

	@echo "Setup environment for %~1 testing ..."
	:: back to root folder
	cd %BASEDIR%

	:: revert changes to tests\data
	git checkout tests\data\*

	:: reset data directory
	rmdir /s /q %DATADIR%
	md %DATADIR%

	:: remove the old config file
	:: del /q /f config\config.php
	copy /y tests\preseed-config.php config\config.php

	:: drop database
	if "%~1" == "mysql" mysql -u oc_autotest -powncloud -e "DROP DATABASE oc_autotest"

	if "%~1" == "pgsql" dropdb -h localhost -p 5432 -U oc_autotest -w oc_autotest

	:: we assume a sqlexpress installation
	if "%~1" == "mssql" sqlcmd -S localhost\sqlexpress -U oc_autotest -P owncloud -Q "IF EXISTS (SELECT name FROM sys.databases WHERE name=N'oc_autotest') DROP DATABASE [oc_autotest]"

	:: copy autoconfig
	copy /y %BASEDIR%\tests\autoconfig-%~1.php %BASEDIR%\config\autoconfig.php

	:: trigger installation
	@echo INDEX
	call php -f index.php
	@echo END INDEX

	::test execution
	@echo "Testing with %~1 ..."
	cd tests
	rmdir /s /q coverage-html-%~1
	md coverage-html-%~1
	php -f enable_all.php

        :: no external files on windows for now
        cd ..
        php occ app:disable files_external
        cd tests

	call phpunit --bootstrap bootstrap.php --configuration phpunit-autotest.xml --log-junit autotest-results-%~1.xml --coverage-clover autotest-clover-%~1.xml --coverage-html coverage-html-%~1

	@echo "Done with testing %~1 ..."
	cd %BASEDIR%
goto:eof

::
:: NOTES on mysql:
::  - CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY 'owncloud';
::  - grant access permissions: grant all on oc_autotest.* to 'oc_autotest'@'localhost';
::
:: NOTES on pgsql:
::  - su - postgres
::  - createuser -P (enter username and password and enable superuser)
::  - to enable dropdb I decided to add following line to pg_hba.conf (this is not the safest way but I don't care for the testing machine):
:: local	all	all	trust
::
:: NOTES on mssql:
::  we assume the usage of a local installed sqlexpress
::  create a user 'oc_autotest' with password 'owncloud' and assign the server role 'dbcreator'
::  make sure the sqlserver is configured to allow sql authentication
::

::
:: ownCloud
::
:: @author Thomas Müller
:: @author Tobias Ramforth (translated into Windows batch file)
::
:: @copyright 2012, 2013 Thomas Müller thomas.mueller@tmit.eu
::

@echo off

set BASEDIR=%~dp0
set DATADIR=data-autotest

:: create autoconfig for sqlite, mysql, postgresql and mssql
echo ^<?php                                      > .\tests\autoconfig-sqlite.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-sqlite.php
echo  'installed' ^=^> false^,                   >> .\tests\autoconfig-sqlite.php
echo  'dbtype' ^=^> 'sqlite'^,                   >> .\tests\autoconfig-sqlite.php
echo  'dbtableprefix' ^=^> 'oc_'^,               >> .\tests\autoconfig-sqlite.php
echo  'adminlogin' ^=^> 'admin'^,                >> .\tests\autoconfig-sqlite.php
echo  'adminpass' ^=^> 'admin'^,                 >> .\tests\autoconfig-sqlite.php
echo  'directory' ^=^> '%BASEDIR%%DATADIR%'^,    >> .\tests\autoconfig-sqlite.php
echo ^)^;                                        >> .\tests\autoconfig-sqlite.php

echo ^<?php                                      > .\tests\autoconfig-mysql.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-mysql.php
echo   'installed' ^=^> false^,                  >> .\tests\autoconfig-mysql.php
echo   'dbtype' ^=^> 'mysql'^,                   >> .\tests\autoconfig-mysql.php
echo   'dbtableprefix' ^=^> 'oc_'^,              >> .\tests\autoconfig-mysql.php
echo   'adminlogin' ^=^> 'admin'^,               >> .\tests\autoconfig-mysql.php
echo   'adminpass' ^=^> 'admin'^,                >> .\tests\autoconfig-mysql.php
echo   'directory' ^=^> '%BASEDIR%%DATADIR%'^,   >> .\tests\autoconfig-mysql.php
echo   'dbuser' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mysql.php
echo   'dbname' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mysql.php
echo   'dbhost' ^=^> 'localhost'^,               >> .\tests\autoconfig-mysql.php
echo   'dbpass' ^=^> 'owncloud'^,                >> .\tests\autoconfig-mysql.php
echo ^)^;                                        >> .\tests\autoconfig-mysql.php

echo ^<?php                                      > .\tests\autoconfig-pgsql.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-pgsql.php
echo   'installed' ^=^> false^,                  >> .\tests\autoconfig-pgsql.php
echo   'dbtype' ^=^> 'pgsql'^,                   >> .\tests\autoconfig-pgsql.php
echo   'dbtableprefix' ^=^> 'oc_'^,              >> .\tests\autoconfig-pgsql.php
echo   'adminlogin' ^=^> 'admin'^,               >> .\tests\autoconfig-pgsql.php
echo   'adminpass' ^=^> 'admin'^,                >> .\tests\autoconfig-pgsql.php
echo   'directory' ^=^> '%BASEDIR%%DATADIR%'^,   >> .\tests\autoconfig-pgsql.php
echo   'dbuser' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-pgsql.php
echo   'dbname' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-pgsql.php
echo   'dbhost' ^=^> 'localhost'^,               >> .\tests\autoconfig-pgsql.php
echo   'dbpass' ^=^> 'owncloud'^,                >> .\tests\autoconfig-pgsql.php
echo ^)^;                                        >> .\tests\autoconfig-pgsql.php

echo ^<?php                                      > .\tests\autoconfig-mssql.php
echo $AUTOCONFIG ^= array ^(                     >> .\tests\autoconfig-mssql.php
echo   'installed' ^=^> false^,                  >> .\tests\autoconfig-mssql.php
echo   'dbtype' ^=^> 'mssql'^,                   >> .\tests\autoconfig-mssql.php
echo   'dbtableprefix' ^=^> 'oc_'^,              >> .\tests\autoconfig-mssql.php
echo   'adminlogin' ^=^> 'admin'^,               >> .\tests\autoconfig-mssql.php
echo   'adminpass' ^=^> 'admin'^,                >> .\tests\autoconfig-mssql.php
echo   'directory' ^=^> '%BASEDIR%%DATADIR%'^,   >> .\tests\autoconfig-mssql.php
echo   'dbuser' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mssql.php
echo   'dbname' ^=^> 'oc_autotest'^,             >> .\tests\autoconfig-mssql.php
echo   'dbhost' ^=^> 'localhost\sqlexpress'^,    >> .\tests\autoconfig-mssql.php
echo   'dbpass' ^=^> 'owncloud'^,                >> .\tests\autoconfig-mssql.php
echo ^)^;                                        >> .\tests\autoconfig-mssql.php

echo localhost:5432:*:oc_autotest:owncloud > %APPDATA%\postgresql\pgpass.conf

::
:: start test execution
::
if [%1] == [] (
	echo "Running on all database backends"
	call:execute_tests "sqlite" "%2"
	call:execute_tests "mysql" "%2"
	call:execute_tests "mssql" "%2"
	::call:execute_tests "ora" "%2"
	call:execute_tests "pgsql" "%2"
) else (
	call:execute_tests "%1" "%2"
)

goto:eof

:execute_tests
	@echo on

	@echo "Setup environment for %~1 testing ..."
	:: back to root folder
	cd %BASEDIR%

	:: revert changes to tests\data
	git checkout tests\data\*

	:: reset data directory
	rmdir /s /q %DATADIR%
	md %DATADIR%

	:: remove the old config file
	:: del /q /f config\config.php
	copy /y tests\preseed-config.php config\config.php

	:: drop database
	if "%~1" == "mysql" mysql -u oc_autotest -powncloud -e "DROP DATABASE oc_autotest"

	if "%~1" == "pgsql" dropdb -h localhost -p 5432 -U oc_autotest -w oc_autotest

	:: we assume a sqlexpress installation
	if "%~1" == "mssql" sqlcmd -S localhost\sqlexpress -U oc_autotest -P owncloud -Q "IF EXISTS (SELECT name FROM sys.databases WHERE name=N'oc_autotest') DROP DATABASE [oc_autotest]"

	:: copy autoconfig
	copy /y %BASEDIR%\tests\autoconfig-%~1.php %BASEDIR%\config\autoconfig.php

	:: trigger installation
	@echo INDEX
	call php -f index.php
	@echo END INDEX

	::test execution
	@echo "Testing with %~1 ..."
	cd tests
	rmdir /s /q coverage-html-%~1
	md coverage-html-%~1
	php -f enable_all.php

        :: no external files on windows for now
        cd ..
        php occ app:disable files_external
        cd tests

	call phpunit --bootstrap bootstrap.php --configuration phpunit-autotest.xml --log-junit autotest-results-%~1.xml --coverage-clover autotest-clover-%~1.xml --coverage-html coverage-html-%~1 %~2

	@echo "Done with testing %~1 ..."
	cd %BASEDIR%
goto:eof

::
:: NOTES on mysql:
::  - CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY 'owncloud';
::  - grant access permissions: grant all on oc_autotest.* to 'oc_autotest'@'localhost';
::
:: NOTES on pgsql:
::  - su - postgres
::  - createuser -P (enter username and password and enable superuser)
::  - to enable dropdb I decided to add following line to pg_hba.conf (this is not the safest way but I don't care for the testing machine):
:: local	all	all	trust
::
:: NOTES on mssql:
::  we assume the usage of a local installed sqlexpress
::  create a user 'oc_autotest' with password 'owncloud' and assign the server role 'dbcreator'
::  make sure the sqlserver is configured to allow sql authentication
::

Allow passing a test file just like in autotest.sh


@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem                                                                         ##
@rem  Groovy JVM Bootstrap for Windowz                                       ##
@rem                                                                         ##
@rem ##########################################################################

@rem
@rem $Revision: 4170 $ $Date: 2006-10-26 12:11:12 +0000 (Thu, 26 Oct 2006) $
@rem

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~1
shift

set CLASS=%~1
shift

if exist "%USERPROFILE%/.groovy/preinit.bat" call "%USERPROFILE%/.groovy/preinit.bat"

@rem Determine the command interpreter to execute the "CD" later
set COMMAND_COM="cmd.exe"
if exist "%SystemRoot%\system32\cmd.exe" set COMMAND_COM="%SystemRoot%\system32\cmd.exe"
if exist "%SystemRoot%\command.com" set COMMAND_COM="%SystemRoot%\command.com"

@rem Use explicit find.exe to prevent cygwin and others find.exe from being used
set FIND_EXE="find.exe"
if exist "%SystemRoot%\system32\find.exe" set FIND_EXE="%SystemRoot%\system32\find.exe"
if exist "%SystemRoot%\command\find.exe" set FIND_EXE="%SystemRoot%\command\find.exe"

:check_JAVA_HOME
@rem Make sure we have a valid JAVA_HOME
if not "%JAVA_HOME%" == "" goto have_JAVA_HOME

echo.
echo ERROR: Environment variable JAVA_HOME has not been set.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo.
goto end

:have_JAVA_HOME
@rem Validate JAVA_HOME
%COMMAND_COM% /C DIR "%JAVA_HOME%" 2>&1 | %FIND_EXE% /I /C "%JAVA_HOME%" >nul
if not errorlevel 1 goto check_GROOVY_HOME

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

:check_GROOVY_HOME
@rem Define GROOVY_HOME if not set
if "%GROOVY_HOME%" == "" set GROOVY_HOME=%DIRNAME%..

:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem remove trailing slash from GRAILS_HOME
if "%GRAILS_HOME:~-1%"=="\" SET GRAILS_HOME=%GRAILS_HOME:~0,-1%

@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set SERVER_PORT=
set SERVER_PORT_HTTPS=
set GRAILS_ENV=
set CP=

:win9xME_args_slurp
if "x%~1" == "x" goto execute
if "%~1" == "-Dserver.port" (
	set SERVER_PORT=%~1=%~2
	shift
	shift
	goto win9xME_args_slurp
) else if "%~1" == "-Dserver.port.https" (
	set SERVER_PORT_HTTPS=%~1=%~2
	shift
	shift
	goto win9xME_args_slurp
 ) else if "%~1" == "-Dgrails.env" (
       set GRAILS_ENV=%~1=%~2
       shift
       shift
       goto win9xME_args_slurp
) else (
	if "x%~1" == "x-cp" (
		set CP=%~2
		shift
		shift
		goto win9xME_args_slurp
	) else (
		if "x%~1" == "x-classpath" (
			set CP=%~2
			shift
			shift
			goto win9xME_args_slurp
		) else (
			set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
			shift
			goto win9xME_args_slurp
		)
	)
)

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line
set STARTER_CLASSPATH=%GRAILS_HOME%\lib\groovy-all-1.6-beta-1-SNAPSHOT.jar;%GRAILS_HOME%\dist\grails-cli-1.0-RC4-SNAPSHOT.jar

if exist "%USERPROFILE%/.groovy/init.bat" call "%USERPROFILE%/.groovy/init.bat"

@rem Setting a classpath using the -cp or -classpath option means not to use
@rem the global classpath. Groovy behaves then the same as the java
@rem interpreter
if "x" == "x%CP%" goto empty_cp
:non_empty_cp
set CP=%CP%;.
goto after_cp
:empty_cp
set CP=.
:after_cp

if "x" == "x%CLASSPATH%" goto after_classpath
set CP=%CP%;%CLASSPATH%
:after_classpath

set STARTER_MAIN_CLASS=org.codehaus.groovy.grails.cli.support.GrailsStarter
set STARTER_CONF=%GRAILS_HOME%\conf\groovy-starter.conf

set JAVA_EXE=%JAVA_HOME%\bin\java.exe
set TOOLS_JAR=%JAVA_HOME%\lib\tools.jar

if "%JAVA_OPTS%" == "" set JAVA_OPTS="-Xmx128m"
set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name="%PROGNAME%"
set JAVA_OPTS=%JAVA_OPTS% -Dgrails.home="%GRAILS_HOME%"
set JAVA_OPTS=%JAVA_OPTS% -Dbase.dir="."
set JAVA_OPTS=%JAVA_OPTS% -Dtools.jar="%TOOLS_JAR%"
set JAVA_OPTS=%JAVA_OPTS% -Dgroovy.starter.conf="%STARTER_CONF%"

if exist "%USERPROFILE%/.groovy/postinit.bat" call "%USERPROFILE%/.groovy/postinit.bat"

@rem Execute Groovy
CALL "%JAVA_EXE%" %JAVA_OPTS% %SERVER_PORT% %SERVER_PORT_HTTPS% %GRAILS_ENV% -classpath "%STARTER_CLASSPATH%" %STARTER_MAIN_CLASS% --main %CLASS% --conf "%STARTER_CONF%" --classpath "%CP%" "%CMD_LINE_ARGS%"
:end
@rem End local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" endlocal

@rem Optional pause the batch file
if "%GROOVY_BATCH_PAUSE%" == "on" pause

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem                                                                         ##
@rem  Groovy JVM Bootstrap for Windowz                                       ##
@rem                                                                         ##
@rem ##########################################################################

@rem
@rem $Revision: 4170 $ $Date: 2006-10-26 12:11:12 +0000 (Thu, 26 Oct 2006) $
@rem

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~1
shift

set CLASS=%~1
shift

if exist "%USERPROFILE%/.groovy/preinit.bat" call "%USERPROFILE%/.groovy/preinit.bat"

@rem Determine the command interpreter to execute the "CD" later
set COMMAND_COM="cmd.exe"
if exist "%SystemRoot%\system32\cmd.exe" set COMMAND_COM="%SystemRoot%\system32\cmd.exe"
if exist "%SystemRoot%\command.com" set COMMAND_COM="%SystemRoot%\command.com"

@rem Use explicit find.exe to prevent cygwin and others find.exe from being used
set FIND_EXE="find.exe"
if exist "%SystemRoot%\system32\find.exe" set FIND_EXE="%SystemRoot%\system32\find.exe"
if exist "%SystemRoot%\command\find.exe" set FIND_EXE="%SystemRoot%\command\find.exe"

:check_JAVA_HOME
@rem Make sure we have a valid JAVA_HOME
if not "%JAVA_HOME%" == "" goto have_JAVA_HOME

echo.
echo ERROR: Environment variable JAVA_HOME has not been set.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo.
goto end

:have_JAVA_HOME
@rem Validate JAVA_HOME
%COMMAND_COM% /C DIR "%JAVA_HOME%" 2>&1 | %FIND_EXE% /I /C "%JAVA_HOME%" >nul
if not errorlevel 1 goto check_GROOVY_HOME

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

:check_GROOVY_HOME
@rem Define GROOVY_HOME if not set
if "%GROOVY_HOME%" == "" set GROOVY_HOME=%DIRNAME%..

:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem remove trailing slash from GRAILS_HOME
if "%GRAILS_HOME:~-1%"=="\" SET GRAILS_HOME=%GRAILS_HOME:~0,-1%

@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set CP=
set GRAILS_OPTIONS=

:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CURR_ARG=%~1
if "%CURR_ARG:~0,2%" == "-D" (
	set GRAILS_OPTIONS=%GRAILS_OPTIONS% %~1=%~2
	shift
	shift
	goto win9xME_args_slurp
) else (
	if "x%~1" == "x-cp" (
		set CP=%~2
		shift
		shift
		goto win9xME_args_slurp
	) else (
		if "x%~1" == "x-classpath" (
			set CP=%~2
			shift
			shift
			goto win9xME_args_slurp
		) else (
			set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
			shift
			goto win9xME_args_slurp
		)
	)
)

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line
set STARTER_CLASSPATH=%GRAILS_HOME%\lib\groovy-all-1.6-beta-1-SNAPSHOT.jar;%GRAILS_HOME%\dist\grails-cli-1.0-RC4-SNAPSHOT.jar

if exist "%USERPROFILE%/.groovy/init.bat" call "%USERPROFILE%/.groovy/init.bat"

@rem Setting a classpath using the -cp or -classpath option means not to use
@rem the global classpath. Groovy behaves then the same as the java
@rem interpreter
if "x" == "x%CP%" goto empty_cp
:non_empty_cp
set CP=%CP%;.
goto after_cp
:empty_cp
set CP=.
:after_cp

if "x" == "x%CLASSPATH%" goto after_classpath
set CP=%CP%;%CLASSPATH%
:after_classpath

set STARTER_MAIN_CLASS=org.codehaus.groovy.grails.cli.support.GrailsStarter
set STARTER_CONF=%GRAILS_HOME%\conf\groovy-starter.conf

set JAVA_EXE=%JAVA_HOME%\bin\java.exe
set TOOLS_JAR=%JAVA_HOME%\lib\tools.jar

if "%JAVA_OPTS%" == "" set JAVA_OPTS="-Xmx128m"
set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name="%PROGNAME%"
set JAVA_OPTS=%JAVA_OPTS% -Dgrails.home="%GRAILS_HOME%"
set JAVA_OPTS=%JAVA_OPTS% -Dbase.dir="."
set JAVA_OPTS=%JAVA_OPTS% -Dtools.jar="%TOOLS_JAR%"
set JAVA_OPTS=%JAVA_OPTS% -Dgroovy.starter.conf="%STARTER_CONF%"

if exist "%USERPROFILE%/.groovy/postinit.bat" call "%USERPROFILE%/.groovy/postinit.bat"

@rem Execute Groovy
CALL "%JAVA_EXE%" %JAVA_OPTS% %GRAILS_OPTIONS% -classpath "%STARTER_CLASSPATH%" %STARTER_MAIN_CLASS% --main %CLASS% --conf "%STARTER_CONF%" --classpath "%CP%" "%CMD_LINE_ARGS%"
:end
@rem End local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" endlocal

@rem Optional pause the batch file
if "%GROOVY_BATCH_PAUSE%" == "on" pause

fix for GRAILS-2044

fix for GRAILS-2044

git-svn-id: 29aad96320b2a07b98332cd568fc1316025c072f@6448 1cfb16fd-6d17-0410-8ff1-b7e8e1e2867d


@echo off
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
set vm=%1
set acmd="%2"
if "%acmd%" == "" (
	set vm="default"
	set acmd=%1
)
if "%acmd%" == "-f" (
	set vm="default"
	set acmd=%1
	set force=true
)
if "%3"=="-f" (
	set force=true
)
set dm=docker-machine.exe
if "%force%"=="true" (
	for /f "delims=" %%A in ('%dm% status %vm%') do set "status=%%A"
	echo.%status%
	if "%status%" NEQ "running" (
		%dm% start %vm%
	)
)

REM already running means controlvm (as opposed to modifyvm)

set up=
set b2d=%HOME%\b2d
call :unixpath %b2d%
set b2du=%up%

if "%force%"=="true" (
	%dm% ssh %vm% cp -f %b2du%/git/.gitconfig /home/docker
	%dm% ssh %vm% cp -f %b2du%/scripts/profile /home/docker/.ashrc
	%dm% ssh %vm% cp -f %b2du%/scripts/.bash_aliases /home/docker/.bash_aliases
	%dm% ssh %vm% mkdir -p /home/docker/.local/bin
	%dm% ssh %vm% "echo cd %b2du%/nodes/$(hostname)>/home/docker/next"
)
%dm% ssh %vm% %acmd%

goto:EOF

rem > expr "c:\wind\back\up" | sed -e "s,\\\,/,g" | sed -e "s,\(.\):,/\1/,g"
rem /c/wind/back/up

:unixpath
set P=%~1
for /f "delims=" %%A in ('expr "%p%"^|sed -e "s,\\\,/,g"') do set "p=%%A"
for /f "delims=" %%A in ('expr "%p%"^|sed -e "s,\(.\):,/\1,g"') do set "p=%%A"
for /f "delims=" %%A in ('expr "%p%"^|sed -e "s,^/C,/c,g"') do set "p=%%A"
( endlocal & REM.-- RETURN VALUES
	set "up=%p%"
)

bin/dmsshcmd.bat: add direct command call to machine (-f to copy files)


:: This script installs the dotfiles for Windows. Since Windows lacks
:: access to most decent software, only a few of the dotfiles are
:: relevant on this platform. No fancy loops needed here.

@echo off

set HOME=%UserProfile%

echo Installing scripts
if not exist %HOME%\bin mkdir %HOME%\bin
copy w32bin\*.bat %HOME%\bin

echo Installing vlcrc
if not exist %APPDATA%\vlc mkdir %APPDATA%\vlc
attrib -r %APPDATA%\vlc\vlcrc
copy _config\vlc\vlcrc %APPDATA%\vlc\vlcrc
attrib +r %APPDATA%\vlc\vlcrc

echo Installing mpv.conf
if not exist %APPDATA%\mpv mkdir %APPDATA%\mpv
copy _config\mpv\mpv.conf %APPDATA%\mpv\mpv.conf
copy _config\mpv\input.conf %APPDATA%\mpv\input.conf

echo Installing _vimperatorrc
copy _vimperatorrc %HOME%

echo Installing bash dotfiles
copy _bashrc       %HOME%\.bashrc
copy _bash_aliases %HOME%\.bash_aliases
copy _bash_profile %HOME%\.bash_profile

echo Installing _gitconfig
copy _gitconfig %HOME%\.gitconfig

echo Installing _vim
copy _vimrc %HOME%\_vimrc
xcopy _vim %HOME%\vimfiles /i /q /s /y
if not exist %HOME%\_vim\spell mkdir %HOME%\_vim\spell

Add vimrc install to install.bat.

Add vimrc install to install.bat.


rem Install packer 0.5.1
if not exist D:\Packer\cache mkdir D:\Packer\cache
setx PACKER_CACHE_DIR D:\Packer\cache
set PACKER_CACHE_DIR=D:\Packer\cache
if not exist D:\Packer\temp mkdir D:\Packer\temp
setx PACKER_TEMP_DIR D:\Packer\temp
set PACKER_TEMP_DIR=D:\Packer\temp

if exist c:\hashicorp\packer\packer.exe goto PACKER_INSTALLED
wget --no-check-certificate https://dl.bintray.com/mitchellh/packer/0.5.1_windows_amd64.zip -O %TEMP%\0.5.1_windows_amd64.zip
mkdir c:\hashicorp\packer
cd /D c:\hashicorp\packer
unzip %TEMP%\0.5.1_windows_amd64.zip
cd /D %USERPROFILE%
:PACKER_INSTALLED
where packer
if ERRORLEVEL 1 call :addPackerToUserPath
goto PACKER_DONE
:addPackerToUserPath
for /F "tokens=2* delims= " %%f IN ('reg query "HKCU\Environment" /v Path ^| findstr /i path') do set OLD_USER_PATH=%%g
reg add HKCU\Environment /v Path /d "%OLD_USER_PATH%;C:\hashicorp\packer" /f
set PATH=%PATH%;C:\hashicorp\packer
exit /b
:PACKER_DONE

rem Install VirtualBox 4.3.6
if not exist "%USERPROFILE%\.VirtualBox\VirtualBox.xml" (
  mkdir "%USERPROFILE%\.VirtualBox"
  wget --no-check-certificate https://github.com/StefanScherer/basebox-slave/raw/master/VirtualBox.xml -O "%USERPROFILE%\.VirtualBox\VirtualBox.xml"
)
if not exist D:\VirtualBox mkdir D:\VirtualBox
if exist "c:\program files\oracle\virtualbox\vboxmanage.exe" goto VIRTUALBOX_INSTALLED
wget http://download.virtualbox.org/virtualbox/4.3.6/VirtualBox-4.3.6-91406-Win.exe -O %TEMP%\VirtualBox-4.3.6-91406-Win.exe
%TEMP%\VirtualBox-4.3.6-91406-Win.exe -s
:VIRTUALBOX_INSTALLED
where vboxmanage
if ERRORLEVEL 1 call :addVirtualBoxToUserPath
goto VIRTUALBOX_DONE
:addVirtualBoxToUserPath
for /F "tokens=2* delims= " %%f IN ('reg query "HKCU\Environment" /v Path ^| findstr /i path') do set OLD_USER_PATH=%%g
reg add HKCU\Environment /v Path /d "%OLD_USER_PATH%;c:\program files\oracle\virtualbox" /f
set PATH=%PATH%;c:\program files\oracle\virtualbox
exit /b
:VIRTUALBOX_DONE

rem Install Jenkins
rem wget http://mirrors.jenkins-ci.org/windows/latest -O %TEMP%\jenkins.zip
rem cd /D %TEMP%
rem unzip jenkins.zip
rem setup.exe -s

rem Install git for Windows
if exist "c:\Program Files (x86)\Git\bin" goto GIT_INSTALLED
dir "c:\Program Files (x86)\Git\bin
wget --no-check-certificate https://msysgit.googlecode.com/files/Git-1.8.5.2-preview20131230.exe -O %TEMP%\gitsetup.exe
%TEMP%\gitsetup.exe /VERYSILENT
:GIT_INSTALLED
where git
if ERRORLEVEL 1 call :addGitToUserPath
goto GIT_DONE
:addGitToUserPath
for /F "tokens=2* delims= " %%f IN ('reg query "HKCU\Environment" /v Path ^| findstr /i path') do set OLD_USER_PATH=%%g
reg add HKCU\Environment /v Path /d "%OLD_USER_PATH%;c:\Program Files (x86)\Git\bin" /f
set PATH=%PATH%;c:\Program Files (x86)\Git\bin
exit /b
:GIT_DONE

if not exist D:\ISO mkdir D:\ISO
if not exist D:\GitHub mkdir D:\GitHub
cd /D D:\GitHub
git clone https://github.com/StefanScherer/basebox-packer.git

clone basebox-packer repo

clone basebox-packer repo


:: Appcelerator Titanium Mobile
:: Copyright (c) 2011 by Appcelerator, Inc. All Rights Reserved.
:: Licensed under the terms of the Apache Public License
:: Please see the LICENSE included with this distribution for details.

@echo off
if "%ANDROID_NDK%" == "" (echo "Error: The path to the Android NDK must be set in the ANDROID_NDK environment variable" & exit /b %ERRORLEVEL)

set THIS_DIR=%~dp0

if not "%NUM_CPUS%" == "" (set ARGS=-j %NUM_CPUS%)

%ANDROID_NDK%\ndk-build.cmd NDK_APPLICATION_MK=%THIS_DIR%Application.mk NDK_PROJECT_PATH=%THIS_DIR% NDK_MODULE_PATH=%THIS_DIR%src\ndk-modules TI_DIST_DIR=C:\Users\qa\titanium\titanium_mobile\dist %ARGS% %*

:: Appcelerator Titanium Mobile
:: Copyright (c) 2011 by Appcelerator, Inc. All Rights Reserved.
:: Licensed under the terms of the Apache Public License
:: Please see the LICENSE included with this distribution for details.

@echo off
if "%ANDROID_NDK%" == "" (echo "Error: The path to the Android NDK must be set in the ANDROID_NDK environment variable" & exit /b %ERRORLEVEL)

set THIS_DIR=%~dp0

if %THIS_DIR:~-1%==\ set THIS_DIR=%THIS_DIR:~0,-1%

if not "%NUM_CPUS%" == "" (set ARGS=-j %NUM_CPUS%)

%ANDROID_NDK%\ndk-build.cmd NDK_APPLICATION_MK=%THIS_DIR%\Application.mk NDK_PROJECT_PATH=%THIS_DIR% NDK_MODULE_PATH=%THIS_DIR%\src\ndk-modules TI_DIST_DIR=C:\Users\qa\titanium\titanium_mobile\dist %ARGS% %*

remove trailing \ in THIS_DIR variable

TIMOB-6315: remove trailing \ in THIS_DIR variable


echo Testing Register (raw values)
test error servo 1 set-raw punch -1
test cmd 1 write 30 0 0
test rsp 1 none
test success servo 1 set-raw punch 0
test cmd 1 write 30 ff 3
test rsp 1 none
test success servo 1 set-raw punch 1023
test error servo 1 set-raw punch 1024
test cmd 1 read 30 2
test rsp 1 none 0 0
test output "0" servo 1 get-raw punch
test cmd 1 read 30 2
test rsp 1 none ff 03
test output "1023" servo 1 get-raw punch

echo Testing Register
test error servo 1 set punch -1
test cmd 1 write 30 0 0
test rsp 1 none
test success servo 1 set punch 0
test cmd 1 write 30 ff 3
test rsp 1 none
test success servo 1 set punch 1023
test error servo 1 set punch 1024
test cmd 1 read 30 2
test rsp 1 none ff 03
test output "1023" servo 1 get punch

echo Testing RegisterOnOff
test error servo 1 set led foo
test cmd 1 write 19 1
test rsp 1 none
test success servo 1 set led on
test cmd 1 write 19 0
test rsp 1 none
test success servo 1 set led off
test error servo 1 set-raw led 2
test cmd 1 read 19 1
test rsp 1 none 0
test output "off" servo 1 get led
test cmd 1 read 19 1
test rsp 1 none 1
test output "on" servo 1 get led

echo Testing RegisterDirection
test error mini-io 1 set control_digital_dir_0 foo
test cmd 1 write 19 1
test rsp 1 none
test success mini-io 1 set led on
test cmd 1 write 6 0
test rsp 1 none
test success mini-io 1 set control_digital_dir_0 input
test error mini-io 1 set-raw control_digital_dir_0 2
test cmd 1 read 6 1
test rsp 1 none 0
test output "input" mini-io 1 get control_digital_dir_0
test cmd 1 read 6 1
test rsp 1 none 1
test output "output" mini-io 1 get control_digital_dir_0

echo Testing RegisterBaudRate
test error servo 1 set baud-rate foo
test error servo 1 set baud-rate 0
test error servo 1 set baud-rate 1
test error servo 1 set baud-rate 7842
test cmd 1 write 04 fe
test rsp 1 none
test success servo 1 set baud-rate 7843
test cmd 1 write 04 0
test rsp 1 none
test success servo 1 set baud-rate 2000000
test error servo 1 set baud-rate 2000001
test cmd 1 read 04 1
test rsp 1 none 1
test output "1000000 bps" servo 1 get baud-rate

echo Testing RegisterAngle
test error servo 1 set goal-position foo
test cmd 1 write 1e 0 0
test rsp 1 none
test success servo 1 set goal-position 0
test cmd 1 write 1e 1 0
test rsp 1 none
test success servo 1 set goal-position 0.3
test cmd 1 write 1e ff 3
test rsp 1 none
test success servo 1 set goal-position 300
test error servo 1 set goal-position 300.2
test cmd 1 read 1e 2
test rsp 1 none 0 0
test output "0.0 deg" servo 1 get goal-position
test cmd 1 read 1e 2
test rsp 1 none ff 3
test output "300.0 deg" servo 1 get goal-position

echo Testing RegisterTemperature
test error servo 1 set high-limit-temp foo
test error servo 1 set high-limit-temp 10.3
test cmd 1 write 0b 0
test rsp 1 none
test success servo 1 set high-limit-temp 0
test cmd 1 write 0b 1
test rsp 1 none
test success servo 1 set high-limit-temp 1
test cmd 1 write 0b 95
test rsp 1 none
test success servo 1 set high-limit-temp 149
test cmd 1 write 0b 96
test rsp 1 none
test success servo 1 set high-limit-temp 150
test cmd 1 write 0b 97
test rsp 1 none
test error servo 1 set high-limit-temp 151
test cmd 1 read 0b 1
test rsp 1 none 0
test output "0C" servo 1 get high-limit-temp
test cmd 1 read 0b 1
test rsp 1 none 96
test output "150C" servo 1 get high-limit-temp

echo Testing RegisterVoltage
test error servo 1 set high-limit-voltage foo
test error servo 1 set high-limit-voltage 4.9
test cmd 1 write 0d 32
test rsp 1 none
test success servo 1 set high-limit-voltage 5.0
test cmd 1 write 0d 95
test rsp 1 none
test success servo 1 set high-limit-voltage 14.9
test cmd 1 write 0d 96
test rsp 1 none
test success servo 1 set high-limit-voltage 15.0
test error servo1 set high-limit-voltage 15.1
test cmd 1 read 0d 1
test rsp 1 none 32
test output "5.0V" servo 1 get high-limit-voltage
test cmd 1 read 0d 1
test rsp 1 none 96
test output "15.0V" servo 1 get high-limit-voltage

echo Testing RegisterStatusRet
test error servo 1 set status-level foo
test cmd 1 write 10 0
test rsp 1 none
test success servo 1 set status-level none
test cmd 1 write 10 1
test rsp 1 none
test success servo 1 set status-level read
test cmd 1 write 10 2
test rsp 1 none
test success servo 1 set status-level all
test cmd 1 read 10 1
test rsp 1 none 0
test output "none" servo 1 get status-level
test cmd 1 read 10 1
test rsp 1 none 1
test output "read" servo 1 get status-level
test cmd 1 read 10 1
test rsp 1 none 2
test output "all" servo 1 get status-level

echo Testing RegisterAlarm
test error servo 1 set alarm-led foo
test cmd 1 write 11 0
test rsp 1 none
test success servo 1 set alarm-led none
test cmd 1 write 11 1
test rsp 1 none
test success servo 1 set alarm-led inputvoltage
test cmd 1 write 11 2
test rsp 1 none
test success servo 1 set alarm-led anglelimit
test cmd 1 write 11 4
test rsp 1 none
test success servo 1 set alarm-led overheating
test cmd 1 write 11 8
test rsp 1 none
test success servo 1 set alarm-led range
test cmd 1 write 11 10
test rsp 1 none
test success servo 1 set alarm-led checksum
test cmd 1 write 11 20
test rsp 1 none
test success servo 1 set alarm-led overload
test cmd 1 write 11 40
test rsp 1 none
test success servo 1 set alarm-led instruction
test cmd 1 write 11 3
test rsp 1 none
test success servo 1 set alarm-led inputvoltage,anglelimit
test cmd 1 write 11 30
test rsp 1 none
test success servo 1 set alarm-led overload,checksum
test cmd 1 write 11 33
test rsp 1 none
test success servo 1 set alarm-led overload,checksum,inputvoltage,anglelimit
test cmd 1 write 11 7f
test rsp 1 none
test success servo 1 set alarm-led all
test cmd 1 read 11 1
test rsp 1 none 0
test output "None" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 1
test output "InputVoltage" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 2
test output "AngleLimit" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 4
test output "OverHeating" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 8
test output "Range" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 10
test output "Checksum" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 20
test output "Overload" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 40
test output "Instruction" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 03
test output "InputVoltage,AngleLimit" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 30
test output "Checksum,Overload" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 33
test output "InputVoltage,AngleLimit,Checksum,Overload" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 7f
test output "All" servo 1 get alarm-led

echo Testing RegisterAngularVelocity
test error servo 1 set moving-speed foo
test cmd 1 write 20 0 0
test rsp 1 none
test success servo 1 set moving-speed 0
test cmd 1 write 20 fe 03
test rsp 1 none
test success servo 1 set moving-speed 113.9
test cmd 1 write 20 ff 03
test rsp 1 none
test success servo 1 set moving-speed 114
test error servo 1 set moving-speed 114.1
test cmd 1 read 20 2
test rsp 1 none 0 0
test output "0.0 RPM" servo 1 get moving-speed
test cmd 1 read 20 2
test rsp 1 none ff 03
test output "114.0 RPM" servo 1 get moving-speed

echo Testing RegisterLoad
test cmd 1 read 28 2
test rsp 1 none 00 00
test output "CCW 0" servo 1 get present-load
test cmd 1 read 28 2
test rsp 1 none 01 00
test output "CCW 1" servo 1 get present-load
test cmd 1 read 28 2
test rsp 1 none ff 03
test output "CCW 1023" servo 1 get present-load
test cmd 1 read 28 2
test rsp 1 none 00 04
test output "CW 0" servo 1 get present-load
test cmd 1 read 28 2
test rsp 1 none 01 04
test output "CW 1" servo 1 get present-load
test cmd 1 read 28 2
test rsp 1 none ff 07
test output "CW 1023" servo 1 get present-load

echo Testing Register (raw values)
test error servo 1 set-raw punch -1
test cmd 1 write 30 0 0
test rsp 1 none
test success servo 1 set-raw punch 0
test cmd 1 write 30 ff 3
test rsp 1 none
test success servo 1 set-raw punch 1023
test error servo 1 set-raw punch 1024
test cmd 1 read 30 2
test rsp 1 none 0 0
test output "0" servo 1 get-raw punch
test cmd 1 read 30 2
test rsp 1 none ff 03
test output "1023" servo 1 get-raw punch

echo Testing Register
test error servo 1 set punch -1
test cmd 1 write 30 0 0
test rsp 1 none
test success servo 1 set punch 0
test cmd 1 write 30 ff 3
test rsp 1 none
test success servo 1 set punch 1023
test error servo 1 set punch 1024
test cmd 1 read 30 2
test rsp 1 none ff 03
test output "1023" servo 1 get punch

echo Testing RegisterOnOff
test error servo 1 set led foo
test cmd 1 write 19 1
test rsp 1 none
test success servo 1 set led on
test cmd 1 write 19 0
test rsp 1 none
test success servo 1 set led off
test error servo 1 set-raw led 2
test cmd 1 read 19 1
test rsp 1 none 0
test output "off" servo 1 get led
test cmd 1 read 19 1
test rsp 1 none 1
test output "on" servo 1 get led

echo Testing RegisterDirection
test error mini-io 1 set control_digital_dir_0 foo
test cmd 1 write 19 1
test rsp 1 none
test success mini-io 1 set led on
test cmd 1 write 6 0
test rsp 1 none
test success mini-io 1 set control_digital_dir_0 input
test error mini-io 1 set-raw control_digital_dir_0 2
test cmd 1 read 6 1
test rsp 1 none 0
test output "input" mini-io 1 get control_digital_dir_0
test cmd 1 read 6 1
test rsp 1 none 1
test output "output" mini-io 1 get control_digital_dir_0

echo Testing RegisterBaudRate
test error servo 1 set baud-rate foo
test error servo 1 set baud-rate 0
test error servo 1 set baud-rate 1
test error servo 1 set baud-rate 7842
test cmd 1 write 04 fe
test rsp 1 none
test success servo 1 set baud-rate 7843
test cmd 1 write 04 0
test rsp 1 none
test success servo 1 set baud-rate 2000000
test error servo 1 set baud-rate 2000001
test cmd 1 read 04 1
test rsp 1 none 1
test output "1000000 bps" servo 1 get baud-rate

echo Testing RegisterAngle
test error servo 1 set goal-position foo
test cmd 1 write 1e 0 0
test rsp 1 none
test success servo 1 set goal-position 0
test cmd 1 write 1e 1 0
test rsp 1 none
test success servo 1 set goal-position 0.3
test cmd 1 write 1e ff 3
test rsp 1 none
test success servo 1 set goal-position 300
test error servo 1 set goal-position 300.2
test cmd 1 read 1e 2
test rsp 1 none 0 0
test output "0.0 deg" servo 1 get goal-position
test cmd 1 read 1e 2
test rsp 1 none ff 3
test output "300.0 deg" servo 1 get goal-position

echo Testing RegisterTemperature
test error servo 1 set high-limit-temp foo
test error servo 1 set high-limit-temp 10.3
test cmd 1 write 0b 0
test rsp 1 none
test success servo 1 set high-limit-temp 0
test cmd 1 write 0b 1
test rsp 1 none
test success servo 1 set high-limit-temp 1
test cmd 1 write 0b 95
test rsp 1 none
test success servo 1 set high-limit-temp 149
test cmd 1 write 0b 96
test rsp 1 none
test success servo 1 set high-limit-temp 150
test cmd 1 write 0b 97
test rsp 1 none
test error servo 1 set high-limit-temp 151
test cmd 1 read 0b 1
test rsp 1 none 0
test output "0C" servo 1 get high-limit-temp
test cmd 1 read 0b 1
test rsp 1 none 96
test output "150C" servo 1 get high-limit-temp

echo Testing RegisterVoltage
test error servo 1 set high-limit-voltage foo
test error servo 1 set high-limit-voltage 4.9
test cmd 1 write 0d 32
test rsp 1 none
test success servo 1 set high-limit-voltage 5.0
test cmd 1 write 0d 95
test rsp 1 none
test success servo 1 set high-limit-voltage 14.9
test cmd 1 write 0d 96
test rsp 1 none
test success servo 1 set high-limit-voltage 15.0
test error servo1 set high-limit-voltage 15.1
test cmd 1 read 0d 1
test rsp 1 none 32
test output "5.0V" servo 1 get high-limit-voltage
test cmd 1 read 0d 1
test rsp 1 none 96
test output "15.0V" servo 1 get high-limit-voltage

echo Testing RegisterStatusRet
test error servo 1 set status-level foo
test cmd 1 write 10 0
test rsp 1 none
test success servo 1 set status-level none
test cmd 1 write 10 1
test rsp 1 none
test success servo 1 set status-level read
test cmd 1 write 10 2
test rsp 1 none
test success servo 1 set status-level all
test cmd 1 read 10 1
test rsp 1 none 0
test output "none" servo 1 get status-level
test cmd 1 read 10 1
test rsp 1 none 1
test output "read" servo 1 get status-level
test cmd 1 read 10 1
test rsp 1 none 2
test output "all" servo 1 get status-level

echo Testing RegisterAlarm
test error servo 1 set alarm-led foo
test cmd 1 write 11 0
test rsp 1 none
test success servo 1 set alarm-led none
test cmd 1 write 11 1
test rsp 1 none
test success servo 1 set alarm-led inputvoltage
test cmd 1 write 11 2
test rsp 1 none
test success servo 1 set alarm-led anglelimit
test cmd 1 write 11 4
test rsp 1 none
test success servo 1 set alarm-led overheating
test cmd 1 write 11 8
test rsp 1 none
test success servo 1 set alarm-led range
test cmd 1 write 11 10
test rsp 1 none
test success servo 1 set alarm-led checksum
test cmd 1 write 11 20
test rsp 1 none
test success servo 1 set alarm-led overload
test cmd 1 write 11 40
test rsp 1 none
test success servo 1 set alarm-led instruction
test cmd 1 write 11 3
test rsp 1 none
test success servo 1 set alarm-led inputvoltage,anglelimit
test cmd 1 write 11 30
test rsp 1 none
test success servo 1 set alarm-led overload,checksum
test cmd 1 write 11 33
test rsp 1 none
test success servo 1 set alarm-led overload,checksum,inputvoltage,anglelimit
test cmd 1 write 11 7f
test rsp 1 none
test success servo 1 set alarm-led all
test cmd 1 read 11 1
test rsp 1 none 0
test output "None" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 1
test output "InputVoltage" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 2
test output "AngleLimit" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 4
test output "OverHeating" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 8
test output "Range" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 10
test output "Checksum" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 20
test output "Overload" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 40
test output "Instruction" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 03
test output "InputVoltage,AngleLimit" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 30
test output "Checksum,Overload" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 33
test output "InputVoltage,AngleLimit,Checksum,Overload" servo 1 get alarm-led
test cmd 1 read 11 1
test rsp 1 none 7f
test output "All" servo 1 get alarm-led

echo Testing RegisterAngularVelocity
test error servo 1 set moving-speed foo
test cmd 1 write 20 0 0
test rsp 1 none
test success servo 1 set moving-speed 0
test cmd 1 write 20 fe 03
test rsp 1 none
test success servo 1 set moving-speed 113.9
test cmd 1 write 20 ff 03
test rsp 1 none
test success servo 1 set moving-speed 114
test error servo 1 set moving-speed 114.2
test cmd 1 read 20 2
test rsp 1 none 0 0
test output "0.0 RPM" servo 1 get moving-speed
test cmd 1 read 20 2
test rsp 1 none ff 03
test output "114.0 RPM" servo 1 get moving-speed

echo Testing RegisterLoad
test cmd 1 read 28 2
test rsp 1 none 00 00
test output "CCW 0" servo 1 get present-load
test cmd 1 read 28 2
test rsp 1 none 01 00
test output "CCW 1" servo 1 get present-load
test cmd 1 read 28 2
test rsp 1 none ff 03
test output "CCW 1023" servo 1 get present-load
test cmd 1 read 28 2
test rsp 1 none 00 04
test output "CW 0" servo 1 get present-load
test cmd 1 read 28 2
test rsp 1 none 01 04
test output "CW 1" servo 1 get present-load
test cmd 1 read 28 2
test rsp 1 none ff 07
test output "CW 1023" servo 1 get present-load

fix rounding issue with moving_speed test


@setlocal
@echo off

REM find current branch
for /f "usebackq tokens=*" %%i in (`git symbolic-ref -q HEAD`) do set "current_branch_ref=%%i"
if defined current_branch_ref set "current_branch=%current_branch_ref:refs/heads/=%"

REM handle detached HEAD
if not defined current_branch (
    echo You're not on any branch! Aborting...
    goto :eof
)

REM Don't rewrite history on 'develop' or 'master' branches
set __exit=1
if not "%current_branch%"=="master" if not "%current_branch%"=="develop" set __exit=0
if %__exit%==1 (
    echo You cannot call this script from 'develop' or 'master'. Change to a topic branch first.  Aborting...
    goto :eof
)

REM find tracking branch
for /f "usebackq tokens=*" %%i in (`git rev-parse --symbolic-full-name --abbrev-ref @{u}`) do set "tracking_branch=%%i"
if not defined tracking_branch (
    echo Branch ^'%current_branch%^' is not tracking a remote branch! Aborting...
    goto :eof
)

for /f "usebackq tokens=*" %%i in (`git log --oneline -1`) do set "head_commit=%%i"
choice /C yn /M "Rewrite HEAD commit (%head_commit%) on branch '%current_branch%', and push to '%tracking_branch%'?"

if not %errorlevel%==1 goto :eof

for /f "usebackq tokens=*" %%i in (`git config branch.%current_branch%.remote`) do set "remote=%%i"
if not defined remote (
    REM should never happen...
    echo Error: could not isolate remote name for tracking branch ^'%tracking_branch%^'! Aborting...
    goto :eof
)

for /f "usebackq tokens=*" %%i in (`call echo %%tracking_branch:%remote%/^=%%`) do set "tracking_abbrev=%%i"

git commit --amend --no-edit
git push -f %remote% %current_branch%:%tracking_abbrev%

Add kick_jenkins script

Add kick_jenkins script


call npm install
IF "%ERRORLEVEL%" NEQ "0" goto error

call npm run build
IF "%ERRORLEVEL%" NEQ "0" goto error

del /q %DEPLOYMENT_TARGET%\*
for /d %%x in (%DEPLOYMENT_TARGET%\*) do @rd /s /q "%%x"
IF "%ERRORLEVEL%" NEQ "0" goto error

:: xcopy %DEPLOYMENT_SOURCE%\* %DEPLOYMENT_TARGET% /Y /E
%DEPLOYMENT_SOURCE%\build\7za.exe a -t7z %DEPLOYMENT_SOURCE%\deploy.7z %DEPLOYMENT_SOURCE%\*
IF "%ERRORLEVEL%" NEQ "0" goto error

%DEPLOYMENT_SOURCE%\build\7za.exe e %DEPLOYMENT_SOURCE%\deploy.7z %DEPLOYMENT_TARGET%
IF "%ERRORLEVEL%" NEQ "0" goto error

del /q %DEPLOYMENT_SOURCE%\deploy.7z
IF "%ERRORLEVEL%" NEQ "0" goto error

goto end

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

call npm install
IF "%ERRORLEVEL%" NEQ "0" goto error

call npm run build
IF "%ERRORLEVEL%" NEQ "0" goto error

del /q %DEPLOYMENT_TARGET%\*
for /d %%x in (%DEPLOYMENT_TARGET%\*) do @rd /s /q "%%x"
IF "%ERRORLEVEL%" NEQ "0" goto error

:: xcopy %DEPLOYMENT_SOURCE%\* %DEPLOYMENT_TARGET% /Y /E
%DEPLOYMENT_SOURCE%\build\7za.exe a -t7z %DEPLOYMENT_SOURCE%\deploy.7z %DEPLOYMENT_SOURCE%\*
IF "%ERRORLEVEL%" NEQ "0" goto error

%DEPLOYMENT_SOURCE%\build\7za.exe -y x %DEPLOYMENT_SOURCE%\deploy.7z -o%DEPLOYMENT_TARGET%
IF "%ERRORLEVEL%" NEQ "0" goto error

del /q %DEPLOYMENT_SOURCE%\deploy.7z
IF "%ERRORLEVEL%" NEQ "0" goto error

goto end

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

speed up deployment with 7za

speed up deployment with 7za


echo ON

set DEFAULT_ANACONDA_BUILD_RECIPES=libboost python-scons python-gitpython
set DEFAULT_ANACONDA_CHANNELS=statiskit conda-forge
set DEFAULT_ANACONDA_CHANNEL=statiskit

if "%ANACONDA_CHANNELS%" == "" (
    set ANACONDA_CHANNELS=%DEFAULT_ANACONDA_CHANNELS%
) else (
    echo Channels used: %ANACONDA_CHANNELS%
)

if "%ANACONDA_CHANNEL%" == "" (
    set ANACONDA_CHANNEL=%DEFAULT_ANACONDA_CHANNEL%
) else (
    echo Channel used: %ANACONDA_CHANNEL%
)

set ANACONDA_CHANNEL_FLAGS=
for %%i in (%ANACONDA_CHANNELS%) do (
    set "ANACONDA_CHANNEL_FLAGS=!ANACONDA_CHANNEL_FLAGS! -c %%i"
)

if "%ANACONDA_BUILD_RECIPES%" == "" (
    set ANACONDA_BUILD_RECIPES=%DEFAULT_ANACONDA_BUILD_RECIPES%
) else (
    echo Recipes to build: %ANACONDA_BUILD_RECIPES%
)

if "%ANACONDA_USERNAME%" == "" (
    set /p ANACONDA_USERNAME="Username: "
) else (
    echo Username: %ANACONDA_USERNAME%
)

if "%ANACONDA_PASSWORD%" == "" (
    set /p ANACONDA_USERNAME=%ANACONDA_USERNAME%%"'s password: "
) else (
    echo %ANACONDA_USERNAME%'s password: [secure]
)

echo ON

conda install -n root anaconda-client
if !errorlevel! neq 0 (
    exit /b !errorlevel!
)

echo OFF

echo y|anaconda login --username %ANACONDA_USERNAME% --password %ANACONDA_PASSWORD%
:: if !errorlevel! neq 0 (
::     exit /b !errorlevel!
:: )

echo ON

if "%TOOLCHAIN%" == "" (
    git clone https://gist.github.com/c491cb08d570beeba2c417826a50a9c3.git toolchain
    if !errorlevel! neq 0 (
        anaconda logout
        exit /b !errorlevel!
    )
    cd toolchain
    call config.bat
    if !errorlevel! neq 0 (
        cd ..
        anaconda logout
        rmdir toolchain /s /q
        exit /b !errorlevel!
    )
    cd ..
    rmdir toolchain /s /q
)

set ANACONDA_BUILD_FLAGS=%ANACONDA_CHANNEL_FLAGS% %ANACONDA_BUILD_FLAGS%
for %%i in (%ANACONDA_BUILD_RECIPES%) do (
    for /f %%j in ('conda build %%i %ANACONDA_BUILD_FLAGS% --output') do set ANACONDA_UPLOAD_RECIPE=%%j
    anaconda upload !ANACONDA_UPLOAD_RECIPE! --user %ANACONDA_CHANNEL% %ANACONDA_UPLOAD_FLAGS%
)

anaconda logout

ECHO OFF

echo ON

set DEFAULT_ANACONDA_BUILD_RECIPES=libboost python-scons python-gitpython
set DEFAULT_ANACONDA_CHANNELS=statiskit conda-forge
set DEFAULT_ANACONDA_CHANNEL=statiskit

if "%ANACONDA_CHANNELS%" == "" (
    set ANACONDA_CHANNELS=%DEFAULT_ANACONDA_CHANNELS%
) else (
    echo Channels used: %ANACONDA_CHANNELS%
)

if "%ANACONDA_CHANNEL%" == "" (
    set ANACONDA_CHANNEL=%DEFAULT_ANACONDA_CHANNEL%
) else (
    echo Channel used: %ANACONDA_CHANNEL%
)

set ANACONDA_CHANNEL_FLAGS=
for %%i in (%ANACONDA_CHANNELS%) do (
    set "ANACONDA_CHANNEL_FLAGS=!ANACONDA_CHANNEL_FLAGS! -c %%i"
)

if "%ANACONDA_BUILD_RECIPES%" == "" (
    set ANACONDA_BUILD_RECIPES=%DEFAULT_ANACONDA_BUILD_RECIPES%
) else (
    echo Recipes to build: %ANACONDA_BUILD_RECIPES%
)

if "%ANACONDA_USERNAME%" == "" (
    set /p ANACONDA_USERNAME="Username: "
) else (
    echo Username: %ANACONDA_USERNAME%
)

if "%ANACONDA_PASSWORD%" == "" (
    set /p ANACONDA_USERNAME=%ANACONDA_USERNAME%%"'s password: "
) else (
    echo %ANACONDA_USERNAME%'s password: [secure]
)

echo ON

conda install -n root anaconda-client
:: if !errorlevel! neq 0 (
::    exit /b !errorlevel!
:: )

echo OFF

echo y|anaconda login --username %ANACONDA_USERNAME% --password %ANACONDA_PASSWORD%
:: if !errorlevel! neq 0 (
::     exit /b !errorlevel!
:: )

echo ON

if "%TOOLCHAIN%" == "" (
    git clone https://gist.github.com/c491cb08d570beeba2c417826a50a9c3.git toolchain
    if !errorlevel! neq 0 (
        anaconda logout
        exit /b !errorlevel!
    )
    cd toolchain
    call config.bat
    if !errorlevel! neq 0 (
        cd ..
        anaconda logout
        rmdir toolchain /s /q
        exit /b !errorlevel!
    )
    cd ..
    rmdir toolchain /s /q
)

set ANACONDA_BUILD_FLAGS=%ANACONDA_CHANNEL_FLAGS% %ANACONDA_BUILD_FLAGS%
for %%i in (%ANACONDA_BUILD_RECIPES%) do (
    for /f %%j in ('conda build %%i %ANACONDA_BUILD_FLAGS% --output') do set ANACONDA_UPLOAD_RECIPE=%%j
    anaconda upload !ANACONDA_UPLOAD_RECIPE! --user %ANACONDA_CHANNEL% %ANACONDA_UPLOAD_FLAGS%
)

anaconda logout

ECHO OFF

Test !errorlevel!

Test !errorlevel!


choco install docfx -y
choco update docfx -y
docfx docfx\docfx.json
del docs /s /q
REM the CNAME file is generated in the doc folder when added through the github
REM settings page. Apparently github uses this file to determine the custom
REM domain. The line above deletes the whole docs folder so we need to copy it
REM from the docfx folder. If we ever want to change the custom domain settings
REM we need to alter the docfx\CNAME file and not use the github settings page.
copy docfx\CNAME docs /Y
xcopy docfx\_site docs /E /Y

choco install docfx -y
choco upgrade docfx -y
docfx docfx\docfx.json
del docs /s /q
REM the CNAME file is generated in the doc folder when added through the github
REM settings page. Apparently github uses this file to determine the custom
REM domain. The line above deletes the whole docs folder so we need to copy it
REM from the docfx folder. If we ever want to change the custom domain settings
REM we need to alter the docfx\CNAME file and not use the github settings page.
copy docfx\CNAME docs /Y
xcopy docfx\_site docs /E /Y

Use choco upgrade iso update

Use choco upgrade iso update


@echo off
rem > Build-Release [cfg file]

rem  Note: compiling twice the same sources gives different binaries.

rem clean output directory
del ..\dcu\*.dcu

if '%1' NEQ '' goto use_cfg_argument

:use_default_cfg
dcc32 Drago
goto return

:use_cfg_argument
set cfg=%1
copy Drago.cfg Drago.cfg.bak > nul
copy %cfg% Drago.cfg > nul
dcc32 Drago
move Drago.cfg.bak Drago.cfg > nul

:return

Add batch to compile release binary.

Add batch to compile release binary.


<# :
@echo off
setlocal
set "POWERSHELL_BAT_ARGS=%*"
if defined POWERSHELL_BAT_ARGS set "POWERSHELL_BAT_ARGS=%POWERSHELL_BAT_ARGS:"=\"%"
endlocal & powershell -NoLogo -NoProfile -Command "$_ = $input; Invoke-Expression $( '$input = $_; $_ = \"\"; $args = @( &{ $args } %POWERSHELL_BAT_ARGS% );' + [String]::Join( [char]10, $( Get-Content \"%~f0\" ) ) )"
goto :EOF
#>

$packages = @(

	@{
		"name" = "7-zip";
		"home" = "http://7-zip.org/";
		"url" = "http://downloads.sourceforge.net/sevenzip/7za920.zip";
		"dir" = "7za";
		"postinstall" = {
			$dir = $args[0];
			$script:7zip_exe = "$dir\7za.exe";
		};
	}

	@{
		"name" = "ConEmu";
		"home" = "https://github.com/Maximus5/ConEmu/";
		"url" = "https://github.com/Maximus5/ConEmu/releases/download/v15.12.10/ConEmuPack.151210.7z";
		"dir" = "ConEmu";
	}

	@{
		"name" = "Clink";
		"home" = "http://mridgers.github.io/clink";
		"url" = "https://github.com/mridgers/clink/releases/download/0.4.5/clink_0.4.5.zip";
		"dir" = "clink";
		"onlyFiles" = $True;
		"postinstall" = {
			$dir = $args[0];
			ls $dir |
			? { $_.Attributes -eq "Directory" } |
			% { rmdir -Force -Path "$dir\$_"; };
		};
	}

	@{
		"name" = "Far3";
		"home" = "http://www.farmanager.com/";
		"url" = "http://www.farmanager.com/files/Far30b4499.x86.20160101.7z";
		"dir" = "Far3";
	}

	@{
		"skip" = $True;
		"name" = "Far3bis";
		"home" = "http://code.google.com/p/conemu-maximus5/";
		"url" = "http://downloads.sourceforge.net/project/conemu/FarManager/Far3bis/far3.4254bis.x86.x64.7z";
		"dir" = "Far3bis";
	}

	@{
		"name" = "Notepad2-mod";
		"home" = "http://xhmikosr.github.io/notepad2-mod/";
		"url" = "https://github.com/XhmikosR/notepad2-mod/releases/download/4.2.25.964/Notepad2-mod.4.2.25.964_x64.zip";
		"dir" = "notepad2-mod";
		"postinstall" = {
			$dir = $args[0];
			$ini = "$dir\Notepad2.ini";
			mv -Force -Path "$ini" -Destination "$ini.orig";
			& {
				"[Notepad2]";
				"Notepad2.ini=..\..\etc\notepad2\Notepad2.ini";
			} | Out-File "$ini";
		};
	}

	@{
		"name" = "UnxUtils";
		"home" = "http://unxutils.sourceforge.met/";
		"url" = "http://downloads.sourceforge.net/project/unxutils/unxutils/current/UnxUtils.zip";
		"dir" = "unxutils";
		"postinstall" = {
			$dir = $args[0];
			$src = "$dir\usr\local\wbin\*";
			$dst = "$dir\bin";
			mv -Force -Path $src -Destination $dst;
		};
	}

	@{
		"name" = "UnxUtils Updates";
		"home" = "http://unxutils.sourceforge.met/";
		"url" = "http://unxutils.sourceforge.net/UnxUpdates.zip";
		"dir" = "unxutils\bin";
	}

);

# =========================================================================

$vendorsDir = [System.IO.Path]::GetFullPath("$pwd\..\vendors");
$distribDir = "$pwd\distrib";

$7zip_exe = "";

# =========================================================================

function download-archive( [string]$url, [string]$targetDir ) {
	$filename = "$targetDir\" + [System.IO.Path]::GetFileName($url);
	if ( ! ( Test-Path $filename ) ) {
		$webclient = New-Object System.Net.WebClient;
		$webclient.DownloadFile($url, $filename);
	}
	return $filename;
}

function extract-zip( [string]$filename, [string]$targetDir ) {
	$shell = New-Object -com shell.application;
	$zip = $shell.NameSpace($filename);
	foreach ( $item in $zip.items() ) {
		$shell.Namespace($targetDir).CopyHere($item, 16);
	}
}

function extract-7z( [string]$filename, [string]$targetDir, [bool]$onlyFiles ) {
	$mode = if ( $onlyFiles ) { "e" } else { "x" };
	& "$script:7zip_exe" $mode "$filename" -y "-o$targetDir";
}

function extract-archive( [string]$filename, [string]$targetDir, [bool]$onlyFiles ) {
	if ( $script:7zip_exe ) {
		extract-7z $filename $targetDir $onlyFiles;
	} else {
		extract-zip $filename $targetDir;
	}
}

function install-package( $package ) {
	$dstDir = $script:vendorsDir + "\" + $package.dir;

	"=================================================================";
	"Package     : $($package.name)";
	"Destination : $dstDir";

	if ( $package.skip ) {
		"Skipped";
		return;
	}

	New-Item -Force -ItemType Directory -Path $dstDir >$null;
	$filename = download-archive $package.url $script:distribDir;
	extract-archive $filename $dstDir ( !! $package.onlyFiles );

	if ( ! $package.postinstall ) {
		return;
	}

	"`nInvoke command:";
	$package.postinstall;
	Invoke-Command -ScriptBlock $package.postinstall -ArgumentList $dstDir;
}

# =========================================================================

$enabled = "$pwd\candy-for-tea.enabled";
$logfile = "$pwd\candy-for-tea.log";

if ( ! ( Test-Path "$enabled" ) ) {
	[System.Reflection.Assembly]::LoadWithPartialName( "System.Windows.Forms" ) >$Null;
	[System.Windows.Forms.MessageBox]::Show( "To enable execution create the file:`n$enabled.", "Disabled", 0, "Stop" ) >$Null;
	exit;
}

$packages | % { install-package $_; } | Out-File $logfile;

if ( Test-Path $enabled ) {
	Remove-Item -Force -Path "$enabled";
}

# =========================================================================

# EOF

<# :
@echo off
setlocal
set "POWERSHELL_BAT_ARGS=%*"
if defined POWERSHELL_BAT_ARGS set "POWERSHELL_BAT_ARGS=%POWERSHELL_BAT_ARGS:"=\"%"
endlocal & powershell -NoLogo -NoProfile -Command "$_ = $input; Invoke-Expression $( '$input = $_; $_ = \"\"; $args = @( &{ $args } %POWERSHELL_BAT_ARGS% );' + [String]::Join( [char]10, $( Get-Content \"%~f0\" ) ) )"
goto :EOF
#>

$packages = @(

	@{
		"name" = "7-zip";
		"home" = "http://7-zip.org/";
		"url" = "http://downloads.sourceforge.net/sevenzip/7za920.zip";
		"dir" = "7za";
		"postinstall" = {
			$dir = $args[0];
			$script:7zip_exe = "$dir\7za.exe";
		};
	}

	@{
		"name" = "ConEmu";
		"home" = "https://github.com/Maximus5/ConEmu/";
		"url" = "https://github.com/Maximus5/ConEmu/releases/download/v16.01.11/ConEmuPack.160111.7z";
		"dir" = "ConEmu";
	}

	@{
		"name" = "Clink";
		"home" = "http://mridgers.github.io/clink";
		"url" = "https://github.com/mridgers/clink/releases/download/0.4.5/clink_0.4.5.zip";
		"dir" = "clink";
		"onlyFiles" = $True;
		"postinstall" = {
			$dir = $args[0];
			ls $dir |
			? { $_.Attributes -eq "Directory" } |
			% { rmdir -Force -Path "$dir\$_"; };
		};
	}

	@{
		"name" = "Far3";
		"home" = "http://www.farmanager.com/";
		"url" = "http://www.farmanager.com/files/Far30b4499.x86.20160101.7z";
		"dir" = "Far3";
	}

	@{
		"skip" = $True;
		"name" = "Far3bis";
		"home" = "http://code.google.com/p/conemu-maximus5/";
		"url" = "http://downloads.sourceforge.net/project/conemu/FarManager/Far3bis/far3.4254bis.x86.x64.7z";
		"dir" = "Far3bis";
	}

	@{
		"name" = "Notepad2-mod";
		"home" = "http://xhmikosr.github.io/notepad2-mod/";
		"url" = "https://github.com/XhmikosR/notepad2-mod/releases/download/4.2.25.964/Notepad2-mod.4.2.25.964_x64.zip";
		"dir" = "notepad2-mod";
		"postinstall" = {
			$dir = $args[0];
			$ini = "$dir\Notepad2.ini";
			mv -Force -Path "$ini" -Destination "$ini.orig";
			& {
				"[Notepad2]";
				"Notepad2.ini=..\..\etc\notepad2\Notepad2.ini";
			} | Out-File "$ini";
		};
	}

	@{
		"name" = "UnxUtils";
		"home" = "http://unxutils.sourceforge.met/";
		"url" = "http://downloads.sourceforge.net/project/unxutils/unxutils/current/UnxUtils.zip";
		"dir" = "unxutils";
		"postinstall" = {
			$dir = $args[0];
			$src = "$dir\usr\local\wbin\*";
			$dst = "$dir\bin";
			mv -Force -Path $src -Destination $dst;
		};
	}

	@{
		"name" = "UnxUtils Updates";
		"home" = "http://unxutils.sourceforge.met/";
		"url" = "http://unxutils.sourceforge.net/UnxUpdates.zip";
		"dir" = "unxutils\bin";
	}

);

# =========================================================================

$vendorsDir = [System.IO.Path]::GetFullPath("$pwd\..\vendors");
$distribDir = "$pwd\distrib";

$7zip_exe = "";

# =========================================================================

function download-archive( [string]$url, [string]$targetDir ) {
	$filename = "$targetDir\" + [System.IO.Path]::GetFileName($url);
	if ( ! ( Test-Path $filename ) ) {
		$webclient = New-Object System.Net.WebClient;
		$webclient.DownloadFile($url, $filename);
	}
	return $filename;
}

function extract-zip( [string]$filename, [string]$targetDir ) {
	$shell = New-Object -com shell.application;
	$zip = $shell.NameSpace($filename);
	foreach ( $item in $zip.items() ) {
		$shell.Namespace($targetDir).CopyHere($item, 16);
	}
}

function extract-7z( [string]$filename, [string]$targetDir, [bool]$onlyFiles ) {
	$mode = if ( $onlyFiles ) { "e" } else { "x" };
	& "$script:7zip_exe" $mode "$filename" -y "-o$targetDir";
}

function extract-archive( [string]$filename, [string]$targetDir, [bool]$onlyFiles ) {
	if ( $script:7zip_exe ) {
		extract-7z $filename $targetDir $onlyFiles;
	} else {
		extract-zip $filename $targetDir;
	}
}

function install-package( $package ) {
	$dstDir = $script:vendorsDir + "\" + $package.dir;

	"=================================================================";
	"Package     : $($package.name)";
	"Destination : $dstDir";

	if ( $package.skip ) {
		"Skipped";
		return;
	}

	New-Item -Force -ItemType Directory -Path $dstDir >$null;
	$filename = download-archive $package.url $script:distribDir;
	extract-archive $filename $dstDir ( !! $package.onlyFiles );

	if ( ! $package.postinstall ) {
		return;
	}

	"`nInvoke command:";
	$package.postinstall;
	Invoke-Command -ScriptBlock $package.postinstall -ArgumentList $dstDir;
}

# =========================================================================

$enabled = "$pwd\candy-for-tea.enabled";
$logfile = "$pwd\candy-for-tea.log";

if ( ! ( Test-Path "$enabled" ) ) {
	[System.Reflection.Assembly]::LoadWithPartialName( "System.Windows.Forms" ) >$Null;
	[System.Windows.Forms.MessageBox]::Show( "To enable execution create the file:`n$enabled.", "Disabled", 0, "Stop" ) >$Null;
	exit;
}

$packages | % { install-package $_; } | Out-File $logfile;

if ( Test-Path $enabled ) {
	Remove-Item -Force -Path "$enabled";
}

# =========================================================================

# EOF

update the downloading url of ConEmu

update the downloading url of ConEmu


ECHO OFF

CD Install

RMDIR _x86 /S /Q
RMDIR _x64 /S /Q
RMDIR Help /S /Q
RMDIR Resources /S /Q
MKDIR _x86
MKDIR _x64
MKDIR Resources
MKDIR Help

REM --- Update JASP install Folder ------
SET JASP-BUILD=c:\Jasp\Build
SET BUILD_DIR_32=%JASP-BUILD%\build-JASP-Release-32
SET BUILD_DIR_64=%JASP-BUILD%\build-JASP-Release-64
SET JASP-DESKTOP=%JASP-BUILD%\jasp-desktop
SET QT-MSVC-BIN-2015=C:\Qt\5.10.1\msvc2015\bin
SET QT-MSVC-BIN-2017=C:\Qt\5.10.1\msvc2017_64\bin

REM --- Copy icon ---
COPY %JASP-DESKTOP%\JASP-Desktop\icon.ico /Y

REM --- Update Jasp and Engine -----
COPY %BUILD_DIR_32%\JASP.exe /Y _x86
COPY %BUILD_DIR_32%\JASPEngine.exe /Y _x86
COPY %BUILD_DIR_32%\*.dll /Y _x86

COPY %BUILD_DIR_64%\JASP.exe /Y _x64
COPY %BUILD_DIR_64%\JASPEngine.exe /Y _x64
COPY %BUILD_DIR_64%\*.dll /Y _x64

REM ---- QT Core -------
REM %QT-MSVC-BIN-2015%\windeployqt.exe %BUILD_DIR_32%\JASP.exe --no-patchqt --release --libdir ./_x86 --plugindir _x86
REM %QT-MSVC-BIN-2017%\windeployqt.exe %BUILD_DIR_64%\JASPEngine.exe --compiler-runtime --release --libdir _x64
REM COPY %QT-MSVC-BIN-2017%\Qt5Core.dll _x64

cd _x86
REM %QT-MSVC-BIN-2015%\windeployqt.exe --compiler-runtime --release JASP.exe
%QT-MSVC-BIN-2015%\windeployqt.exe -core -gui -webenginewidgets -webchannel -svg -network -printsupport -xml -qml -quick -quickwidgets --qmldir %JASP-DESKTOP%\JASP-Desktop\resources JASP.exe

cd ..

cd _x64
%QT-MSVC-BIN-2017%\windeployqt.exe -core -gui -webenginewidgets -webchannel -svg -network -printsupport -xml -qml -quick -quickwidgets --qmldir %JASP-DESKTOP%\JASP-Desktop\resources JASP.exe
cd ..

REM ---- Update Resources -------
RMDIR Resources /S /Q
XCOPY %JASP-DESKTOP%\Resources /E /I Resources

REM ---- Update Help -------
RMDIR Help /S /Q
XCOPY %JASP-DESKTOP%\Resources\Help /E /I Help

REM --- Update R ------
REM RMDIR R /S /Q
REM XCOPY %BUILD_DIR_64%\R /E /I R
REM XCOPY %BUILD_DIR_32%\R /E /Y R

CD ..

ECHO .........Done ..........
PAUSE

ECHO OFF

CD Install

RMDIR _x86 /S /Q
RMDIR _x64 /S /Q
RMDIR Help /S /Q
RMDIR Resources /S /Q
MKDIR _x86
MKDIR _x64
MKDIR Resources
MKDIR Help

REM --- Update JASP install Folder ------
SET JASP-BUILD=c:\Jasp\Build
SET JASP-REDIST=c:\Jasp\Redist
SET BUILD_DIR_32=%JASP-BUILD%\build-JASP-Release-32
SET BUILD_DIR_64=%JASP-BUILD%\build-JASP-Release-64
SET JASP-DESKTOP=%JASP-BUILD%\jasp-desktop
SET QT-MSVC-BIN-2015=C:\Qt\5.10.1\msvc2015\bin
SET QT-MSVC-BIN-2017=C:\Qt\5.10.1\msvc2017_64\bin

REM --- Copy icon ---
COPY %JASP-DESKTOP%\JASP-Desktop\icon.ico /Y

REM --- Update Jasp and Engine -----
COPY %BUILD_DIR_32%\JASP.exe /Y _x86
COPY %BUILD_DIR_32%\JASPEngine.exe /Y _x86
COPY %BUILD_DIR_32%\*.dll /Y _x86

COPY %BUILD_DIR_64%\JASP.exe /Y _x64
COPY %BUILD_DIR_64%\JASPEngine.exe /Y _x64
COPY %BUILD_DIR_64%\*.dll /Y _x64

REM ---- QT Core -------
REM %QT-MSVC-BIN-2015%\windeployqt.exe %BUILD_DIR_32%\JASP.exe --no-patchqt --release --libdir ./_x86 --plugindir _x86
REM %QT-MSVC-BIN-2017%\windeployqt.exe %BUILD_DIR_64%\JASPEngine.exe --compiler-runtime --release --libdir _x64
REM COPY %QT-MSVC-BIN-2017%\Qt5Core.dll _x64

cd _x86
REM %QT-MSVC-BIN-2015%\windeployqt.exe --compiler-runtime --release JASP.exe
%QT-MSVC-BIN-2015%\windeployqt.exe -core -gui -webenginewidgets -webchannel -svg -network -printsupport -xml -qml -quick -quickwidgets --qmldir %JASP-DESKTOP%\JASP-Desktop\resources JASP.exe

REM --- Copy Redist ---
COPY %JASP-REDIST%\vcredist_x86.exe .

cd ..

cd _x64
%QT-MSVC-BIN-2017%\windeployqt.exe -core -gui -webenginewidgets -webchannel -svg -network -printsupport -xml -qml -quick -quickwidgets --qmldir %JASP-DESKTOP%\JASP-Desktop\resources JASP.exe

REM --- Copy Redist ---
COPY %JASP-REDIST%\vcredist_x64.exe .

cd ..

REM ---- Update Resources -------
RMDIR Resources /S /Q
XCOPY %JASP-DESKTOP%\Resources /E /I Resources
DEL Resources\TestFiles.zip

REM ---- Update Help -------
RMDIR Help /S /Q
XCOPY %JASP-DESKTOP%\Resources\Help /E /I Help

REM --- Update R ------
REM RMDIR R /S /Q
REM XCOPY %BUILD_DIR_64%\R /E /I R
REM XCOPY %BUILD_DIR_32%\R /E /Y R

CD ..

ECHO .........Done ..........
PAUSE

Add VS Redist to Windows Setup

Add VS Redist to Windows Setup


CALL procdump -s 2 -n 4 CESService7.exe c:\ProcDumpFiles

CALL  procdump -s 2 -n 4 CESCustomCrawlers7.exe c:\ProcDumpFiles

CALL procdump -s 2 -n 4 CESConverter7.exe c:\ProcDumpFiles

CALL taskkill /f /im CESService7.exe

CALL taskkill /f /im CESCustomCrawlers7.exe

CALL taskkill /f /im CESConverter7.exe

CALL msg * "CESService7 has just stop because it was taking too much memory(RAM), please contact Coveo and check your dump files C:\ProcDumpFiles, Link to doc: LINK"

Create ScriptDumpFiles.bat

Create ScriptDumpFiles.bat

This is a bat file used in a monitoring process to see if Coveo is using more then 50% of RAM.


@echo off
setlocal EnableDelayedExpansion
setlocal enableextensions

REM no options / set to default
set BuildType=Release
set InitEnvScript=win32-init_env_command.cmd
if /i "%1"=="-h" (
	echo Usage: win32-build.cmd [Build Type] [Init-env Script]
	echo -- Build Type option can be : --release (-r^) or --debug (-d^). Default is release.
	echo -- Default Init-env script is: win32-init_env_command.cmd
	pause
	exit 0
) else if /i "%1"=="--help" (
	echo Usage: win32-build.cmd [Build Type] [Init-env Script]
	echo -- Build Type option can be : --release (-r^) or --debug (-d^). Default is Release.
	echo -- Default Init-env script is: win32-init_env_command.cmd
	pause
	exit 0
) else if /i "%1"=="-d" (
	set BuildType=Debug
	set InitEnvScript=%2
) else if /i "%1"=="--debug" (
	set BuildType=Debug
	set InitEnvScript=%2
) else if /i "%1"=="-r" (
	set BuildType=Release
	set InitEnvScript=%2
) else if /i "%1"=="--release" (
	set BuildType=Release
	set InitEnvScript=%2
) else if not "%1"=="" (
	set BuildType=Release
	set InitEnvScript=%1
)

if /i "%InitEnvScript%"=="" (
	echo No script specified. Default will be used.
	set InitEnvScript=win32-init_env_command.cmd
)

echo --
echo build type is set to: %BuildType%.
echo Init-env Script to be called: %InitEnvScript%.
echo --

REM #######################################################################################

if not exist "%InitEnvScript%" (
	if not "%InitEnvScript%"=="win32-init_env_command.cmd" (
		echo `%InitEnvScript%` file not found !
		echo Init-env script used : "win32-init_env_command.cmd"
		set InitEnvScript="win32-init_env_command.cmd"
	)
	if not exist "win32-init_env_command.cmd" (
		echo "win32-init_env_command.cmd" not found !
		echo `win32-init_env_command.cmd-skeleton` is a good file to start with... (I'll copy this file for you^)
		copy "win32-init_env_command.cmd-skeleton" "win32-init_env_command.cmd"
	)
)

call "%InitEnvScript%"

REM #######################################################################################

set saved_directory=%CD%
set target_dist=..\dist

echo.
echo _______________________________________________________________________________
echo.

mkdir ..\local-tmp 2> NULL
for /F %%s in (%OpenViBE_build_order%) do (
	set OpenViBE_project_name_full=%%s
	set OpenViBE_project_name_rel=!OpenViBE_project_name_full:%OpenViBE_base%\=!
	echo Configuring and building !OpenViBE_project_name_rel! ...
	echo.

	mkdir ..\local-tmp\!OpenViBE_project_name_rel! 2> NULL
	cd ..\local-tmp\!OpenViBE_project_name_rel!

	cmake -DCMAKE_INSTALL_PREFIX="%%s" -DCMAKE_BUILD_TYPE=%BuildType% -DCMAKE_CXX_FLAGS=" /DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR /wd4355" -Wno-dev -DCMAKE_MODULE_PATH="%saved_directory:\=/%/../cmake-modules;${CMAKE_MODULE_PATH}" !OpenViBE_project_name_full! -G"NMake Makefiles"
	IF NOT "!ERRORLEVEL!" == "0" goto terminate_error

	nmake
	IF NOT "!ERRORLEVEL!" == "0" goto terminate_error

	nmake OpenViBE-documentation 2> NULL
	REM IF NOT "!ERRORLEVEL!" == "0" goto terminate_error

	nmake install
	REM IF NOT "!ERRORLEVEL!" == "0" goto terminate_error

	cd %saved_directory%

	echo.
	echo _______________________________________________________________________________
	echo.
)

echo.
echo Building process terminated successfully !
echo.

REM #######################################################################################

echo.
echo Installing files to 'dist' folder, this can take a few seconds - maybe a few minutes...
echo.

REM rmdir /s /q %target_dist%         > NULL 2<&1

mkdir %target_dist%               > NULL 2<&1
mkdir %target_dist%\bin           > NULL 2<&1
mkdir %target_dist%\include       > NULL 2<&1
mkdir %target_dist%\lib           > NULL 2<&1
mkdir %target_dist%\share         > NULL 2<&1
mkdir %target_dist%\etc           > NULL 2<&1
mkdir %target_dist%\doc           > NULL 2<&1
mkdir %target_dist%\log           > NULL 2<&1
mkdir %target_dist%\tmp           > NULL 2<&1

echo @echo off                                                            >  %target_dist%\ov-vr-demo-tie-fighter.cmd
echo SET OpenViBE_DistRoot=%%CD%%>> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo pushd ..\scripts                                                     >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo call %InitEnvScript%                                                 >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo popd                                                                 >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo copy share\openvibe-applications\vr-demo\tie-fighter\resources.cfg-base share\openvibe-applications\vr-demo\tie-fighter\resources.cfg >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo type %OV_DEP_CEGUI%\resources.cfg ^>^> share\openvibe-applications\vr-demo\tie-fighter\resources.cfg >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo cd share\openvibe-applications\vr-demo\tie-fighter                   >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo %%OpenViBE_DistRoot%%\bin\OpenViBE-vr-demo-dynamic.exe tie-fighter   >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo cd %%OpenViBE_DistRoot%%                                             >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo exit                                                                 >> %target_dist%\ov-vr-demo-tie-fighter.cmd

echo @echo off                                                            >  %target_dist%\ov-vr-demo-handball.cmd
echo SET OpenViBE_DistRoot=%%CD%%>> %target_dist%\ov-vr-demo-handball.cmd
echo pushd ..\scripts                                                     >> %target_dist%\ov-vr-demo-handball.cmd
echo call %InitEnvScript%                                                 >> %target_dist%\ov-vr-demo-handball.cmd
echo popd                                                                 >> %target_dist%\ov-vr-demo-handball.cmd
echo copy share\openvibe-applications\vr-demo\handball\resources.cfg-base share\openvibe-applications\vr-demo\handball\resources.cfg >> %target_dist%\ov-vr-demo-handball.cmd
echo type %OV_DEP_CEGUI%\resources.cfg ^>^> share\openvibe-applications\vr-demo\handball\resources.cfg >> %target_dist%\ov-vr-demo-handball.cmd
echo cd share\openvibe-applications\vr-demo\handball                      >> %target_dist%\ov-vr-demo-handball.cmd
echo %%OpenViBE_DistRoot%%\bin\OpenViBE-vr-demo-dynamic.exe handball      >> %target_dist%\ov-vr-demo-handball.cmd
echo cd %%OpenViBE_DistRoot%%                                             >> %target_dist%\ov-vr-demo-handball.cmd
echo exit                                                                 >> %target_dist%\ov-vr-demo-handball.cmd

echo @echo off                                               >  %target_dist%\ov-acquisition-server.cmd
echo pushd ..\scripts                                        >> %target_dist%\ov-acquisition-server.cmd
echo call %InitEnvScript%                                    >> %target_dist%\ov-acquisition-server.cmd
echo popd                                                    >> %target_dist%\ov-acquisition-server.cmd
echo cd bin                                                  >> %target_dist%\ov-acquisition-server.cmd
echo OpenViBE-acquisition-server-dynamic.exe %%1 %%2 %%3 %%4 >> %target_dist%\ov-acquisition-server.cmd
echo pause                                                   >> %target_dist%\ov-acquisition-server.cmd

echo @echo off                                               >  %target_dist%\ov-designer.cmd
echo pushd ..\scripts                                        >> %target_dist%\ov-designer.cmd
echo call %InitEnvScript%                                    >> %target_dist%\ov-designer.cmd
echo popd                                                    >> %target_dist%\ov-designer.cmd
echo cd bin                                                  >> %target_dist%\ov-designer.cmd
echo OpenViBE-designer-dynamic.exe %%1 %%2 %%3 %%4 %%5 %%6   >> %target_dist%\ov-designer.cmd
echo pause                                                   >> %target_dist%\ov-designer.cmd

echo @echo off                                               >  %target_dist%\ov-id-generator.cmd
echo pushd ..\scripts                                        >> %target_dist%\ov-id-generator.cmd
echo call %InitEnvScript%                                    >> %target_dist%\ov-id-generator.cmd
echo popd                                                    >> %target_dist%\ov-id-generator.cmd
echo cd bin                                                  >> %target_dist%\ov-id-generator.cmd
echo OpenViBE-id-generator-dynamic.exe %%1 %%2 %%3 %%4 %%5   >> %target_dist%\ov-id-generator.cmd
echo pause                                                   >> %target_dist%\ov-id-generator.cmd

echo @echo off                                               >  %target_dist%\ov-plugin-inspector.cmd
echo pushd ..\scripts                                        >> %target_dist%\ov-plugin-inspector.cmd
echo call %InitEnvScript%                                    >> %target_dist%\ov-plugin-inspector.cmd
echo popd                                                    >> %target_dist%\ov-plugin-inspector.cmd
echo cd bin                                                  >> %target_dist%\ov-plugin-inspector.cmd
echo OpenViBE-plugin-inspector-dynamic.exe %%1 %%2 %%3 %%4   >> %target_dist%\ov-plugin-inspector.cmd
echo pause                                                   >> %target_dist%\ov-plugin-inspector.cmd

echo @echo off                                               >  %target_dist%\ov-skeleton-generator.cmd
echo pushd ..\scripts                                        >> %target_dist%\ov-skeleton-generator.cmd
echo call win32-init_env_command.cmd                         >> %target_dist%\ov-skeleton-generator.cmd
echo popd                                                    >> %target_dist%\ov-skeleton-generator.cmd
echo cd bin                                                  >> %target_dist%\ov-skeleton-generator.cmd
echo OpenViBE-skeleton-generator-dynamic.exe %%1 %%2 %%3 %%4 >> %target_dist%\ov-skeleton-generator.cmd
echo pause                                                   >> %target_dist%\ov-skeleton-generator.cmd

echo @echo off                                               >  %target_dist%\ov-ssvep-demo-training.cmd
echo pushd ..\scripts                                        >> %target_dist%\ov-ssvep-demo-training.cmd
echo call win32-init_env_command.cmd                         >> %target_dist%\ov-ssvep-demo-training.cmd
echo popd                                                    >> %target_dist%\ov-ssvep-demo-training.cmd
echo cd bin                                                  >> %target_dist%\ov-ssvep-demo-training.cmd
echo start OpenViBE-ssvep-demo-dynamic.exe training	         >> %target_dist%\ov-ssvep-demo-training.cmd

echo @echo off                                               >  %target_dist%\ov-ssvep-demo-shooter.cmd
echo pushd ..\scripts                                        >> %target_dist%\ov-ssvep-demo-shooter.cmd
echo call win32-init_env_command.cmd                         >> %target_dist%\ov-ssvep-demo-shooter.cmd
echo popd                                                    >> %target_dist%\ov-ssvep-demo-shooter.cmd
echo cd bin                                                  >> %target_dist%\ov-ssvep-demo-shooter.cmd
echo start OpenViBE-ssvep-demo-dynamic.exe shooter           >> %target_dist%\ov-ssvep-demo-shooter.cmd

echo @echo off                                               >  %target_dist%\bin\OpenViBE-external-application-launcher.cmd
echo pushd ..                                                >> %target_dist%\bin\OpenViBE-external-application-launcher.cmd
echo ov-%%1.cmd %%2 %%3 %%4 %%5                              >> %target_dist%\bin\OpenViBE-external-application-launcher.cmd

echo.
for /F %%s in (%OpenViBE_build_order%) do (
	set OpenViBE_project_name_full=%%s
	set OpenViBE_project_name_rel=!OpenViBE_project_name_full:%OpenViBE_base%\=!
	echo ## Installing !OpenViBE_project_name_rel! ...
	xcopy /q /e /y /c %%s\bin\*.*         %target_dist%\bin     >> NULL
	xcopy /q /e /y %%s\include\*.*        %target_dist%\include >> NULL
	xcopy /q /e /y %%s\lib\*.*            %target_dist%\lib     >> NULL
	xcopy /q /e /y %%s\share\*.*          %target_dist%\share   >> NULL
	xcopy /q /e /y %%s\etc\*.*            %target_dist%\etc     >> NULL
	xcopy /q /e /y %%s\doc\*.*            %target_dist%\doc     >> NULL
)
echo.

echo.
echo Install completed !
echo.

goto terminate_success

REM #######################################################################################

:terminate_error

echo.
echo An error occured during building process !
echo.
pause

goto terminate

REM #######################################################################################

:terminate_success

pause

goto terminate

REM #######################################################################################

:terminate

if exist NULL del NULL

@echo off
setlocal EnableDelayedExpansion
setlocal enableextensions

REM no options / set to default
set BuildType=Release
set InitEnvScript=win32-init_env_command.cmd
set PAUSE=pause
if /i "%1"=="-h" (
	echo Usage: win32-build.cmd [Build Type] [Init-env Script]
	echo -- Build Type option can be : --release (-r^) or --debug (-d^). Default is release.
	echo -- Default Init-env script is: win32-init_env_command.cmd
	pause
	exit 0
) else if /i "%1"=="--help" (
	echo Usage: win32-build.cmd [Build Type] [Init-env Script]
	echo -- Build Type option can be : --release (-r^) or --debug (-d^). Default is Release.
	echo -- Default Init-env script is: win32-init_env_command.cmd
	pause
	exit 0
) else if /i "%1"=="--no-pause" (
	set PAUSE=echo ""
) else if /i "%1"=="-d" (
	set BuildType=Debug
	set InitEnvScript=%2
) else if /i "%1"=="--debug" (
	set BuildType=Debug
	set InitEnvScript=%2
) else if /i "%1"=="-r" (
	set BuildType=Release
	set InitEnvScript=%2
) else if /i "%1"=="--release" (
	set BuildType=Release
	set InitEnvScript=%2
) else if not "%1"=="" (
	set BuildType=Release
	set InitEnvScript=%1
)

if /i "%InitEnvScript%"=="" (
	echo No script specified. Default will be used.
	set InitEnvScript=win32-init_env_command.cmd
)

echo --
echo build type is set to: %BuildType%.
echo Init-env Script to be called: %InitEnvScript%.
echo --

REM #######################################################################################

if not exist "%InitEnvScript%" (
	if not "%InitEnvScript%"=="win32-init_env_command.cmd" (
		echo `%InitEnvScript%` file not found !
		echo Init-env script used : "win32-init_env_command.cmd"
		set InitEnvScript="win32-init_env_command.cmd"
	)
	if not exist "win32-init_env_command.cmd" (
		echo "win32-init_env_command.cmd" not found !
		echo `win32-init_env_command.cmd-skeleton` is a good file to start with... (I'll copy this file for you^)
		copy "win32-init_env_command.cmd-skeleton" "win32-init_env_command.cmd"
	)
)

call "%InitEnvScript%"

REM #######################################################################################

set saved_directory=%CD%
set target_dist=..\dist

echo.
echo _______________________________________________________________________________
echo.

mkdir ..\local-tmp 2> NULL
for /F %%s in (%OpenViBE_build_order%) do (
	set OpenViBE_project_name_full=%%s
	set OpenViBE_project_name_rel=!OpenViBE_project_name_full:%OpenViBE_base%\=!
	echo Configuring and building !OpenViBE_project_name_rel! ...
	echo.

	mkdir ..\local-tmp\!OpenViBE_project_name_rel! 2> NULL
	cd ..\local-tmp\!OpenViBE_project_name_rel!

	cmake -DCMAKE_INSTALL_PREFIX="%%s" -DCMAKE_BUILD_TYPE=%BuildType% -DCMAKE_CXX_FLAGS=" /DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR /wd4355" -Wno-dev -DCMAKE_MODULE_PATH="%saved_directory:\=/%/../cmake-modules;${CMAKE_MODULE_PATH}" !OpenViBE_project_name_full! -G"NMake Makefiles"
	IF NOT "!ERRORLEVEL!" == "0" goto terminate_error

	nmake
	IF NOT "!ERRORLEVEL!" == "0" goto terminate_error

	nmake OpenViBE-documentation 2> NULL
	REM IF NOT "!ERRORLEVEL!" == "0" goto terminate_error

	nmake install
	REM IF NOT "!ERRORLEVEL!" == "0" goto terminate_error

	cd %saved_directory%

	echo.
	echo _______________________________________________________________________________
	echo.
)

echo.
echo Building process terminated successfully !
echo.

REM #######################################################################################

echo.
echo Installing files to 'dist' folder, this can take a few seconds - maybe a few minutes...
echo.

REM rmdir /s /q %target_dist%         > NULL 2<&1

mkdir %target_dist%               > NULL 2<&1
mkdir %target_dist%\bin           > NULL 2<&1
mkdir %target_dist%\include       > NULL 2<&1
mkdir %target_dist%\lib           > NULL 2<&1
mkdir %target_dist%\share         > NULL 2<&1
mkdir %target_dist%\etc           > NULL 2<&1
mkdir %target_dist%\doc           > NULL 2<&1
mkdir %target_dist%\log           > NULL 2<&1
mkdir %target_dist%\tmp           > NULL 2<&1

echo @echo off                                                            >  %target_dist%\ov-vr-demo-tie-fighter.cmd
echo SET OpenViBE_DistRoot=%%CD%%>> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo pushd ..\scripts                                                     >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo call %InitEnvScript%                                                 >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo popd                                                                 >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo copy share\openvibe-applications\vr-demo\tie-fighter\resources.cfg-base share\openvibe-applications\vr-demo\tie-fighter\resources.cfg >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo type %OV_DEP_CEGUI%\resources.cfg ^>^> share\openvibe-applications\vr-demo\tie-fighter\resources.cfg >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo cd share\openvibe-applications\vr-demo\tie-fighter                   >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo %%OpenViBE_DistRoot%%\bin\OpenViBE-vr-demo-dynamic.exe tie-fighter   >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo cd %%OpenViBE_DistRoot%%                                             >> %target_dist%\ov-vr-demo-tie-fighter.cmd
echo exit                                                                 >> %target_dist%\ov-vr-demo-tie-fighter.cmd

echo @echo off                                                            >  %target_dist%\ov-vr-demo-handball.cmd
echo SET OpenViBE_DistRoot=%%CD%%>> %target_dist%\ov-vr-demo-handball.cmd
echo pushd ..\scripts                                                     >> %target_dist%\ov-vr-demo-handball.cmd
echo call %InitEnvScript%                                                 >> %target_dist%\ov-vr-demo-handball.cmd
echo popd                                                                 >> %target_dist%\ov-vr-demo-handball.cmd
echo copy share\openvibe-applications\vr-demo\handball\resources.cfg-base share\openvibe-applications\vr-demo\handball\resources.cfg >> %target_dist%\ov-vr-demo-handball.cmd
echo type %OV_DEP_CEGUI%\resources.cfg ^>^> share\openvibe-applications\vr-demo\handball\resources.cfg >> %target_dist%\ov-vr-demo-handball.cmd
echo cd share\openvibe-applications\vr-demo\handball                      >> %target_dist%\ov-vr-demo-handball.cmd
echo %%OpenViBE_DistRoot%%\bin\OpenViBE-vr-demo-dynamic.exe handball      >> %target_dist%\ov-vr-demo-handball.cmd
echo cd %%OpenViBE_DistRoot%%                                             >> %target_dist%\ov-vr-demo-handball.cmd
echo exit                                                                 >> %target_dist%\ov-vr-demo-handball.cmd

echo @echo off                                               >  %target_dist%\ov-acquisition-server.cmd
echo pushd ..\scripts                                        >> %target_dist%\ov-acquisition-server.cmd
echo call %InitEnvScript%                                    >> %target_dist%\ov-acquisition-server.cmd
echo popd                                                    >> %target_dist%\ov-acquisition-server.cmd
echo cd bin                                                  >> %target_dist%\ov-acquisition-server.cmd
echo OpenViBE-acquisition-server-dynamic.exe %%1 %%2 %%3 %%4 >> %target_dist%\ov-acquisition-server.cmd
echo pause                                                   >> %target_dist%\ov-acquisition-server.cmd

echo @echo off                                               >  %target_dist%\ov-designer.cmd
echo pushd ..\scripts                                        >> %target_dist%\ov-designer.cmd
echo call %InitEnvScript%                                    >> %target_dist%\ov-designer.cmd
echo popd                                                    >> %target_dist%\ov-designer.cmd
echo cd bin                                                  >> %target_dist%\ov-designer.cmd
echo OpenViBE-designer-dynamic.exe %%1 %%2 %%3 %%4 %%5 %%6   >> %target_dist%\ov-designer.cmd
echo pause                                                   >> %target_dist%\ov-designer.cmd

echo @echo off                                               >  %target_dist%\ov-id-generator.cmd
echo pushd ..\scripts                                        >> %target_dist%\ov-id-generator.cmd
echo call %InitEnvScript%                                    >> %target_dist%\ov-id-generator.cmd
echo popd                                                    >> %target_dist%\ov-id-generator.cmd
echo cd bin                                                  >> %target_dist%\ov-id-generator.cmd
echo OpenViBE-id-generator-dynamic.exe %%1 %%2 %%3 %%4 %%5   >> %target_dist%\ov-id-generator.cmd
echo pause                                                   >> %target_dist%\ov-id-generator.cmd

echo @echo off                                               >  %target_dist%\ov-plugin-inspector.cmd
echo pushd ..\scripts                                        >> %target_dist%\ov-plugin-inspector.cmd
echo call %InitEnvScript%                                    >> %target_dist%\ov-plugin-inspector.cmd
echo popd                                                    >> %target_dist%\ov-plugin-inspector.cmd
echo cd bin                                                  >> %target_dist%\ov-plugin-inspector.cmd
echo OpenViBE-plugin-inspector-dynamic.exe %%1 %%2 %%3 %%4   >> %target_dist%\ov-plugin-inspector.cmd
echo pause                                                   >> %target_dist%\ov-plugin-inspector.cmd

echo @echo off                                               >  %target_dist%\ov-skeleton-generator.cmd
echo pushd ..\scripts                                        >> %target_dist%\ov-skeleton-generator.cmd
echo call win32-init_env_command.cmd                         >> %target_dist%\ov-skeleton-generator.cmd
echo popd                                                    >> %target_dist%\ov-skeleton-generator.cmd
echo cd bin                                                  >> %target_dist%\ov-skeleton-generator.cmd
echo OpenViBE-skeleton-generator-dynamic.exe %%1 %%2 %%3 %%4 >> %target_dist%\ov-skeleton-generator.cmd
echo pause                                                   >> %target_dist%\ov-skeleton-generator.cmd

echo @echo off                                               >  %target_dist%\ov-ssvep-demo-training.cmd
echo pushd ..\scripts                                        >> %target_dist%\ov-ssvep-demo-training.cmd
echo call win32-init_env_command.cmd                         >> %target_dist%\ov-ssvep-demo-training.cmd
echo popd                                                    >> %target_dist%\ov-ssvep-demo-training.cmd
echo cd bin                                                  >> %target_dist%\ov-ssvep-demo-training.cmd
echo start OpenViBE-ssvep-demo-dynamic.exe training	         >> %target_dist%\ov-ssvep-demo-training.cmd

echo @echo off                                               >  %target_dist%\ov-ssvep-demo-shooter.cmd
echo pushd ..\scripts                                        >> %target_dist%\ov-ssvep-demo-shooter.cmd
echo call win32-init_env_command.cmd                         >> %target_dist%\ov-ssvep-demo-shooter.cmd
echo popd                                                    >> %target_dist%\ov-ssvep-demo-shooter.cmd
echo cd bin                                                  >> %target_dist%\ov-ssvep-demo-shooter.cmd
echo start OpenViBE-ssvep-demo-dynamic.exe shooter           >> %target_dist%\ov-ssvep-demo-shooter.cmd

echo @echo off                                               >  %target_dist%\bin\OpenViBE-external-application-launcher.cmd
echo pushd ..                                                >> %target_dist%\bin\OpenViBE-external-application-launcher.cmd
echo ov-%%1.cmd %%2 %%3 %%4 %%5                              >> %target_dist%\bin\OpenViBE-external-application-launcher.cmd

echo.
for /F %%s in (%OpenViBE_build_order%) do (
	set OpenViBE_project_name_full=%%s
	set OpenViBE_project_name_rel=!OpenViBE_project_name_full:%OpenViBE_base%\=!
	echo ## Installing !OpenViBE_project_name_rel! ...
	xcopy /q /e /y /c %%s\bin\*.*         %target_dist%\bin     >> NULL
	xcopy /q /e /y %%s\include\*.*        %target_dist%\include >> NULL
	xcopy /q /e /y %%s\lib\*.*            %target_dist%\lib     >> NULL
	xcopy /q /e /y %%s\share\*.*          %target_dist%\share   >> NULL
	xcopy /q /e /y %%s\etc\*.*            %target_dist%\etc     >> NULL
	xcopy /q /e /y %%s\doc\*.*            %target_dist%\doc     >> NULL
)
echo.

echo.
echo Install completed !
echo.

goto terminate_success

REM #######################################################################################

:terminate_error

echo.
echo An error occured during building process !
echo.
%PAUSE%

goto terminate

REM #######################################################################################

:terminate_success

%PAUSE%

goto terminate

REM #######################################################################################

:terminate

if exist NULL del NULL

ADD Undocumented feature : --no-pause option to skip the pause at the end off script execution , useful for automatic build

git-svn-id: 8b72b58fb31a931b6e9a2bd3bb08bc6614045fb1@3358 c330d7e9-fc0c-0410-a5b3-fd85c6f5aa8f