RMDIR Node /S /Q
MKDIR Node
xcopy OpenRoads\NodeMain.js Node
xcopy OpenRoads\RoadsLib.js Node

mkdir Node\Data
mkdir Node\Data.XMas
mkdir Node\JsLibs
mkdir Node\Shaders
mkdir Node\Images
mkdir Node\Node
mkdir Node\Node\node_modules
mkdir Node\Node\node_modules\node-canvas
mkdir Node\Node\node_modules\node-glfw
mkdir Node\Node\node_modules\node-webgl
mkdir Node\Node\node_modules\node-core-audio
mkdir Node\Node\node_modules\node-core-audio\gyp
mkdir Node\Node\node_modules\node-core-audio\build
mkdir Node\Node\node_modules\node-core-audio\node_modules
mkdir Node\Node\node_modules\node-core-audio\node_modules\fft

xcopy OpenRoads\Data Node\Data /E
xcopy OpenRoads\Data.XMas Node\Data.XMas /E
xcopy OpenRoads\Images Node\Images /E
xcopy OpenRoads\JsLibs Node\JsLibs /E
xcopy OpenRoads\Shaders Node\Shaders /E
xcopy OpenRoads\Node\node_modules\node-canvas Node\Node\node_modules\node-canvas /E
xcopy OpenRoads\Node\node_modules\node-glfw Node\Node\node_modules\node-glfw /E
xcopy OpenRoads\Node\node_modules\node-webgl Node\Node\node_modules\node-webgl /E
xcopy OpenRoads\Node\node_modules\node-core-audio Node\Node\node_modules\node-core-audio
xcopy OpenRoads\Node\node_modules\node-core-audio\gyp Node\Node\node_modules\node-core-audio\gyp /E
xcopy OpenRoads\Node\node_modules\node-core-audio\build Node\Node\node_modules\node-core-audio\build /E
xcopy OpenRoads\Node\node_modules\node-core-audio\node_modules\fft Node\Node\node_modules\node-core-audio\node_modules\fft /E

del Node\Data\settings.json
del Node\Data.XMas\settings.json

del Node\Node\node_modules\node-core-audio\build\* /Q
del Node\Node\node_modules\node-core-audio\build\Release\*.pdb
del Node\Node\node_modules\node-core-audio\build\Release\*.exp
del Node\Node\node_modules\node-core-audio\build\Release\*.lib
RMDIR Node\Node\node_modules\node-core-audio\build\Release\obj /S /Q
RMDIR Node\Node\node_modules\node-core-audio\gyp /S /Q

del Node\Node\node_modules\node-glfw\build\* /Q
del Node\Node\node_modules\node-glfw\build\Release\*.pdb
del Node\Node\node_modules\node-glfw\build\Release\*.exp
del Node\Node\node_modules\node-glfw\build\Release\*.lib
RMDIR Node\Node\node_modules\node-glfw\build\Release\obj /S /Q
RMDIR Node\Node\node_modules\node-glfw\src /S /Q
RMDIR Node\Node\node_modules\node-glfw\test /S /Q
RMDIR Node\Node\node_modules\node-glfw\node_modules /S /Q

del Node\Node\node_modules\node-webgl\build\* /Q
del Node\Node\node_modules\node-webgl\build\Release\*.pdb
del Node\Node\node_modules\node-webgl\build\Release\*.exp
del Node\Node\node_modules\node-webgl\build\Release\*.lib
RMDIR Node\Node\node_modules\node-webgl\build\Release\obj /S /Q

RMDIR Node\Node\node_modules\node-webgl\doc /S /Q
RMDIR Node\Node\node_modules\node-webgl\examples /S /Q
RMDIR Node\Node\node_modules\node-webgl\src /S /Q
RMDIR Node\Node\node_modules\node-webgl\test /S /Q
RMDIR Node\Node\node_modules\node-webgl\tools /S /Q

del Node\Node\node_modules\node-webgl\node_modules\node-glfw\build\* /Q
del Node\Node\node_modules\node-webgl\node_modules\node-glfw\build\Release\*.pdb
del Node\Node\node_modules\node-webgl\node_modules\node-glfw\build\Release\*.exp
del Node\Node\node_modules\node-webgl\node_modules\node-glfw\build\Release\*.lib
RMDIR Node\Node\node_modules\node-webgl\node_modules\node-glfw\build\Release\obj /S /Q
RMDIR Node\Node\node_modules\node-webgl\node_modules\node-glfw\src /S /Q
RMDIR Node\Node\node_modules\node-webgl\node_modules\node-glfw\test /S /Q

Build script improvements

Build script improvements


@echo off
SET BASE_PATH=%~dp0
START /MIN CMD /C "%BASE_PATH%lsleasesd.exe -webui -webui-addr 127.0.0.1:9999"

@echo off
SET BASE_PATH=%~dp0
START /MIN CMD /C "%BASE_PATH%lsleasesd.exe" -webui -webui-addr 127.0.0.1:9999

fix windows start server script

fix windows start server script


REM
REM Copyright (C) 2011-13, DyND Developers
REM BSD 2-Clause License, see LICENSE.txt
REM
REM This is the master windows build + test script for building
REM the dynd python bindings on jenkins.
REM
REM Jenkins Requirements:
REM   - Anaconda should be installed in C:\Anaconda.
REM   - Use a jenkins build matrix for multiple
REM     platforms/python versions
REM   - Use the XShell plugin to launch this script
REM   - Call the script from the root workspace
REM     directory as buildscripts/jenkins-build
REM   - Use a user-defined axis to select python versions with PYTHON_VERSION
REM

REM If no MSVC version is selected, choose 2013
if "%MSVC_VERSION%" == "" set MSVC_VERSION=12.0
REM Require a version of Python to be selected
if "%PYTHON_VERSION%" == "" exit /b 1

REM Jenkins has '/' in its workspace. Fix it to '\' to simplify the DOS commands.
set WORKSPACE=%WORKSPACE:/=\%

REM Remove the build subdirectory from last time
rd /q /s build

REM Get libdynd into the libraries subdirectory
REM TODO: Build libdynd in a separate jenkins project,
REM       and use its build artifact here.
call .\buildscripts\checkout_libdynd.bat
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Make sure binstar is installed in the main environment
echo Updating binstar...
call C:\Anaconda\Scripts\conda install --yes binstar || exit 1
call C:\Anaconda\Scripts\binstar --version
echo on

REM Use conda to create a conda environment of the required
REM python version and containing the dependencies.
SET PYENV_PREFIX=%WORKSPACE%\build\pyenv
rd /s /q %PYENV_PREFIX%
REM NOTE: cython is forced to 0.20.2 temporarily because of a bug in anaconda
REM       https://github.com/ContinuumIO/anaconda-issues/issues/178
call C:\Anaconda\Scripts\conda create --yes -p %PYENV_PREFIX% python=%PYTHON_VERSION% cython=0.20.2 scipy nose
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on
set PYTHON_EXECUTABLE=%PYENV_PREFIX%\Python.exe
set PATH=%PYENV_PREFIX%;%PYENV_PREFIX%\Scripts;%PATH%

REM Select the correct compiler, by first getting whether
REM the Python is 32-bit or 64-bit.
FOR /F "delims=" %%i IN ('%PYTHON_EXECUTABLE% -c "import ctypes;print(8*ctypes.sizeof(ctypes.c_void_p))"') DO set PYTHON_BITS=%%i
if "%PYTHON_BITS%" == "64" goto :python64
 set MSVC_VCVARS_PLATFORM=x86
 set MSVC_BUILD_PLATFORM=Win32
 if "%MSVC_VERSION%" == "12.0" set CMAKE_BUILD_TARGET="Visual Studio 12"
goto :python32
:python64
 set MSVC_VCVARS_PLATFORM=amd64
 set MSVC_BUILD_PLATFORM=x64
 if "%MSVC_VERSION%" == "12.0" set CMAKE_BUILD_TARGET="Visual Studio 12 Win64"
:python32

REM Configure the appropriate visual studio command line environment
if "%PROGRAMFILES(X86)%" == "" set VCDIR=%PROGRAMFILES%\Microsoft Visual Studio %MSVC_VERSION%\VC
if NOT "%PROGRAMFILES(X86)%" == "" set VCDIR=%PROGRAMFILES(X86)%\Microsoft Visual Studio %MSVC_VERSION%\VC
call "%VCDIR%\vcvarsall.bat" %MSVC_VCVARS_PLATFORM%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on

REM Create a fresh visual studio solution with cmake, and do the build/install
cd build
cmake -DDYND_INSTALL_LIB=OFF -DCMAKE_INSTALL_PREFIX=install -G %CMAKE_BUILD_TARGET% -DPYTHON_EXECUTABLE=%PYTHON_EXECUTABLE% ..
IF %ERRORLEVEL% NEQ 0 exit /b 1
devenv dynd-python.sln /Build "RelWithDebInfo|%MSVC_BUILD_PLATFORM%"
IF %ERRORLEVEL% NEQ 0 exit /b 1
devenv dynd-python.sln /Build "RelWithDebInfo|%MSVC_BUILD_PLATFORM%" /Project INSTALL
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Run the tests and generate xml results
%PYTHON_EXECUTABLE% -c "import dynd;dynd.test(xunitfile='../test_results.xml', verbosity=2, exit=1)"
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Get the version number and process it into a suitable form
FOR /F "delims=" %%i IN ('%PYTHON_EXECUTABLE% -c "import dynd;print(dynd.__version__)"') DO set PYDYND_VERSION=%%i
if "%PYDYND_VERSION%" == "" exit /b 1
set PYDYND_VERSION=%PYDYND_VERSION:-=_%

REM Put the conda package by itself in the directory pkgs/<anaconda-arch>
cd ..
rd /q /s pkgs
mkdir pkgs
cd pkgs
mkdir win-%PYTHON_BITS%
cd win-%PYTHON_BITS%

REM Create a conda package from the build
call C:\Anaconda\Scripts\conda package -p %PYENV_PREFIX% --pkg-name=dynd-python --pkg-version=%PYDYND_VERSION%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on

REM Upload the package to binstar
FOR /F "delims=" %%i IN ('dir /b dynd-python-*.tar.bz2') DO set PKG_FILE=%%i
call C:\Anaconda\Scripts\binstar -t %BINSTAR_MWIEBE_AUTH% upload --force %PKG_FILE% || exit 1
call C:\Anaconda\Scripts\binstar -t %BINSTAR_BLAZE_AUTH% upload --force %PKG_FILE% || exit 1

cd ..

exit /b 0

REM
REM Copyright (C) 2011-13, DyND Developers
REM BSD 2-Clause License, see LICENSE.txt
REM
REM This is the master windows build + test script for building
REM the dynd python bindings on jenkins.
REM
REM Jenkins Requirements:
REM   - Anaconda should be installed in C:\Anaconda.
REM   - Use a jenkins build matrix for multiple
REM     platforms/python versions
REM   - Use the XShell plugin to launch this script
REM   - Call the script from the root workspace
REM     directory as buildscripts/jenkins-build
REM   - Use a user-defined axis to select python versions with PYTHON_VERSION
REM

REM If no MSVC version is selected, choose 2013
if "%MSVC_VERSION%" == "" set MSVC_VERSION=12.0
REM Require a version of Python to be selected
if "%PYTHON_VERSION%" == "" exit /b 1

REM Jenkins has '/' in its workspace. Fix it to '\' to simplify the DOS commands.
set WORKSPACE=%WORKSPACE:/=\%

REM Remove the build subdirectory from last time
rd /q /s build

REM Get libdynd into the libraries subdirectory
REM TODO: Build libdynd in a separate jenkins project,
REM       and use its build artifact here.
call .\buildscripts\checkout_libdynd.bat
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Make sure binstar is installed in the main environment
echo Updating binstar...
call C:\Anaconda\Scripts\conda install --yes binstar || exit 1
call C:\Anaconda\Scripts\binstar --version
echo on

REM Use conda to create a conda environment of the required
REM python version and containing the dependencies.
SET PYENV_PREFIX=%WORKSPACE%\build\pyenv
rd /s /q %PYENV_PREFIX%
REM NOTE: cython is forced to 0.20.2 temporarily because of a bug in anaconda
REM       https://github.com/ContinuumIO/anaconda-issues/issues/178
call C:\Anaconda\Scripts\conda create --yes -p %PYENV_PREFIX% python=%PYTHON_VERSION% cython=0.20.2 scipy nose
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on
set PYTHON_EXECUTABLE=%PYENV_PREFIX%\Python.exe
set PATH=%PYENV_PREFIX%;%PYENV_PREFIX%\Scripts;%PATH%

