echo ON

"%PYTHON%" setup.py install --standard-lib
if errorlevel 1 exit 1

if not exist %PREFIX%/etc/conda/activate.d mkdir %PREFIX%/etc/conda/activate.d
if errorlevel 1 exit 1
if not exist %PREFIX%/etc/conda/deactivate.d mkdir -p $PREFIX/etc/conda/dedeactivate.d
type NUL > %PREFIX%/etc/conda/activate.d/scons_vars.bat
if errorlevel 1 exit 1
type NUL > %PREFIX%/etc/conda/deactivate.d/scons_vars.bat
if errorlevel 1 exit 1

echo set SCONSFLAGS="--sitedir=%CONDA_PREFIX%/share/site_scons" > %PREFIX%/etc/conda/activate.d/scons_vars.bat
if errorlevel 1 exit 1
echo set SCONSFLAGS= > %PREFIX%/etc/conda/deactivate.d/scons_vars.bat
if errorlevel 1 exit 1

if not exist %PREFIX%/share/site_scons mkdir %PREFIX%/share/site_scons
if errorlevel 1 exit 1
if not exist %PREFIX%/share/site_scons/site_init.py type NUL > %PREFIX%/share/site_scons/site_init.py
if errorlevel 1 exit 1
if not exist %PREFIX%/share/site_scons/site_tools mkdir %PREFIX%/share/site_scons/site_tools
if errorlevel 1 exit 1

Update bld.bat

Update bld.bat


SET RDIR=Effekseer150Win

rmdir %RDIR%
mkdir %RDIR%

echo Compile Editor

echo Copy application

mkdir %RDIR%\Tool

copy Dev\release\Effekseer.exe %RDIR%\Tool\.
copy Dev\release\Effekseer.exe.config %RDIR%\Tool\.
copy Dev\release\EffekseerCore.dll %RDIR%\Tool\.
copy Dev\release\EffekseerViewer.dll %RDIR%\Tool\.
copy Dev\release\IronPython.dll %RDIR%\Tool\.
copy Dev\release\IronPython.Modules.dll %RDIR%\Tool\.
copy Dev\release\Microsoft.Dynamic.dll %RDIR%\Tool\.
copy Dev\release\Microsoft.Scripting.dll %RDIR%\Tool\.
copy Dev\release\EffekseerMaterialEditor.exe %RDIR%\Tool\.
copy Dev\release\Viewer.dll %RDIR%\Tool\.

mkdir %RDIR%\Tool\scripts
mkdir %RDIR%\Tool\scripts\export
copy Dev\release\scripts\export\Default.cs %RDIR%\Tool\scripts\export\.

mkdir %RDIR%\Tool\tools
copy Dev\release\tools\fbxToEffekseerModelConverter.exe %RDIR%\Tool\tools\.
copy Dev\release\tools\mqoToEffekseerModelConverter.exe %RDIR%\Tool\tools\.

copy Dev\release\tools\EffekseerMaterialCompilerDX9.dll %RDIR%\Tool\tools\.
copy Dev\release\tools\EffekseerMaterialCompilerDX11.dll %RDIR%\Tool\tools\.
copy Dev\release\tools\EffekseerMaterialCompilerDX12.dll %RDIR%\Tool\tools\.
copy Dev\release\tools\EffekseerMaterialCompilerGL.dll %RDIR%\Tool\tools\.
copy Dev\release\tools\EffekseerMaterialCompilerMetal.dll %RDIR%\Tool\tools\.

mkdir %RDIR%\Tool\resources
robocopy Dev\release\resources\ %RDIR%\Tool\resources\. /s

echo Sample

mkdir %RDIR%\Sample
robocopy Release\Sample %RDIR%\Sample *.efkproj *.efkmodel *.efkmat *.efkefc *.txt *.png *.mqo *.fbx /S
robocopy ResourceData\samples %RDIR%\Sample *.efkproj *.efkmodel *.efkmat *.efkefc *.txt *.png *.mqo *.fbx /S

echo Readme
copy readme_tool_win.txt %RDIR%\readme.txt
copy docs\readme_sample.txt %RDIR%\Sample\readme.txt

copy docs\Help_Ja.html %RDIR%\Help_Ja.html
copy docs\Help_En.html %RDIR%\Help_En.html
copy LICENSE_TOOL %RDIR%\LICENSE_TOOL

pause

SET RDIR=Effekseer150Win

rmdir %RDIR%
mkdir %RDIR%

echo Compile Editor

echo Copy application

mkdir %RDIR%\Tool

copy Dev\release\Effekseer.exe %RDIR%\Tool\.
copy Dev\release\Effekseer.exe.config %RDIR%\Tool\.
copy Dev\release\EffekseerCore.dll %RDIR%\Tool\.
copy Dev\release\EffekseerViewer.dll %RDIR%\Tool\.
copy Dev\release\IronPython.dll %RDIR%\Tool\.
copy Dev\release\IronPython.Modules.dll %RDIR%\Tool\.
copy Dev\release\Microsoft.Dynamic.dll %RDIR%\Tool\.
copy Dev\release\Microsoft.Scripting.dll %RDIR%\Tool\.
copy Dev\release\EffekseerMaterialEditor.exe %RDIR%\Tool\.
copy Dev\release\Viewer.dll %RDIR%\Tool\.
copy Dev\release\Newtonsoft.Json.dll %RDIR%\Tool\.

mkdir %RDIR%\Tool\scripts
mkdir %RDIR%\Tool\scripts\export
copy Dev\release\scripts\export\Default.cs %RDIR%\Tool\scripts\export\.

mkdir %RDIR%\Tool\tools
copy Dev\release\tools\fbxToEffekseerModelConverter.exe %RDIR%\Tool\tools\.
copy Dev\release\tools\mqoToEffekseerModelConverter.exe %RDIR%\Tool\tools\.

copy Dev\release\tools\EffekseerMaterialCompilerDX9.dll %RDIR%\Tool\tools\.
copy Dev\release\tools\EffekseerMaterialCompilerDX11.dll %RDIR%\Tool\tools\.
copy Dev\release\tools\EffekseerMaterialCompilerDX12.dll %RDIR%\Tool\tools\.
copy Dev\release\tools\EffekseerMaterialCompilerGL.dll %RDIR%\Tool\tools\.
copy Dev\release\tools\EffekseerMaterialCompilerMetal.dll %RDIR%\Tool\tools\.

mkdir %RDIR%\Tool\resources
robocopy Dev\release\resources\ %RDIR%\Tool\resources\. /s

echo Sample

mkdir %RDIR%\Sample
robocopy Release\Sample %RDIR%\Sample *.efkproj *.efkmodel *.efkmat *.efkefc *.txt *.png *.mqo *.fbx /S
robocopy ResourceData\samples %RDIR%\Sample *.efkproj *.efkmodel *.efkmat *.efkefc *.txt *.png *.mqo *.fbx /S

echo Readme
copy readme_tool_win.txt %RDIR%\readme.txt
copy docs\readme_sample.txt %RDIR%\Sample\readme.txt

copy docs\Help_Ja.html %RDIR%\Help_Ja.html
copy docs\Help_En.html %RDIR%\Help_En.html
copy LICENSE_TOOL %RDIR%\LICENSE_TOOL

pause

Fix a bag that saving camera settings crashes Effekseer


@echo off
rem ----------------------------------------------------------------------------
rem
rem This variable should be set to the directory where is installed ProActive
rem

IF NOT DEFINED PROACTIVE set PROACTIVE=%CD%\..\..

rem ----------------------------------------------------------------------------

if NOT DEFINED JAVA_HOME goto javahome
if "%JAVA_HOME%" == "" goto javahome

rem ----
rem Set up the classpath using classes dir or jar files
rem

IF DEFINED CLASSPATHEXT (
	SET CLASSPATH=%CLASSPATHEXT%
) ELSE (
	SET CLASSPATH=.
)

IF EXIST "%PROACTIVE%\classes" (
	SET CLASSPATH=%CLASSPATH%;%PROACTIVE%\classes\Core;%PROACTIVE%\classes\Extensions;%PROACTIVE%\classes\Extra;%PROACTIVE%\classes\Examples;%PROACTIVE%\classes\IC2D-old
	SET JARS=%PROACTIVE%\lib\
	FOR %%j IN (%PROACTIVE%\lib\*.jar) DO SET JARS=!JARS!;%%j
) ELSE (
	SET JARS=%PROACTIVE%\dist\lib\
	FOR %%j IN (%PROACTIVE%\dist\lib\*.jar) DO SET JARS=!JARS!;%%j
)

SET CLASSPATH=%CLASSPATH%;%JARS%
IF EXIST "%PROACTIVE%\ProActive_examples.jar" set CLASSPATH=%CLASSPATH%;%PROACTIVE%\ProActive_examples.jar

set JAVA_CMD="%JAVA_HOME%\bin\java.exe" -Djava.security.manager -Djava.security.policy="%PROACTIVE%\scripts\proactive.java.policy" -Dlog4j.configuration=file:"%PROACTIVE%\scripts\proactive-log4j"

rem Adding java tools to the path
SET OK=1
FOR /F "delims=;" %%i IN ("%PATH%") DO (
IF /I "%%i" == "%JAVA_HOME%\bin" SET OK=0
)
IF /I %OK%==1 SET PATH=%JAVA_HOME%\bin;%PATH%

goto end

:javahome
echo.
echo The enviroment variable JAVA_HOME must be set the current jdk distribution
echo installed on your computer.
echo Use
echo    set JAVA_HOME=<the directory where is the JDK>
goto end

:end

@echo off
rem ----------------------------------------------------------------------------
rem
rem This variable should be set to the directory where is installed ProActive
rem

IF NOT DEFINED PROACTIVE set PROACTIVE=%CD%\..\..

rem ----------------------------------------------------------------------------

if NOT DEFINED JAVA_HOME goto javahome
if "%JAVA_HOME%" == "" goto javahome

rem ----
rem Set up the classpath using classes dir or jar files
rem

IF DEFINED CLASSPATHEXT (
	SET CLASSPATH=%CLASSPATHEXT%
) ELSE (
	SET CLASSPATH=.
)

IF EXIST "%PROACTIVE%\classes" (
	SET CLASSPATH=%CLASSPATH%;%PROACTIVE%\classes\Core;%PROACTIVE%\classes\Extensions;%PROACTIVE%\classes\Extra;%PROACTIVE%\classes\Examples;%PROACTIVE%\classes\IC2D-old
	SET JARS=%PROACTIVE%\lib\
	FOR %%j IN ("%PROACTIVE%\lib\*.jar") DO SET JARS=!JARS!;%%j
) ELSE (
	SET JARS=%PROACTIVE%\dist\lib\
	FOR %%j IN ("%PROACTIVE%\dist\lib\*.jar") DO SET JARS=!JARS!;%%j
)

SET CLASSPATH=%CLASSPATH%;%JARS%
IF EXIST "%PROACTIVE%\ProActive_examples.jar" set CLASSPATH=%CLASSPATH%;%PROACTIVE%\ProActive_examples.jar

set JAVA_CMD="%JAVA_HOME%\bin\java.exe" -Djava.security.manager -Djava.security.policy="%PROACTIVE%\scripts\proactive.java.policy" -Dlog4j.configuration=file:"%PROACTIVE%\scripts\proactive-log4j"