REM Select the correct compiler, by first getting whether
REM the Python is 32-bit or 64-bit.
FOR /F "delims=" %%i IN ('%PYTHON_EXECUTABLE% -c "import ctypes;print(8*ctypes.sizeof(ctypes.c_void_p))"') DO set PYTHON_BITS=%%i
if "%PYTHON_BITS%" == "64" goto :python64
 set MSVC_VCVARS_PLATFORM=x86
 set MSVC_BUILD_PLATFORM=Win32
 if "%MSVC_VERSION%" == "12.0" set CMAKE_BUILD_TARGET="Visual Studio 12 2013"
goto :python32
:python64
 set MSVC_VCVARS_PLATFORM=amd64
 set MSVC_BUILD_PLATFORM=x64
 if "%MSVC_VERSION%" == "12.0" set CMAKE_BUILD_TARGET="Visual Studio 12 2013 Win64"
:python32

REM Configure the appropriate visual studio command line environment
if "%PROGRAMFILES(X86)%" == "" set VCDIR=%PROGRAMFILES%\Microsoft Visual Studio %MSVC_VERSION%\VC
if NOT "%PROGRAMFILES(X86)%" == "" set VCDIR=%PROGRAMFILES(X86)%\Microsoft Visual Studio %MSVC_VERSION%\VC
call "%VCDIR%\vcvarsall.bat" %MSVC_VCVARS_PLATFORM%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on

REM Create a fresh visual studio solution with cmake, and do the build/install
cd build
cmake -DDYND_INSTALL_LIB=OFF -DCMAKE_INSTALL_PREFIX=install -G %CMAKE_BUILD_TARGET% -DPYTHON_EXECUTABLE=%PYTHON_EXECUTABLE% ..
IF %ERRORLEVEL% NEQ 0 exit /b 1
devenv dynd-python.sln /Build "RelWithDebInfo|%MSVC_BUILD_PLATFORM%"
IF %ERRORLEVEL% NEQ 0 exit /b 1
devenv dynd-python.sln /Build "RelWithDebInfo|%MSVC_BUILD_PLATFORM%" /Project INSTALL
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Run the tests and generate xml results
%PYTHON_EXECUTABLE% -c "import dynd;dynd.test(xunitfile='../test_results.xml', verbosity=2, exit=1)"
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Get the version number and process it into a suitable form
FOR /F "delims=" %%i IN ('%PYTHON_EXECUTABLE% -c "import dynd;print(dynd.__version__)"') DO set PYDYND_VERSION=%%i
if "%PYDYND_VERSION%" == "" exit /b 1
set PYDYND_VERSION=%PYDYND_VERSION:-=_%

REM Put the conda package by itself in the directory pkgs/<anaconda-arch>
cd ..
rd /q /s pkgs
mkdir pkgs
cd pkgs
mkdir win-%PYTHON_BITS%
cd win-%PYTHON_BITS%

REM Create a conda package from the build
call C:\Anaconda\Scripts\conda package -p %PYENV_PREFIX% --pkg-name=dynd-python --pkg-version=%PYDYND_VERSION%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on

REM Upload the package to binstar
FOR /F "delims=" %%i IN ('dir /b dynd-python-*.tar.bz2') DO set PKG_FILE=%%i
call C:\Anaconda\Scripts\binstar -t %BINSTAR_MWIEBE_AUTH% upload --force %PKG_FILE% || exit 1
call C:\Anaconda\Scripts\binstar -t %BINSTAR_BLAZE_AUTH% upload --force %PKG_FILE% || exit 1

cd ..

exit /b 0

Change "Visual Studio 12" to "Visual Studio 12 2013" for cmake


@ECHO OFF
IF NOT EXIST UmbracoVersion.txt (
	ECHO UmbracoVersion.txt missing!
	GOTO :showerror
)

REM Get the version and comment from UmbracoVersion.txt lines 2 and 3
SET "release="
SET "comment="
FOR /F "skip=1 delims=" %%i IN (UmbracoVersion.txt) DO IF NOT DEFINED release SET "release=%%i"
FOR /F "skip=2 delims=" %%i IN (UmbracoVersion.txt) DO IF NOT DEFINED comment SET "comment=%%i"

SET version=%release%

IF [%comment%] EQU [] (SET version=%release%) ELSE (SET version=%release%-%comment%)
ECHO Building Umbraco %version%

ReplaceIISExpressPortNumber.exe ..\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj %release%

ECHO Installing the Microsoft.Bcl.Build package before anything else, otherwise you'd have to run build.cmd twice
SET nuGetFolder=%CD%\..\src\packages\
..\src\.nuget\NuGet.exe sources Remove -Name MyGetUmbracoCore
..\src\.nuget\NuGet.exe sources Add -Name MyGetUmbracoCore -Source https://www.myget.org/F/umbracocore/api/v2/ >NUL
..\src\.nuget\NuGet.exe install ..\src\Umbraco.Web.UI\packages.config -OutputDirectory %nuGetFolder%
..\src\.nuget\NuGet.exe install ..\src\umbraco.businesslogic\packages.config -OutputDirectory %nuGetFolder%
..\src\.nuget\NuGet.exe install ..\src\Umbraco.Core\packages.config -OutputDirectory %nuGetFolder%

ECHO Removing the belle build folder to make sure everything is clean as a whistle
RD ..\src\Umbraco.Web.UI.Client\build /Q /S

ECHO Removing existing built files to make sure everything is clean as a whistle
RMDIR /Q /S _BuildOutput
DEL /F /Q UmbracoCms.*.zip
DEL /F /Q UmbracoExamine.*.zip
DEL /F /Q UmbracoCms.*.nupkg
DEL /F /Q webpihash.txt

ECHO Making sure Git is in the path so that the build can succeed
CALL InstallGit.cmd
ECHO Performing MSBuild and producing Umbraco binaries zip files
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build-debug.proj" /p:BUILD_RELEASE=%release% /p:BUILD_COMMENT=%comment%

IF ERRORLEVEL 1 GOTO :showerror

echo off
SET SRC=c:\Repositories\Umbraco\build\_BuildOutput
SET DEST=n:\web\webcentrum2-dev.muni.cz\%1

echo. && echo bin:
robocopy %SRC%\WebApp\bin %DEST%\src\Lib\Umbraco /S /XO /IS /NJH /NFL /NDL
robocopy %SRC%\UmbracoExamine.PDF %DEST%\src\Lib\Umbraco /S /XO /IS /NJH /NFL /NDL
echo. && echo umbraco:
robocopy %SRC%\WebApp\umbraco %DEST%\web\Umbraco /S /XO /IS /NJH /NFL /NDL
echo. && echo umbraco_client:
robocopy %SRC%\WebApp\umbraco_client %DEST%\web\Umbraco_Client /S /XO /IS /NJH /NFL /NDL

GOTO :EOF

:showerror
PAUSE

@ECHO OFF
IF NOT EXIST UmbracoVersion.txt (
	ECHO UmbracoVersion.txt missing!
	GOTO :showerror
)

REM Get the version and comment from UmbracoVersion.txt lines 2 and 3
SET "release="
SET "comment="
FOR /F "skip=1 delims=" %%i IN (UmbracoVersion.txt) DO IF NOT DEFINED release SET "release=%%i"
FOR /F "skip=2 delims=" %%i IN (UmbracoVersion.txt) DO IF NOT DEFINED comment SET "comment=%%i"

SET version=%release%

IF [%comment%] EQU [] (SET version=%release%) ELSE (SET version=%release%-%comment%)
ECHO Building Umbraco %version%

ReplaceIISExpressPortNumber.exe ..\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj %release%

ECHO Installing the Microsoft.Bcl.Build package before anything else, otherwise you'd have to run build.cmd twice
SET nuGetFolder=%CD%\..\src\packages\
..\src\.nuget\NuGet.exe sources Remove -Name MyGetUmbracoCore
..\src\.nuget\NuGet.exe sources Add -Name MyGetUmbracoCore -Source https://www.myget.org/F/umbracocore/api/v2/ >NUL
..\src\.nuget\NuGet.exe install ..\src\Umbraco.Web.UI\packages.config -OutputDirectory %nuGetFolder%
..\src\.nuget\NuGet.exe install ..\src\umbraco.businesslogic\packages.config -OutputDirectory %nuGetFolder%
..\src\.nuget\NuGet.exe install ..\src\Umbraco.Core\packages.config -OutputDirectory %nuGetFolder%

ECHO Removing the belle build folder to make sure everything is clean as a whistle
RD ..\src\Umbraco.Web.UI.Client\build /Q /S

ECHO Removing existing built files to make sure everything is clean as a whistle
RMDIR /Q /S _BuildOutput
DEL /F /Q UmbracoCms.*.zip
DEL /F /Q UmbracoExamine.*.zip
DEL /F /Q UmbracoCms.*.nupkg
DEL /F /Q webpihash.txt

ECHO Making sure Git is in the path so that the build can succeed
CALL InstallGit.cmd
ECHO Performing MSBuild and producing Umbraco binaries zip files
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build-debug.proj" /p:BUILD_RELEASE=%release% /p:BUILD_COMMENT=%comment%

IF ERRORLEVEL 1 GOTO :showerror

echo off
SET SRC=c:\Repositories\Umbraco\build\_BuildOutput
SET DEST=n:\web\webcentrum2-dev.muni.cz\%1

echo. && echo bin:
robocopy %SRC%\WebApp\bin %DEST%\src\Lib\Umbraco /S /XO /IS /NJH /NFL /NDL
robocopy %SRC%\UmbracoExamine.PDF %DEST%\lib\Umbraco-CMS /S /XO /IS /NJH /NFL /NDL
echo. && echo umbraco:
robocopy %SRC%\WebApp\umbraco %DEST%\web\Umbraco /S /XO /IS /NJH /NFL /NDL
echo. && echo umbraco_client:
robocopy %SRC%\WebApp\umbraco_client %DEST%\web\Umbraco_Client /S /XO /IS /NJH /NFL /NDL

GOTO :EOF

:showerror
PAUSE

Fix debug build script destination directory


@TITLE Building Mesa3D
@cd "%~dp0"
@cd ..\..\
@for %%I in ("%cd%") do @set mesa=%%~sI
@set mesa=%mesa%\
@where /q cmake.exe
@IF ERRORLEVEL 1 set PATH=%mesa%cmake\bin\;%PATH%
@set ERRORLEVEL=0
@where /q python.exe
@IF ERRORLEVEL 1 set PATH=%mesa%Python\;%mesa%Python\Scripts\;%PATH%
@set ERRORLEVEL=0
@set pyupd=y
@set pyfrstupd=1
@if EXIST pyupd.ini set /p pyfrstupd=<pyupd.ini
@if %pyfrstupd%==0 set pyupd=n
@if %pyfrstupd%==0 set /p pyupd=Install/update python modules (y/n):
@if "%pyupd%"=="y" (
@python -m pip install -U mako
@python -m pip freeze > requirements.txt
@python -m pip install -r requirements.txt --upgrade
@del requirements.txt
@echo.
@echo 0 > pyupd.ini
)
@set abi=x86
@set /p x64=Do you want to build for x64? (y/n) Otherwise build for x86:
@if /I "%x64%"=="y" set abi=x64
@set longabi=%abi%
@if %abi%==x64 set longabi=x86_64
@set altabi=i686
@if %abi%==x64 set altabi=%longabi%
@set minabi=32
@if %abi%==x64 set minabi=64
@set targetabi=x86
@if %abi%==x64 set targetabi=amd64
@set hostabi=x86
@set vsenv="%ProgramFiles%
@if NOT "%ProgramW6432%"=="" set hostabi=amd64
@set vsabi=%minabi%
@if NOT %targetabi%==%hostabi% set vsabi=%hostabi%_%targetabi%
@if NOT "%ProgramW6432%"=="" set vsenv=%vsenv% (x86)
@set vsenv15=%vsenv%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars%vsabi%.bat"
@if %vsabi%==32 set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\vcvars%vsabi%.bat"
@if %vsabi%==64 set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\%targetabi%\vcvars%vsabi%.bat"
@if NOT %targetabi%==%hostabi% set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\%vsabi%\vcvars%vsabi%.bat"
@set gcc=%mesa%mingw-w64\%abi%\mingw%minabi%\bin
@set vsenvloaded=0
@set toolset=14
@if EXIST %vsenv15% set toolset=15
@if EXIST toolset-%abi%.ini set /p toolset=<toolset-%abi%.ini
@set vsenv=%vsenv14%
@if %toolset%==15 set vsenv=%vsenv15%
@set PATH=%mesa%flexbison\;%PATH%
@TITLE Building Mesa3D %abi%

:build_llvm
@set /p buildllvm=Begin LLVM build. Only needs to run once for each ABI and version. Proceed (y/n):
@if /I NOT "%buildllvm%"=="y" GOTO build_mesa
@echo.
@cd %mesa%llvm
@if EXIST %abi% RD /S /Q %abi%
@if EXIST cmake-%abi% RD /S /Q cmake-%abi%
@md cmake-%abi%
@cd cmake-%abi%
@set toolchain=Visual Studio 14
@set toolset=14
@if EXIST %vsenv15% set toolchain=Visual Studio 15 2017
@if EXIST %vsenv15% set toolset=15
@set ninja=n
@set oldtoolset=n
@set x64compiler= -Thost=x64
@if EXIST %mesa%ninja set ninja=1
@if EXIST %vsenv15% set ninja=%ninja%2
@if %ninja%==12 set /p oldtoolset=Build with MSVC 2015 backward compatibility toolset, alternative solution for LLVM 3.9.1 build with Visual Studio 2017 (y/n):
@if %ninja%==12 echo.
@if /I "%oldtoolset%"=="y" set ninja=y
@if /I "%oldtoolset%"=="y" set toolset=14
@if %ninja%==12 set ninja=2
@if %ninja%==1 set ninja=2
@if %ninja%==2 set /p ninja=Use Ninja build system instead of MsBuild, there is no requirement to do this with the primary toolset though (y/n):
@echo.
@if /I "%ninja%"=="y" set toolchain=Ninja
@if /I "%ninja%"=="y" set x64compiler=
@if "%toolchain%"=="Ninja" set PATH=%mesa%ninja\;%PATH%
@set vsenv=%vsenv14%
@if %toolset%==15 set vsenv=%vsenv15%
@set llvmbuildsys=%CD%
@call %vsenv%
@set vsenvloaded=1
@echo.
@set modtoolchainabi=0
@if NOT "%toolchain%"=="Ninja" set modtoolchainabi=1
@if %abi%==x64 set modtoolchainabi=%modtoolchainabi%2
@if %modtoolchainabi%==12 set toolchain=%toolchain% Win64
@cd %llvmbuildsys%
@if NOT %hostabi%==amd64 set x64compiler=
@cmake -G "%toolchain%"%x64compiler% -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT -DLLVM_ENABLE_RTTI=1 -DLLVM_ENABLE_TERMINFO=OFF -DCMAKE_INSTALL_PREFIX=../%abi% ..
@echo.
@pause
@echo.
@if NOT "%toolchain%"=="Ninja" cmake --build . --config Release --target install
@if "%toolchain%"=="Ninja" ninja install
@echo.
@echo %toolset% > %mesa%toolset-%abi%.ini

:build_mesa
@set /p buildmesa=Begin mesa build. Proceed (y/n):
@if /i NOT "%buildmesa%"=="y" GOTO build_dxtn
@echo.
@set LLVM=%mesa%llvm\%abi%
@if NOT EXIST %LLVM% (
@echo Could not find LLVM, aborting mesa build.
@echo.
@pause
@GOTO build_dxtn
)
@cd %mesa%
@if NOT EXIST mesa echo Mesa3D source code not found. Attempting to download it using git as long as it is in PATH...
@if NOT EXIST mesa set /p branch=Enter Mesa source code branch name - defaults to master:
@if "%branch%"=="" set branch=master
@if NOT EXIST mesa echo.
@if NOT EXIST mesa git clone --depth=1 --branch=%branch% git://anongit.freedesktop.org/mesa/mesa mesa
@cd mesa
git apply -v ..\mesa-dist-win\patches\scons-llvm5.patch
git apply -v ..\mesa-dist-win\patches\s3tc.patch
@echo.
@set openswr=n
@set sconscmd=python %mesa%Python\Scripts\scons.py build=release platform=windows machine=%longabi% libgl-gdi
@if %abi%==x64 set /p openswr=Do you want to build OpenSWR drivers? (y=yes):
@echo.
@if /I "%openswr%"=="y" set sconscmd=%sconscmd% swr=1
@set /p osmesa=Do you want to build off-screen rendering drivers (y/n):
@echo.
@if /I "%osmesa%"=="y" set sconscmd=%sconscmd% osmesa
@set /p graw=Do you want to build graw library (y/n):
@echo.
@if /I "%graw%"=="y" set sconscmd=%sconscmd% graw-gdi
@GOTO build_with_vs

:build_with_mingw
@set mingw=n
@set mingwtest=0
@if EXIST %gcc% set mingwtest=1
@set msys2=%mesa%msys64\msys2_shell.cmd
@if EXIST %msys2% set mingwtest=%mingwtest%2
@if %mingwtest%==12 set /p mingw=Do you want to build with MinGW-W64 instead of Visual Studio (y=yes):
@set ERRORLEVEL=0
@where /q gcc.exe
@IF ERRORLEVEL 1 set PATH=%gcc%\;%PATH%
@set ERRORLEVEL=0
@if /I "%mingw%"=="y" set sconscmd=%sconscmd% toolchain=crossmingw
@if /I "%mingw%"=="y" copy %gcc%\%altabi%-w64-mingw32-gcc-ar.exe %gcc%\%altabi%-w64-mingw32-ar.exe
@if /I "%mingw%"=="y" copy %gcc%\%altabi%-w64-mingw32-gcc-ranlib.exe %gcc%\%altabi%-w64-mingw32-ranlib.exe
@if /I "%mingw%"=="y" call "%msys2%" -use-full-path
@if /I "%mingw%"=="y" (
pacman -Syu
pacman -S python2
wget https://bootstrap.pypa.io/get-pip.py
python2 get-pip.py
pip install -U mako
pip install -U scons
pip freeze > requirements.txt
pip install -r requirements.txt --upgrade
cd $mesa
cd mesa
GOTO build_mesa_exec
)

:build_with_vs
@set cleanbuild=n
@if EXIST build\windows-%longabi% set /p cleanbuild=Do you want to clean build (y/n):
@if EXIST build\windows-%longabi% echo.
@if /I "%cleanbuild%"=="y" RD /S /Q build\windows-%longabi%
@if %vsenvloaded%==0 (
@call %vsenv%
@cd %mesa%mesa
@echo.
)

:build_mesa_exec
@%sconscmd%
@echo.

:build_dxtn
@if NOT EXIST %gcc% GOTO distcreate
@if NOT EXIST %mesa%dxtn GOTO distcreate
@if NOT EXIST %mesa%mesa GOTO distcreate
@set /p builddxtn=Do you want to build S3 texture compression library? (y/n):
@if /i NOT "%builddxtn%"=="y" GOTO distcreate
@set PATH=%gcc%\;%PATH%
@cd %mesa%dxtn
@echo.
@if EXIST %abi% RD /S /Q %abi%
@MD %abi%
@set dxtn=gcc -shared -m%minabi% -v *.c *.h -I ..\mesa\include -Wl,--dll,--dynamicbase,--enable-auto-image-base,--nxcompat -o %abi%\dxtn.dll
@%dxtn%
@echo.

:distcreate
@set /p dist=Create or update Mesa3D distribution package (y/n):
@echo.
@if /I NOT "%dist%"=="y" GOTO exit
@cd %mesa%
@if NOT EXIST mesa-dist-win MD mesa-dist-win
@cd mesa-dist-win
@if NOT EXIST bin MD bin
@cd bin
@if EXIST %abi% RD /S /Q %abi%
@MD %abi%
@cd %abi%
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\libgl-gdi\opengl32.dll opengl32.dll
@copy %mesa%mesa\build\windows-%longabi%\gallium\drivers\swr\swrAVX.dll swrAVX.dll
@copy %mesa%mesa\build\windows-%longabi%\gallium\drivers\swr\swrAVX2.dll swrAVX2.dll
@copy %mesa%mesa\build\windows-%longabi%\mesa\drivers\osmesa\osmesa.dll osmesa-swrast.dll
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\osmesa\osmesa.dll osmesa-gallium.dll
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\graw-gdi\graw.dll graw.dll
@copy %mesa%dxtn\%abi%\dxtn.dll dxtn.dll
@echo.
@pause

:exit
exit

@TITLE Building Mesa3D
@cd "%~dp0"
@cd ..\..\
@for %%I in ("%cd%") do @set mesa=%%~sI
@set mesa=%mesa%\
@where /q cmake.exe
@IF ERRORLEVEL 1 set PATH=%mesa%cmake\bin\;%PATH%
@set ERRORLEVEL=0
@where /q python.exe
@IF ERRORLEVEL 1 set PATH=%mesa%Python\;%mesa%Python\Scripts\;%PATH%
@set ERRORLEVEL=0
@set pyupd=y
@set pyfrstupd=1
@if EXIST pyupd.ini set /p pyfrstupd=<pyupd.ini
@if %pyfrstupd%==0 set pyupd=n
@if %pyfrstupd%==0 set /p pyupd=Install/update python modules (y/n):
@if "%pyupd%"=="y" (
@python -m pip install -U mako
@python -m pip freeze > requirements.txt
@python -m pip install -r requirements.txt --upgrade
@del requirements.txt
@echo.
@echo 0 > pyupd.ini
)
@set abi=x86
@set /p x64=Do you want to build for x64? (y/n) Otherwise build for x86:
@if /I "%x64%"=="y" set abi=x64
@set longabi=%abi%
@if %abi%==x64 set longabi=x86_64
@set altabi=i686
@if %abi%==x64 set altabi=%longabi%
@set minabi=32
@if %abi%==x64 set minabi=64
@set targetabi=x86
@if %abi%==x64 set targetabi=amd64
@set hostabi=x86
@set vsenv="%ProgramFiles%
@if NOT "%ProgramW6432%"=="" set hostabi=amd64
@set vsabi=%minabi%
@if NOT %targetabi%==%hostabi% set vsabi=%hostabi%_%targetabi%
@if NOT "%ProgramW6432%"=="" set vsenv=%vsenv% (x86)
@set vsenv15=%vsenv%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars%vsabi%.bat"
@if %vsabi%==32 set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\vcvars%vsabi%.bat"
@if %vsabi%==64 set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\%targetabi%\vcvars%vsabi%.bat"
@if NOT %targetabi%==%hostabi% set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\%vsabi%\vcvars%vsabi%.bat"
@set gcc=%mesa%mingw-w64\%abi%\mingw%minabi%\bin
@set vsenvloaded=0
@set toolset=14
@if EXIST %vsenv15% set toolset=15
@if EXIST toolset-%abi%.ini set /p toolset=<toolset-%abi%.ini
@set vsenv=%vsenv14%
@if %toolset%==15 set vsenv=%vsenv15%
@set PATH=%mesa%flexbison\;%PATH%
@TITLE Building Mesa3D %abi%

:build_llvm
@set /p buildllvm=Begin LLVM build. Only needs to run once for each ABI and version. Proceed (y/n):
@if /I NOT "%buildllvm%"=="y" GOTO build_mesa
@echo.
@cd %mesa%llvm
@if EXIST %abi% RD /S /Q %abi%
@if EXIST cmake-%abi% RD /S /Q cmake-%abi%
@md cmake-%abi%
@cd cmake-%abi%
@set toolchain=Visual Studio 14
@set toolset=14
@if EXIST %vsenv15% set toolchain=Visual Studio 15 2017
@if EXIST %vsenv15% set toolset=15
@set ninja=n
@set oldtoolset=n
@set x64compiler= -Thost=x64
@if EXIST %mesa%ninja set ninja=1
@if EXIST %vsenv15% set ninja=%ninja%2
@if %ninja%==12 set /p oldtoolset=Build with MSVC 2015 backward compatibility toolset, alternative solution for LLVM 3.9.1 build with Visual Studio 2017 (y/n):
@if %ninja%==12 echo.
@if /I "%oldtoolset%"=="y" set ninja=y
@if /I "%oldtoolset%"=="y" set toolset=14
@if %ninja%==12 set ninja=2
@if %ninja%==1 set ninja=2
@if %ninja%==2 set /p ninja=Use Ninja build system instead of MsBuild, there is no requirement to do this with the primary toolset though (y/n):
@echo.
@if /I "%ninja%"=="y" set toolchain=Ninja
@if /I "%ninja%"=="y" set x64compiler=
@if "%toolchain%"=="Ninja" set PATH=%mesa%ninja\;%PATH%
@set vsenv=%vsenv14%
@if %toolset%==15 set vsenv=%vsenv15%
@set llvmbuildsys=%CD%
@call %vsenv%
@set vsenvloaded=1
@echo.
@set modtoolchainabi=0
@if NOT "%toolchain%"=="Ninja" set modtoolchainabi=1
@if %abi%==x64 set modtoolchainabi=%modtoolchainabi%2
@if %modtoolchainabi%==12 set toolchain=%toolchain% Win64
@cd %llvmbuildsys%
@if NOT %hostabi%==amd64 set x64compiler=
@cmake -G "%toolchain%"%x64compiler% -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT -DLLVM_ENABLE_RTTI=1 -DLLVM_ENABLE_TERMINFO=OFF -DCMAKE_INSTALL_PREFIX=../%abi% ..
@echo.
@pause
@echo.
@if NOT "%toolchain%"=="Ninja" cmake --build . --config Release --target install
@if "%toolchain%"=="Ninja" ninja install
@echo.
@echo %toolset% > %mesa%toolset-%abi%.ini