rem Adding java tools to the path
SET OK=1
FOR /F "delims=;" %%i IN ("%PATH%") DO (
IF /I "%%i" == "%JAVA_HOME%\bin" SET OK=0
)
IF /I %OK%==1 SET PATH=%JAVA_HOME%\bin;%PATH%

goto end

:javahome
echo.
echo The enviroment variable JAVA_HOME must be set the current jdk distribution
echo installed on your computer.
echo Use
echo    set JAVA_HOME=<the directory where is the JDK>
goto end

:end

fix for PROACTIVE-188

fix for PROACTIVE-188

git-svn-id: 9146c88ff6d39b48099bf954d15d68f687b3fa69@7485 28e8926c-6b08-0410-baaa-805c5e19b8d6


@echo off

rem mvn -N clean install

rem cd ./bubble-common
rem mvn -Dmaven.test.skip=true clean install

rem cd ./bubble-persistence
rem mvn -Dmaven.test.skip=true clean install

rem cd ../bubble-remote
rem mvn -Dmaven.test.skip=true clean install

rem cd ./bubble-application
rem mvn -f bubble-application/pom.xml -Dmaven.test.skip=true clean package

mvn -Dmaven.test.skip=true clean assembly:assembly

@echo off

rem mvn -N clean install

rem cd ./bubble-common
rem mvn -Dmaven.test.skip=true clean install

rem cd ./bubble-persistence
rem mvn -Dmaven.test.skip=true clean install

rem cd ../bubble-web
rem mvn -Dmaven.test.skip=true clean install

rem cd ./bubble-application
rem mvn -f bubble-application/pom.xml -Dmaven.test.skip=true clean package

mvn -Dmaven.test.skip=true clean assembly:assembly

Update package.cmd

Update package.cmd

增加bubble-web编译并package脚本


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

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

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

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

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

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

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

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

@setlocal
@set debug=

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

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

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

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

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

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

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

Fix setting BUILD

Fix setting BUILD


mkdir %LIBRARY_INC%\cspice

copy "makeDynamicSpice.bat" %SRC_DIR%\src\cspice

cd %SRC_DIR%\src\cspice

call makeDynamicSpice.bat

copy "cspice.dll" %LIBRARY_LIB%

if errorlevel 1 exit 1

cd %SRC_DIR%

copy "include\\*.h" %LIBRARY_INC%\cspice

if errorlevel 1 exit 1

mkdir %LIBRARY_INC%\cspice

copy "%RECIPE_DIR%\\makeDynamicSpice.bat" %SRC_DIR%\src\cspice
copy "%RECIPE_DIR%\\cspice.def" %SRC_DIR%\src\cspice

cd %SRC_DIR%\src\cspice

call makeDynamicSpice.bat

copy "cspice.dll" %LIBRARY_LIB%

if errorlevel 1 exit 1

cd %SRC_DIR%

copy "include\\*.h" %LIBRARY_INC%\cspice

if errorlevel 1 exit 1

Copy required files to source directory

Copy required files to source directory


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

:: Keep environment variables within this script
:: unless invoked with --no-local.
if x%1==x--no-local goto nolocal
if x%2==x--no-local goto nolocal
setlocal
:nolocal

set GOBUILDFAIL=0

rem TODO avoid rebuild if possible

if x%1==x--no-rebuild goto norebuild
echo # Building packages and commands.
go install -a -v std
if errorlevel 1 goto fail
echo.
:norebuild

echo # Testing packages.
go test std -short -timeout=120s
if errorlevel 1 goto fail
echo.

echo # runtime -cpu=1,2,4
go test runtime -short -timeout=120s -cpu=1,2,4
if errorlevel 1 goto fail
echo.

echo # sync -cpu=10
go test sync -short -timeout=120s -cpu=10
if errorlevel 1 goto fail
echo.

echo # ..\misc\dashboard\builder ..\misc\goplay
go build ..\misc\dashboard\builder ..\misc\goplay
if errorlevel 1 goto fail
echo.

echo # ..\test\bench\go1
go test ..\test\bench\go1
if errorlevel 1 goto fail
echo.

:: TODO: The other tests in run.bash.

echo # test
cd ..\test
set FAIL=0
go run run.go
if errorlevel 1 set FAIL=1
cd ..\src
echo.
if %FAIL%==1 goto fail

echo # Checking API compatibility.
go tool api -c ..\api\go1.txt
if errorlevel 1 goto fail
echo.

echo ALL TESTS PASSED
goto end

:fail
set GOBUILDFAIL=1

:end

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

:: Keep environment variables within this script
:: unless invoked with --no-local.
if x%1==x--no-local goto nolocal
if x%2==x--no-local goto nolocal
setlocal
:nolocal

set GOBUILDFAIL=0

rem TODO avoid rebuild if possible

if x%1==x--no-rebuild goto norebuild
echo # Building packages and commands.
go install -a -v std
if errorlevel 1 goto fail
echo.
:norebuild

echo # Testing packages.
go test std -short -timeout=120s
if errorlevel 1 goto fail
echo.

echo # runtime -cpu=1,2,4
go test runtime -short -timeout=120s -cpu=1,2,4
if errorlevel 1 goto fail
echo.

echo # sync -cpu=10
go test sync -short -timeout=120s -cpu=10
if errorlevel 1 goto fail
echo.

echo # ..\misc\dashboard\builder ..\misc\goplay
go build ..\misc\dashboard\builder ..\misc\goplay
if errorlevel 1 goto fail
echo.

:: TODO(brainman): disabled, because it fails with: mkdir C:\Users\ADMINI~1\AppData\Local\Temp\2.....\test\bench\: The filename or extension is too long.
::echo # ..\test\bench\go1
::go test ..\test\bench\go1
::if errorlevel 1 goto fail
::echo.

:: TODO: The other tests in run.bash.

echo # test
cd ..\test
set FAIL=0
go run run.go
if errorlevel 1 set FAIL=1
cd ..\src
echo.
if %FAIL%==1 goto fail

echo # Checking API compatibility.
go tool api -c ..\api\go1.txt
if errorlevel 1 goto fail
echo.

echo ALL TESTS PASSED
goto end

:fail
set GOBUILDFAIL=1

:end

run.bat: disable test in test\bench\go1 to fix build

R=golang-dev, r
CC=golang-dev
http://codereview.appspot.com/5848066


@echo off
setlocal

set "output=nul"
set "times=1"

goto :parseArgs

:help

goto :eof

:parseArgs

if "%~1" == "" goto main

if /i "%~1" == "-?" goto help
if /i "%~1" == "-h" goto help
if /i "%~1" == "--help" goto help

if /i "%~1" == "-t" (
    set "times=%~2"
    shift
)

if /i "%~1" == "--times" (
    set "times=%~2"
    shift
)

if /i "%~1" == "-o" (
    set "output=%~2"
    shift
)

if /i "%~1" == "--output" (
    set "output=%~2"
    shift
)

shift
goto parseArgs

:curl

@powershell -NoProfile "iwr %~1 -OutFile %~2" 2> nul

goto :eof

:downloadPackage

set "url=https://www.nuget.org/api/v2/package/%~1"
call :curl "%url%" %2

goto :eof

:main

for /l %%i in (1, 1, %times%) do (
    call :downloadPackage "%package%" "%output%"
)

@echo off
setlocal

set "output=nul"
set "times=1"

goto :parseArgs

:help

:: TODO: put something here.

goto :eof

:parseArgs

set "package=%~1"
shift

if "%~1" == "" goto main

if /i "%~1" == "-?" goto help
if /i "%~1" == "-h" goto help
if /i "%~1" == "--help" goto help

if /i "%~1" == "-t" (
    set "times=%~2"
    shift
)

if /i "%~1" == "--times" (
    set "times=%~2"
    shift
)

if /i "%~1" == "-o" (
    set "output=%~2"
    shift
)

if /i "%~1" == "--output" (
    set "output=%~2"
    shift
)

shift
goto parseArgs

:curl

@powershell -NoProfile "iwr %~1 -OutFile %~2" 2> nul

goto :eof

:downloadPackage

set "url=https://www.nuget.org/api/v2/package/%~1"
call :curl "%url%" %2

goto :eof

:main

for /l %%i in (1, 1, %times%) do (
    call :downloadPackage "%package%" "%output%"
)

fix arg parsing for cmd

fix arg parsing for cmd


setenv bootargs "console=ttyO2,115200n8 mpurate=500 vram=12M omapdss.def_disp=lcd43 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait"
setenv loadaddr 0x82000000
fatload mmc 0 ${loadaddr} uImage
bootm ${loadaddr}

setenv bootargs "console=ttyO2,115200n8 mpurate=720 vram=12M omapdss.def_disp=lcd43 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait"
setenv loadaddr 0x82000000
fatload mmc 0 ${loadaddr} uImage
bootm ${loadaddr}

Set mpurate=720 since I only use boot.scr for Tide


@echo off

rem ### sshTeraTerm.ps1 実行バッチ

set "SSH_POWERSHELL_URL=https://raw.githubusercontent.com/initsh/initsh.github.io/master/ps1/sshTeraTerm.ps1"
set "SSH_POWERSHELL_DIR=%USERPROFILE%\GoogleDrive\ps1"
set "SSH_POWERSHELL=%USERPROFILE%\GoogleDrive\ps1\sshTeraTerm.ps1"

if not exist "%SSH_POWERSHELL_DIR%" mkdir "%SSH_POWERSHELL_DIR%" 1>nul
if not exist "%SSH_POWERSHELL%" bitsadmin.exe /TRANSFER get_sshTeraTerm "%SSH_POWERSHELL_URL%" "%SSH_POWERSHELL%"

start powershell.exe "%SSH_POWERSHELL%" %*

move "%~dp0%~nx0" "%USERPROFILE%" 1>nul

rem # EOF

Create ssh.bat

Create ssh.bat


@rem This script should be called with the current version number of the
@rem server.
@rem
@rem Since it is intended for building deployable artifacts, it requires a clean
@rem git working directory (e.g. no uncommitted changes).
@rem
@rem Example of running it manually:
@rem  - "deploy.bat 6.1.2"
@rem  - "deploy.bat $npm_package_version" (if run from a npm script)
@echo off

SETLOCAL

if "%1"=="" (
  echo Missing required version argument
  goto :exit
)

SET version=%1

@rem Handle changes that are not staged
git diff --exit-code > nul
if errorlevel 1 (
  echo Uncommitted git changes detected. Please commit them and try again.
  goto exit
)

@rem Handle changes that are staged
git diff --cached --exit-code > nul
if errorlevel 1 (
  echo Uncommitted git changes detected. Please commit them and try again.
  goto exit
)