:build_mesa
@set /p buildmesa=Begin mesa build. Proceed (y/n):
@if /i NOT "%buildmesa%"=="y" GOTO build_dxtn
@echo.
@set LLVM=%mesa%llvm\%abi%
@if NOT EXIST %LLVM% (
@echo Could not find LLVM, aborting mesa build.
@echo.
@pause
@GOTO build_dxtn
)
@cd %mesa%
@if NOT EXIST mesa echo Mesa3D source code not found. Attempting to download it using git as long as it is in PATH...
@if NOT EXIST mesa set /p branch=Enter Mesa source code branch name - defaults to master:
@if "%branch%"=="" set branch=master
@if NOT EXIST mesa echo.
@if NOT EXIST mesa git clone --depth=1 --branch=%branch% git://anongit.freedesktop.org/mesa/mesa mesa
@cd mesa
git apply -v ..\mesa-dist-win\patches\scons-llvm5.patch
git apply -v ..\mesa-dist-win\patches\s3tc.patch
@echo.
@set openswr=n
@set sconscmd=python %mesa%Python\Scripts\scons.py build=release platform=windows machine=%longabi% libgl-gdi
@if %abi%==x64 set /p openswr=Do you want to build OpenSWR drivers? (y=yes):
@echo.
@if /I "%openswr%"=="y" set sconscmd=%sconscmd% swr=1
@set /p osmesa=Do you want to build off-screen rendering drivers (y/n):
@echo.
@if /I "%osmesa%"=="y" set sconscmd=%sconscmd% osmesa
@set /p graw=Do you want to build graw library (y/n):
@echo.
@if /I "%graw%"=="y" set sconscmd=%sconscmd% graw-gdi
@GOTO build_with_vs

:build_with_mingw
@set mingw=n
@set mingwtest=0
@if EXIST %gcc% set mingwtest=1
@set msys2=%mesa%msys64\msys2_shell.cmd
@if EXIST %msys2% set mingwtest=%mingwtest%2
@if %mingwtest%==12 set /p mingw=Do you want to build with MinGW-W64 instead of Visual Studio (y=yes):
@set ERRORLEVEL=0
@where /q gcc.exe
@IF ERRORLEVEL 1 set PATH=%gcc%\;%PATH%
@set ERRORLEVEL=0
@if /I "%mingw%"=="y" set sconscmd=%sconscmd% toolchain=crossmingw
@if /I "%mingw%"=="y" copy %gcc%\%altabi%-w64-mingw32-gcc-ar.exe %gcc%\%altabi%-w64-mingw32-ar.exe
@if /I "%mingw%"=="y" copy %gcc%\%altabi%-w64-mingw32-gcc-ranlib.exe %gcc%\%altabi%-w64-mingw32-ranlib.exe
@if /I "%mingw%"=="y" call "%msys2%" -use-full-path
@if /I "%mingw%"=="y" (
pacman -Syu
pacman -S python2
wget https://bootstrap.pypa.io/get-pip.py
python2 get-pip.py
pip install -U mako
pip install -U scons
pip freeze > requirements.txt
pip install -r requirements.txt --upgrade
cd $mesa
cd mesa
GOTO build_mesa_exec
)

:build_with_vs
@set cleanbuild=n
@if EXIST build\windows-%longabi% set /p cleanbuild=Do you want to clean build (y/n):
@if EXIST build\windows-%longabi% echo.
@if /I "%cleanbuild%"=="y" RD /S /Q build\windows-%longabi%
@if %vsenvloaded%==0 (
@call %vsenv%
@cd %mesa%mesa
@echo.
)

:build_mesa_exec
@%sconscmd%
@echo.

:build_dxtn
@if NOT EXIST %gcc% GOTO distcreate
@if NOT EXIST %mesa%dxtn GOTO distcreate
@if NOT EXIST %mesa%mesa GOTO distcreate
@set /p builddxtn=Do you want to build S3 texture compression library? (y/n):
@if /i NOT "%builddxtn%"=="y" GOTO distcreate
@set PATH=%gcc%\;%PATH%
@cd %mesa%dxtn
@echo.
@if EXIST %abi% RD /S /Q %abi%
@MD %abi%
@set dxtn=gcc -shared -m%minabi% -v *.c *.h -I ..\mesa\include -Wl,--dll,--dynamicbase,--enable-auto-image-base,--nxcompat -o %abi%\dxtn.dll
@%dxtn%
@echo.

:distcreate
@set /p dist=Create or update Mesa3D distribution package (y/n):
@echo.
@if /I NOT "%dist%"=="y" GOTO exit
@cd %mesa%
@if NOT EXIST mesa-dist-win MD mesa-dist-win
@cd mesa-dist-win
@if NOT EXIST bin MD bin
@cd bin
@if EXIST %abi% RD /S /Q %abi%
@MD %abi%
@cd %abi%
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\libgl-gdi\opengl32.dll opengl32.dll
@if %abi%==x64 copy %mesa%mesa\build\windows-%longabi%\gallium\drivers\swr\swrAVX.dll swrAVX.dll
@if %abi%==x64 copy %mesa%mesa\build\windows-%longabi%\gallium\drivers\swr\swrAVX2.dll swrAVX2.dll
@copy %mesa%mesa\build\windows-%longabi%\mesa\drivers\osmesa\osmesa.dll osmesa-swrast.dll
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\osmesa\osmesa.dll osmesa-gallium.dll
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\graw-gdi\graw.dll graw.dll
@copy %mesa%dxtn\%abi%\dxtn.dll dxtn.dll
@echo.
@pause

:exit
exit

Build script - distribution creation Drop OpenSWR 32-bit due to it being an unsupported platform


:: Copyright 2014-2015 Viktor Szakats <https://github.com/vszakats>
:: See LICENSE.md

@echo off

set _NAM=%~n0
set _NAM=%_NAM:~3%
set _VER=%1
set _CPU=%2

setlocal
pushd "%_NAM%"

:: Build

set ZLIB_PATH=../../zlib
set OPENSSL_PATH=../../openssl
set OPENSSL_INCLUDE=%OPENSSL_PATH%/include
set OPENSSL_LIBPATH=%OPENSSL_PATH%
set OPENSSL_LIBS=-lssl -lcrypto
set NGHTTP2_PATH=../../nghttp2
set LIBRTMP_PATH=../../librtmp
set LIBSSH2_PATH=../../libssh2
if "%_CPU%" == "win32" set ARCH=w32
if "%_CPU%" == "win64" set ARCH=w64
set CURL_CFLAG_EXTRAS=-DCURL_STATICLIB -DNGHTTP2_STATICLIB -fno-ident
set CURL_LDFLAG_EXTRAS=-static-libgcc -L../../libev/lib -lev

mingw32-make mingw32-clean
:: - '-rtmp' is not enabled because libcurl then (of course) needs librtmp
::   even if its functionality is not actually needed or used
:: - Do not link WinIDN in 32-bit builds, for Windows XP compatibility (missing normaliz.dll)
if "%_CPU%" == "win32" mingw32-make mingw32-ssh2-ssl-sspi-zlib-ldaps-srp-nghttp2-ipv6
if "%_CPU%" == "win64" mingw32-make mingw32-ssh2-ssl-sspi-zlib-ldaps-srp-nghttp2-ipv6-winidn

:: Download CA bundle
if not exist ..\ca-bundle.crt curl -R -fsS -L --proto-redir =https https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt -o ..\ca-bundle.crt

:: Make steps for determinism

if exist lib\*.a   strip -p --enable-deterministic-archives -g lib\*.a
if exist lib\*.lib strip -p --enable-deterministic-archives -g lib\*.lib

python ..\peclean.py src\*.exe
python ..\peclean.py lib\*.dll