SET gitsha=
FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-parse --verify HEAD`) DO (
  SET gitsha=%%F
)

if errorlevel 1 (
  echo Error retrieving current git SHA
  goto :exit
)
if "%gitsha%" == "" (
  echo Error retrieving current git SHA
  goto :exit
)

SET NAME=shieldbattery/shieldbattery
SET IMG=%NAME%:%gitsha%
SET NPM_TAG=%NAME%:%version%
SET LATEST_TAG=%NAME%:latest

docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t %IMG%
if errorlevel 1 (
  echo Error building the image
  goto exit
)

@rem Give the image the tag for the current NPM version
docker tag %IMG% %NPM_TAG%
if errorlevel 1 (
  echo Error tagging the image with the current NPM version
  goto exit
)

@rem Update the "latest" tag to point to the newest image.
docker tag %IMG% %LATEST_TAG%
if errorlevel 1 (
  echo Error tagging the image with the latest tag
  goto exit
)

echo -------------
CHOICE /C:YN /N /M "Image has been built, push to Docker Hub? [yN]: "
if %ERRORLEVEL% neq 1 (
  echo Not pushing to Docker Hub, workflow complete.
  goto :nopush
)

@rem Log in to the Docker Hub account where the image will be pushed. The console may prompt for
@rem authentication. This account must have access to the shieldbattery organization.
echo Logging into Docker Hub...
docker login
if errorlevel 1 (
  echo Error logging into Docker Hub
  goto exit
)

@rem Push the image to the Docker hub. Docker hub account needs to be setup for this step to work.
docker push %NAME%
if errorlevel 1 (
  echo Error pushing the image
  goto exit
)

exit /b 0

:nopush
exit /b 0

:exit

@rem This script should be called with the current version number of the
@rem server.
@rem
@rem Since it is intended for building deployable artifacts, it requires a clean
@rem git working directory (e.g. no uncommitted changes).
@rem
@rem Example of running it manually:
@rem  - "deploy.bat 6.1.2"
@rem  - "deploy.bat $npm_package_version" (if run from a npm script)
@echo off

SETLOCAL

if "%1"=="" (
  echo Missing required version argument
  goto :exit
)

SET version=%1

@rem Handle changes that are not staged
git diff --exit-code > nul
if errorlevel 1 (
  echo Uncommitted git changes detected. Please commit them and try again.
  goto exit
)

@rem Handle changes that are staged
git diff --cached --exit-code > nul
if errorlevel 1 (
  echo Uncommitted git changes detected. Please commit them and try again.
  goto exit
)

SET gitsha=
FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-parse --verify HEAD`) DO (
  SET gitsha=%%F
)

if errorlevel 1 (
  echo Error retrieving current git SHA
  goto :exit
)
if "%gitsha%" == "" (
  echo Error retrieving current git SHA
  goto :exit
)

SET NAME=shieldbattery/shieldbattery
SET IMG=%NAME%:%gitsha%
SET NPM_TAG=%NAME%:%version%
SET LATEST_TAG=%NAME%:latest

docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t %IMG% -t %NPM_TAG% -t %LATEST_TAG% --push .
if errorlevel 1 (
  echo Error building the image
  goto exit
)

exit /b 0

:exit

Fix the commands for using docker buildx since it doesn't output the images locally.


@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off
@echo Started: %date% %time%

:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.12
:: ----------------------

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

IF NOT DEFINED DEPLOYMENT_SOURCE (
  SET DEPLOYMENT_SOURCE=%~dp0%.
)
echo "Deployment Source: %DEPLOYMENT_SOURCE%"

IF NOT DEFINED DEPLOY_DIST_FOLDER (
    SET DEPLOY_DIST_FOLDER=dist
)

IF NOT DEFINED DEPLOYMENT_DIST (
    SET DEPLOYMENT_DIST=%DEPLOYMENT_SOURCE%\%DEPLOY_DIST_FOLDER%
) ELSE (
    ECHO "Deployement Dist already set"
)
echo "Deployment Dist: %DEPLOYMENT_DIST%"

IF NOT DEFINED DEPLOYMENT_TARGET (
  SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)
echo "Deployment Target: %DEPLOYMENT_TARGET%"

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

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

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

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

for /F "tokens=5 delims=.\" %%a in ("%PREVIOUS_MANIFEST_PATH%") do SET PREVIOUS_SCM_COMMIT_ID=%%a

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Pre-Deployment
:: ----------
@echo "Initiating Pre-Deployment: %date% %time%"
:: .deploy initial install if node_modules doesn't exist.
IF NOT EXIST "%DEPLOYMENT_SOURCE%\.deploy\node_modules" (
    echo "NPM Install: %DEPLOYMENT_SOURCE%\.deploy\package.json"
    pushd "%DEPLOYMENT_SOURCE%\.deploy\"
    npm install --production --progress=false --cache-min=432000
    popd
) ELSE (
   echo "%DEPLOYMENT_SOURCE%\.deploy\node_modules already exists"
)

::Initial install if node_modules doesn't exist.
IF EXIST "%DEPLOYMENT_SOURCE%\package.json" (
 echo "Main package.json exists."
    IF NOT EXIST "%DEPLOYMENT_SOURCE%\node_modules" (
        echo "NPM Install: %DEPLOYMENT_SOURCE%\package.json"
        pushd "%DEPLOYMENT_SOURCE%"
        npm install --production --progress=false --cache-min=432000
        npm install --save json-loader --progress=false --cache-min=432000
        popd
    ) ELSE (
        echo "Main node_modules exists"
    )
) ELSE (
 echo "No main package.json."
)

@echo "Previous Commit: %PREVIOUS_SCM_COMMIT_ID%  Current Commit: %SCM_COMMIT_ID%"
:: Only do npm install if there was a change in package.json
for /F %%f in ('git.exe diff --name-only %PREVIOUS_SCM_COMMIT_ID% %SCM_COMMIT_ID% ^| grep package.json') do (
    SET PACKAGEJSON=%%~f
    SET PKGFOLDER=!DEPLOYMENT_SOURCE!\!PACKAGEJSON:package.json=!
    echo "NPM Install: !PKGFOLDER!package.json"
    pushd "!PKGFOLDER!"
    npm install --production --progress=false --cache-min=432000
    npm install --save json-loader --progress=false --cache-min=432000
    IF !ERRORLEVEL! NEQ 0 goto error
    popd
)

:: Clean-up Dist before we start.
echo."Removing %DEPLOYMENT_TARGET%\%DEPLOY_DIST_FOLDER%"
del /f/s/q "%DEPLOYMENT_DIST%" > nul
rmdir /s/q "%DEPLOYMENT_DIST%"
IF !ERRORLEVEL! NEQ 0 goto error

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

@echo "Initiating Deployment: %date% %time%"

:: 1. Build Script
node %DEPLOYMENT_SOURCE%\.deploy\deploy.js
IF !ERRORLEVEL! NEQ 0 goto error

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

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

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off
@echo Started: %date% %time%

:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.12
:: ----------------------

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

IF NOT DEFINED DEPLOYMENT_SOURCE (
  SET DEPLOYMENT_SOURCE=%~dp0%.
)
echo "Deployment Source: %DEPLOYMENT_SOURCE%"

IF NOT DEFINED DEPLOY_DIST_FOLDER (
    SET DEPLOY_DIST_FOLDER=dist
)

IF NOT DEFINED DEPLOYMENT_DIST (
    SET DEPLOYMENT_DIST=%DEPLOYMENT_SOURCE%\%DEPLOY_DIST_FOLDER%
) ELSE (
    ECHO "Deployement Dist already set"
)
echo "Deployment Dist: %DEPLOYMENT_DIST%"

IF NOT DEFINED DEPLOYMENT_TARGET (
  SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)
echo "Deployment Target: %DEPLOYMENT_TARGET%"

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

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

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

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

for /F "tokens=5 delims=.\" %%a in ("%PREVIOUS_MANIFEST_PATH%") do SET PREVIOUS_SCM_COMMIT_ID=%%a

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Pre-Deployment
:: ----------
@echo "Initiating Pre-Deployment: %date% %time%"
:: .deploy initial install if node_modules doesn't exist.
IF NOT EXIST "%DEPLOYMENT_SOURCE%\.deploy\node_modules" (
    echo "NPM Install: %DEPLOYMENT_SOURCE%\.deploy\package.json"
    pushd "%DEPLOYMENT_SOURCE%\.deploy\"
    call npm install --production --progress=false --cache-min=432000
    popd
) ELSE (
   echo "%DEPLOYMENT_SOURCE%\.deploy\node_modules already exists"
)

::Initial install if node_modules doesn't exist.
IF EXIST "%DEPLOYMENT_SOURCE%\package.json" (
 echo "Main package.json exists."
    IF NOT EXIST "%DEPLOYMENT_SOURCE%\node_modules" (
        echo "NPM Install: %DEPLOYMENT_SOURCE%\package.json"
        pushd "%DEPLOYMENT_SOURCE%"
        call npm install --production --progress=false --cache-min=432000
        call npm install --save json-loader --progress=false --cache-min=432000
        popd
    ) ELSE (
        echo "Main node_modules exists"
    )
) ELSE (
 echo "No main package.json."
)

@echo "Previous Commit: %PREVIOUS_SCM_COMMIT_ID%  Current Commit: %SCM_COMMIT_ID%"
:: Only do npm install if there was a change in package.json
for /F %%f in ('git.exe diff --name-only %PREVIOUS_SCM_COMMIT_ID% %SCM_COMMIT_ID% ^| grep package.json') do (
    SET PACKAGEJSON=%%~f
    SET PKGFOLDER=!DEPLOYMENT_SOURCE!\!PACKAGEJSON:package.json=!
    echo "NPM Install: !PKGFOLDER!package.json"
    pushd "!PKGFOLDER!"
    npm install --production --progress=false --cache-min=432000
    npm install --save json-loader --progress=false --cache-min=432000
    IF !ERRORLEVEL! NEQ 0 goto error
    popd
)

:: Clean-up Dist before we start.
echo."Removing %DEPLOYMENT_TARGET%\%DEPLOY_DIST_FOLDER%"
del /f/s/q "%DEPLOYMENT_DIST%" > nul
rmdir /s/q "%DEPLOYMENT_DIST%"
IF !ERRORLEVEL! NEQ 0 goto error

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

@echo "Initiating Deployment: %date% %time%"

:: 1. Build Script
node %DEPLOYMENT_SOURCE%\.deploy\deploy.js
IF !ERRORLEVEL! NEQ 0 goto error

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

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

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

Build Master:2017-03-17T20:58:16.532Z

Build Master:2017-03-17T20:58:16.532Z


@ECHO OFF

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
	set SPHINXBUILD=sphinx-build
)
set BUILDDIR=build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
set I18NSPHINXOPTS=%SPHINXOPTS% source
if NOT "%PAPER%" == "" (
	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
	set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)

if "%1" == "" goto help

if "%1" == "help" (
	:help
	echo.Please use `make ^<target^>` where ^<target^> is one of
	echo.  html       to make standalone HTML files
	echo.  dirhtml    to make HTML files named index.html in directories
	echo.  singlehtml to make a single large HTML file
	echo.  pickle     to make pickle files
	echo.  json       to make JSON files
	echo.  htmlhelp   to make HTML files and a HTML help project
	echo.  qthelp     to make HTML files and a qthelp project
	echo.  devhelp    to make HTML files and a Devhelp project
	echo.  epub       to make an epub
	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
	echo.  text       to make text files
	echo.  man        to make manual pages
	echo.  texinfo    to make Texinfo files
	echo.  gettext    to make PO message catalogs
	echo.  changes    to make an overview over all changed/added/deprecated items
	echo.  xml        to make Docutils-native XML files
	echo.  pseudoxml  to make pseudoxml-XML files for display purposes
	echo.  linkcheck  to check all external links for integrity
	echo.  doctest    to run all doctests embedded in the documentation if enabled
	echo.  coverage   to run coverage check of the documentation if enabled
	goto end
)