touch -c src/*.exe        -r CHANGES
touch -c lib/*.dll        -r CHANGES
touch -c ../ca-bundle.crt -r CHANGES
touch -c lib/*.a          -r CHANGES
touch -c lib/*.lib        -r CHANGES

:: Test run

src\curl.exe --version

:: Create package

set _BAS=%_NAM%-%_VER%-%_CPU%-mingw
set _DST=%TEMP%\%_BAS%

xcopy /y /s /q docs\*.              "%_DST%\docs\*.txt"
xcopy /y /s /q docs\*.html          "%_DST%\docs\"
xcopy /y /s /q docs\libcurl\*.html  "%_DST%\docs\libcurl\"
xcopy /y /s /q include\curl\*.h     "%_DST%\include\curl\"
 copy /y       lib\mk-ca-bundle.pl  "%_DST%\"
 copy /y       lib\mk-ca-bundle.vbs "%_DST%\"
 copy /y       CHANGES              "%_DST%\CHANGES.txt"
 copy /y       COPYING              "%_DST%\COPYING.txt"
 copy /y       README               "%_DST%\README.txt"
 copy /y       RELEASE-NOTES        "%_DST%\RELEASE-NOTES.txt"
xcopy /y /s    src\*.exe            "%_DST%\bin\"
xcopy /y /s    lib\*.dll            "%_DST%\bin\"
 copy /y       ..\ca-bundle.crt     "%_DST%\bin\curl-ca-bundle.crt"

 copy /y       ..\openssl\LICENSE   "%_DST%\LICENSE-openssl.txt"
 copy /y       ..\libssh2\COPYING   "%_DST%\COPYING-libssh2.txt"

if exist lib\*.a   xcopy /y /s lib\*.a   "%_DST%\lib\"
if exist lib\*.lib xcopy /y /s lib\*.lib "%_DST%\lib\"

unix2dos -k %_DST:\=/%/*.txt
unix2dos -k %_DST:\=/%/docs/*.txt

touch -c %_DST:\=/%/docs/examples     -r CHANGES
touch -c %_DST:\=/%/docs/libcurl/opts -r CHANGES
touch -c %_DST:\=/%/docs/libcurl      -r CHANGES
touch -c %_DST:\=/%/docs              -r CHANGES
touch -c %_DST:\=/%/include/curl      -r CHANGES
touch -c %_DST:\=/%/include           -r CHANGES
touch -c %_DST:\=/%/lib               -r CHANGES
touch -c %_DST:\=/%/bin               -r CHANGES
touch -c %_DST:\=/%                   -r CHANGES

call ..\pack.bat
call ..\upload.bat

popd
endlocal

:: Copyright 2014-2015 Viktor Szakats <https://github.com/vszakats>
:: See LICENSE.md

@echo off

set _NAM=%~n0
set _NAM=%_NAM:~3%
set _VER=%1
set _CPU=%2

setlocal
pushd "%_NAM%"

:: Build

set ZLIB_PATH=../../zlib
set OPENSSL_PATH=../../openssl
set OPENSSL_INCLUDE=%OPENSSL_PATH%/include
set OPENSSL_LIBPATH=%OPENSSL_PATH%
set OPENSSL_LIBS=-lssl -lcrypto
set NGHTTP2_PATH=../../nghttp2
set LIBRTMP_PATH=../../librtmp
set LIBSSH2_PATH=../../libssh2
if "%_CPU%" == "win32" set ARCH=w32
if "%_CPU%" == "win64" set ARCH=w64
set CURL_CFLAG_EXTRAS=-DCURL_STATICLIB -DNGHTTP2_STATICLIB -fno-ident
set CURL_LDFLAG_EXTRAS=-static-libgcc -L../../libev/lib -lev

mingw32-make mingw32-clean
:: - '-rtmp' is not enabled because libcurl then (of course) needs librtmp
::   even if its functionality is not actually needed or used
:: - Do not link WinIDN in 32-bit builds, for Windows XP compatibility (missing normaliz.dll)
if "%_CPU%" == "win32" mingw32-make mingw32-ssh2-ssl-sspi-zlib-ldaps-srp-nghttp2-ipv6
if "%_CPU%" == "win64" mingw32-make mingw32-ssh2-ssl-sspi-zlib-ldaps-srp-nghttp2-ipv6-winidn

:: Download CA bundle
if not exist ..\ca-bundle.crt curl -R -fsS -L --proto-redir =https https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt -o ..\ca-bundle.crt

:: Make steps for determinism

if exist lib\*.a   strip -p --enable-deterministic-archives -g lib\*.a
if exist lib\*.lib strip -p --enable-deterministic-archives -g lib\*.lib

python ..\peclean.py src\*.exe
python ..\peclean.py lib\*.dll

touch -c src/*.exe        -r CHANGES
touch -c lib/*.dll        -r CHANGES
touch -c ../ca-bundle.crt -r CHANGES
touch -c lib/*.a          -r CHANGES
touch -c lib/*.lib        -r CHANGES

:: Test run

src\curl.exe --version

:: Create package

set _BAS=%_NAM%-%_VER%-%_CPU%-mingw
set _DST=%TEMP%\%_BAS%

xcopy /y /s /q docs\*.              "%_DST%\docs\*.txt"
xcopy /y /s /q docs\*.html          "%_DST%\docs\"
xcopy /y /s /q docs\libcurl\*.html  "%_DST%\docs\libcurl\"
xcopy /y /s /q include\curl\*.h     "%_DST%\include\curl\"
 copy /y       lib\mk-ca-bundle.pl  "%_DST%\"
 copy /y       lib\mk-ca-bundle.vbs "%_DST%\"
 copy /y       CHANGES              "%_DST%\CHANGES.txt"
 copy /y       COPYING              "%_DST%\COPYING.txt"
 copy /y       README               "%_DST%\README.txt"
 copy /y       RELEASE-NOTES        "%_DST%\RELEASE-NOTES.txt"
xcopy /y /s    src\*.exe            "%_DST%\bin\"
xcopy /y /s    lib\*.dll            "%_DST%\bin\"
 copy /y       ..\ca-bundle.crt     "%_DST%\bin\curl-ca-bundle.crt"

 copy /y       ..\openssl\LICENSE   "%_DST%\LICENSE-openssl.txt"
 copy /y       ..\libssh2\COPYING   "%_DST%\COPYING-libssh2.txt"
::copy /y       ..\librtmp\COPYING   "%_DST%\COPYING-librtmp.txt"
 copy /y       ..\nghttp2\COPYING   "%_DST%\COPYING-nghttp2.txt"
 copy /y       ..\libev\LICENSE     "%_DST%\LICENSE-libev.txt"

if exist lib\*.a   xcopy /y /s lib\*.a   "%_DST%\lib\"
if exist lib\*.lib xcopy /y /s lib\*.lib "%_DST%\lib\"

unix2dos -k %_DST:\=/%/*.txt
unix2dos -k %_DST:\=/%/docs/*.txt

touch -c %_DST:\=/%/docs/examples     -r CHANGES
touch -c %_DST:\=/%/docs/libcurl/opts -r CHANGES
touch -c %_DST:\=/%/docs/libcurl      -r CHANGES
touch -c %_DST:\=/%/docs              -r CHANGES
touch -c %_DST:\=/%/include/curl      -r CHANGES
touch -c %_DST:\=/%/include           -r CHANGES
touch -c %_DST:\=/%/lib               -r CHANGES
touch -c %_DST:\=/%/bin               -r CHANGES
touch -c %_DST:\=/%                   -r CHANGES

call ..\pack.bat
call ..\upload.bat

popd
endlocal

add licenses of enabled components

add licenses of enabled components


::/****************************************************************************
::**
::** Copyright (C) Qxt Foundation. Some rights reserved.
::**
::** This file is part of the Qxt build system of the Qt eXTension library
::**
::** This library is free software; you can redistribute it and/or
::** modify it under the terms of the GNU Lesser General Public
::** License as published by the Free Software Foundation; either
::** version 2.1 of the License, or any later version.
::**
::** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
::** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
::**
::** There is aditional information in the LICENSE file of libqxt.
::** If you did not receive a copy of the file try to download it or
::** contact the libqxt Management
::**
::** <http://libqxt.sourceforge.net>  <aep@exys.org>  <coda@bobandgeorge.com>
::**
::****************************************************************************/

@ECHO off
::set our subroutine handlers
GOTO handle_subroutine

::please prefix all functions with func_ to avoid problems with normal labels
::do not use set errorlevel as you returnvalue cmd will not touch it after we set the errorlevel

:: ---------------------------------MAIN FUNCTION------------------------------------------------------
:func_main
    SET QMAKE=qmake
    SET MAKE=nmake
    SET PROJECT_ROOT=%CD%
    SET TESTDIR=%PROJECT_ROOT%\config.tests
    SET CONFIG_LOG=config.log
    SET LAST_FUNC_RET=0

    del %PROJECT_ROOT%\config.in >>Nul
    del %PROJECT_ROOT%\config.log >>Nul
    del %PROJECT_ROOT%\depends.pri >>Nul

    echo #depends.pri > %PROJECT_ROOT%\depends.pri

    ::this is a workaround for supporting win9x
    ::win9x does not support passing all commandline params with %*
    :: %CALL_SUB% func_readArgs %*
    ::

    shift

    GOTO lbl_func_readArgs
    :win9x_end_readArgs
    IF %LAST_FUNC_RET% == 1 goto RETURN

    %CALL_SUB% func_detectTools
    IF %LAST_FUNC_RET% == 1 goto RETURN

    %CALL_SUB% func_testLibs openssl OPENSSL

    %CALL_SUB% func_testLibs ffmpeg FFMPEG

    %CALL_SUB% func_testLibs sdl SDL

    %CALL_SUB% func_testLibs curses CURSES

    echo autodetection finished running qmake
    cd %PROJECT_ROOT%
    %CALL_SUB% func_compile

GOTO RETURN
::--------------------------------End of main----------------------------------------------------------

:: ----func_test3rdParty Test for 3rdparty libs
:: param 0 name of lib
:: param 1 name param to add to project file
::-----------------------------------------
:func_testLibs
    echo testing for %0
    echo %0 >>%PROJECT_ROOT%\%CONFIG_LOG%
    cd %TESTDIR%\%0
    %QMAKE% >>%PROJECT_ROOT%\%CONFIG_LOG%
    IF NOT %ERRORLEVEL% == 0 (
        GOTO lbl_testLibs_error
    )

    %MAKE% clean >>Nul

    %MAKE% >>%PROJECT_ROOT%\%CONFIG_LOG%
    IF %ERRORLEVEL% == 0 (
        echo DEFINES+=HAVE_%1% >>%PROJECT_ROOT%\config.in
        echo .....[SUCCESS]
        SET LAST_FUNC_RET=0
        GOTO lbl_testLibs_end
    )

    :lbl_testLibs_error
    echo .....[FAILED]
    SET LAST_FUNC_RET=1

    :lbl_testLibs_end
    cd %PROJECT_ROOT%

GOTO RETURN

:: ----func_detectTools
:: looks for qmake and make
:func_detectTools
    echo autodetecting tools

    ::checking for Qmake
    echo    testing for qmake

    qmake -v >>%PROJECT_ROOT%\%CONFIG_LOG%
    IF NOT %ERRORLEVEL% == 0 (
    echo    You don't seem to have 'qmake' in your PATH.
    echo    Cannot proceed.
    SET LAST_FUNC_RET=1
    GOTO RETURN
    )
    echo    qmake found

    echo testing for make

    :detectTools_test_make

    echo    testing for nmake
    nmake /? >>%PROJECT_ROOT%\%CONFIG_LOG%
    IF NOT %ERRORLEVEL% == 0 GOTO lbl_test_gmake
    echo    using nmake
    SET MAKE=nmake
    GOTO detectTools_end_test_make

    :lbl_test_gmake
    echo    testing for gnu make
    make -v >>%PROJECT_ROOT%\%CONFIG_LOG%
    IF NOT %ERRORLEVEL% == 0 GOTO lbl_test_mingw
    echo    using make
    SET MAKE=make
    GOTO detectTools_end_test_make

    :lbl_test_mingw
    echo    testing for mingw32-make
    mingw32-make  -v >>%PROJECT_ROOT%\%CONFIG_LOG%
    IF NOT %ERRORLEVEL% == 0   GOTO lbl_make_not_found
    echo    using mingw32-make
    SET MAKE=mingw32-make
    GOTO detectTools_end_test_make

    :lbl_no_make
    echo    You don't seem to have 'make' or 'nmake' in your PATH.
    echo    Cannot proceed.
    SET LAST_FUNC_RET=1
    GOTO RETURN

    :detectTools_end_test_make
    SET LAST_FUNC_RET=0
GOTO RETURN

:: ----func_compile
:func_compile
    copy %PROJECT_ROOT%\config.pri %PROJECT_ROOT%\config.pri.bak >>Nul
    copy %PROJECT_ROOT%\config.in %PROJECT_ROOT%\config.pri >>Nul
    del %PROJECT_ROOT%\config.in >>Nul
    %QMAKE% %MSVCMODE% -recursive
GOTO RETURN

:: ----func_readArgs
:lbl_func_readArgs
    set QMAKEBIN=qmake
    set MSVCMODE=
    echo include(depends.pri) > %PROJECT_ROOT%\config.in
    echo QXT_stability += unknown >> %PROJECT_ROOT%\config.in

    :top
    if "%0" == "" goto finish
    if "%0" == "-qmake-bin" (
        set QMAKEBIN=%1
        goto bottom2
    )

    if "%0" == "-I" (
        echo INCLUDEPATH += "%1" >> %PROJECT_ROOT%\depends.pri
        goto bottom2
    )

    if "%0" == "-L" (
        echo LIBS += -L"%1" >> %PROJECT_ROOT%\depends.pri
        goto bottom2
    )

    if "%0" == "-l" (
        echo LIBS += -l"%1" >> %PROJECT_ROOT%\depends.pri
        goto bottom2
    )

    if "%0" == "-nomake" (
        echo QXT_BUILD -= %1 >> %PROJECT_ROOT%\config.in
        goto bottom2
    )

    if "%0" == "-prefix" (
        echo QXTINSTALLDIR = %1 >> %PROJECT_ROOT%\config.in
        goto bottom2
    )

    if "%0" == "-libdir" (
        echo target.path = %1 >> %PROJECT_ROOT%\config.in
        goto bottom2
    )

    if "%0" == "-docdir" (
        echo docs.path = %1 >> %PROJECT_ROOT%\config.in
        goto bottom2
    )

    if "%0" == "-headerdir" (
        echo include.path = %1 >> %PROJECT_ROOT%\config.in
        goto bottom2
    )

    if "%0" == "-bindir" (
        echo bin.path = %1 >> %PROJECT_ROOT%\config.in
        goto bottom2
    )

    if "%0" == "-ignore-stability" (
        echo QXT_ignore_stability += %1 >> %PROJECT_ROOT%\config.in
        goto bottom2
    )

    if "%0" == "-static" (
        echo CONFIG += static staticlib >> %PROJECT_ROOT%\config.in
        goto bottom
    )

    if "%0" == "-debug" (
        echo CONFIG += debug >> %PROJECT_ROOT%\config.in
        goto bottom
    )

    if "%0" == "-release" (
        echo CONFIG += release >> %PROJECT_ROOT%\config.in
        goto bottom
    )

    if "%0" == "-no-stability-unknown" (
        echo QXT_stability -= unknown >> %PROJECT_ROOT%\config.in
        goto bottom
    )

    if "%0" == "-no-openssl" (
        echo QXT_LIBS -= openssl >> %PROJECT_ROOT%\config.in
        goto bottom
    )

    if "%0" == "-msvc" (
        set MSVCMODE=-tp vc
        goto bottom
    )

    if "%0" == "/help" goto help
    if "%0" == "-help" goto help
    if "%0" == "--help" goto help
    if "%0" == "/?" goto help

    echo Unrecognized configure option: %0
    del %PROJECT_ROOT%\config.in
    SET LAST_FUNC_RET=1
    GOTO RETURN

    :bottom2
        shift
    :bottom
        shift
    goto top

    :help
        echo Usage: configure [-prefix (dir)] [-libdir (dir)] [-docdir (dir)]
        echo        [-bindir (dir)] [-headerdir (dir)] [-qmake-bin (path)]
        echo        [-static] [-debug] [-release] [-no-stability-unknown]
        echo        [-no-openssl] [-nomake (module)] [-msvc]
        echo.
        echo Installation options:
        echo.
        echo -prefix (dir) ....... This will install everything relative to (dir)
        echo                       default: C:\libqxt
        echo -libdir (dir) ....... Libraries will be installed to (dir)
        echo                       default: PREFIX/lib
        echo -docdir (dir) ....... Documentation will be installed to (dir)
        echo                       default: PREFIX/share/doc
        echo -bindir (dir) ....... Executables will be installed to (dir)
        echo                       default: PREFIX/bin
        echo -headerdir (dir) .... Include files will be installed to (dir)
        echo                       default: PREFIX/include
        echo -qmake-bin (path) ... Specifies the path to the qmake executable
        echo                       default: search the system path
        echo -L (path)............ Specifies the a additional library search path
        echo -I (path)............ Specifies the a additional include search path
        echo -l (path)............ Add a custom library
        echo -static ............. Compile Qxt as a static library
        echo -debug .............. Build Qxt with debugging symbols
        echo -release ............ Build Qxt without debugging support
        echo -no-stability-unknown Do not build untested classes
        echo -no-openssl ......... Do not link to OpenSSL
        echo -nomake (module) .... Do not compile the specified module
        echo                       options: kit network gui sql media curses web
        echo -msvc ............... Configure Qxt to use Microsoft Visual Studio

        del %PROJECT_ROOT%\config.in
        SET LAST_FUNC_RET=1
        GOTO RETURN

    :finish
    ::return with errorlevel 0
    SET LAST_FUNC_RET=0