if "%1" == "clean" (
	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
	del /q /s %BUILDDIR%\*
	goto end
)

REM Check if sphinx-build is available and fallback to Python version if any
%SPHINXBUILD% 2> nul
if errorlevel 9009 goto sphinx_python
goto sphinx_ok

:sphinx_python

set SPHINXBUILD=python -m sphinx.__init__
%SPHINXBUILD% 2> nul
if errorlevel 9009 (
	echo.
	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
	echo.installed, then set the SPHINXBUILD environment variable to point
	echo.to the full path of the 'sphinx-build' executable. Alternatively you
	echo.may add the Sphinx directory to PATH.
	echo.
	echo.If you don't have Sphinx installed, grab it from
	echo.http://sphinx-doc.org/
	exit /b 1
)

:sphinx_ok

if "%1" == "html" (
	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
	goto end
)

if "%1" == "dirhtml" (
	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
	goto end
)

if "%1" == "singlehtml" (
	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
	goto end
)

if "%1" == "pickle" (
	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can process the pickle files.
	goto end
)

if "%1" == "json" (
	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can process the JSON files.
	goto end
)

if "%1" == "htmlhelp" (
	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
	goto end
)

if "%1" == "qthelp" (
	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\ARGUSDocumentation.qhcp
	echo.To view the help file:
	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\ARGUSDocumentation.ghc
	goto end
)

if "%1" == "devhelp" (
	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished.
	goto end
)

if "%1" == "epub" (
	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The epub file is in %BUILDDIR%/epub.
	goto end
)