GOTO win9x_end_readArgs

::-----------------------------------subroutine handler do not touch this---------------------------
:handle_subroutine
    :: if we are not in a subroutine call goto main
    IF (CALL_FNC)==(%1) (
        ::make %0 the first argument
        shift
        shift
        shift
        ::shift
        GOTO %2 ::this calls the subroutines in this file
    )
    SET ROOTDIR=%CD%
    set CALL_SUB=CALL %0 CALL_FNC
    GOTO func_main

:RETURN {End-of-code}

@ECHO off
SET QMAKE=qmake
SET MAKE=nmake
SET PROJECT_ROOT=%CD%
SET TESTDIR=%PROJECT_ROOT%\config.tests
SET CONFIG_LOG=config.log
SET LAST_FUNC_RET=0

del %PROJECT_ROOT%\config.in >>Nul
del %PROJECT_ROOT%\config.log >>Nul
del %PROJECT_ROOT%\depends.pri >>Nul

echo #depends.pri > %PROJECT_ROOT%\depends.pri

shift
set QMAKEBIN=qmake
set MSVCMODE=
set OPENSSL=1
set CURSES=1
echo include(depends.pri) > %PROJECT_ROOT%\config.in
echo QXT_stability += unknown >> %PROJECT_ROOT%\config.in

:top
if "%0" == ""            goto finish
if "%0" == "-qmake-bin"  goto setqmake
if "%0" == "-I"          goto addinclude
if "%0" == "-L"          goto addlibpath
if "%0" == "-l"          goto addlib
if "%0" == "-nomake"     goto nomake
if "%0" == "-prefix"     goto prefix
if "%0" == "-libdir"     goto libdir
if "%0" == "-docdir"     goto docdir
if "%0" == "-headerdir"  goto headerdir
if "%0" == "-bindir"     goto bindir
if "%0" == "-static"     goto static
if "%0" == "-debug"      goto debug
if "%0" == "-release"    goto release
if "%0" == "-no-openssl" goto noopenssl
if "%0" == "-msvc"       goto msvc
if "%0" == "/help"       goto help
if "%0" == "-help"       goto help
if "%0" == "--help"      goto help
if "%0" == "/?"          goto help

echo Unrecognized configure option: %0
del %PROJECT_ROOT%\config.in
goto end

:setqmake
set QMAKEBIN=%1
goto bottom2

:addinclude
echo INCLUDEPATH += "%1" >> %PROJECT_ROOT%\depends.pri
goto bottom2

:addlibpath
echo LIBS += -L"%1" >> %PROJECT_ROOT%\depends.pri
goto bottom2

:addlib
echo LIBS += -l"%1" >> %PROJECT_ROOT%\depends.pri
goto bottom2

:nomake
if "%1"=="curses" set CURSES=0
echo QXT_BUILD -= %1 >> %PROJECT_ROOT%\config.in
goto bottom2

:prefix
echo QXTINSTALLDIR = %1 >> %PROJECT_ROOT%\config.in
goto bottom2

:libdir
echo target.path = %1 >> %PROJECT_ROOT%\config.in
goto bottom2

:docdir
echo docs.path = %1 >> %PROJECT_ROOT%\config.in
goto bottom2

:headerdir
echo include.path = %1 >> %PROJECT_ROOT%\config.in
goto bottom2

:bindir
echo bin.path = %1 >> %PROJECT_ROOT%\config.in
goto bottom2

:static
echo CONFIG += static staticlib >> %PROJECT_ROOT%\config.in
goto bottom

:debug
echo CONFIG += debug >> %PROJECT_ROOT%\config.in
goto bottom

:release
echo CONFIG += release >> %PROJECT_ROOT%\config.in
goto bottom

:noopenssl
set OPENSSL=0
echo QXT_LIBS -= openssl >> %PROJECT_ROOT%\config.in
goto bottom

:msvc
set MSVCMODE=-tp vc
goto bottom

:bottom2
    shift
:bottom
    shift
goto top

:help
    echo Usage: configure [-prefix (dir)] [-libdir (dir)] [-docdir (dir)]
    echo        [-bindir (dir)] [-headerdir (dir)] [-qmake-bin (path)]
    echo        [-static] [-debug] [-release] [-no-stability-unknown]
    echo        [-no-openssl] [-nomake (module)] [-msvc]
    echo.
    echo Installation options:
    echo.
    echo -prefix (dir) ....... This will install everything relative to (dir)
    echo                       default: C:\libqxt
    echo -libdir (dir) ....... Libraries will be installed to (dir)
    echo                       default: PREFIX/lib
    echo -docdir (dir) ....... Documentation will be installed to (dir)
    echo                       default: PREFIX/share/doc
    echo -bindir (dir) ....... Executables will be installed to (dir)
    echo                       default: PREFIX/bin
    echo -headerdir (dir) .... Include files will be installed to (dir)
    echo                       default: PREFIX/include
    echo -qmake-bin (path) ... Specifies the path to the qmake executable
    echo                       default: search the system path
    echo -L (path)............ Specifies the a additional library search path
    echo -I (path)............ Specifies the a additional include search path
    echo -l (path)............ Add a custom library
    echo -static ............. Compile Qxt as a static library
    echo -debug .............. Build Qxt with debugging symbols
    echo -release ............ Build Qxt without debugging support
    echo -no-openssl ......... Do not link to OpenSSL
    echo -nomake (module) .... Do not compile the specified module
    echo                       options: kit network gui sql media curses web
    echo -msvc ............... Configure Qxt to use Microsoft Visual Studio

    del %PROJECT_ROOT%\config.in
    goto end

:finish
echo    Testing for qmake...
qmake -v >> %PROJECT_ROOT%\%CONFIG_LOG%
if errorlevel 1 goto qmakeERR
goto qmakeOK
:qmakeERR
echo    You don't seem to have 'qmake' in your PATH.
echo    Cannot proceed.
goto end

:qmakeOK
echo    Testing for nmake...
nmake /? >> %PROJECT_ROOT%\%CONFIG_LOG%
if errorlevel 1 goto nmakeERR
echo    Using nmake.
SET MAKE=nmake
GOTO detectTools_end_test_make

:nmakeERR
echo    Testing for GNU make...
make -v >> %PROJECT_ROOT%\%CONFIG_LOG%
if errorlevel 1 goto gmakeERR
echo    Using GNU make.
SET MAKE=make
GOTO detectTools_end_test_make

:gmakeERR
echo    Testing for mingw32-make...
mingw32-make -v >> %PROJECT_ROOT%\%CONFIG_LOG%
if errorlevel 1 goto mingwmakeERR
echo    Using mingw32-make.
SET MAKE=mingw32-make
GOTO detectTools_end_test_make

:mingwmakeERR
echo    You don't seem to have 'make.' 'mingw32-make,' or 'nmake' in your PATH.
echo    Cannot proceed.
goto end

:detectTools_end_test_make
if "%OPENSSL%"=="0" goto skipopenssltest
echo Testing for OpenSSL...
echo OpenSSL... >> %PROJECT_ROOT%\%CONFIG_LOG%
cd %TESTDIR%\openssl
%QMAKE% >> %PROJECT_ROOT%\%CONFIG_LOG%
if errorlevel 1 goto testfailed
%MAKE% clean >> %PROJECT_ROOT%\%CONFIG_LOG%
%MAKE% >> %PROJECT_ROOT%\%CONFIG_LOG%
if errorlevel 1 goto testfailed

:skipopenssltest
if "%CURSES%"=="0" goto skipcursestest
echo Testing for curses...
echo curses... >> %PROJECT_ROOT%\%CONFIG_LOG%
cd %TESTDIR%\curses
%QMAKE% >> %PROJECT_ROOT%\%CONFIG_LOG%
if errorlevel 1 goto testfailed
%MAKE% clean >> %PROJECT_ROOT%\%CONFIG_LOG%
%MAKE% >> %PROJECT_ROOT%\%CONFIG_LOG%
if errorlevel 1 goto testfailed

goto alltestsok

:testfailed
echo Test failed. Cannot proceed.
goto end

:skipcursestest
:alltestsok
cd %PROJECT_ROOT%

echo Configuration successful. Generating makefiles.
copy %PROJECT_ROOT%\config.pri %PROJECT_ROOT%\config.pri.bak >> %PROJECT_ROOT%\%CONFIG_LOG%
copy %PROJECT_ROOT%\config.in %PROJECT_ROOT%\config.pri >> %PROJECT_ROOT%\%CONFIG_LOG%
del %PROJECT_ROOT%\config.in >> %PROJECT_ROOT%\%CONFIG_LOG%
%QMAKE% %MSVCMODE% -recursive
if errorlevel 1 goto mainqmakeERR

echo Makefiles generated. Run %MAKE% now.
goto end

:mainqmakeERR
echo Error running qmake. Cannot proceed.
goto end

:end

rewrite configure.bat AGAIN ~nb

rewrite configure.bat AGAIN ~nb


REM See https://gist.github.com/cobyism/4730490
git stpp dist origin gh-pages

Add publish.cmd

Add publish.cmd


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

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

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

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

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

:SelectNodeVersion

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

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

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

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

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

goto :EOF

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

:Deployment
echo Handling node.js deployment.

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

:: 2. Select node version
call :SelectNodeVersion

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

  pushd "%DEPLOYMENT_TARGET%"
  echo "Building web site using build script"
  call :ExecuteCmd !NPM_CMD! run build
  if !ERRORLEVEL! NEQ 0 goto error
  popd
)

:: 4. Build the webclient
IF EXIST "%DEPLOYMENT_TARGET%\build" (
  pushd "%DEPLOYMENT_TARGET%\build"
  echo "Putting build content in parent direct"
  call :ExecuteCmd move *.* ..
 :: call :ExecuteCmd ".\node_modules\.bin\gulp.cmd"
  if !ERRORLEVEL! NEQ 0 goto error
  popd
)

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

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

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

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

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

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

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

:SelectNodeVersion

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

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

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

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

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

goto :EOF

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

:Deployment
echo Handling node.js deployment.

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

:: 2. Select node version
call :SelectNodeVersion

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

  pushd "%DEPLOYMENT_TARGET%"
  echo "Building web site using build script"
  call :ExecuteCmd !NPM_CMD! run build
  if !ERRORLEVEL! NEQ 0 goto error
  popd
)

:: 4. Build the webclient
IF EXIST "%DEPLOYMENT_TARGET%\build" (
  pushd "%DEPLOYMENT_TARGET%\build"
  echo "Putting build content in parent direct"
  call :ExecuteCmd move *.* ..
  call :ExecuteCmd move static ..
 :: call :ExecuteCmd ".\node_modules\.bin\gulp.cmd"
  if !ERRORLEVEL! NEQ 0 goto error
  popd
)

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

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

Add moving of the static directory to deploy


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

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

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

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

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

:SelectNodeVersion

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

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

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

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

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

goto :EOF

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

:Deployment
echo Handling node.js deployment.

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

:: 2. Select node version
call :SelectNodeVersion

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

:: 4. Run gulp transformations
IF EXIST "%DEPLOYMENT_SOURCE%\gulpfile.js" (
  echo Running gulp
  pushd "%DEPLOYMENT_SOURCE%"
  call :ExecuteCmd .\node_modules\.bin\gulp
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

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

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

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

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

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

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

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

:SelectNodeVersion

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

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

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

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

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

goto :EOF

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

:Deployment
echo Handling node.js deployment.

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

:: 2. Select node version
call :SelectNodeVersion

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

:: 4. Run gulp transformations
IF EXIST "%DEPLOYMENT_SOURCE%\gulpfile.js" (
  echo Running gulp
  pushd "%DEPLOYMENT_SOURCE%"
  call :ExecuteCmd .\node_modules\.bin\gulp.js
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

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

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

edit deploy.cmd

edit deploy.cmd


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

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

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

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

:: Setup
:: -----
:: Setup npm global path to d:\home

echo Print variables
echo dp0=%~dp0%
echo ARTIFACTS=%ARTIFACTS%
echo DEPLOYMENT_SOURCE=%DEPLOYMENT_SOURCE%
echo DEPLOYMENT_TARGET=%DEPLOYMENT_TARGET%
echo NEXT_MANIFEST_PATH=%NEXT_MANIFEST_PATH%
echo PREVIOUS_MANIFEST_PATH=%PREVIOUS_MANIFEST_PATH%
echo DEPLOYMENT_TEMP=%DEPLOYMENT_TEMP%
echo IN_PLACE_DEPLOYMENT=%IN_PLACE_DEPLOYMENT%
echo ANGUALR_CLI=%ANGUALR_CLI%

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

IF NOT EXIST "%HOME%\tools" (MKDIR "%HOME%\tools")

SET PATH=%PATH%;%HOME%\tools

call npm config set prefix "%HOME%\tools"
IF !ERRORLEVEL! NEQ 0 goto error

echo Installing yarn
call npm install -g yarn
IF !ERRORLEVEL! NEQ 0 goto error

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

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

echo Handling backend WebApi project.
echo Restore NuGet packages
call :ExecuteCmd nuget restore "%DEPLOYMENT_SOURCE%\AzureFunctions.sln"
IF !ERRORLEVEL! NEQ 0 goto error

:: 1. Build backend WebApi to the temporary path
echo "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\AzureFunctions\AzureFunctions.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false  /p:DeleteExistingFiles=False /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\AzureFunctions\AzureFunctions.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false  /p:DeleteExistingFiles=False /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
IF !ERRORLEVEL! NEQ 0 goto error

echo Handling frontend Angular2 project.
:: 2. Bundle frontend angular2 app to the temporary path
	pushd "%DEPLOYMENT_SOURCE%\AzureFunctions.AngularClient"
	echo Restore yarn packages
	call :ExecuteCmd yarn install
	IF !ERRORLEVEL! NEQ 0 (
		call :ExecuteCmd yarn install
		IF !ERRORLEVEL! NEQ 0 goto error
	)
	echo Bundle angular2 app
	call :ExecuteCmd node_modules\.bin\ng build --environment=prod --output-path="%ARTIFACTS%\dist"
	IF !ERRORLEVEL! NEQ 0 (
		call :ExecuteCmd node_modules\.bin\ng build --environment=prod --output-path="%ARTIFACTS%\dist"
		IF !ERRORLEVEL! NEQ 0 goto error
	)

	echo Copy angular output to the temporary path
		echo ROBOCOPY "%ARTIFACTS%\dist" "%DEPLOYMENT_TEMP%" /E /IS
		call :ExecuteCmd ROBOCOPY "%ARTIFACTS%\dist" "%DEPLOYMENT_TEMP%" /E /IS
		:: http://ss64.com/nt/robocopy-exit.html
		IF %ERRORLEVEL% EQU 16 echo ***FATAL ERROR*** & goto error
		IF %ERRORLEVEL% EQU 15 echo OKCOPY + FAIL + MISMATCHES + XTRA & goto error
		IF %ERRORLEVEL% EQU 14 echo FAIL + MISMATCHES + XTRA & goto error
		IF %ERRORLEVEL% EQU 13 echo OKCOPY + FAIL + MISMATCHES & goto error
		IF %ERRORLEVEL% EQU 12 echo FAIL + MISMATCHES& goto error
		IF %ERRORLEVEL% EQU 11 echo OKCOPY + FAIL + XTRA & goto error
		IF %ERRORLEVEL% EQU 10 echo FAIL + XTRA & goto error
		IF %ERRORLEVEL% EQU 9 echo OKCOPY + FAIL & goto error
		IF %ERRORLEVEL% EQU 8 echo FAIL & goto error
		IF %ERRORLEVEL% EQU 7 echo OKCOPY + MISMATCHES + XTRA & goto error
		IF %ERRORLEVEL% EQU 6 echo MISMATCHES + XTRA & goto error
		IF %ERRORLEVEL% EQU 5 echo OKCOPY + MISMATCHES & goto error
		IF %ERRORLEVEL% EQU 4 echo MISMATCHES & goto error
		IF %ERRORLEVEL% EQU 3 echo OKCOPY + XTRA
		IF %ERRORLEVEL% EQU 2 echo XTRA
		IF %ERRORLEVEL% EQU 1 echo OKCOPY
		IF %ERRORLEVEL% EQU 0 echo No Change

		IF EXIST "%DEPLOYMENT_SOURCE%\AzureFunctions.AngularClient\node_modules\swagger-editor" (
			echo Copy Swagger Editor to output
			echo ROBOCOPY "%DEPLOYMENT_SOURCE%\AzureFunctions.AngularClient\node_modules\swagger-editor" "%DEPLOYMENT_TEMP%\node_modules\swagger-editor" /E /IS
			call :ExecuteCmd ROBOCOPY "%DEPLOYMENT_SOURCE%\AzureFunctions.AngularClient\node_modules\swagger-editor" "%DEPLOYMENT_TEMP%\node_modules\swagger-editor" /E /IS
			:: http://ss64.com/nt/robocopy-exit.html
			IF %ERRORLEVEL% EQU 16 echo ***FATAL ERROR*** & goto error
			IF %ERRORLEVEL% EQU 15 echo OKCOPY + FAIL + MISMATCHES + XTRA & goto error
			IF %ERRORLEVEL% EQU 14 echo FAIL + MISMATCHES + XTRA & goto error
			IF %ERRORLEVEL% EQU 13 echo OKCOPY + FAIL + MISMATCHES & goto error
			IF %ERRORLEVEL% EQU 12 echo FAIL + MISMATCHES& goto error
			IF %ERRORLEVEL% EQU 11 echo OKCOPY + FAIL + XTRA & goto error
			IF %ERRORLEVEL% EQU 10 echo FAIL + XTRA & goto error
			IF %ERRORLEVEL% EQU 9 echo OKCOPY + FAIL & goto error
			IF %ERRORLEVEL% EQU 8 echo FAIL & goto error
			IF %ERRORLEVEL% EQU 7 echo OKCOPY + MISMATCHES + XTRA & goto error
			IF %ERRORLEVEL% EQU 6 echo MISMATCHES + XTRA & goto error
			IF %ERRORLEVEL% EQU 5 echo OKCOPY + MISMATCHES & goto error
			IF %ERRORLEVEL% EQU 4 echo MISMATCHES & goto error
			IF %ERRORLEVEL% EQU 3 echo OKCOPY + XTRA
			IF %ERRORLEVEL% EQU 2 echo XTRA
			IF %ERRORLEVEL% EQU 1 echo OKCOPY
			IF %ERRORLEVEL% EQU 0 echo No Change
		)

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

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

IF EXIST %WEBJOB_PATH%\templates-update.cmd (
    del %WEBJOB_PATH%\templates-update.cmd
)

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

:: 5. update build.txt
call :ExecuteCmd echo %SCM_COMMIT_ID% > %DEPLOYMENT_TARGET%\build.txt
IF !ERRORLEVEL! NEQ 0 (
  call :ExecuteCmd echo %SCM_COMMIT_ID% > %DEPLOYMENT_TARGET%\build.txt
  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: 1.0.6
:: ----------------------

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

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

:: Setup
:: -----
:: Setup npm global path to d:\home

echo Print variables
echo dp0=%~dp0%
echo ARTIFACTS=%ARTIFACTS%
echo DEPLOYMENT_SOURCE=%DEPLOYMENT_SOURCE%
echo DEPLOYMENT_TARGET=%DEPLOYMENT_TARGET%
echo NEXT_MANIFEST_PATH=%NEXT_MANIFEST_PATH%
echo PREVIOUS_MANIFEST_PATH=%PREVIOUS_MANIFEST_PATH%
echo DEPLOYMENT_TEMP=%DEPLOYMENT_TEMP%
echo IN_PLACE_DEPLOYMENT=%IN_PLACE_DEPLOYMENT%
echo ANGUALR_CLI=%ANGUALR_CLI%

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

IF NOT EXIST "%HOME%\tools" (MKDIR "%HOME%\tools")

SET PATH=%PATH%;%HOME%\tools

call npm config set prefix "%HOME%\tools"
IF !ERRORLEVEL! NEQ 0 goto error

echo Installing yarn
call npm install -g yarn
IF !ERRORLEVEL! NEQ 0 goto error

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

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

echo Handling backend WebApi project.
echo Restore NuGet packages
call :ExecuteCmd nuget restore "%DEPLOYMENT_SOURCE%\AzureFunctions.sln"
IF !ERRORLEVEL! NEQ 0 goto error

:: 1. Build backend WebApi to the temporary path
echo "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\AzureFunctions\AzureFunctions.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false  /p:DeleteExistingFiles=False /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\AzureFunctions\AzureFunctions.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false  /p:DeleteExistingFiles=False /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
IF !ERRORLEVEL! NEQ 0 goto error

echo Handling frontend Angular2 project.
:: 2. Bundle frontend angular2 app to the temporary path
	pushd "%DEPLOYMENT_SOURCE%\AzureFunctions.AngularClient"
	echo Restore yarn packages
	call :ExecuteCmd yarn install
	IF !ERRORLEVEL! NEQ 0 (
		call :ExecuteCmd yarn install
		IF !ERRORLEVEL! NEQ 0 goto error
	)
	echo Bundle angular2 app
	call :ExecuteCmd node_modules\.bin\ng build --prod --environment=prod --output-path="%ARTIFACTS%\dist"
	IF !ERRORLEVEL! NEQ 0 (
		call :ExecuteCmd node_modules\.bin\ng build --prod --environment=prod --output-path="%ARTIFACTS%\dist"
		IF !ERRORLEVEL! NEQ 0 goto error
	)

	echo Copy angular output to the temporary path
		echo ROBOCOPY "%ARTIFACTS%\dist" "%DEPLOYMENT_TEMP%" /E /IS
		call :ExecuteCmd ROBOCOPY "%ARTIFACTS%\dist" "%DEPLOYMENT_TEMP%" /E /IS
		:: http://ss64.com/nt/robocopy-exit.html
		IF %ERRORLEVEL% EQU 16 echo ***FATAL ERROR*** & goto error
		IF %ERRORLEVEL% EQU 15 echo OKCOPY + FAIL + MISMATCHES + XTRA & goto error
		IF %ERRORLEVEL% EQU 14 echo FAIL + MISMATCHES + XTRA & goto error
		IF %ERRORLEVEL% EQU 13 echo OKCOPY + FAIL + MISMATCHES & goto error
		IF %ERRORLEVEL% EQU 12 echo FAIL + MISMATCHES& goto error
		IF %ERRORLEVEL% EQU 11 echo OKCOPY + FAIL + XTRA & goto error
		IF %ERRORLEVEL% EQU 10 echo FAIL + XTRA & goto error
		IF %ERRORLEVEL% EQU 9 echo OKCOPY + FAIL & goto error
		IF %ERRORLEVEL% EQU 8 echo FAIL & goto error
		IF %ERRORLEVEL% EQU 7 echo OKCOPY + MISMATCHES + XTRA & goto error
		IF %ERRORLEVEL% EQU 6 echo MISMATCHES + XTRA & goto error
		IF %ERRORLEVEL% EQU 5 echo OKCOPY + MISMATCHES & goto error
		IF %ERRORLEVEL% EQU 4 echo MISMATCHES & goto error
		IF %ERRORLEVEL% EQU 3 echo OKCOPY + XTRA
		IF %ERRORLEVEL% EQU 2 echo XTRA
		IF %ERRORLEVEL% EQU 1 echo OKCOPY
		IF %ERRORLEVEL% EQU 0 echo No Change

		IF EXIST "%DEPLOYMENT_SOURCE%\AzureFunctions.AngularClient\node_modules\swagger-editor" (
			echo Copy Swagger Editor to output
			echo ROBOCOPY "%DEPLOYMENT_SOURCE%\AzureFunctions.AngularClient\node_modules\swagger-editor" "%DEPLOYMENT_TEMP%\node_modules\swagger-editor" /E /IS
			call :ExecuteCmd ROBOCOPY "%DEPLOYMENT_SOURCE%\AzureFunctions.AngularClient\node_modules\swagger-editor" "%DEPLOYMENT_TEMP%\node_modules\swagger-editor" /E /IS
			:: http://ss64.com/nt/robocopy-exit.html
			IF %ERRORLEVEL% EQU 16 echo ***FATAL ERROR*** & goto error
			IF %ERRORLEVEL% EQU 15 echo OKCOPY + FAIL + MISMATCHES + XTRA & goto error
			IF %ERRORLEVEL% EQU 14 echo FAIL + MISMATCHES + XTRA & goto error
			IF %ERRORLEVEL% EQU 13 echo OKCOPY + FAIL + MISMATCHES & goto error
			IF %ERRORLEVEL% EQU 12 echo FAIL + MISMATCHES& goto error
			IF %ERRORLEVEL% EQU 11 echo OKCOPY + FAIL + XTRA & goto error
			IF %ERRORLEVEL% EQU 10 echo FAIL + XTRA & goto error
			IF %ERRORLEVEL% EQU 9 echo OKCOPY + FAIL & goto error
			IF %ERRORLEVEL% EQU 8 echo FAIL & goto error
			IF %ERRORLEVEL% EQU 7 echo OKCOPY + MISMATCHES + XTRA & goto error
			IF %ERRORLEVEL% EQU 6 echo MISMATCHES + XTRA & goto error
			IF %ERRORLEVEL% EQU 5 echo OKCOPY + MISMATCHES & goto error
			IF %ERRORLEVEL% EQU 4 echo MISMATCHES & goto error
			IF %ERRORLEVEL% EQU 3 echo OKCOPY + XTRA
			IF %ERRORLEVEL% EQU 2 echo XTRA
			IF %ERRORLEVEL% EQU 1 echo OKCOPY
			IF %ERRORLEVEL% EQU 0 echo No Change
		)

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

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

IF EXIST %WEBJOB_PATH%\templates-update.cmd (
    del %WEBJOB_PATH%\templates-update.cmd
)

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

:: 5. update build.txt
call :ExecuteCmd echo %SCM_COMMIT_ID% > %DEPLOYMENT_TARGET%\build.txt
IF !ERRORLEVEL! NEQ 0 (
  call :ExecuteCmd echo %SCM_COMMIT_ID% > %DEPLOYMENT_TARGET%\build.txt
  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 --prod to build output

Add --prod to build output


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

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

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

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

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

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

echo Handling ASP.NET Core Web Application deployment.

:: 0. Install Azure Artifacts Credential Provider for NuGet
call :ExecuteCmd @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://github.com/Microsoft/artifacts-credprovider/blob/master/helpers/installcredprovider.ps1'))"
IF !ERRORLEVEL! NEQ 0 goto error

:: 1. Restore nuget packages
call :ExecuteCmd dotnet restore "%DEPLOYMENT_SOURCE%\live.asp.net.sln" %RESTORE_ARGS%
IF !ERRORLEVEL! NEQ 0 goto error

:: 2. Build and publish
call :ExecuteCmd dotnet publish "%DEPLOYMENT_SOURCE%\src\live.asp.net\live.asp.net.csproj" --output "%DEPLOYMENT_TEMP%" --configuration Release %PUBLISH_ARGS%
IF !ERRORLEVEL! NEQ 0 goto error

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

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

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

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

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

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

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

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

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

echo Handling ASP.NET Core Web Application deployment.

:: 0. Install Azure Artifacts Credential Provider for NuGet
call :ExecuteCmd @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.ps1'))"
IF !ERRORLEVEL! NEQ 0 goto error

:: 1. Restore nuget packages
call :ExecuteCmd dotnet restore "%DEPLOYMENT_SOURCE%\live.asp.net.sln" %RESTORE_ARGS%
IF !ERRORLEVEL! NEQ 0 goto error

:: 2. Build and publish
call :ExecuteCmd dotnet publish "%DEPLOYMENT_SOURCE%\src\live.asp.net\live.asp.net.csproj" --output "%DEPLOYMENT_TEMP%" --configuration Release %PUBLISH_ARGS%
IF !ERRORLEVEL! NEQ 0 goto error

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

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

Fix deployment script

Fix deployment script


@echo off
if exist C:\Python26\python.exe (
    C:\Python26\python.exe %~dp0\clcache.py %*
) else (
    python.exe %~dp0\clcache.py %*
)

Use "python.exe" in PATH too, instead of only relying on fixed location.


@echo off
cl /DNOMINMAX /Ox /DNDEBUG /W4 /Zi /EHsc -I ./include -I../xbyak -I../cybozulib/include -I../cybozulib_ext/include %1  /link /LIBPATH:..\cybozulib_ext\lib /LIBPATH:.\lib

add mk.bat to make windows exe

add mk.bat to make windows exe


@echo off

set version=5_6_5

echo %PLATFORM% | findstr /C:"winrt" > nul && (
	set pkgName=%PLATFORM:~10%
)
if "%PLATFORM%" == "mingw53_32" (
	set pkgName=mingw
)
if "%pkgName%" == "" (
	set pkgName=%PLATFORM%
)

powershell -Command "Invoke-WebRequest https://github.com/Skycoder42/ci-builds/releases/download/cryptopp_%version%/cryptopp_%version%_%pkgName%.zip -OutFile %temp%\cryptopp.zip" || exit /B 1
7z x %temp%\cryptopp.zip -o .\src\3rdparty || exit /B 1

@echo off

set version=5_6_5

echo %PLATFORM% | findstr /C:"winrt" > nul && (
	set pkgName=%PLATFORM:~10%
)
if "%PLATFORM%" == "mingw53_32" (
	set pkgName=mingw
)
if "%pkgName%" == "" (
	set pkgName=%PLATFORM%
)

powershell -Command "Invoke-WebRequest https://github.com/Skycoder42/ci-builds/releases/download/cryptopp_%version%/cryptopp_%version%_%pkgName%.zip -OutFile %temp%\cryptopp.zip" || exit /B 1
7z x %temp%\cryptopp.zip -o.\src\3rdparty || exit /B 1

fix 7z

fix 7z


rem #!/bin/bash

echo "Executing Auto Run for Sentinel Tool"
echo "\$Header: /share/content/gforge/sentinel/sentinel/scripts/autorun.cmd,v 1.2 2008-04-23 18:17:10 hebell Exp $"
echo "\$Name: not supported by cvs2svn $"

setlocal

rem DATE=`date +%Y%m%d`
set JAVA_HOME=c:/jdk1.6_43
set BASE_DIR=.

rem export JAVA_HOME BASE_DIR

rem ORACLE_HOME=/app/oracle/product/dbhome/9.2.0
rem PATH=$ORACLE_HOME/bin:$PATH
rem LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
rem TNS_ADMIN=$ORACLE_HOME/network/admin
set JAVA_PARMS=-Xms512m -Xmx512m -XX:PermSize=64m

rem export JAVA_PARMS ORACLE_HOME TNS_ADMIN PATH LD_LIBRARY_PATH

echo "Executing job as `id`"
echo "Executing on `date`"

rem find %BASE_DIR%/../reports -mtime +20 -exec rm {} \;

%JAVA_HOME%/bin/java -client %JAVA_PARMS% -classpath %BASE_DIR%;%BASE_DIR%/commons-lang-2.4.jar;%BASE_DIR%/commons-logging-1.1.jar;%BASE_DIR%/log4j-1.2.14.jar;%BASE_DIR%/jdom-1.0.jar;%BASE_DIR%/stax-api-1.0.1.jar;%BASE_DIR%/mail.jar;%BASE_DIR%/activation.jar;%BASE_DIR%/ojdbc14.jar;%BASE_DIR%/evsapi41-beans.jar;%BASE_DIR%/evsapi41-framework.jar;%BASE_DIR%/lexbig.jar;%BASE_DIR%/lexevsapi51-client.jar;%BASE_DIR%/lexevsapi51-framework.jar;%BASE_DIR%/LexEVSSecurity.jar;%BASE_DIR%/acegi-security-1.0.4.jar;%BASE_DIR%/sdk-client-framework.jar;%BASE_DIR%/hibernate3.jar;%BASE_DIR%/spring.jar;%BASE_DIR%/cglib-2.1.3.jar;%BASE_DIR%/asm.jar;%BASE_DIR%/cadsrsentinel.jar gov.nih.nci.cadsr.sentinel.tool.AutoProcessAlerts %BASE_DIR%/log4j.xml true %BASE_DIR%/cadsrsentinel.xml

endlocal

rem #!/bin/bash

echo "Executing Auto Run for Sentinel Tool"
echo "\$Header: /share/content/gforge/sentinel/sentinel/scripts/autorun.cmd,v 1.2 2008-04-23 18:17:10 hebell Exp $"
echo "\$Name: not supported by cvs2svn $"

setlocal

rem DATE=`date +%Y%m%d`
set JAVA_HOME=c:/jdk1.6_43
set BASE_DIR=.

rem export JAVA_HOME BASE_DIR

rem ORACLE_HOME=/app/oracle/product/dbhome/9.2.0
rem PATH=$ORACLE_HOME/bin:$PATH
rem LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
rem TNS_ADMIN=$ORACLE_HOME/network/admin
set JAVA_PARMS=-Xms512m -Xmx512m -XX:PermSize=64m

rem export JAVA_PARMS ORACLE_HOME TNS_ADMIN PATH LD_LIBRARY_PATH

echo "Executing job as `id`"
echo "Executing on `date`"

rem find %BASE_DIR%/../reports -mtime +20 -exec rm {} \;

%JAVA_HOME%/bin/java -client %JAVA_PARMS% -classpath %BASE_DIR%;%BASE_DIR%/commons-lang-2.4.jar;%BASE_DIR%/commons-logging-1.1.jar;%BASE_DIR%/log4j-1.2.14.jar;%BASE_DIR%/jdom-1.0.jar;%BASE_DIR%/stax-api-1.0.1.jar;%BASE_DIR%/mail.jar;%BASE_DIR%/activation.jar;%BASE_DIR%/ojdbc14.jar;%BASE_DIR%/lexbig.jar;%BASE_DIR%/lexevsapi60-beans.jar;%BASE_DIR%/lexevs-client-framework.jar;%BASE_DIR%/lexevs-core.jar;%BASE_DIR%/LexEVSSecurity.jar;%BASE_DIR%/acegi-security-1.0.4.jar;%BASE_DIR%/sdk-client-framework.jar;%BASE_DIR%/hibernate3.jar;%BASE_DIR%/spring.jar;%BASE_DIR%/cglib-2.1.3.jar;%BASE_DIR%/asm.jar;%BASE_DIR%/cadsrsentinel.jar gov.nih.nci.cadsr.sentinel.tool.AutoProcessAlerts %BASE_DIR%/log4j.xml true %BASE_DIR%/cadsrsentinel.xml

endlocal

Fix for EVS upgrade

Fix for EVS upgrade

SVN-Revision: 992


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

:: Checks if there is already a connection established
db2 connect > NUL
if %ERRORLEVEL% NEQ 0 (
 echo Please connect to a database before the execution of the installation.
 goto exit
) else (
 if EXIST init.bat (
  call init.bat
 )
 echo Uninstalling log4db2...
 db2 -tf %SRC_MAIN_CODE_PATH%\CleanTriggers.sql
 db2 -tf %SRC_MAIN_CODE_PATH%\CleanObjects.sql
 db2 -tf %SRC_MAIN_CODE_PATH%\CleanTables.sql
)

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

:: Uninstalls all the components of this utility.
::
:: Version: 2014-02-14 1-Alpha
:: Author: Andres Gomez Casanova (AngocA)
:: Made in COLOMBIA.

:: Checks if there is already a connection established
db2 connect > NUL
if %ERRORLEVEL% NEQ 0 (
 echo Please connect to a database before the execution of the installation.
 goto exit
) else (
 if EXIST init.bat (
  call init.bat
 )
 echo Uninstalling log4db2...
 db2 -tf %SRC_MAIN_CODE_PATH%\CleanTriggers.sql
 db2 -tf %SRC_MAIN_CODE_PATH%\CleanObjects.sql
 db2 -tf %SRC_MAIN_CODE_PATH%\CleanTables.sql
)

Update uninstall.bat

Update uninstall.bat