if "%1" == "latex" (
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "latexpdf" (
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	cd %BUILDDIR%/latex
	make all-pdf
	cd %~dp0
	echo.
	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "latexpdfja" (
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	cd %BUILDDIR%/latex
	make all-pdf-ja
	cd %~dp0
	echo.
	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "text" (
	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The text files are in %BUILDDIR%/text.
	goto end
)

if "%1" == "man" (
	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The manual pages are in %BUILDDIR%/man.
	goto end
)

if "%1" == "texinfo" (
	%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
	goto end
)

if "%1" == "gettext" (
	%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
	goto end
)

if "%1" == "changes" (
	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
	if errorlevel 1 exit /b 1
	echo.
	echo.The overview file is in %BUILDDIR%/changes.
	goto end
)

if "%1" == "linkcheck" (
	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
	if errorlevel 1 exit /b 1
	echo.
	echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
	goto end
)

if "%1" == "doctest" (
	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
	if errorlevel 1 exit /b 1
	echo.
	echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
	goto end
)

if "%1" == "coverage" (
	%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
	if errorlevel 1 exit /b 1
	echo.
	echo.Testing of coverage in the sources finished, look at the ^
results in %BUILDDIR%/coverage/python.txt.
	goto end
)

if "%1" == "xml" (
	%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The XML files are in %BUILDDIR%/xml.
	goto end
)

if "%1" == "pseudoxml" (
	%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
	goto end
)

:end

@ECHO OFF

REM Command file for Sphinx documentation

	set SPHINXBUILD=python -m sphinx.__init__

set BUILDDIR=build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
set I18NSPHINXOPTS=%SPHINXOPTS% source
if NOT "%PAPER%" == "" (
	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
	set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)

if "%1" == "" goto help

if "%1" == "help" (
	:help
	echo.Please use `make ^<target^>` where ^<target^> is one of
	echo.  html       to make standalone HTML files
	echo.  dirhtml    to make HTML files named index.html in directories
	echo.  singlehtml to make a single large HTML file
	echo.  pickle     to make pickle files
	echo.  json       to make JSON files
	echo.  htmlhelp   to make HTML files and a HTML help project
	echo.  qthelp     to make HTML files and a qthelp project
	echo.  devhelp    to make HTML files and a Devhelp project
	echo.  epub       to make an epub
	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
	echo.  text       to make text files
	echo.  man        to make manual pages
	echo.  texinfo    to make Texinfo files
	echo.  gettext    to make PO message catalogs
	echo.  changes    to make an overview over all changed/added/deprecated items
	echo.  xml        to make Docutils-native XML files
	echo.  pseudoxml  to make pseudoxml-XML files for display purposes
	echo.  linkcheck  to check all external links for integrity
	echo.  doctest    to run all doctests embedded in the documentation if enabled
	echo.  coverage   to run coverage check of the documentation if enabled
	goto end
)

if "%1" == "clean" (
	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
	del /q /s %BUILDDIR%\*
	goto end
)

REM Check if sphinx-build is available and fallback to Python version if any
%SPHINXBUILD% --version 2> nul
if errorlevel 9009 goto sphinx_python
goto sphinx_ok

:sphinx_python

set SPHINXBUILD=python -m sphinx.__init__
%SPHINXBUILD% --version 2> nul
if errorlevel 9009 (
	echo.
	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
	echo.installed, then set the SPHINXBUILD environment variable to point
	echo.to the full path of the 'sphinx-build' executable. Alternatively you
	echo.may add the Sphinx directory to PATH.
	echo.
	echo.If you don't have Sphinx installed, grab it from
	echo.http://sphinx-doc.org/
	exit /b 1
)

:sphinx_ok

if "%1" == "html" (
	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
	goto end
)

if "%1" == "dirhtml" (
	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
	goto end
)

if "%1" == "singlehtml" (
	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
	goto end
)

if "%1" == "pickle" (
	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can process the pickle files.
	goto end
)

if "%1" == "json" (
	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can process the JSON files.
	goto end
)

if "%1" == "htmlhelp" (
	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
	goto end
)

if "%1" == "qthelp" (
	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\ARGUSDocumentation.qhcp
	echo.To view the help file:
	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\ARGUSDocumentation.ghc
	goto end
)

if "%1" == "devhelp" (
	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished.
	goto end
)

if "%1" == "epub" (
	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The epub file is in %BUILDDIR%/epub.
	goto end
)

if "%1" == "latex" (
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "latexpdf" (
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	cd %BUILDDIR%/latex
	make all-pdf
	cd %~dp0
	echo.
	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "latexpdfja" (
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	cd %BUILDDIR%/latex
	make all-pdf-ja
	cd %~dp0
	echo.
	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "text" (
	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The text files are in %BUILDDIR%/text.
	goto end
)

if "%1" == "man" (
	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The manual pages are in %BUILDDIR%/man.
	goto end
)

if "%1" == "texinfo" (
	%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
	goto end
)

if "%1" == "gettext" (
	%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
	goto end
)

if "%1" == "changes" (
	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
	if errorlevel 1 exit /b 1
	echo.
	echo.The overview file is in %BUILDDIR%/changes.
	goto end
)

if "%1" == "linkcheck" (
	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
	if errorlevel 1 exit /b 1
	echo.
	echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
	goto end
)

if "%1" == "doctest" (
	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
	if errorlevel 1 exit /b 1
	echo.
	echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
	goto end
)

if "%1" == "coverage" (
	%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
	if errorlevel 1 exit /b 1
	echo.
	echo.Testing of coverage in the sources finished, look at the ^
results in %BUILDDIR%/coverage/python.txt.
	goto end
)

if "%1" == "xml" (
	%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The XML files are in %BUILDDIR%/xml.
	goto end
)

if "%1" == "pseudoxml" (
	%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
	goto end
)

:end

Fix make.bat to work properly with Sphinx 1.3 sphinx.__init__ module


@setlocal
@set PROMPT=$$$S

@pushd "%~dp0"

if exist "%~dp0Misc\version.cmd" call "%~dp0Misc\version.cmd"

if exist goarch.txt for /F %%I in (goarch.txt) do set "GOARCH=%%I"
if "%GOARCH%" == "" for /F "delims=/ tokens=2" %%I in ('go version') do set "GOARCH=%%I"

if "%GOPATH%" == "" set "GOPATH=%USERPROFILE%\go"
for /F "delims=; tokens=1" %%I in ("%GOPATH%") do set "GOPATH1ST=%%I"

call :"%~1" %2 %3 %4 %5 %6
@popd
@endlocal
@exit /b

:""
        for /F %%I in ('git describe --tags') do set "X_VERSION=-X main.version=%%I"
        call :"build"
        @exit /b 0

:"debug"
        set "TAGS=-tags=debug"
        call :"build"
        @exit /b

:"release"
        for /F %%I in (%~dp0Misc\version.txt) do set "VERSION=%%I"
        set "X_VERSION=-X main.version=%VERSION%"
        call :"build"
        @exit /b

:"build"
        call :"fmt"
        call :"goversioninfo"
        for /F %%I in ('dir /b /s /aa nyagos.d') do attrib -A "%%I" & if exist mains\bindata.go del mains\bindata.go
        if not exist mains\bindata.go call :"bindata"
        for /F "delims=" %%V in ('git log -1 --date^=short --pretty^=format:"-X main.stamp=%%ad -X main.commit=%%H"') do go build -o nyagos.exe -ldflags "%%V %X_VERSION%" %TAGS%
        @exit /b

:"fmt"
        for /F %%I IN ('dir /s /b /aa *.go') do go fmt "%%I" & attrib -A "%%I"
        @exit /b

:"status"
        nyagos -e "print(nyagos.version or 'Snapshot on '..nyagos.stamp)"
        @exit /b

:eachdir
        powershell "ls -R | ?{ $_ -match '\.go$' } | %%{ [System.IO.Path]::GetDirectoryName($_.FullName)} | Sort-Object | Get-Unique | %%{ Write-Host 'go %~1 on',$_ ;  pushd $_ ; go %~1 ; popd }"
        exit /b

:"vet"
        call :eachdir vet
        exit /b

:"clean"
        for %%I in (nyagos.exe nyagos.syso version.now mains\bindata.go) do if exist %%I del %%I
        call :eachdir clean

:"sweep"
        for /R %%I in (*~ *.bak) do if exist %%I del %%I
        @exit /b

:"get"
        powershell "Get-ChildItem . -Recurse | ?{ $_.Extension -eq '.go' } | %%{  Get-Content $_.FullName | %%{ ($_ -replace '\s*//.*$','').Split()[-1] } | ?{ $_ -match 'github.com/' -and -not ($_ -match '/nyagos/' ) } } | Sort-Object | Get-Unique | %%{ Write-Host $_ ; go get -u $_ }"
        @exit /b

:getbindata
        go get "github.com/jteeuwen/go-bindata"
        pushd "%GOPATH1ST%\src\github.com\jteeuwen\go-bindata\go-bindata"
        go build
        copy go-bindata.exe "%~dp0\."
        popd
        @exit /b

:"bindata"
        if not exist go-bindata.exe call :getbindata
        go-bindata.exe -pkg "mains" -o "mains\bindata.go" "nyagos.d/..."
        @exit /b

:getgoversioninfo
        go get "github.com/josephspurrier/goversioninfo"
        pushd "%GOPATH1ST%\src\github.com\josephspurrier\goversioninfo\cmd\goversioninfo"
        go build
        copy goversioninfo.exe "%~dp0\."
        popd
        @exit /b

:"goversioninfo"
        if not exist goversioninfo.exe call :getgoversioninfo
        powershell -ExecutionPolicy RemoteSigned -File "%~dp0mains\makejson.ps1" > "%~dp0Misc\version.json"
        goversioninfo.exe -icon mains\nyagos.ico -o "%~dp0nyagos.syso" "%~dp0Misc\version.json"
        @exit /b

:"const"
        for /F %%I in ('dir /b /s makeconst.cmd') do pushd %%~dpI & call %%I & popd
        @exit /b

:"package"
        for /F %%I in ('nyagos -e "print(nyagos.version or (string.gsub(nyagos.stamp,[[/]],[[]])))"') do set VERSION=%%I
        zip -9 "nyagos-%VERSION%-%GOARCH%.zip" nyagos.exe lua53.dll nyagos.lua .nyagos makeicon.cmd nyagos.d\*.lua nyagos.d\catalog\*.lua license.txt readme_ja.md readme.md Doc\*.md
        @exit /b

:"install"
        if not "%1" == "" set "INSTALLDIR=%1" & echo @set "INSTALLDIR=%~1" > "%~dp0Misc\version.cmd"
        if "%INSTALLDIR%" == "" (
            echo Please %0.cmd install PATH\TO\BIN, once
            @exit /b
        )
        if not exist "%INSTALLDIR%" (
            echo Please %0.cmd install EXIST\PATH\TO\BIN,  once
            @exit /b
        )

        robocopy nyagos.d "%INSTALLDIR%\nyagos.d" /E
        if not exist "%INSTALLDIR%\lua53.dll" copy lua53.dll "%INSTALLDIR%\."
        copy nyagos.lua "%INSTALLDIR%\."
        copy /-Y _nyagos "%INSTALLDIR%\."
        copy nyagos.exe "%INSTALLDIR%\."
        if errorlevel 1 (start "" "%~dpfx0" install_ & @exit /b)
        @exit /b

:"install_"
        taskkill /F /im nyagos.exe
        copy nyagos.exe "%INSTALLDIR%\."
        timeout /T 3
        @exit %ERRORLEVEL%

:"icon"
        makeicon.cmd
        @exit /b

:"help"
        echo Usage for make.cmd
        echo  %0          : Equals to '%0 build'
        echo  %0 build    : Build nyagos.exe as snapshot (ignore version.txt)
        echo  %0 release  : Build nyagos.exe as release  (see version.txt)
        echo  %0 fmt      : Format all source files with 'go fmt'
        echo  %0 clean    : Delete nyagos.exe and nyagos.syso
        echo  %0 package  : Make the package zip-file
        echo  %0 get      : Do 'go get' for each github library
        echo  %0 upgrade  : Do 'git pull' for each github library
        echo  %0 help     : Print help
        echo  %0 install INSTALLDIR
        echo     : Copy binaries to INSTALLDIR
        echo  %0 install
        echo     : Copy binaries to last INSTALLDIR
        @exit /b

@setlocal
@set PROMPT=$$$S

@pushd "%~dp0"

if exist "%~dp0Misc\version.cmd" call "%~dp0Misc\version.cmd"

if exist goarch.txt for /F %%I in (goarch.txt) do set "GOARCH=%%I"
if "%GOARCH%" == "" for /F "delims=/ tokens=2" %%I in ('go version') do set "GOARCH=%%I"

if "%GOPATH%" == "" set "GOPATH=%USERPROFILE%\go"
for /F "delims=; tokens=1" %%I in ("%GOPATH%") do set "GOPATH1ST=%%I"

call :"%~1" %2 %3 %4 %5 %6
@popd
@endlocal
@exit /b

:""
        for /F %%I in ('git describe --tags') do set "X_VERSION=-X main.version=%%I"
        call :"build"
        @exit /b 0

:"debug"
        set "TAGS=-tags=debug"
        call :"build"
        @exit /b

:"release"
        for /F %%I in (%~dp0Misc\version.txt) do set "VERSION=%%I"
        set "X_VERSION=-X main.version=%VERSION%"
        call :"build"
        @exit /b

:"build"
        call :"fmt"
        call :"goversioninfo"
        for /F %%I in ('dir /b /s /aa nyagos.d') do attrib -A "%%I" & if exist mains\bindata.go del mains\bindata.go
        if not exist mains\bindata.go call :"bindata"
        for /F "delims=" %%V in ('git log -1 --date^=short --pretty^=format:"-X main.stamp=%%ad -X main.commit=%%H"') do go build -o nyagos.exe -ldflags "%%V %X_VERSION%" %TAGS%
        @exit /b

:"fmt"
        for /F %%I IN ('dir /s /b /aa *.go') do go fmt "%%I" & attrib -A "%%I"
        @exit /b

:"status"
        nyagos -e "print(nyagos.version or 'Snapshot on '..nyagos.stamp)"
        @exit /b

:eachdir
        powershell "ls -R | ?{ $_ -match '\.go$' } | %%{ [System.IO.Path]::GetDirectoryName($_.FullName)} | Sort-Object | Get-Unique | %%{ Write-Host 'go %~1 on',$_ ;  pushd $_ ; go %~1 ; popd }"
        exit /b

:"vet"
        call :eachdir vet
        exit /b

:"clean"
        for %%I in (nyagos.exe nyagos.syso version.now mains\bindata.go) do if exist %%I del %%I
        call :eachdir clean

:"sweep"
        for /R %%I in (*~ *.bak) do if exist %%I del %%I
        @exit /b

:"get"
        go get -v
        @exit /b

:getbindata
        go get "github.com/jteeuwen/go-bindata"
        pushd "%GOPATH1ST%\src\github.com\jteeuwen\go-bindata\go-bindata"
        go build
        copy go-bindata.exe "%~dp0\."
        popd
        @exit /b

:"bindata"
        if not exist go-bindata.exe call :getbindata
        go-bindata.exe -pkg "mains" -o "mains\bindata.go" "nyagos.d/..."
        @exit /b

:getgoversioninfo
        go get "github.com/josephspurrier/goversioninfo"
        pushd "%GOPATH1ST%\src\github.com\josephspurrier\goversioninfo\cmd\goversioninfo"
        go build
        copy goversioninfo.exe "%~dp0\."
        popd
        @exit /b

:"goversioninfo"
        if not exist goversioninfo.exe call :getgoversioninfo
        powershell -ExecutionPolicy RemoteSigned -File "%~dp0mains\makejson.ps1" > "%~dp0Misc\version.json"
        goversioninfo.exe -icon mains\nyagos.ico -o "%~dp0nyagos.syso" "%~dp0Misc\version.json"
        @exit /b

:"const"
        for /F %%I in ('dir /b /s makeconst.cmd') do pushd %%~dpI & call %%I & popd
        @exit /b

:"package"
        for /F %%I in ('nyagos -e "print(nyagos.version or (string.gsub(nyagos.stamp,[[/]],[[]])))"') do set VERSION=%%I
        zip -9 "nyagos-%VERSION%-%GOARCH%.zip" nyagos.exe lua53.dll nyagos.lua .nyagos makeicon.cmd nyagos.d\*.lua nyagos.d\catalog\*.lua license.txt readme_ja.md readme.md Doc\*.md
        @exit /b

:"install"
        if not "%1" == "" set "INSTALLDIR=%1" & echo @set "INSTALLDIR=%~1" > "%~dp0Misc\version.cmd"
        if "%INSTALLDIR%" == "" (
            echo Please %0.cmd install PATH\TO\BIN, once
            @exit /b
        )
        if not exist "%INSTALLDIR%" (
            echo Please %0.cmd install EXIST\PATH\TO\BIN,  once
            @exit /b
        )

        robocopy nyagos.d "%INSTALLDIR%\nyagos.d" /E
        if not exist "%INSTALLDIR%\lua53.dll" copy lua53.dll "%INSTALLDIR%\."
        copy nyagos.lua "%INSTALLDIR%\."
        copy /-Y _nyagos "%INSTALLDIR%\."
        copy nyagos.exe "%INSTALLDIR%\."
        if errorlevel 1 (start "" "%~dpfx0" install_ & @exit /b)
        @exit /b

:"install_"
        taskkill /F /im nyagos.exe
        copy nyagos.exe "%INSTALLDIR%\."
        timeout /T 3
        @exit %ERRORLEVEL%

:"icon"
        makeicon.cmd
        @exit /b

:"help"
        echo Usage for make.cmd
        echo  %0          : Equals to '%0 build'
        echo  %0 build    : Build nyagos.exe as snapshot (ignore version.txt)
        echo  %0 release  : Build nyagos.exe as release  (see version.txt)
        echo  %0 fmt      : Format all source files with 'go fmt'
        echo  %0 clean    : Delete nyagos.exe and nyagos.syso
        echo  %0 package  : Make the package zip-file
        echo  %0 get      : Do 'go get' for each github library
        echo  %0 upgrade  : Do 'git pull' for each github library
        echo  %0 help     : Print help
        echo  %0 install INSTALLDIR
        echo     : Copy binaries to INSTALLDIR
        echo  %0 install
        echo     : Copy binaries to last INSTALLDIR
        @exit /b

make get: powershell script -> simple `go get -v`


cd ..
set "destination=testcoverage"

rmdir /q /s %destination%
mkdir %destination%
cd content/tests
dotnet test /p:AltCover=true
mv coverage.xml ../../%destination%/coverage.xml

cd ../../%destination%

set "reportgenerator=%UserProfile%\.nuget\packages\reportgenerator\4.1.4\tools\net47\ReportGenerator.exe"
set "targetdir=."

"%reportGenerator%" -reports:coverage.xml -reporttypes:HtmlInline -targetdir:%targetdir%

cd ..
set "destination=testcoverage"

rmdir /q /s %destination%
mkdir %destination%
cd content/tests
dotnet test /p:AltCover=true
mv coverage.xml ../../%destination%/coverage.xml

cd ../../%destination%

set "reportgenerator=%UserProfile%\.nuget\packages\reportgenerator\4.1.5\tools\net47\ReportGenerator.exe"
set "targetdir=."

"%reportGenerator%" -reports:coverage.xml -reporttypes:HtmlInline -targetdir:%targetdir%

chore: update to dep of reportgenerator to 4.1.5


set PYTHON=C:\Python27\python
set EASY_INSTALL=c:\python27\scripts\easy_install.exe
set NEXUSDIR="C:\Program Files (x86)\NeXus Data Format\"
set PATH=C:\Python27;C:\Python27\Scripts;C:\mingw\bin;%PATH%
set PYLINT=c:\python27\scripts\pylint

cd %WORKSPACE%
%PYTHON% check_packages.py

cd %WORKSPACE%
python setup.py build -cmingw32

cd %WORKSPACE%
python setup.py docs

cd %WORKSPACE%
python setup.py bdist_egg --skip-build

cd %WORKSPACE%\test
%PYTHON% utest_sasview.py

cd %WORKSPACE%
mkdir sasview-install
set PYTHONPATH=%WORKSPACE%\sasview-install;%PYTHONPATH%

cd %WORKSPACE%
cd dist
%EASY_INSTALL% -d ..\sasview-install sasview-3.1.2-py2.7-win32.egg

cd %WORKSPACE%\sasview
python setup_exe.py py2exe
python installer_generator.py
"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" installer.iss

cd Output
xcopy setupSasView.exe %WORKSPACE%\dist

cd %WORKSPACE%
%PYLINT% --rcfile "%WORKSPACE%cd /build_tools/pylint.rc" -f parseable sasview-install/sasview*.egg/sas sasview > test/sasview.txt

cd  %WORKSPACE%

set PYTHON=C:\Python27\python
set EASY_INSTALL=c:\python27\scripts\easy_install.exe
set NEXUSDIR="C:\Program Files (x86)\NeXus Data Format\"
set PATH=C:\Python27;C:\Python27\Scripts;C:\mingw\bin;%PATH%
set PYLINT=c:\python27cscripts\pylint

cd %WORKSPACE%\sasview
%PYTHON% check_packages.py

cd %WORKSPACE%\sasview
python setup.py build -cmingw32

cd %WORKSPACE%\sasview
python setup.py docs

cd %WORKSPACE%\sasview
python setup.py bdist_egg --skip-build

cd %WORKSPACE%\sasview\test
%PYTHON% utest_sasview.py

cd %WORKSPACE%\sasview
mkdir sasview-install
set PYTHONPATH=%WORKSPACE%\sasview\sasview-install;%PYTHONPATH%

cd %WORKSPACE%\sasview
cd dist
%EASY_INSTALL% -d ..\sasview-install sasview-3.1.2-py2.7-win32.egg

cd %WORKSPACE%\sasview\sasview
python setup_exe.py py2exe
python installer_generator.py
"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" installer.iss

cd Output
xcopy setupSasView.exe %WORKSPACE%\sasview\dist

cd %WORKSPACE%\sasview
%PYLINT% --rcfile "build_tools/pylint.rc" -f parseable sasview-install/sasview*.egg/sas sasview > test/sasview.txt

cd  %WORKSPACE%

Update new windows build script

Update new windows build script


@echo off

echo This script is meant for the Couchbase build server.  It cannot be used by developers.
pushd %~dp0..\Couchbase.Lite
if not exist ..\couchbase.snk (
    echo Private key not found, aborting...
    popd
    exit /b 1
)

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" Couchbase.Lite.csproj /t:Transform /p:TransformFile="Properties\DynamicAssemblyInfo.tt"
dotnet restore
dotnet build -c Packaging

pushd ..\Couchbase.Lite.Support.UWP
if not exist ..\..\nuget.exe (
    powershell -Command "Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile ..\..\nuget.exe"
)
..\..\nuget.exe restore
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" Couchbase.Lite.Support.UWP.csproj /p:Configuration=Packaging
popd

popd

@echo off

echo This script is meant for the Couchbase build server.  It cannot be used by developers.
pushd %~dp0..\Couchbase.Lite
if not exist ..\couchbase.snk (
    echo Private key not found, aborting...
    popd
    exit /b 1
)

if not defined NUGET_REPO (
    echo NUGET_REPO not defined, aborting...
    popd
    exit /b 1
)

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" Couchbase.Lite.csproj /t:Transform /p:TransformFile="Properties\DynamicAssemblyInfo.tt"
dotnet restore -s %NUGET_REPO%
dotnet build -c Packaging

pushd ..\Couchbase.Lite.Support.UWP
if not exist ..\..\nuget.exe (
    powershell -Command "Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile ..\..\nuget.exe"
)
..\..\nuget.exe restore -Source %NUGET_REPO%
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" Couchbase.Lite.Support.UWP.csproj /p:Configuration=Packaging
popd

popd

Modify build script to pass in the source of the CI nuget packages


@echo off

rem Test script for gear360video.cmd

set FFMPEGPATH=c:\Program Files\ffmpeg\bin
set FFMPEGEXE="%FFMPEGPATH%\ffmpeg.exe"
set T=gear360video.cmd
set DEBUG=""
rem This is used as a return value from functions
set RETVAL=
set EXITCODE=0
set VERSION=1

goto MAIN

:PRINT_DEBUG
if %DEBUG% == "yes" (
  echo DEBUG: %1 %2 %3 %4 %5 %6 %7 %8 %9
)
set RETVAL=
exit /b 0

rem Create test video
rem param1 - video size (in pixels, optional)
rem param2 - duration (in seconds, optional)
rem param3 - frame rate (fps, optional)
rem param4 - no sound (0 - sound /default/, 1 - no sound)
rem returns test file full path in RETVAL variable
:TEST_VIDEO
set VIDEOFORMAT=mp4
set VIDEOSIZE=%1
set DURATION=%2
set FRAMERATE=%3
set NOSOUND=%4
rem This is to reset the value, session might store those between runs
set FILENAME=

if "%VIDEOSIZE%" == "" set VIDEOSIZE=3840x1920
if "%DURATION%" == "" set DURATION=1
if "%FRAMERATE%" == "" set FRAMERATE=29.97
if "%NOSOUND%" == "" set NOSOUND=0
if "%FILENAME%" == "" set FILENAME=%TEMP%\testvideo.%VIDEOFORMAT%

rem echo "create_test_video args: size: ${videosize}, duration: ${duration}, fps: ${framerate}, nosound: ${nosound}, out filename: ${filename}"

set SOUNDOPT=
if %NOSOUND% == 0 (
  set SOUNDOPT=-f lavfi -i sine=frequency=1000:sample_rate=48000:duration=%DURATION%
)
%FFMPEGEXE% -loglevel quiet -y -f lavfi -i testsrc=duration=%DURATION%:size=%VIDEOSIZE%:rate=%FRAMERATE% %SOUNDOPT% -f %VIDEOFORMAT% %FILENAME%
set RETVAL=%FILENAME%
exit /b 0

rem Execute test
rem param1: test command (in quotes)
rem param2: test description (in quotes)
rem param3: expected exit code (optional, default 0)
:EXEC_TEST
set start=%time%
set TESTCMD=%~1
set TESTDESCR=%~2
rem Optional, default: 0
set EXPECTEDEXITCODE=%3
set LOGOUTPUT=%TEMP%\cmdout.log

if "%EXPECTEDEXITCODE%" == "" set EXPECTEDEXITCODE=0

call :PRINT_DEBUG exec_test command: %TESTCMD%, descr: %TESTDESCR%, ^
  expected return code: %EXPECTEDEXITCODE%, log out: %LOGOUTPUT%

echo --------
echo %TESTDESCR%
call %TESTCMD% > %LOGOUTPUT%
set EXITCODE=%ERRORLEVEL%
set end=%time%

if %EXITCODE% neq %EXPECTEDEXITCODE% (
  echo Test failed, exit code: %EXITCODE%, expected: %EXPECTEDEXITCODE%
  echo Check file %LOGOUTPUT% to see program output
) else (
  echo OK
)

set options="tokens=1-4 delims=:.,"
rem Don't try to break lines here, it will most probably not work
for /f %options% %%a in ("%start%") do set start_h=%%a&set /a start_m=100%%b %% 100&set /a start_s=100%%c %% 100&set /a start_ms=100%%d %% 100
for /f %options% %%a in ("%end%") do set end_h=%%a&set /a end_m=100%%b %% 100&set /a end_s=100%%c %% 100&set /a end_ms=100%%d %% 100

set /a hours=%end_h%-%start_h%
set /a mins=%end_m%-%start_m%
set /a secs=%end_s%-%start_s%
set /a ms=%end_ms%-%start_ms%
if %ms% lss 0 set /a secs = %secs% - 1 & set /a ms = 100%ms%
if %secs% lss 0 set /a mins = %mins% - 1 & set /a secs = 60%secs%
if %mins% lss 0 set /a hours = %hours% - 1 & set /a mins = 60%mins%
if %hours% lss 0 set /a hours = 24%hours%
if 1%ms% lss 100 set ms=0%ms%

rem mission accomplished
set /a totalsecs = %hours%*3600 + %mins%*60 + %secs%
echo Test took: %totalsecs% s
set RETVAL=
exit /b 0

:MAIN

rem Test suite version
echo Test suite version: %VERSION%

rem Simple help test
call :EXEC_TEST "%T% /h" "Help test"

rem Simple video test
call :TEST_VIDEO
set VIDEOFILE=%RETVAL%
call :EXEC_TEST "%T% %VIDEOFILE%" "Simple video test"

echo Done
goto eof

:eof
exit /b %EXITCODE%

@echo off

rem Test script for gear360video.cmd

set FFMPEGPATH=c:\Program Files\ffmpeg\bin
set FFMPEGEXE="%FFMPEGPATH%\ffmpeg.exe"
set T=gear360video.cmd
set DEBUG=""
rem This is used as a return value from functions
set RETVAL=
set EXITCODE=0
set VERSION=1

goto MAIN

:PRINT_DEBUG
if %DEBUG% == "yes" (
  echo DEBUG: %1 %2 %3 %4 %5 %6 %7 %8 %9
)
set RETVAL=
exit /b 0

rem Create test video
rem param1 - video size (in pixels, optional)
rem param2 - duration (in seconds, optional)
rem param3 - frame rate (fps, optional)
rem param4 - no sound (0 - sound /default/, 1 - no sound)
rem returns test file full path in RETVAL variable
:TEST_VIDEO
set VIDEOFORMAT=mp4
set VIDEOSIZE=%1
set DURATION=%2
set FRAMERATE=%3
set NOSOUND=%4
rem This is to reset the value, session might store those between runs
set FILENAME=

if "%VIDEOSIZE%" == "" set VIDEOSIZE=3840x1920
if "%DURATION%" == "" set DURATION=1
if "%FRAMERATE%" == "" set FRAMERATE=29.97
if "%NOSOUND%" == "" set NOSOUND=0
if "%FILENAME%" == "" set FILENAME=%TEMP%\testvideo.%VIDEOFORMAT%

rem echo "create_test_video args: size: ${videosize}, duration: ${duration}, fps: ${framerate}, nosound: ${nosound}, out filename: ${filename}"

set SOUNDOPT=
if %NOSOUND% == 0 (
  set SOUNDOPT=-f lavfi -i sine=frequency=1000:sample_rate=48000:duration=%DURATION%
)
%FFMPEGEXE% -loglevel quiet -y -f lavfi -i testsrc=duration=%DURATION%:size=%VIDEOSIZE%:rate=%FRAMERATE% %SOUNDOPT% -f %VIDEOFORMAT% %FILENAME%
set RETVAL=%FILENAME%
exit /b 0

rem Execute test
rem param1: test command (in quotes)
rem param2: test description (in quotes)
rem param3: expected exit code (optional, default 0)
:EXEC_TEST
set start=%time%
set TESTCMD=%~1
set TESTDESCR=%~2
rem Optional, default: 0
set EXPECTEDEXITCODE=%3
set LOGOUTPUT=%TEMP%\cmdout.log

if "%EXPECTEDEXITCODE%" == "" set EXPECTEDEXITCODE=0

call :PRINT_DEBUG exec_test command: %TESTCMD%, descr: %TESTDESCR%, ^
  expected return code: %EXPECTEDEXITCODE%, log out: %LOGOUTPUT%

echo --------
echo %TESTDESCR%
call %TESTCMD% > %LOGOUTPUT%
set EXITCODE=%ERRORLEVEL%
set end=%time%

if %EXITCODE% neq %EXPECTEDEXITCODE% (
  echo Test failed, exit code: %EXITCODE%, expected: %EXPECTEDEXITCODE%
  echo Check file %LOGOUTPUT% to see program output
) else (
  echo OK
)

set options="tokens=1-4 delims=:.,"
rem Don't try to break lines here, it will most probably not work
for /f %options% %%a in ("%start%") do set start_h=%%a&set /a start_m=100%%b %% 100&set /a start_s=100%%c %% 100&set /a start_ms=100%%d %% 100
for /f %options% %%a in ("%end%") do set end_h=%%a&set /a end_m=100%%b %% 100&set /a end_s=100%%c %% 100&set /a end_ms=100%%d %% 100

set /a hours=%end_h%-%start_h%
set /a mins=%end_m%-%start_m%
set /a secs=%end_s%-%start_s%
set /a ms=%end_ms%-%start_ms%
if %ms% lss 0 set /a secs = %secs% - 1 & set /a ms = 100%ms%
if %secs% lss 0 set /a mins = %mins% - 1 & set /a secs = 60%secs%
if %mins% lss 0 set /a hours = %hours% - 1 & set /a mins = 60%mins%
if %hours% lss 0 set /a hours = 24%hours%
if 1%ms% lss 100 set ms=0%ms%

rem mission accomplished
set /a totalsecs = %hours%*3600 + %mins%*60 + %secs%
echo Test took: %totalsecs% s
set RETVAL=
exit /b 0

rem Trick to create output filename (one with _pano)
:ADDPANOTOFILENAME
set RETVAL=%~n1_pano.mp4
exit /b 0

:MAIN

rem Test suite version
echo Test suite version: %VERSION%

rem Simple help test
call :EXEC_TEST "%T% /h" "Help test"

rem Simple video test
call :TEST_VIDEO
set VIDEOFILE=%RETVAL%
call :EXEC_TEST "%T% %VIDEOFILE%" "Simple video test"
rem Check if panorama video has been created
call :ADDPANOTOFILENAME %VIDEOFILE%
set EXPECTEDVIDEO=html\data\%RETVAL%
if not exist %EXPECTEDVIDEO% echo "Output video file %EXPECTEDVIDEO% does not exits"

echo Done
goto eof

:eof
exit /b %EXITCODE%

Add output file check to video test

Add output file check to video test


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

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

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
IF NOT DEFINED DEPLOYMENT_TEMP (
  SET DEPLOYMENT_TEMP=%temp%\___deployTemp%random%
  SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
)

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

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

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

echo Handling .NET Web Application deployment.

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

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

IF !ERRORLEVEL! NEQ 0 goto error

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

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

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

goto end

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

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

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

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
IF NOT DEFINED DEPLOYMENT_TEMP (
  SET DEPLOYMENT_TEMP=%temp%\___deployTemp%random%
  SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
)

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

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

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

echo Handling .NET Web Application deployment.

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

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

IF !ERRORLEVEL! NEQ 0 goto error

::------------------
::Custom Script
::------------------

:: Custom 1. Build test project
echo Building test project
"%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\MyWebApp.Tests\MyWebApp.Tests.csproj"
IF !ERRORLEVEL! NEQ 0 goto error

:: Custom 2. Run tests
echo Running tests
vstest.console.exe "%DEPLOYMENT_SOURCE%\MvcTest.Tests\bin\Debug\MvcTest.Tests.dll"
IF !ERRORLEVEL! NEQ 0 goto error

::-------------------
::End Custom Script
::-------------------

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

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

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

goto end

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

Add custom deployment script for unit tests.


echo off
echo =====================================================================
echo Salt Windows Clean Script
echo =====================================================================
echo.

rem Make sure the script is run as Admin
echo Administrative permissions required. Detecting permissions ...
echo ---------------------------------------------------------------------
net session >nul 2>&1
if errorlevel 1 (
    echo Success: Administrative permissions confirmed.
) else (
    echo Failure: This script must be run as Administrator
    goto eof
)
echo.

:: Remove environment variables
    echo %0 :: Removing Environment Variables ...
    echo ---------------------------------------------------------------------
    if defined PyDir (
        reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /F /V "PyDir"
    )

:CheckPython27
if exist "\Python27" goto RemovePython27

goto CheckPython35

:RemovePython27
    rem Uninstall Python 2.7
    echo %0 :: Uninstalling Python 2 ...
    echo ---------------------------------------------------------------------
    echo %0 :: - 2.7.12 (32 bit)
    MsiExec.exe /X {9DA28CE5-0AA5-429E-86D8-686ED898C665} /QN
    echo %0 :: - 2.7.12 (64 bit)
    MsiExec.exe /X {9DA28CE5-0AA5-429E-86D8-686ED898C666} /QN
    echo %0 :: - 2.7.13 (32 bit)
    MsiExec.exe /X {4A656C6C-D24A-473F-9747-3A8D00907A03} /QN
    echo %0 :: - 2.7.13 (64 bit)
    MsiExec.exe /X {4A656C6C-D24A-473F-9747-3A8D00907A04} /QN
    echo %0 :: - 2.7.14 (32 bit)
    MsiExec.exe /X {0398A685-FD8D-46B3-9816-C47319B0CF5E} /QN
    echo %0 :: - 2.7.14 (64 bit)
    MsiExec.exe /X {0398A685-FD8D-46B3-9816-C47319B0CF5F} /QN
    echo %0 :: - 2.7.15 (32 bit)
    MsiExec.exe /X {16CD92A4-0152-4CB7-8FD6-9788D3363616} /QN
    echo %0 :: - 2.7.15 (64 bit)
    MsiExec.exe /X {16CD92A4-0152-4CB7-8FD6-9788D3363617} /QN

    echo.

    rem Wipe the Python directory
    echo %0 :: Removing the C:\Python27 Directory ...
    echo ---------------------------------------------------------------------
    rd /s /q C:\Python27
    if %errorLevel%==0 (
        echo Successful
    ) else (
        echo Failed, please remove manually
    )

:CheckPython35
if exist "\Python35" goto RemovePython35

goto CheckPython37

:RemovePython35
    echo %0 :: Uninstalling Python 3 ...
    echo ---------------------------------------------------------------------
    :: 64 bit
    if exist "%LOCALAPPDATA%\Package Cache\{b94f45d6-8461-440c-aa4d-bf197b2c2499}" (
        echo %0 :: - 3.5.3 64bit
        "%LOCALAPPDATA%\Package Cache\{b94f45d6-8461-440c-aa4d-bf197b2c2499}\python-3.5.3-amd64.exe" /uninstall /quiet
    )
    if exist "%LOCALAPPDATA%\Package Cache\{5d57524f-af24-49a7-b90b-92138880481e}" (
        echo %0 :: - 3.5.4 64bit
        "%LOCALAPPDATA%\Package Cache\{5d57524f-af24-49a7-b90b-92138880481e}\python-3.5.4-amd64.exe" /uninstall /quiet
    )

    :: 32 bit
    if exist "%LOCALAPPDATA%\Package Cache\{a10037e1-4247-47c9-935b-c5ca049d0299}" (
        echo %0 :: - 3.5.3 32bit
        "%LOCALAPPDATA%\Package Cache\{a10037e1-4247-47c9-935b-c5ca049d0299}\python-3.5.3" /uninstall /quiet
    )
    if exist "%LOCALAPPDATA%\Package Cache\{06e841fa-ca3b-4886-a820-cd32c614b0c1}" (
        echo %0 :: - 3.5.4 32bit
        "%LOCALAPPDATA%\Package Cache\{06e841fa-ca3b-4886-a820-cd32c614b0c1}\python-3.5.4" /uninstall /quiet
    )

    rem wipe the Python directory
    echo %0 :: Removing the C:\Python35 Directory ...
    echo ---------------------------------------------------------------------
    rd /s /q "C:\Python35"
    if %errorLevel%==0 (
        echo Successful
    ) else (
        echo Failed, please remove manually
    )

    goto eof

:CheckPython37
if exist "\Python37" goto RemovePython37

goto CheckPython38

:RemovePython37
    echo %0 :: Uninstalling Python 3.7 ...
    echo ---------------------------------------------------------------------
    :: 64 bit
    if exist "%LOCALAPPDATA%\Package Cache\{8ae589dd-de2e-42cd-af56-102374115fee}" (
        echo %0 :: - 3.7.4 64bit
        "%LOCALAPPDATA%\Package Cache\{8ae589dd-de2e-42cd-af56-102374115fee}\python-3.7.4-amd64.exe" /uninstall /quiet
    )

    :: 32 bit
    if exist "%LOCALAPPDATA%\Package Cache\{b66087e3-469e-4725-8b9b-f0981244afea}" (
        echo %0 :: - 3.7.4 32bit
        "%LOCALAPPDATA%\Package Cache\{b66087e3-469e-4725-8b9b-f0981244afea}\python-3.7.4" /uninstall /quiet
    )
    :: Python Launcher, seems to be the same for 32 and 64 bit
    echo %0 :: - Python Launcher
    msiexec.exe /x {D722DA3A-92F5-454A-BD5D-A48C94D82300} /quiet /qn

    rem wipe the Python directory
    echo %0 :: Removing the C:\Python37 Directory ...
    echo ---------------------------------------------------------------------
    rd /s /q "C:\Python37"
    if %errorLevel%==0 (
        echo Successful
    ) else (
        echo Failed, please remove manually
    )

    goto eof

:CheckPython38
if exist "\Python38" goto RemovePython38

goto eof

:RemovePython38
    echo %0 :: Uninstalling Python 3.8 ...
    echo ---------------------------------------------------------------------
    :: 64 bit
    if exist "%LOCALAPPDATA%\Package Cache\{ef6306ce-2a12-4d59-887e-ebf00b9e4ab5}" (
        echo %0 :: - 3.8.8 64bit
        "%LOCALAPPDATA%\Package Cache\{ef6306ce-2a12-4d59-887e-ebf00b9e4ab5}\python-3.8.8-amd64.exe" /uninstall /quiet
    )

    :: 32 bit
    if exist "%LOCALAPPDATA%\Package Cache\{ac93da86-1536-4b03-aea1-dc354b5e9282}" (
        echo %0 :: - 3.8.8 32bit
        "%LOCALAPPDATA%\Package Cache\{ac93da86-1536-4b03-aea1-dc354b5e9282}\python-3.8.8" /uninstall /quiet
    )
    :: Python Launcher, seems to be the same for 32 and 64 bit
    echo %0 :: - Python Launcher
    msiexec.exe /x {3B53E5B7-CFC4-401C-80E9-FF7591C58741} /quiet /qn

    rem wipe the Python directory
    echo %0 :: Removing the C:\Python37 Directory ...
    echo ---------------------------------------------------------------------
    rd /s /q "C:\Python37"
    if %errorLevel%==0 (
        echo Successful
    ) else (
        echo Failed, please remove manually
    )

    goto eof

:eof
echo.
echo =====================================================================
echo End of %0
echo =====================================================================

echo off
echo =====================================================================
echo Salt Windows Clean Script
echo =====================================================================
echo.

rem Make sure the script is run as Admin
echo Administrative permissions required. Detecting permissions ...
echo ---------------------------------------------------------------------
net session >nul 2>&1
if %errorLevel%==0 (
    echo Success: Administrative permissions confirmed.
) else (
    echo Failure: This script must be run as Administrator
    goto eof
)
echo.

:: Remove environment variables
    echo %0 :: Removing Environment Variables ...
    echo ---------------------------------------------------------------------
    if defined PyDir (
        reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /F /V "PyDir"
    )

:CheckPython27
if exist "\Python27" goto RemovePython27

goto CheckPython35

:RemovePython27
    rem Uninstall Python 2.7
    echo %0 :: Uninstalling Python 2 ...
    echo ---------------------------------------------------------------------
    echo %0 :: - 2.7.12 (32 bit)
    MsiExec.exe /X {9DA28CE5-0AA5-429E-86D8-686ED898C665} /QN
    echo %0 :: - 2.7.12 (64 bit)
    MsiExec.exe /X {9DA28CE5-0AA5-429E-86D8-686ED898C666} /QN
    echo %0 :: - 2.7.13 (32 bit)
    MsiExec.exe /X {4A656C6C-D24A-473F-9747-3A8D00907A03} /QN
    echo %0 :: - 2.7.13 (64 bit)
    MsiExec.exe /X {4A656C6C-D24A-473F-9747-3A8D00907A04} /QN
    echo %0 :: - 2.7.14 (32 bit)
    MsiExec.exe /X {0398A685-FD8D-46B3-9816-C47319B0CF5E} /QN
    echo %0 :: - 2.7.14 (64 bit)
    MsiExec.exe /X {0398A685-FD8D-46B3-9816-C47319B0CF5F} /QN
    echo %0 :: - 2.7.15 (32 bit)
    MsiExec.exe /X {16CD92A4-0152-4CB7-8FD6-9788D3363616} /QN
    echo %0 :: - 2.7.15 (64 bit)
    MsiExec.exe /X {16CD92A4-0152-4CB7-8FD6-9788D3363617} /QN

    echo.

    rem Wipe the Python directory
    echo %0 :: Removing the C:\Python27 Directory ...
    echo ---------------------------------------------------------------------
    rd /s /q C:\Python27
    if %errorLevel%==0 (
        echo Successful
    ) else (
        echo Failed, please remove manually
    )

:CheckPython35
if exist "\Python35" goto RemovePython35

goto CheckPython37

:RemovePython35
    echo %0 :: Uninstalling Python 3 ...
    echo ---------------------------------------------------------------------
    :: 64 bit
    if exist "%LOCALAPPDATA%\Package Cache\{b94f45d6-8461-440c-aa4d-bf197b2c2499}" (
        echo %0 :: - 3.5.3 64bit
        "%LOCALAPPDATA%\Package Cache\{b94f45d6-8461-440c-aa4d-bf197b2c2499}\python-3.5.3-amd64.exe" /uninstall /quiet
    )
    if exist "%LOCALAPPDATA%\Package Cache\{5d57524f-af24-49a7-b90b-92138880481e}" (
        echo %0 :: - 3.5.4 64bit
        "%LOCALAPPDATA%\Package Cache\{5d57524f-af24-49a7-b90b-92138880481e}\python-3.5.4-amd64.exe" /uninstall /quiet
    )

    :: 32 bit
    if exist "%LOCALAPPDATA%\Package Cache\{a10037e1-4247-47c9-935b-c5ca049d0299}" (
        echo %0 :: - 3.5.3 32bit
        "%LOCALAPPDATA%\Package Cache\{a10037e1-4247-47c9-935b-c5ca049d0299}\python-3.5.3" /uninstall /quiet
    )
    if exist "%LOCALAPPDATA%\Package Cache\{06e841fa-ca3b-4886-a820-cd32c614b0c1}" (
        echo %0 :: - 3.5.4 32bit
        "%LOCALAPPDATA%\Package Cache\{06e841fa-ca3b-4886-a820-cd32c614b0c1}\python-3.5.4" /uninstall /quiet
    )

    rem wipe the Python directory
    echo %0 :: Removing the C:\Python35 Directory ...
    echo ---------------------------------------------------------------------
    rd /s /q "C:\Python35"
    if %errorLevel%==0 (
        echo Successful
    ) else (
        echo Failed, please remove manually
    )

    goto eof

:CheckPython37
if exist "\Python37" goto RemovePython37

goto CheckPython38

:RemovePython37
    echo %0 :: Uninstalling Python 3.7 ...
    echo ---------------------------------------------------------------------
    :: 64 bit
    if exist "%LOCALAPPDATA%\Package Cache\{8ae589dd-de2e-42cd-af56-102374115fee}" (
        echo %0 :: - 3.7.4 64bit
        "%LOCALAPPDATA%\Package Cache\{8ae589dd-de2e-42cd-af56-102374115fee}\python-3.7.4-amd64.exe" /uninstall /quiet
    )

    :: 32 bit
    if exist "%LOCALAPPDATA%\Package Cache\{b66087e3-469e-4725-8b9b-f0981244afea}" (
        echo %0 :: - 3.7.4 32bit
        "%LOCALAPPDATA%\Package Cache\{b66087e3-469e-4725-8b9b-f0981244afea}\python-3.7.4" /uninstall /quiet
    )
    :: Python Launcher, seems to be the same for 32 and 64 bit
    echo %0 :: - Python Launcher
    msiexec.exe /x {D722DA3A-92F5-454A-BD5D-A48C94D82300} /quiet /qn

    rem wipe the Python directory
    echo %0 :: Removing the C:\Python37 Directory ...
    echo ---------------------------------------------------------------------
    rd /s /q "C:\Python37"
    if %errorLevel%==0 (
        echo Successful
    ) else (
        echo Failed, please remove manually
    )

    goto eof

:CheckPython38
if exist "\Python38" goto RemovePython38

goto eof

:RemovePython38
    echo %0 :: Uninstalling Python 3.8 ...
    echo ---------------------------------------------------------------------
    :: 64 bit
    if exist "%LOCALAPPDATA%\Package Cache\{ef6306ce-2a12-4d59-887e-ebf00b9e4ab5}" (
        echo %0 :: - 3.8.8 64bit
        "%LOCALAPPDATA%\Package Cache\{ef6306ce-2a12-4d59-887e-ebf00b9e4ab5}\python-3.8.8-amd64.exe" /uninstall /quiet
    )

    :: 32 bit
    if exist "%LOCALAPPDATA%\Package Cache\{ac93da86-1536-4b03-aea1-dc354b5e9282}" (
        echo %0 :: - 3.8.8 32bit
        "%LOCALAPPDATA%\Package Cache\{ac93da86-1536-4b03-aea1-dc354b5e9282}\python-3.8.8" /uninstall /quiet
    )
    :: Python Launcher, seems to be the same for 32 and 64 bit
    echo %0 :: - Python Launcher
    msiexec.exe /x {3B53E5B7-CFC4-401C-80E9-FF7591C58741} /quiet /qn

    rem wipe the Python directory
    echo %0 :: Removing the C:\Python37 Directory ...
    echo ---------------------------------------------------------------------
    rd /s /q "C:\Python37"
    if %errorLevel%==0 (
        echo Successful
    ) else (
        echo Failed, please remove manually
    )

    goto eof

:eof
echo.
echo =====================================================================
echo End of %0
echo =====================================================================

Fix Admin detect

Fix Admin detect


@echo off

set script=%~dp0%
set parent=%script: =,%
set parent=%parent:\= %
set parentdir=
call :getparentdir %parent%
set parent=%parentdir:,= %

if not exist ..\env.bat (
	echo Add %parent%\env.bat: (..\env.bat^)
	echo See env.bat.template in %script%
	echo In ..\env.bat, complete your %%PATH%% with Git, VirtualBox and Boot2Docker
	exit /B 1
)
call "%parent%\env.bat"
set PATH=%PATH%;%script%

rem http://stackoverflow.com/a/7218493/6309: test substring
echo.%PATH%| findstr /C:"Boot2Docker" 1>nul
if errorlevel 1 (
	echo "Boot2Docker is not found in PATH: check your ..\env.bat"
	exit /B 1
)
echo.%PATH%| findstr /C:"Git" 1>nul
if errorlevel 1 (
	echo "Git is not found in PATH: check your ..\env.bat"
	exit /B 1
)
echo.%PATH%| findstr /C:"VirtualBox" 1>nul
if errorlevel 1 (
	echo "VirtualBox is not found in PATH: check your ..\env.bat"
	exit /B 1
)

doskey vbm="VBoxManage.exe" $*
doskey vbmmt="VBoxManage.exe modifyvm \"boot2docker-vm\" natpf1 \"tcp-port$1,tcp,,$1,,$1\";"
doskey vbmmu="VBoxManage.exe modifyvm \"boot2docker-vm\" natpf1 \"udp-port$1,udp,,$1,,$1\";"
doskey vbmct="VBoxManage.exe controlvm \"boot2docker-vm\" natpf1 \"tcp-port$1,tcp,,$1,,$1\";"
doskey vbmcu="VBoxManage.exe controlvm \"boot2docker-vm\" natpf1 \"udp-port$1,udp,,$1,,$1\";"

goto :eof

rem http://www.dostips.com/DtTutoFunctions.php#FunctionTutorial.ReturningValuesClassic
:getparentdir
if "%~1" EQU "b2d" goto :EOF
if not "%parentdir%" == "" (
	set "parentdir=%parentdir%\%~1"
)
if "%parentdir%" == "" (
	set parentdir=%~1
)
shift
goto getparentdir

@echo off

set script=%~dp0%
set parent=%script: =,%
set parent=%parent:\= %
set parentdir=
call :getparentdir %parent%
set parent=%parentdir:,= %

if not exist ..\env.bat (
	echo Add %parent%\env.bat: (..\env.bat^)
	echo See env.bat.template in %script%
	echo In ..\env.bat, complete your %%PATH%% with Git, VirtualBox and Boot2Docker
	exit /B 1
)
call "%parent%\env.bat"
set PATH=%PATH%;%script%

rem http://stackoverflow.com/a/7218493/6309: test substring
echo.%PATH%| findstr /C:"Boot2Docker" 1>nul
if errorlevel 1 (
	echo "Boot2Docker is not found in PATH: check your ..\env.bat"
	exit /B 1
)
echo.%PATH%| findstr /C:"Git" 1>nul
if errorlevel 1 (
	echo "Git is not found in PATH: check your ..\env.bat"
	exit /B 1
)
echo.%PATH%| findstr /C:"VirtualBox" 1>nul
if errorlevel 1 (
	echo "VirtualBox is not found in PATH: check your ..\env.bat"
	exit /B 1
)

doskey vbm="VBoxManage.exe" $*
doskey vbmmt="VBoxManage.exe modifyvm \"boot2docker-vm\" natpf1 \"tcp-port$1,tcp,,$1,,$1\";"
doskey vbmmu="VBoxManage.exe modifyvm \"boot2docker-vm\" natpf1 \"udp-port$1,udp,,$1,,$1\";"
doskey vbmct="VBoxManage.exe controlvm \"boot2docker-vm\" natpf1 \"tcp-port$1,tcp,,$1,,$1\";"
doskey vbmcu="VBoxManage.exe controlvm \"boot2docker-vm\" natpf1 \"udp-port$1,udp,,$1,,$1\";"
doskey bd="boot2docker.exe" $*

goto :eof

rem http://www.dostips.com/DtTutoFunctions.php#FunctionTutorial.ReturningValuesClassic
:getparentdir
if "%~1" EQU "b2d" goto :EOF
if not "%parentdir%" == "" (
	set "parentdir=%parentdir%\%~1"
)
if "%parentdir%" == "" (
	set parentdir=%~1
)
shift
goto getparentdir

add bd as alias to boot2docker

senv.bat: add bd as alias to boot2docker