:: @ECHO OFF
:: Target (x64 CLR)
call dnvm use 1.0.0-rc1-update1 -a x64 -r clr

:: Patch project.json files
cd %APPVEYOR_BUILD_FOLDER%\build
call npm install
call node patch-project-json.js ../src/SteelToe.Discovery.Client/project.json %APPVEYOR_BUILD_VERSION% %APPVEYOR_REPO_TAG_NAME%
call node patch-project-json.js ../src/SteelToe.Discovery.Eureka.Client/project.json %APPVEYOR_BUILD_VERSION% %APPVEYOR_REPO_TAG_NAME%
cd %APPVEYOR_BUILD_FOLDER%

:: Restore packages
cd src
call dnu restore
cd ..\test
call dnu restore
cd ..

:: Build packages
cd src\SteelToe.Discovery.Client
call dnu pack --configuration Release
cd %APPVEYOR_BUILD_FOLDER%
cd src\SteelToe.Discovery.Eureka.Client
call dnu pack --configuration Release
cd %APPVEYOR_BUILD_FOLDER%

:: @ECHO OFF
:: Target (x64 CLR)
call dnvm use 1.0.0-rc1-update1 -a x64 -r clr

:: Patch project.json files
cd %APPVEYOR_BUILD_FOLDER%\scripts
call npm install
call node patch-project-json.js ../src/SteelToe.Discovery.Client/project.json %APPVEYOR_BUILD_VERSION% %APPVEYOR_REPO_TAG_NAME%
call node patch-project-json.js ../src/SteelToe.Discovery.Eureka.Client/project.json %APPVEYOR_BUILD_VERSION% %APPVEYOR_REPO_TAG_NAME%
cd %APPVEYOR_BUILD_FOLDER%

:: Restore packages
cd src
call dnu restore
cd ..\test
call dnu restore
cd ..

:: Build packages
cd src\SteelToe.Discovery.Client
call dnu pack --configuration Release
cd %APPVEYOR_BUILD_FOLDER%
cd src\SteelToe.Discovery.Eureka.Client
call dnu pack --configuration Release
cd %APPVEYOR_BUILD_FOLDER%

Update appveyor_build

Update appveyor_build


if not exist "C:\Windows\Temp\7z920-x64.msi" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware
if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels
goto :done

:vmware

if exist "C:\Users\vagrant\windows.iso" (
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\windows.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.1.1/3770994/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
    rd /S /Q "C:\Program Files (x86)\VMWare"
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"

goto :done

:virtualbox

:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer

if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (
    move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.0.20/VBoxGuestAdditions_5.0.20.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
rd /S /Q "C:\Windows\Temp\virtualbox"
goto :done

:parallels
if exist "C:\Users\vagrant\prl-tools-win.iso" (
	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
	cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels
	cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
	rd /S /Q "C:\Windows\Temp\parallels"
)

:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi

if not exist "C:\Windows\Temp\7z920-x64.msi" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware
if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels
goto :done

:vmware

if exist "C:\Users\vagrant\windows.iso" (
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\windows.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.1.1/3770994/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
    rd /S /Q "C:\Program Files (x86)\VMWare"
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"

goto :done

:virtualbox

:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer

if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (
    move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.0.24/VBoxGuestAdditions_5.0.24.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
rd /S /Q "C:\Windows\Temp\virtualbox"
goto :done

:parallels
if exist "C:\Users\vagrant\prl-tools-win.iso" (
	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
	cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels
	cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
	rd /S /Q "C:\Windows\Temp\parallels"
)

:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi

Update vbox addtions 5.0.24

Update vbox addtions 5.0.24


@rem Copyright 2018 gRPC authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem     http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.

@echo "Starting Windows build"

cd /d %~dp0
cd ..

call npm install -g npm@5 || goto :error

call npm install || goto :error
call npm run test || goto :error

goto :EOF

:error
exit /b 1

@rem Copyright 2018 Google LLC. All rights reserved.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem     http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.

@echo "Starting Windows build"

cd /d %~dp0
cd ..

call npm install -g npm@latest || goto :error
call npm install || goto :error
call npm run test || goto :error

goto :EOF

:error
exit /b 1

use latest npm on Windows (#140)

chore: use latest npm on Windows (#140)


@echo off

setlocal

rem Check if Python3 is installed.
for /f %%i in ("python3.exe") do set _FOUND=%%~$PATH:i
if not "%_FOUND%" == "" goto :endif
    echo ERROR: Python3 not installed.  See http://python.org/download/
    goto :eof
:endif

python3.exe "%~dp0/windows_config.py" %*

@echo off

setlocal

rem Locate python.exe.
for /f %%i in ("python.exe") do set _FOUND=%%~$PATH:i
if not "%_FOUND%" == "" goto :endif
    echo ERROR: python.exe not found.
    goto :eof
:endif

rem Determine if python.exe is Python3.
"%_FOUND%" --version | findstr /B /L /C:"Python 3" >NUL 2>&1
if not ERRORLEVEL 1 goto :endif2
    echo ERROR: python.exe is not Python3.
    goto :eof
:endif2

rem python.exe "%~dp0windows_config.py" %*

fix test for Python3

windows_config.bat: fix test for Python3


::npm-install.bat
@echo off
::install web server dependencies && game server dependencies
cd web-server && npm install -d && cd .. && cd game-server && npm install -d

add 'npm-install.bat' for windows

add 'npm-install.bat' for windows


@set MINGWPATH=C:\MinGW
@set PATH=%MINGWPATH%\msys\1.0\bin;%MINGWPATH%\bin

@set LANG=en_US.UTF8
@set LC_ALL=en_US.UTF8

@set OPENSSL=openssl-1.0.1e
@set BERKELEYDB=db-4.8.30.NC
@set BOOST=boost_1_54_0
@set BOOSTVERSION=1.54.0
@rem If you wonder why there is no -s- see: https://github.com/bitcoin/bitcoin/pull/2835#issuecomment-21231694
@set BOOSTSUFFIX=-mgw46-mt-1_54
@set MINIUPNPC=miniupnpc-1.8

@set EWBLIBS=libs

@set EWBPATH=contrib/easywinbuilder
@set ROOTPATH=..\..
@set ROOTPATHSH=%ROOTPATH:\=/%

@rem bootstrap coin name
@for /F %%a in ('dir /b %ROOTPATH%\*.pro') do @set COINNAME=%%a
@set COINNAME=%COINNAME:-qt.pro=%

@set QTPATH=C:\Qt\4.8.5\bin
@set QTDOWNLOADPATH=http://download.qt-project.org/official_releases/qt/4.8/4.8.5/qt-win-opensource-4.8.5-mingw.exe
@rem Qt5 will need changes in gather_dlls.bat

@set MSYS=%MINGWPATH:\=/%/msys/1.0/bin
@set PERL=%MSYS%/perl.exe

@rem the following will be set as additional CXXFLAGS and CFLAGS for everything - no ' or ", space is ok
@set ADDITIONALCCFLAGS=-fno-guess-branch-probability -frandom-seed=1984 -Wno-unused-variable -Wno-unused-value -Wno-sign-compare -Wno-strict-aliasing

@rem Note: Variables set here can NOT be overwritten in makefiles

@set MINGWPATH=C:\MinGW
@set PATH=%MINGWPATH%\msys\1.0\bin;%MINGWPATH%\bin

@set LANG=en_US.UTF8
@set LC_ALL=en_US.UTF8

@set OPENSSL=openssl-1.0.1e
@set BERKELEYDB=db-4.8.30.NC
@set BOOST=boost_1_54_0
@set BOOSTVERSION=1.54.0
@rem If you wonder why there is no -s- see: https://github.com/bitcoin/bitcoin/pull/2835#issuecomment-21231694
@set BOOSTSUFFIX=-mgw46-mt-1_54
@set MINIUPNPC=miniupnpc-1.8

@set EWBLIBS=libs

@set EWBPATH=contrib/easywinbuilder
@set ROOTPATH=..\..
@set ROOTPATHSH=%ROOTPATH:\=/%

@rem bootstrap coin name
@for /F %%a in ('dir /b %ROOTPATH%\*.pro') do @set COINNAME=%%a
@set COINNAME=%COINNAME:-qt.pro=%

@set QTPATH=C:\Qt\4.8.5\bin
@set QTDOWNLOADPATH=http://download.qt-project.org/archive/qt/4.8/4.8.5/qt-win-opensource-4.8.5-mingw.exe
@rem Qt5 will need changes in gather_dlls.bat

@set MSYS=%MINGWPATH:\=/%/msys/1.0/bin
@set PERL=%MSYS%/perl.exe

@rem the following will be set as additional CXXFLAGS and CFLAGS for everything - no ' or ", space is ok
@set ADDITIONALCCFLAGS=-fno-guess-branch-probability -frandom-seed=1984 -Wno-unused-variable -Wno-unused-value -Wno-sign-compare -Wno-strict-aliasing

@rem Note: Variables set here can NOT be overwritten in makefiles

Change Qt download link

Change Qt download link


setlocal EnableDelayedExpansion

if "%ARCH%"=="64" (
    set WIN64="WIN64=YES"
) else (
    set WIN64=
)

:: Work out MSVC_VER - needed for build process.
:: Currently guess from Python version
if  %vc% LEQ 9 set MSVC_VER=1500
if  %vc% GTR 9 set MSVC_VER=1900

:: Need consistent flags between build and install.
set BLD_OPTS=%WIN64% ^
    MSVC_VER=%MSVC_VER% ^
    GDAL_HOME=%LIBRARY_PREFIX% ^
    BINDIR=%LIBRARY_BIN% ^
    LIBDIR=%LIBRARY_LIB% ^
    INCDIR=%LIBRARY_INC% ^
    DATADIR=%LIBRARY_PREFIX%\share\gdal ^
    HTMLDIR=%LIBRARY_PREFIX%\share\doc\gdal ^
    CURL_INC="-I%LIBRARY_INC%" ^
    CURL_LIB="%LIBRARY_LIB%\libcurl.lib wsock32.lib wldap32.lib winmm.lib" ^
    EXPAT_DIR=%LIBRARY_PREFIX% ^
    EXPAT_INCLUDE="-I%LIBRARY_INC%" ^
    EXPAT_LIB=%LIBRARY_LIB%\expat.lib ^
    FREEXL_CFLAGS="-I%LIBRARY_INC%" ^
    FREEXL_LIBS=%LIBRARY_LIB%\freexl_i.lib ^
    GEOS_CFLAGS="-I%LIBRARY_INC% -DHAVE_GEOS" ^
    GEOS_DIR=%LIBRARY_PREFIX% ^
    GEOS_LIB=%LIBRARY_LIB%\geos_c.lib ^
    HDF4_DIR=%LIBRARY_PREFIX% ^
    HDF4_HAS_MAXOPENFILES=YES ^
    HDF4_LIB="%LIBRARY_LIB%\hdf.lib %LIBRARY_LIB%\mfhdf.lib %LIBRARY_LIB%\xdr.lib" ^
    HDF5_DIR=%LIBRARY_PREFIX% ^
    HDF5_LIB=%LIBRARY_LIB%\hdf5.lib ^
    JPEGDIR=%LIBRARY_INC% ^
    JPEG_EXTERNAL_LIB=1 ^
    JPEG_LIB=%LIBRARY_LIB%\libjpeg.lib ^
    KEA_CFLAGS="-I%LIBRARY_INC%" ^
    KEA_LIB=%LIBRARY_LIB%\libkea.lib ^
    NETCDF_INC_DIR=%LIBRARY_INC% ^
    NETCDF_LIB=%LIBRARY_LIB%\netcdf.lib ^
    NETCDF_SETTING=yes ^
    OPENJPEG_CFLAGS="-I%LIBRARY_INC%\openjpeg-2.3" ^
    OPENJPEG_ENABLED=YES ^
    OPENJPEG_LIB=%LIBRARY_LIB%\openjp2.lib ^
    PG_INC_DIR=%LIBRARY_INC% ^
    PG_LIB=%LIBRARY_LIB%\libpq.lib ^
    PNGDIR=%LIBRARY_INC% ^
    PNG_EXTERNAL_LIB=1 ^
    PNG_LIB=%LIBRARY_LIB%\libpng.lib ^
    PROJ_FLAGS=-DPROJ_STATIC ^
    PROJ_INCLUDE="-I%LIBRARY_INC%" ^
    PROJ_LIBRARY=%LIBRARY_LIB%\proj.lib ^
    SPATIALITE_412_OR_LATER=yes ^
    SQLITE_INC="-I%LIBRARY_INC% -DHAVE_SPATIALITE" ^
    SQLITE_LIB="%LIBRARY_LIB%\sqlite3.lib %LIBRARY_LIB%\spatialite_i.lib" ^
    TIFF_INC="-I%LIBRARY_INC%" ^
    TIFF_LIB=%LIBRARY_LIB%\libtiff_i.lib ^
    TIFF_OPTS=-DBIGTIFF_SUPPORT ^
    XERCES_DIR=%LIBRARY_PREFIX% ^
    XERCES_INCLUDE="-I%LIBRARY_INC% -I%LIBRARY_INC%\xercesc" ^
    XERCES_LIB=%LIBRARY_LIB%\xerces-c_3.lib ^
    GEOTIFF_INC="-I%LIBRARY_INC%" ^
    GEOTIFF_LIB=%LIBRARY_LIB%\geotiff_i.lib ^
    LIBICONV_INCLUDE="-I%LIBRARY_INC% -DICONV_CONST= " ^
    LIBICONV_LIBRARY="%LIBRARY_LIB%\iconv.lib"

endlocal && set BLD_OPTS=%BLD_OPTS%

setlocal EnableDelayedExpansion

if "%ARCH%"=="64" (
    set WIN64="WIN64=YES"
) else (
    set WIN64=
)

:: Work out MSVC_VER - needed for build process.
:: Currently guess from Python version
if  %vc% LEQ 9 set MSVC_VER=1500
if  %vc% GTR 9 set MSVC_VER=1900

:: Need consistent flags between build and install.
set BLD_OPTS=%WIN64% ^
    MSVC_VER=%MSVC_VER% ^
    GDAL_HOME=%LIBRARY_PREFIX% ^
    BINDIR=%LIBRARY_BIN% ^
    LIBDIR=%LIBRARY_LIB% ^
    INCDIR=%LIBRARY_INC% ^
    DATADIR=%LIBRARY_PREFIX%\share\gdal ^
    HTMLDIR=%LIBRARY_PREFIX%\share\doc\gdal ^
    CURL_INC="-I%LIBRARY_INC%" ^
    CURL_LIB="%LIBRARY_LIB%\libcurl.lib wsock32.lib wldap32.lib winmm.lib" ^
    EXPAT_DIR=%LIBRARY_PREFIX% ^
    EXPAT_INCLUDE="-I%LIBRARY_INC%" ^
    EXPAT_LIB=%LIBRARY_LIB%\expat.lib ^
    FREEXL_CFLAGS="-I%LIBRARY_INC%" ^
    FREEXL_LIBS=%LIBRARY_LIB%\freexl_i.lib ^
    GEOS_CFLAGS="-I%LIBRARY_INC% -DHAVE_GEOS" ^
    GEOS_DIR=%LIBRARY_PREFIX% ^
    GEOS_LIB=%LIBRARY_LIB%\geos_c.lib ^
    HDF4_DIR=%LIBRARY_PREFIX% ^
    HDF4_HAS_MAXOPENFILES=YES ^
    HDF4_LIB="%LIBRARY_LIB%\hdf.lib %LIBRARY_LIB%\mfhdf.lib %LIBRARY_LIB%\xdr.lib" ^
    HDF5_DIR=%LIBRARY_PREFIX% ^
    HDF5_LIB=%LIBRARY_LIB%\hdf5.lib ^
    JPEGDIR=%LIBRARY_INC% ^
    JPEG_EXTERNAL_LIB=1 ^
    JPEG_LIB=%LIBRARY_LIB%\libjpeg.lib ^
    KEA_CFLAGS="-I%LIBRARY_INC%" ^
    KEA_LIB=%LIBRARY_LIB%\libkea.lib ^
    NETCDF_INC_DIR=%LIBRARY_INC% ^
    NETCDF_LIB=%LIBRARY_LIB%\netcdf.lib ^
    NETCDF_SETTING=yes ^
    OPENJPEG_CFLAGS="-I%LIBRARY_INC%\openjpeg-2.3" ^
    OPENJPEG_ENABLED=YES ^
    OPENJPEG_LIB=%LIBRARY_LIB%\openjp2.lib ^
    PG_INC_DIR=%LIBRARY_INC% ^
    PG_LIB=%LIBRARY_LIB%\libpq.lib ^
    PNGDIR=%LIBRARY_INC% ^
    PNG_EXTERNAL_LIB=1 ^
    PNG_LIB=%LIBRARY_LIB%\libpng.lib ^
    PROJ_FLAGS=-DPROJ_STATIC ^
    PROJ_INCLUDE="-I%LIBRARY_INC%" ^
    PROJ_LIBRARY=%LIBRARY_LIB%\proj.lib ^
    SPATIALITE_412_OR_LATER=yes ^
    SQLITE_INC="-I%LIBRARY_INC% -DHAVE_SPATIALITE" ^
    SQLITE_LIB="%LIBRARY_LIB%\sqlite3.lib %LIBRARY_LIB%\spatialite_i.lib" ^
    TIFF_INC="-I%LIBRARY_INC%" ^
    TIFF_LIB=%LIBRARY_LIB%\tiff.lib ^
    TIFF_OPTS=-DBIGTIFF_SUPPORT ^
    XERCES_DIR=%LIBRARY_PREFIX% ^
    XERCES_INCLUDE="-I%LIBRARY_INC% -I%LIBRARY_INC%\xercesc" ^
    XERCES_LIB=%LIBRARY_LIB%\xerces-c_3.lib ^
    GEOTIFF_INC="-I%LIBRARY_INC%" ^
    GEOTIFF_LIB=%LIBRARY_LIB%\geotiff_i.lib ^
    LIBICONV_INCLUDE="-I%LIBRARY_INC% -DICONV_CONST= " ^
    LIBICONV_LIBRARY="%LIBRARY_LIB%\iconv.lib"

endlocal && set BLD_OPTS=%BLD_OPTS%

fix tiff name

fix tiff name


@ECHO OFF
SET PBR_VERSION="%PKG_VERSION%"
python setup.py install --single-version-externally-managed --record record.txt

Move build.bat to bld.bat

Move build.bat to bld.bat


@setlocal EnableDelayedExpansion EnableExtensions
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
@if defined PACKER_DEBUG (@echo on) else (@echo off)

title Setting network configuration. Please wait...

echo ==^> Disabling new network prompt
reg add "HKLM\System\CurrentControlSet\Control\Network\NewNetworkWindowOff"
echo ==^> Enabling icmpv4 Echo Request
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow
echo ==^> Disabling ipv6 protocol
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters" /f /v DisabledComponents /t REG_DWORD /d 0xffffffff

title Setting folder options. Please wait...

echo ==^> Setting folder options
echo ==^> Show file extensions
:: Default is 1 - hide file extensions
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v HideFileExt /t REG_DWORD /d 0
echo ==^> Show hidden files and folders
:: Default is 2 - do not show hidden files and folders
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v Hidden /t REG_DWORD /d 1
echo ==^> Display Full path
:: Default FullPath 0 and FullPathAddress 0
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v FullPath /t REG_DWORD /d 1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v FullPathAddress /t REG_DWORD /d 1

title Setting power configuration. Please wait...

echo ==^> Setting power configuration to High Performance
powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
echo ==^> Zero Hibernation File
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /f /v HibernateFileSizePercent /t REG_DWORD /d 0
echo ==^> Disable Hibernation Mode
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /f /v HibernateEnabled /t REG_DWORD /d 0

title Setting command prompt personalization. Please wait...

echo ==^> Enable QuickEdit mode
:: Default is 1 - Disable QuickEdit mode
reg add "HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f
echo ==^> Show Run command in Start Menu
:: Default is 0 - Disable Show Run
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v Start_ShowRun /t REG_DWORD /d 1

title Setting UI personalization. Please wait...

echo ==^> Set taskbar icons: small
:: Default is 0 - Display Large Icons
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v TaskbarSmallIcons /t REG_QWORD /d 1
echo ==^> Show Administrative Tools in Start Menu
:: Default is 0 - Don't Show Administrator Tools
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v StartMenuAdminTools /t REG_DWORD /d 1
echo ==^> Disable available user names at login
:: Default is 0 - Display Last UserName
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /f /v dontdisplaylastusername /t REG_DWORD /d 1

:exit0

ver>nul

goto :exit

:exit1

verify other 2>nul

:exit

@setlocal EnableDelayedExpansion EnableExtensions
@for %%i in (%~dp0\_packer_config*.cmd) do @call "%%~i"
@if defined PACKER_DEBUG (@echo on) else (@echo off)

title Setting network configuration. Please wait...

echo ==^> Disabling new network prompt
reg add "HKLM\System\CurrentControlSet\Control\Network\NewNetworkWindowOff"
echo ==^> Enabling icmpv4 Echo Request
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow
echo ==^> Disabling ipv6 protocol
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters" /f /v DisabledComponents /t REG_DWORD /d 0xffffffff

title Setting folder options. Please wait...

echo ==^> Setting folder options
echo ==^> Show file extensions
:: Default is 1 - hide file extensions
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v HideFileExt /t REG_DWORD /d 0
echo ==^> Show hidden files and folders
:: Default is 2 - do not show hidden files and folders
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v Hidden /t REG_DWORD /d 1
echo ==^> Display Full path
:: Default FullPath 0 and FullPathAddress 0
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v FullPath /t REG_DWORD /d 1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v FullPathAddress /t REG_DWORD /d 1

title Setting power configuration. Please wait...

echo ==^> Setting power configuration to High Performance
powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
echo ==^> Zero Hibernation File
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /f /v HibernateFileSizePercent /t REG_DWORD /d 0
echo ==^> Disable Hibernation Mode
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /f /v HibernateEnabled /t REG_DWORD /d 0

title Setting command prompt personalization. Please wait...

echo ==^> Enable QuickEdit mode
:: Default is 1 - Disable QuickEdit mode
reg add "HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f
echo ==^> Show Run command in Start Menu
:: Default is 0 - Disable Show Run
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v Start_ShowRun /t REG_DWORD /d 1

title Setting UI personalization. Please wait...

echo ==^> Set taskbar icons: small
:: Default is 0 - Display Large Icons
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v TaskbarSmallIcons /t REG_QWORD /d 1
echo ==^> Set Control Panel icons: small
:: Default is 0 - Display Large Icons
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" /f /v AllItemsIconView /t REG_QWORD /d 1
echo ==^> Show Administrative Tools in Start Menu
:: Default is 0 - Don't Show Administrator Tools
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v StartMenuAdminTools /t REG_DWORD /d 1
echo ==^> Disable available user names at login
:: Default is 0 - Display Last UserName
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /f /v dontdisplaylastusername /t REG_DWORD /d 1

:exit0

ver>nul

goto :exit

:exit1

verify other 2>nul

:exit

add aditional customizations

add aditional customizations


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
:: All rights reserved.
:: Contact: Nokia Corporation (qt-info@nokia.com)
::
:: This file is part of the Qt Mobility Components.
::
:: $QT_BEGIN_LICENSE:LGPL$
:: No Commercial Usage
:: This file contains pre-release code and may not be distributed.
:: You may use this file in accordance with the terms and conditions
:: contained in the Technology Preview License Agreement accompanying
:: this package.
::
:: GNU Lesser General Public License Usage
:: Alternatively, this file may be used under the terms of the GNU Lesser
:: General Public License version 2.1 as published by the Free Software
:: Foundation and appearing in the file LICENSE.LGPL included in the
:: packaging of this file.  Please review the following information to
:: ensure the GNU Lesser General Public License version 2.1 requirements
:: will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
::
:: In addition, as a special exception, Nokia gives you certain additional
:: rights.  These rights are described in the Nokia Qt LGPL Exception
:: version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
::
:: If you have questions regarding the use of this file, please contact
:: Nokia at qt-info@nokia.com.
::
::
::
::
::
::
::
::
:: $QT_END_LICENSE$
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

@echo off

set QT_MOBILITY_PREFIX= C:\QtMobility
set BUILD_PATH=%CD%
set SOURCE_PATH= %~dp0
cd /D %SOURCE_PATH%
set SOURCE_PATH=%CD%
cd /D %BUILD_PATH%

set PROJECT_CONFIG= %BUILD_PATH%\config.in
set PROJECT_LOG= %BUILD_PATH%\config.log
set RELEASEMODE=release
set QT_MOBILITY_LIB=
set BUILD_UNITTESTS=no
set BUILD_EXAMPLES=no
set CONTACTS_PLUGIN=
set VC_TEMPLATE_OPTION=
set QT_PATH=
set QMAKE_CACHE=%BUILD_PATH%\.qmake.cache

if exist "%QMAKE_CACHE%" del %QMAKE_CACHE%
if exist "%PROJECT_LOG%" del %PROJECT_LOG%
if exist "%PROJECT_CONFIG%" del %PROJECT_CONFIG%

echo QT_MOBILITY_SOURCE_TREE = %SOURCE_PATH% > %QMAKE_CACHE%
echo QT_MOBILITY_BUILD_TREE = %BUILD_PATH% >> %QMAKE_CACHE%

:cmdline_parsing

if "%1" == ""               goto startProcessing
if "%1" == "-debug"         goto debugTag
if "%1" == "-release"       goto releaseTag
if "%1" == "-silent"        goto silentTag
if "%1" == "-prefix"        goto prefixTag
if "%1" == "-libdir"        goto libTag
if "%1" == "-bindir"        goto binTag
if "%1" == "-headerdir"     goto headerTag
if "%1" == "-tests"         goto testTag
if "%1" == "-examples"      goto exampleTag
if "%1" == "-contact-src"   goto contactsTag
if "%1" == "-qt"            goto qtTag
if "%1" == "-vc"            goto vcTag
if "%1" == "/?"             goto usage
if "%1" == "-h"             goto usage
if "%1" == "-help"          goto usage
if "%1" == "--help"         goto usage

echo Unknown option: "%1"
goto usage

:usage
echo Usage: configure.bat [-prefix (dir)] [headerdir (dir)] [libdir (dir)]
    echo                  [-bindir (dir)] [-tests] [-examples]
    echo                  [-debug] [-release] [-silent]
    echo.
    echo Options:
    echo.
    echo -prefix (dir) ..... This will install everything relative to dir
    echo                     (default prefix: C:\QtMobility)
    echo -headerdir (dir) .. Header files will be installed to dir
    echo                     (default prefix: PREFIX/include)
    echo -libdir (dir) ..... Libraries will be installed to dir
    echo                     (default PREFIX/lib)
    echo -bindir (dir) ..... Executables will be installed to dir
    echo                     (default PREFIX/bin)
    echo -debug ............ Build with debugging symbols
    echo -release .......... Build without debugging symbols
    echo -silent ........... Reduces build output
    echo -tests ............ Build unit tests (not build by default)
    echo                     Note, this adds test symbols to all libraries
    echo                     and should not be used for release builds.
    echo -examples ......... Build example applications
    echo -vc ............... Generate Visual Studio make files
    echo -contact-src (backend) ...
    echo                     Compile the specified contacts API backend. Not selecting any backend
    echo                     will result in default selection for build platform
    echo                     options: symbian, wince, memory, maemo

if exist "%PROJECT_CONFIF%" del %PROJECT_CONFIG%
goto exitTag

:qtTag
shift
set QT_PATH=%1\
shift
goto cmdline_parsing

:contactsTag
shift
set CONTACTS_PLUGIN=%CONTACTS_PLUGIN% %1
shift
goto cmdline_parsing

:debugTag
if "%RELEASEMODE%" == "release" set RELEASEMODE=debug
shift
goto cmdline_parsing

:releaseTag
if "%RELEASEMODE%" == "debug"   set RELEASEMODE=release
shift
goto cmdline_parsing

:silentTag
echo CONFIG += silent > %PROJECT_CONFIG%
shift
goto cmdline_parsing

:prefixTag
shift
set QT_MOBILITY_PREFIX=%1
shift
goto cmdline_parsing

:libTag
shift
echo QT_MOBILITY_LIB = %1 >> %PROJECT_CONFIG%
shift
goto cmdline_parsing

:binTag
shift
echo QT_MOBILITY_BIN = %1 >> %PROJECT_CONFIG%
shift
goto cmdline_parsing

:headerTag
shift
echo QT_MOBILITY_INCLUDE = %1 >> %PROJECT_CONFIG%
shift
goto cmdline_parsing

:testTag
set BUILD_UNITTESTS=yes
shift
goto cmdline_parsing

:exampleTag
set BUILD_EXAMPLES=yes
shift
goto cmdline_parsing

:vcTag
shift
set VC_TEMPLATE_OPTION=-tp vc
goto cmdline_parsing

:startProcessing

echo CONFIG += %RELEASEMODE% >> %PROJECT_CONFIG%
echo CONTACTS_BACKENDS = %CONTACTS_PLUGIN% >> %PROJECT_CONFIG%

set CURRENTDIR=%CD%
echo %CURRENTDIR%
if exist %QT_MOBILITY_PREFIX% goto prefixExists
mkdir %QT_MOBILITY_PREFIX%
if errorlevel 1 goto invalidPrefix
cd /D %QT_MOBILITY_PREFIX%
set QT_MOBILITY_PREFIX=%CD%
cd /D %CURRENTDIR%
rd /S /Q %QT_MOBILITY_PREFIX%
goto endprefixProcessing

:invalidPrefix
echo "%QT_MOBILITY_PREFIX%" is not a valid directory path.
goto :exitTag

:prefixExists
cd /D %QT_MOBILITY_PREFIX%
set QT_MOBILITY_PREFIX=%CD%
cd /D %CURRENTDIR%

:endprefixProcessing
echo QT_MOBILITY_PREFIX = %QT_MOBILITY_PREFIX% >> %PROJECT_CONFIG%

echo build_unit_tests = %BUILD_UNITTESTS% >> %PROJECT_CONFIG%
echo build_examples = %BUILD_EXAMPLES% >> %PROJECT_CONFIG%
echo qmf_enabled = no >> %PROJECT_CONFIG%

echo isEmpty($$QT_MOBILITY_INCLUDE):QT_MOBILITY_INCLUDE=$$QT_MOBILITY_PREFIX/include >> %PROJECT_CONFIG%
echo isEmpty($$QT_MOBILITY_LIB):QT_MOBILITY_LIB=$$QT_MOBILITY_PREFIX/lib >> %PROJECT_CONFIG%
echo isEmpty($$QT_MOBILITY_BIN):QT_MOBILITY_BIN=$$QT_MOBILITY_PREFIX/bin >> %PROJECT_CONFIG%

copy %PROJECT_CONFIG% %BUILD_PATH%\config.pri
del %PROJECT_CONFIG%

echo Checking available Qt
%QT_PATH%qmake -v >> %PROJECT_LOG% 2>&1
if errorlevel 1 goto qmakeNotFound
goto qmakeFound
:qmakeNotFound
echo ... Not found  >> %PROJECT_LOG% 2>&1
if "%QT_PATH%" == "" (
    echo >&2 "Cannot find 'qmake' in your PATH."
) else (
    else echo >&2 "Cannot find 'qmake' in %QT_PATH%."
)
echo >&2 "Aborting."
goto exitTag

:qmakeFound
%QT_PATH%qmake -query QT_VERSION

goto checkMake

:makeTest
setlocal
    set CURRENT_PWD=%CD%

    if %BUILD_PATH% == %SOURCE_PATH% (
        cd %SOURCE_PATH%\config.tests\make
        if exist make del make
    ) else (
        rmdir /S /Q config.tests\make
        mkdir config.tests\make
        cd config.tests\make
    )

    for /f "tokens=3" %%i in ('%QT_PATH%qmake %SOURCE_PATH%\config.tests\make\make.pro 2^>^&1 1^>NUL') do set MAKETYPE=%%i

    if %MAKETYPE% == symbian-abld (
        make -h >> %PROJECT_LOG% 2>&1
        if errorlevel 0 (
            echo ... Symbian abld make found.
            set MAKE=make
        )
    ) else if %MAKETYPE% == symbian-sbsv2 (
        make -h >> %PROJECT_LOG% 2>&1
        if errorlevel 0 (
            echo ... Symbian sbsv2 make found.
            set MAKE=make
        )
    ) else if %MAKETYPE% == win32-nmake (
        nmake /? >> %PROJECT_LOG% 2>&1
        if errorlevel 0 (
            echo ... nmake found.
            set MAKE=nmake
        )
    ) else if %MAKETYPE% == win32-mingw (
        make -v >> %PROJECT_LOG% 2>&1
        if errorlevel 0 (
            echo ... mingw32-make found.
            set MAKE=make
        )
    )
    cd %CURRENT_PWD%
endlocal&set %1=%MAKE%&set %2=%MAKETYPE%&goto :EOF

:checkMake
echo Checking make
call :makeTest MAKE MAKETYPE
if not "%MAKE%" == "" goto compileTests

echo >&2 "Cannot find 'nmake', 'mingw32-make' or 'make' in your PATH"
echo >&2 "Aborting."

goto exitTag

:compileTest
setlocal
    echo Checking %1
    set CURRENT_PWD=%CD%

    if %BUILD_PATH% == %SOURCE_PATH% (
        cd %SOURCE_PATH%\config.tests\%2
        if exist %2 del %2
    ) else (
        rmdir /S /Q config.tests\%2
        mkdir config.tests\%2
        cd config.tests\%2
    )

    %QT_PATH%qmake %SOURCE_PATH%\config.tests\%2\%2.pro >> %PROJECT_LOG% 2>&1
    %MAKE% clean >> %PROJECT_LOG%
    %MAKE% >> %PROJECT_LOG% 2>&1

    set FAILED=0
    if %MAKETYPE% == symbian-sbsv2 (
        for /f "tokens=2" %%i in ('%MAKE% SBS^="@sbs --check"') do set FAILED=1
    ) else if %MAKETYPE% == symbian-abld (
        for /f "tokens=2" %%i in ('%MAKE% ABLD^="@ABLD.BAT -c"') do set FAILED=1
    ) else if errorlevel 1 (
        set FAILED=1
    )

    if %FAILED% == 0 (
        echo ... OK
        echo %2_enabled = yes >> %PROJECT_CONFIG%
    ) else (
        echo ... Not Found
        echo %2_enabled = no >> %PROJECT_CONFIG%
    )

    cd %CURRENT_PWD%
endlocal&goto :EOF

:compileTests

echo.
echo Start of compile tests
REM compile tests go here.
call :compileTest LBT lbt
echo End of compile tests

if not exist "%BUILD_PATH%\features" mkdir %BUILD_PATH%\features
echo "Generating Mobility Headers..."
rd /s /q %BUILD_PATH%\include
mkdir %BUILD_PATH%\include
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\global
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\bearer
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\publishsubscribe
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\location
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\serviceframework
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\systeminfo
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\contacts
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\multimedia
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\messaging

if exist config.pri del config.pri
ren %PROJECT_CONFIG% config.pri

echo.
echo Running qmake...
%QT_PATH%qmake -recursive %VC_TEMPLATE_OPTION% %SOURCE_PATH%\qtmobility.pro
if errorlevel 1 goto qmakeRecError
echo.
echo configure has finished. You may run %MAKE% to build the project now.
goto exitTag

:qmakeRecError
echo.
echo configure failed.

:exitTag

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
:: All rights reserved.
:: Contact: Nokia Corporation (qt-info@nokia.com)
::
:: This file is part of the Qt Mobility Components.
::
:: $QT_BEGIN_LICENSE:LGPL$
:: No Commercial Usage
:: This file contains pre-release code and may not be distributed.
:: You may use this file in accordance with the terms and conditions
:: contained in the Technology Preview License Agreement accompanying
:: this package.
::
:: GNU Lesser General Public License Usage
:: Alternatively, this file may be used under the terms of the GNU Lesser
:: General Public License version 2.1 as published by the Free Software
:: Foundation and appearing in the file LICENSE.LGPL included in the
:: packaging of this file.  Please review the following information to
:: ensure the GNU Lesser General Public License version 2.1 requirements
:: will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
::
:: In addition, as a special exception, Nokia gives you certain additional
:: rights.  These rights are described in the Nokia Qt LGPL Exception
:: version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
::
:: If you have questions regarding the use of this file, please contact
:: Nokia at qt-info@nokia.com.
::
::
::
::
::
::
::
::
:: $QT_END_LICENSE$
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

@echo off

set QT_MOBILITY_PREFIX= C:\QtMobility
set BUILD_PATH=%CD%
set SOURCE_PATH= %~dp0
cd /D %SOURCE_PATH%
set SOURCE_PATH=%CD%
cd /D %BUILD_PATH%

set PROJECT_CONFIG= %BUILD_PATH%\config.in
set PROJECT_LOG= %BUILD_PATH%\config.log
set RELEASEMODE=release
set QT_MOBILITY_LIB=
set BUILD_UNITTESTS=no
set BUILD_EXAMPLES=no
set CONTACTS_PLUGIN=
set VC_TEMPLATE_OPTION=
set QT_PATH=
set QMAKE_CACHE=%BUILD_PATH%\.qmake.cache

if exist "%QMAKE_CACHE%" del %QMAKE_CACHE%
if exist "%PROJECT_LOG%" del %PROJECT_LOG%
if exist "%PROJECT_CONFIG%" del %PROJECT_CONFIG%

echo QT_MOBILITY_SOURCE_TREE = %SOURCE_PATH% > %QMAKE_CACHE%
echo QT_MOBILITY_BUILD_TREE = %BUILD_PATH% >> %QMAKE_CACHE%

:cmdline_parsing

if "%1" == ""               goto startProcessing
if "%1" == "-debug"         goto debugTag
if "%1" == "-release"       goto releaseTag
if "%1" == "-silent"        goto silentTag
if "%1" == "-prefix"        goto prefixTag
if "%1" == "-libdir"        goto libTag
if "%1" == "-bindir"        goto binTag
if "%1" == "-headerdir"     goto headerTag
if "%1" == "-tests"         goto testTag
if "%1" == "-examples"      goto exampleTag
if "%1" == "-contact-src"   goto contactsTag
if "%1" == "-qt"            goto qtTag
if "%1" == "-vc"            goto vcTag
if "%1" == "/?"             goto usage
if "%1" == "-h"             goto usage
if "%1" == "-help"          goto usage
if "%1" == "--help"         goto usage

echo Unknown option: "%1"
goto usage

:usage
echo Usage: configure.bat [-prefix (dir)] [headerdir (dir)] [libdir (dir)]
    echo                  [-bindir (dir)] [-tests] [-examples]
    echo                  [-debug] [-release] [-silent]
    echo.
    echo Options:
    echo.
    echo -prefix (dir) ..... This will install everything relative to dir
    echo                     (default prefix: C:\QtMobility)
    echo -headerdir (dir) .. Header files will be installed to dir
    echo                     (default prefix: PREFIX/include)
    echo -libdir (dir) ..... Libraries will be installed to dir
    echo                     (default PREFIX/lib)
    echo -bindir (dir) ..... Executables will be installed to dir
    echo                     (default PREFIX/bin)
    echo -debug ............ Build with debugging symbols
    echo -release .......... Build without debugging symbols
    echo -silent ........... Reduces build output
    echo -tests ............ Build unit tests (not build by default)
    echo                     Note, this adds test symbols to all libraries
    echo                     and should not be used for release builds.
    echo -examples ......... Build example applications
    echo -vc ............... Generate Visual Studio make files
    echo -contact-src (backend) ...
    echo                     Compile the specified contacts API backend. Not selecting any backend
    echo                     will result in default selection for build platform
    echo                     options: symbian, wince, memory, maemo

if exist "%PROJECT_CONFIF%" del %PROJECT_CONFIG%
goto exitTag

:qtTag
shift
set QT_PATH=%1\
shift
goto cmdline_parsing

:contactsTag
shift
set CONTACTS_PLUGIN=%CONTACTS_PLUGIN% %1
shift
goto cmdline_parsing

:debugTag
if "%RELEASEMODE%" == "release" set RELEASEMODE=debug
shift
goto cmdline_parsing

:releaseTag
if "%RELEASEMODE%" == "debug"   set RELEASEMODE=release
shift
goto cmdline_parsing

:silentTag
echo CONFIG += silent > %PROJECT_CONFIG%
shift
goto cmdline_parsing

:prefixTag
shift
set QT_MOBILITY_PREFIX=%1
shift
goto cmdline_parsing

:libTag
shift
echo QT_MOBILITY_LIB = %1 >> %PROJECT_CONFIG%
shift
goto cmdline_parsing

:binTag
shift
echo QT_MOBILITY_BIN = %1 >> %PROJECT_CONFIG%
shift
goto cmdline_parsing

:headerTag
shift
echo QT_MOBILITY_INCLUDE = %1 >> %PROJECT_CONFIG%
shift
goto cmdline_parsing

:testTag
set BUILD_UNITTESTS=yes
shift
goto cmdline_parsing

:exampleTag
set BUILD_EXAMPLES=yes
shift
goto cmdline_parsing

:vcTag
shift
set VC_TEMPLATE_OPTION=-tp vc
goto cmdline_parsing

:startProcessing

echo CONFIG += %RELEASEMODE% >> %PROJECT_CONFIG%
echo CONTACTS_BACKENDS = %CONTACTS_PLUGIN% >> %PROJECT_CONFIG%

set CURRENTDIR=%CD%
echo %CURRENTDIR%
if exist %QT_MOBILITY_PREFIX% goto prefixExists
mkdir %QT_MOBILITY_PREFIX%
if errorlevel 1 goto invalidPrefix
cd /D %QT_MOBILITY_PREFIX%
set QT_MOBILITY_PREFIX=%CD%
cd /D %CURRENTDIR%
rd /S /Q %QT_MOBILITY_PREFIX%
goto endprefixProcessing

:invalidPrefix
echo "%QT_MOBILITY_PREFIX%" is not a valid directory path.
goto :exitTag

:prefixExists
cd /D %QT_MOBILITY_PREFIX%
set QT_MOBILITY_PREFIX=%CD%
cd /D %CURRENTDIR%

:endprefixProcessing
echo QT_MOBILITY_PREFIX = %QT_MOBILITY_PREFIX% >> %PROJECT_CONFIG%

echo build_unit_tests = %BUILD_UNITTESTS% >> %PROJECT_CONFIG%
echo build_examples = %BUILD_EXAMPLES% >> %PROJECT_CONFIG%
echo qmf_enabled = no >> %PROJECT_CONFIG%

echo isEmpty($$QT_MOBILITY_INCLUDE):QT_MOBILITY_INCLUDE=$$QT_MOBILITY_PREFIX/include >> %PROJECT_CONFIG%
echo isEmpty($$QT_MOBILITY_LIB):QT_MOBILITY_LIB=$$QT_MOBILITY_PREFIX/lib >> %PROJECT_CONFIG%
echo isEmpty($$QT_MOBILITY_BIN):QT_MOBILITY_BIN=$$QT_MOBILITY_PREFIX/bin >> %PROJECT_CONFIG%

copy %PROJECT_CONFIG% %BUILD_PATH%\config.pri
del %PROJECT_CONFIG%

echo Checking available Qt
%QT_PATH%qmake -v >> %PROJECT_LOG% 2>&1
if errorlevel 1 goto qmakeNotFound
goto qmakeFound
:qmakeNotFound
echo ... Not found  >> %PROJECT_LOG% 2>&1
if "%QT_PATH%" == "" (
    echo >&2 "Cannot find 'qmake' in your PATH."
) else (
    else echo >&2 "Cannot find 'qmake' in %QT_PATH%."
)
echo >&2 "Aborting."
goto exitTag

:qmakeFound
%QT_PATH%qmake -query QT_VERSION

goto checkMake

:makeTest
setlocal
    set CURRENT_PWD=%CD%

    if %BUILD_PATH% == %SOURCE_PATH% (
        cd %SOURCE_PATH%\config.tests\make
        if exist make del make
    ) else (
        rmdir /S /Q config.tests\make
        mkdir config.tests\make
        cd config.tests\make
    )

    for /f "tokens=3" %%i in ('%QT_PATH%qmake %SOURCE_PATH%\config.tests\make\make.pro 2^>^&1 1^>NUL') do set MAKETYPE=%%i

    if %MAKETYPE% == symbian-abld (
        make -h >> %PROJECT_LOG% 2>&1
        if not errorlevel 1 (
            echo ... Symbian abld make found.
            set MAKE=make
        )
    ) else if %MAKETYPE% == symbian-sbsv2 (
        make -h >> %PROJECT_LOG% 2>&1
        if not errorlevel 1 (
            echo ... Symbian sbsv2 make found.
            set MAKE=make
        )
    ) else if %MAKETYPE% == win32-nmake (
        nmake /? >> %PROJECT_LOG% 2>&1
        if not errorlevel 1 (
            echo ... nmake found.
            set MAKE=nmake
        )
    ) else if %MAKETYPE% == win32-mingw (
        make -v >> %PROJECT_LOG% 2>&1
        if not errorlevel 1 (
            echo ... mingw32-make found.
            set MAKE=make
        )
    )
    cd %CURRENT_PWD%
endlocal&set %1=%MAKE%&set %2=%MAKETYPE%&goto :EOF

:checkMake
echo Checking make
call :makeTest MAKE MAKETYPE
if not "%MAKE%" == "" goto compileTests

echo >&2 "Cannot find 'nmake', 'mingw32-make' or 'make' in your PATH"
echo >&2 "Aborting."

goto exitTag

:compileTest
setlocal
    echo Checking %1
    set CURRENT_PWD=%CD%

    if %BUILD_PATH% == %SOURCE_PATH% (
        cd %SOURCE_PATH%\config.tests\%2
        if exist %2 del %2
    ) else (
        rmdir /S /Q config.tests\%2
        mkdir config.tests\%2
        cd config.tests\%2
    )

    %QT_PATH%qmake %SOURCE_PATH%\config.tests\%2\%2.pro >> %PROJECT_LOG% 2>&1
    %MAKE% clean >> %PROJECT_LOG%
    %MAKE% >> %PROJECT_LOG% 2>&1

    set FAILED=0
    if %MAKETYPE% == symbian-sbsv2 (
        for /f "tokens=2" %%i in ('%MAKE% SBS^="@sbs --check"') do set FAILED=1
    ) else if %MAKETYPE% == symbian-abld (
        for /f "tokens=2" %%i in ('%MAKE% ABLD^="@ABLD.BAT -c"') do set FAILED=1
    ) else if errorlevel 1 (
        set FAILED=1
    )

    if %FAILED% == 0 (
        echo ... OK
        echo %2_enabled = yes >> %PROJECT_CONFIG%
    ) else (
        echo ... Not Found
        echo %2_enabled = no >> %PROJECT_CONFIG%
    )

    cd %CURRENT_PWD%
endlocal&goto :EOF

:compileTests

echo.
echo Start of compile tests
REM compile tests go here.
call :compileTest LBT lbt
echo End of compile tests

if not exist "%BUILD_PATH%\features" mkdir %BUILD_PATH%\features
echo "Generating Mobility Headers..."
rd /s /q %BUILD_PATH%\include
mkdir %BUILD_PATH%\include
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\global
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\bearer
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\publishsubscribe
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\location
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\serviceframework
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\systeminfo
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\contacts
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\multimedia
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\messaging

if exist config.pri del config.pri
ren %PROJECT_CONFIG% config.pri

echo.
echo Running qmake...
%QT_PATH%qmake -recursive %VC_TEMPLATE_OPTION% %SOURCE_PATH%\qtmobility.pro
if errorlevel 1 goto qmakeRecError
echo.
echo configure has finished. You may run %MAKE% to build the project now.
goto exitTag

:qmakeRecError
echo.
echo configure failed.

:exitTag

Fix make file detection.

Fix make file detection.

In batch scripting 'if errorlevel x' means >= x.


REM Set variables for Microsoft Visual Studio for Python 2.7
REM @call "C:\Users\michaelh3\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\vcvarsall.bat" amd64
REM Set environ as workaround for bugs (See http://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat and http://bugs.python.org/issue23246)
REM SET DISTUTILS_USE_SDK=1
REM SET MSSdk=1
REM Test build
python setup.py sdist bdist_wheel
REM Upload to PyPi
REM python setup.py sdist bdist_wheel upload

REM Set variables for Microsoft Visual Studio for Python 2.7
REM @call "C:\Users\michaelh3\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\vcvarsall.bat" amd64
REM Set environ as workaround for bugs (See http://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat and http://bugs.python.org/issue23246)
REM SET DISTUTILS_USE_SDK=1
REM SET MSSdk=1

@call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64

REM Test build
python setup.py sdist bdist_wheel
REM Upload to PyPi
REM python setup.py sdist bdist_wheel upload

Use MSVC 14.0 (2015) for compiling Python 3.6


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

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

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

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

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

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

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

echo Handling .NET Web Application deployment.

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

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

) ELSE (
  call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\orchard.proj" /nologo /verbosity:m /t:Precompiled /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="%DEPLOYMENT_SOURCE%\src\\" %SCM_BUILD_ARGS%
)

IF !ERRORLEVEL! NEQ 0 goto error

:: 3. BigFont, set file from which to deploy
SET DEPLOYMENT_TEMP="%DEPLOYMENT_SOURCE%\build\precompiled"
echo "%DEPLOYMENT_TEMP%"

:: 3. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (

  call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_TEMP%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"

  IF !ERRORLEVEL! NEQ 0 goto error
)

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

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

goto end

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

Use orchard.proj and a custom 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
:: -----

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. Create configuration file
(
  echo export const environment = {
  echo    production: true,
  echo    site_title: "%SiteTitle%",
  echo    site_custom_style_url: "%SiteCustomStyleUrl%",
  echo    site_custom_style_name: "%SiteCustomStyleName%",
  echo    api_url: "%ApiUrl%",
  echo    web_url: "%WebUrl%",
  echo    footer_name: "%FooterName%",
  echo    footer_url: "%FooterUrl%",
  echo    oauth_tenant: "%OAuthTenant%",
  echo    oauth_clientid: "%OAuthClientId%"
  echo };
) > "%DEPLOYMENT_TARGET%"\src\environments\environment.prod.ts

:: 5. Compile TypeScript
echo Transpiling TypeScript
pushd "%DEPLOYMENT_TARGET%"
call :ExecuteCmd node "%DEPLOYMENT_TARGET%\node_modules\@angular\cli\bin\ng" build --prod --aot false --pr false

:: 6. Copy web.config
echo Copying web config
call copy web.config dist\

:: 7. Copy custom styles if exists
IF EXISTS "%HOME%\site\assets\%SiteCustomStyleUrl%" (
  echo Copying custom css styles
  call copy "%HOME%\site\assets\%SiteCustomStyleUrl%" "%DEPLOYMENT_TARGET%\dist\%SiteCustomStyleUrl%"
)

:: 8. Copy custom logo if exists
IF EXISTS "%HOME%\site\assets\logo-white.svg" (
  echo Copying custom big logo
  call copy "%HOME%\site\assets\logo-white.svg" "%DEPLOYMENT_TARGET%\dist\assets\logo-white.svg"
)

:: 9. Copy custom small logo if exists
IF EXISTS "%HOME%\site\assets\logo-small-white.svg" (
  echo Copying custom small logo
  call copy "%HOME%\site\assets\logo-small-white.svg" "%DEPLOYMENT_TARGET%\dist\assets\logo-small-white.svg"
)

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

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

goto end

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

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

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

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
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. Create configuration file
(
  echo export const environment = {
  echo    production: true,
  echo    site_title: "%SiteTitle%",
  echo    site_custom_style_url: "%SiteCustomStyleUrl%",
  echo    site_custom_style_name: "%SiteCustomStyleName%",
  echo    api_url: "%ApiUrl%",
  echo    web_url: "%WebUrl%",
  echo    footer_name: "%FooterName%",
  echo    footer_url: "%FooterUrl%",
  echo    oauth_tenant: "%OAuthTenant%",
  echo    oauth_clientid: "%OAuthClientId%"
  echo };
) > "%DEPLOYMENT_TARGET%"\src\environments\environment.prod.ts

:: 5. Compile TypeScript
echo Transpiling TypeScript
pushd "%DEPLOYMENT_TARGET%"
call :ExecuteCmd node "%DEPLOYMENT_TARGET%\node_modules\@angular\cli\bin\ng" build --prod --aot false --pr false

:: 6. Copy web.config
echo Copying web config
call copy web.config dist\

:: 7. Copy custom styles if exists
IF EXIST "%HOME%\site\assets\%SiteCustomStyleUrl%" (
  echo Copying custom css styles
  call copy "%HOME%\site\assets\%SiteCustomStyleUrl%" "%DEPLOYMENT_TARGET%\dist\%SiteCustomStyleUrl%"
)

:: 8. Copy custom logo if exists
IF EXIST "%HOME%\site\assets\logo-white.svg" (
  echo Copying custom big logo
  call copy "%HOME%\site\assets\logo-white.svg" "%DEPLOYMENT_TARGET%\dist\assets\logo-white.svg"
)

:: 9. Copy custom small logo if exists
IF EXIST "%HOME%\site\assets\logo-small-white.svg" (
  echo Copying custom small logo
  call copy "%HOME%\site\assets\logo-small-white.svg" "%DEPLOYMENT_TARGET%\dist\assets\logo-small-white.svg"
)

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

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

goto end

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

Fix checking if file exist.

Fix checking if file exist.


@echo off
Setlocal EnableDelayedExpansion EnableExtensions

cd %APPVEYOR_BUILD_FOLDER%

:: =========================================================
:: Set some defaults. Infer some variables.
::
if "%LUA_VER%" NEQ "" (
	set LUA=lua
	set LUA_SHORTV=%LUA_VER:~0,3%
) else (
	set LUA=luajit
	set LJ_SHORTV=%LJ_VER:~0,3%
	set LUA_SHORTV=5.1
)

set LUAROCKS_SHORTV=%LUAROCKS_VER:~0,3%

if not defined LUAROCKS_URL set LUAROCKS_URL=http://keplerproject.github.io/luarocks/releases
if not defined LUAROCKS_REPO set LUAROCKS_REPO=http://rocks.moonscript.org
if not defined LUA_URL set LUA_URL=http://www.lua.org/ftp
if not defined LUAJIT_GIT_REPO set LUAJIT_GIT_REPO=http://luajit.org/git/luajit-2.0.git
if not defined LUAJIT_URL set LUAJIT_URL=http://luajit.org/download

if not defined LR_EXTERNAL set LR_EXTERNAL=c:\external
if not defined LUAROCKS_INSTALL set LUAROCKS_INSTALL=%ProgramFiles(x86)%\LuaRocks
if not defined LR_ROOT set LR_ROOT=%LUAROCKS_INSTALL%\%LUAROCKS_SHORTV%
if not defined LR_SYSTREE set LR_SYSTREE=%LUAROCKS_INSTALL%\systree
if /I "%platform%"=="x64" set LR_SYSTREE=%ProgramFiles%\LuaRocks\systree

if not defined SEVENZIP set SEVENZIP=7z

::
:: =========================================================

:: first create some necessary directories:
mkdir downloads 2>NUL

:: Download and compile Lua (or LuaJIT)
if "%LUA%"=="luajit" (
	:: defines LUA_DIR so Cmake can find this LuaJIT install
	set LUA_DIR=c:\lj%LJ_SHORTV%

	if not exist !LUA_DIR! (
		if !LJ_SHORTV!==2.1 (
			:: Clone repository and checkout 2.1 branch
			set lj_source_folder=%APPVEYOR_BUILD_FOLDER%\downloads\luajit-%LJ_VER%
			if not exist !lj_source_folder! (
				echo Cloning git repo %LUAJIT_GIT_REPO% !lj_source_folder!
				git clone %LUAJIT_GIT_REPO% !lj_source_folder! || call :die "Failed to clone repository"
			)
			cd !lj_source_folder!\src
			git checkout v2.1 || call :die
		) else (
			set lj_source_folder=%APPVEYOR_BUILD_FOLDER%\downloads\luajit-%LJ_VER%
			if not exist !lj_source_folder! (
				echo Downloading... %LUAJIT_URL%/LuaJIT-%LJ_VER%.tar.gz
				curl --silent --fail --max-time 120 --connect-timeout 30 %LUAJIT_URL%/LuaJIT-%LJ_VER%.tar.gz | %SEVENZIP% x -si -so -tgzip | %SEVENZIP% x -si -ttar -aoa -odownloads
			)
			cd !lj_source_folder!\src
		)
		:: Compiles LuaJIT
		call msvcbuild.bat

		mkdir !LUA_DIR! 2> NUL
		for %%a in (bin include lib) do ( mkdir "!LUA_DIR!\%%a" )

		for %%a in (luajit.exe lua51.dll) do ( move "!lj_source_folder!\src\%%a" "!LUA_DIR!\bin" )

		move "!lj_source_folder!\src\lua51.lib" "!LUA_DIR!\lib"
		for %%a in (lauxlib.h lua.h lua.hpp luaconf.h lualib.h luajit.h) do (
			copy "!lj_source_folder!\src\%%a" "!LUA_DIR!\include"
		)

	) else (
		echo LuaJIT %LJ_VER% already installed at !LUA_DIR!
	)

) else (
	:: defines LUA_DIR so Cmake can find this Lua install
	set LUA_DIR=c:\lua%LUA_VER%

	if not exist !LUA_DIR! (
		:: Download and compile Lua
		if not exist downloads\lua-%LUA_VER% (
			curl --silent --fail --max-time 120 --connect-timeout 30 %LUA_URL%/lua-%LUA_VER%.tar.gz | %SEVENZIP% x -si -so -tgzip | %SEVENZIP% x -si -ttar -aoa -odownloads
		)

		mkdir downloads\lua-%LUA_VER%\etc 2> NUL
		if not exist downloads\lua-%LUA_VER%\etc\winmake.bat (
			curl --silent --location --insecure --fail --max-time 120 --connect-timeout 30 https://github.com/Tieske/luawinmake/archive/master.tar.gz | %SEVENZIP% x -si -so -tgzip | %SEVENZIP% e -si -ttar -aoa -odownloads\lua-%LUA_VER%\etc luawinmake-master\etc\winmake.bat
		)

		cd downloads\lua-%LUA_VER%
		call etc\winmake
		call etc\winmake install c:\lua%LUA_VER%
	) else (
		echo Lua %LUA_VER% already installed at !LUA_DIR!
	)
)

if not exist !LUA_DIR!\bin\%LUA%.exe (
	echo Missing Lua interpreter
	exit /B 1
)

set PATH=%LUA_DIR%\bin;%PATH%
call !LUA! -v

:: =========================================================
:: LuaRocks
:: =========================================================

if not exist "%LR_ROOT%" (
	:: Downloads and installs LuaRocks
	cd %APPVEYOR_BUILD_FOLDER%

	if not exist downloads\luarocks-%LUAROCKS_VER%-win32.zip (
		echo Downloading LuaRocks...
		curl --silent --fail --max-time 120 --connect-timeout 30 --output downloads\luarocks-%LUAROCKS_VER%-win32.zip %LUAROCKS_URL%/luarocks-%LUAROCKS_VER%-win32.zip
		%SEVENZIP% x -aoa -odownloads downloads\luarocks-%LUAROCKS_VER%-win32.zip
	)

	cd downloads\luarocks-%LUAROCKS_VER%-win32
	call install.bat /LUA %LUA_DIR% /Q /LV %LUA_SHORTV% /P "%LUAROCKS_INSTALL%"
)

if not exist "%LR_ROOT%" (
	echo LuaRocks installation failed.
	exit /B 2
)

set PATH=%LR_ROOT%;%LR_SYSTREE%\bin;%PATH%

:: Lua will use just the system rocks
set LUA_PATH=%LR_ROOT%\lua\?.lua;%LR_ROOT%\lua\?\init.lua
set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?.lua
set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?\init.lua
set LUA_CPATH=%LR_SYSTREE%\lib\lua\%LUA_SHORTV%\?.dll

call luarocks --version || call :die "Error with LuaRocks installation"
call luarocks list

if not exist "%LR_EXTERNAL%" (
	mkdir "%LR_EXTERNAL%"
	mkdir "%LR_EXTERNAL%\lib"
	mkdir "%LR_EXTERNAL%\include"
)

set PATH=%LR_EXTERNAL%;%PATH%

echo ======================================================
if "%LUA%"=="luajit" (
	echo Installation of LuaJIT %LJ_VER% and LuaRocks %LUAROCKS_VER% done.
) else (
	echo Installation of Lua %LUA_VER% and LuaRocks %LUAROCKS_VER% done.
)
echo Platform - %platform%
echo LUA_PATH  - %LUA_PATH%
echo LUA_CPATH - %LUA_CPATH%
echo ======================================================

:: Exports the following variables:
:: (beware of whitespace between & and ^ below)
endlocal & ^
set PATH=%PATH%& ^
set LUA_DIR=%LUA_DIR%& ^
set LR_SYSTREE=%LR_SYSTREE%& ^
set LUA_PATH=%LUA_PATH%& ^
set LUA_CPATH=%LUA_CPATH%& ^
set LR_EXTERNAL=%LR_EXTERNAL%& ^
set LUA=%LUA%

goto :eof

:: This blank space is intentional. If you see errors like "The system cannot find the batch label specified 'foo'"
:: then try adding or removing blank lines lines above.
:: Yes, really.
:: http://stackoverflow.com/questions/232651/why-the-system-cannot-find-the-batch-label-specified-is-thrown-even-if-label-e

:: helper functions:

:: for bailing out when an error occurred
:die %1
echo %1
exit 1
goto :eof

@echo off
Setlocal EnableDelayedExpansion EnableExtensions

cd %APPVEYOR_BUILD_FOLDER%

:: =========================================================
:: Set some defaults. Infer some variables.
::
if "%LUA_VER%" NEQ "" (
	set LUA=lua
	set LUA_SHORTV=%LUA_VER:~0,3%
) else (
	set LUA=luajit
	set LJ_SHORTV=%LJ_VER:~0,3%
	set LUA_SHORTV=5.1
)

set LUAROCKS_SHORTV=%LUAROCKS_VER:~0,3%

if not defined LUAROCKS_URL set LUAROCKS_URL=http://keplerproject.github.io/luarocks/releases
if not defined LUAROCKS_REPO set LUAROCKS_REPO=http://rocks.moonscript.org
if not defined LUA_URL set LUA_URL=http://www.lua.org/ftp
if not defined LUAJIT_GIT_REPO set LUAJIT_GIT_REPO=http://luajit.org/git/luajit-2.0.git
if not defined LUAJIT_URL set LUAJIT_URL=http://luajit.org/download

if not defined LR_EXTERNAL set LR_EXTERNAL=c:\external
if not defined LUAROCKS_INSTALL set LUAROCKS_INSTALL=%ProgramFiles(x86)%\LuaRocks
if not defined LR_ROOT set LR_ROOT=%LUAROCKS_INSTALL%\%LUAROCKS_SHORTV%
if not defined LR_SYSTREE set LR_SYSTREE=%LUAROCKS_INSTALL%\systree
if /I "%platform%"=="x64" set LR_SYSTREE=%ProgramFiles%\LuaRocks\systree

if not defined SEVENZIP set SEVENZIP=7z

::
:: =========================================================

:: first create some necessary directories:
mkdir downloads 2>NUL

:: Download and compile Lua (or LuaJIT)
if "%LUA%"=="luajit" (
	:: defines LUA_DIR so Cmake can find this LuaJIT install
	set LUA_DIR=c:\lj%LJ_SHORTV%

	if not exist !LUA_DIR! (
		if !LJ_SHORTV!==2.1 (
			:: Clone repository and checkout 2.1 branch
			set lj_source_folder=%APPVEYOR_BUILD_FOLDER%\downloads\luajit-%LJ_VER%
			if not exist !lj_source_folder! (
				echo Cloning git repo %LUAJIT_GIT_REPO% !lj_source_folder!
				git clone %LUAJIT_GIT_REPO% !lj_source_folder! || call :die "Failed to clone repository"
			)
			cd !lj_source_folder!\src
			git checkout v2.1 || call :die
		) else (
			set lj_source_folder=%APPVEYOR_BUILD_FOLDER%\downloads\luajit-%LJ_VER%
			if not exist !lj_source_folder! (
				echo Downloading... %LUAJIT_URL%/LuaJIT-%LJ_VER%.tar.gz
				curl --silent --fail --max-time 120 --connect-timeout 30 %LUAJIT_URL%/LuaJIT-%LJ_VER%.tar.gz | %SEVENZIP% x -si -so -tgzip | %SEVENZIP% x -si -ttar -aoa -odownloads
			)
			cd !lj_source_folder!\src
		)
		:: Compiles LuaJIT
		call msvcbuild.bat

		mkdir !LUA_DIR! 2> NUL
		for %%a in (bin include lib) do ( mkdir "!LUA_DIR!\%%a" )

		for %%a in (luajit.exe lua51.dll) do ( move "!lj_source_folder!\src\%%a" "!LUA_DIR!\bin" )

		move "!lj_source_folder!\src\lua51.lib" "!LUA_DIR!\lib"
		for %%a in (lauxlib.h lua.h lua.hpp luaconf.h lualib.h luajit.h) do (
			copy "!lj_source_folder!\src\%%a" "!LUA_DIR!\include"
		)

	) else (
		echo LuaJIT %LJ_VER% already installed at !LUA_DIR!
	)

) else (
	:: defines LUA_DIR so Cmake can find this Lua install
	set LUA_DIR=c:\lua%LUA_VER%

	if not exist !LUA_DIR! (
		:: Download and compile Lua
		if not exist downloads\lua-%LUA_VER% (
			curl --silent --fail --max-time 120 --connect-timeout 30 %LUA_URL%/lua-%LUA_VER%.tar.gz | %SEVENZIP% x -si -so -tgzip | %SEVENZIP% x -si -ttar -aoa -odownloads
		)

		mkdir downloads\lua-%LUA_VER%\etc 2> NUL
		if not exist downloads\lua-%LUA_VER%\etc\winmake.bat (
			curl --silent --location --insecure --fail --max-time 120 --connect-timeout 30 https://github.com/Tieske/luawinmake/archive/master.tar.gz | %SEVENZIP% x -si -so -tgzip | %SEVENZIP% e -si -ttar -aoa -odownloads\lua-%LUA_VER%\etc luawinmake-master\etc\winmake.bat
		)

		cd downloads\lua-%LUA_VER%
		call etc\winmake
		call etc\winmake install c:\lua%LUA_VER%
	) else (
		echo Lua %LUA_VER% already installed at !LUA_DIR!
	)
)

if not exist !LUA_DIR!\bin\%LUA%.exe (
	echo Missing Lua interpreter
	exit /B 1
)

set PATH=%LUA_DIR%\bin;%PATH%
call !LUA! -v

:: =========================================================
:: LuaRocks
:: =========================================================

if not exist "%LR_ROOT%" (
	:: Downloads and installs LuaRocks
	cd %APPVEYOR_BUILD_FOLDER%

	if not exist downloads\luarocks-%LUAROCKS_VER%-win32.zip (
		echo Downloading LuaRocks...
		curl --silent --fail --max-time 120 --connect-timeout 30 --output downloads\luarocks-%LUAROCKS_VER%-win32.zip %LUAROCKS_URL%/luarocks-%LUAROCKS_VER%-win32.zip
		%SEVENZIP% x -aoa -odownloads downloads\luarocks-%LUAROCKS_VER%-win32.zip
	)

	cd downloads\luarocks-%LUAROCKS_VER%-win32
	call install.bat /LUA %LUA_DIR% /Q /LV %LUA_SHORTV% /P "%LUAROCKS_INSTALL%"
)

if not exist "%LR_ROOT%" (
	echo LuaRocks installation failed.
	exit /B 2
)

set PATH=%LR_ROOT%;%LR_SYSTREE%\bin;%PATH%

:: Lua will use just the system rocks
set LUA_PATH=%LR_ROOT%\lua\?.lua;%LR_ROOT%\lua\?\init.lua
set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?.lua
set LUA_PATH=%LUA_PATH%;%LR_SYSTREE%\share\lua\%LUA_SHORTV%\?\init.lua
set LUA_CPATH=%LR_SYSTREE%\lib\lua\%LUA_SHORTV%\?.dll

call luarocks --version || call :die "Error with LuaRocks installation"
call luarocks list

if not exist "%LR_EXTERNAL%" (
	mkdir "%LR_EXTERNAL%"
	mkdir "%LR_EXTERNAL%\lib"
	mkdir "%LR_EXTERNAL%\include"
)

set PATH=%LR_EXTERNAL%;%PATH%

:: Exports the following variables:
:: (beware of whitespace between & and ^ below)
endlocal & set PATH=%PATH%&^
set LUA_DIR=%LUA_DIR%&^
set LR_SYSTREE=%LR_SYSTREE%&^
set LUA_PATH=%LUA_PATH%&^
set LUA_CPATH=%LUA_CPATH%&^
set LR_EXTERNAL=%LR_EXTERNAL%&^
set LUA=%LUA%

echo ======================================================
if "%LUA%"=="luajit" (
	echo Installation of LuaJIT %LJ_VER% and LuaRocks %LUAROCKS_VER% done.
) else (
	echo Installation of Lua %LUA_VER% and LuaRocks %LUAROCKS_VER% done.
)
echo Platform - %platform%
echo LUA_PATH  - %LUA_PATH%
echo LUA_CPATH - %LUA_CPATH%
echo ======================================================

goto :eof

:: This blank space is intentional. If you see errors like "The system cannot find the batch label specified 'foo'"
:: then try adding or removing blank lines lines above.
:: Yes, really.
:: http://stackoverflow.com/questions/232651/why-the-system-cannot-find-the-batch-label-specified-is-thrown-even-if-label-e

:: helper functions:

:: for bailing out when an error occurred
:die %1
echo %1
exit 1
goto :eof

Fix trailing whitespace

Fix trailing whitespace


@echo off

if not exist "genie.exe" (
	echo Downloading genie...
	rem bitsadmin /transfer "genie" "https://github.com/bkaradzic/bx/raw/master/tools/bin/windows/genie.exe" "%~dp0\genie.exe"
	powershell Invoke-WebRequest -Uri "https://github.com/bkaradzic/bx/raw/master/tools/bin/windows/genie.exe" -OutFile "%~dp0\genie.exe"
)

IF "%1"=="" (
	echo No argument set
	echo Exemple : build.bat vs2015
	exit 1
)

genie.exe %*

if errorlevel 1 pause

@echo off

if not exist "genie.exe" (
	echo Downloading genie...
	rem bitsadmin /transfer "genie" "https://github.com/bkaradzic/bx/raw/master/tools/bin/windows/genie.exe" "%~dp0\genie.exe"
	powershell [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri "https://github.com/bkaradzic/bx/raw/master/tools/bin/windows/genie.exe" -OutFile '%~dp0\genie.exe'
)

IF "%1"=="" (
	echo No argument set
	echo Exemple : build.bat vs2015
	exit 1
)

genie.exe %*

if errorlevel 1 pause

Update build script

Update build script


@echo off
@setlocal
set NODE_ENV=production
cd %~dp0\..
call yarn build
set CW_PATH=..\clinwiki\public
del /y %CW_PATH%\*.chunk.js
del /y %CW_PATH%\main.*.js
copy /y build\* %CW_PATH%

Add build script

Add build script


@ECHO OFF

:choice
set /P c=WARNING! Are you sure you want to continue, this will remove all package files, view files, sqlce database, etc... Press 'Y' to auto-remove all files/folders, 'N' to cancel or 'C' to prompt for each folder removal?
if /I "%c%" EQU "C" goto :prompt
if /I "%c%" EQU "Y" goto :auto
if /I "%c%" EQU "N" goto :exit
goto :choice

:prompt

echo Current folder: %CD%

echo Regenerating SQL CE database
SET buildfolder=%CD%
CD ..\tools\RegenerateUmbracoSQLCEDatabase\
RegenerateUmbracoSQLCEDatabase.exe %CD%\..\..\src\Umbraco.Web.UI
CD %buildfolder%

echo Removing bin files
del ..\src\Umbraco.Web.UI\bin\*.*

echo Building solution
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe ..\src\umbraco.sln /t:Clean,Build

echo Resetting installedPackages.config
echo ^<?xml version="1.0" encoding="utf-8"?^>^<packages^>^</packages^> >..\src\Umbraco.Web.UI\App_Data\packages\installed\installedPackages.config

echo Removing plugin cache files
del ..\src\Umbraco.Web.UI\App_Data\TEMP\PluginCache\*.*

echo Removing cache files and examine index
del ..\src\Umbraco.Web.UI\App_Data\TEMP\*.*

echo Removing log files
del ..\src\Umbraco.Web.UI\App_Data\Logs\*.*

echo Removing packages
del ..\src\Umbraco.Web.UI\App_Data\packages\*.*

echo Removing previews
del ..\src\Umbraco.Web.UI\App_Data\preview\*.*

echo Removing app code files (typically added by starterkits)
del ..\src\Umbraco.Web.UI\App_Code\*.*

echo Removing xslt files
del ..\src\Umbraco.Web.UI\xslt\*.*

echo Removing user control files
del ..\src\Umbraco.Web.UI\UserControls\*.*

echo Removing masterpage files
del ..\src\Umbraco.Web.UI\masterpages\*.*

echo Removing view files
del ..\src\Umbraco.Web.UI\Views\*.*

echo Removing razor files
del ..\src\Umbraco.Web.UI\macroScripts\*.*

echo Removing media files
del ..\src\Umbraco.Web.UI\media\*.*

echo Removing script files
del ..\src\Umbraco.Web.UI\scripts\*.*

echo Removing css files
del ..\src\Umbraco.Web.UI\css\*.*

echo "Umbraco install reverted to clean install"
pause
exit

:auto

echo Current folder: %CD%

echo Regenerating SQL CE database
SET buildfolder=%CD%
CD ..\tools\RegenerateUmbracoSQLCEDatabase\
RegenerateUmbracoSQLCEDatabase.exe %CD%\..\..\src\Umbraco.Web.UI
CD %buildfolder%

echo Removing bin files
 FOR %%A IN (..\src\Umbraco.Web.UI\bin\*.*) DO DEL %%A

echo Building solution
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe ..\src\umbraco.sln /t:Clean,Build

echo Resetting installedPackages.config
echo ^<?xml version="1.0" encoding="utf-8"?^>^<packages^>^</packages^> >..\src\Umbraco.Web.UI\App_Data\packages\installed\installedPackages.config

echo Removing plugin cache files
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\TEMP\PluginCache\*.*) DO DEL %%A

echo Removing cache files and examine index
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\TEMP\*.*) DO DEL %%A

echo Removing log files
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\Logs\*.*) DO DEL %%A

echo Removing packages
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\packages\*.*) DO DEL %%A

echo Removing previews
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\preview\*.*) DO DEL %%A

echo Removing app code files (typically added by starterkits)
FOR %%A IN (..\src\Umbraco.Web.UI\App_Code\*.*) DO DEL %%A

echo Removing xslt files
FOR %%A IN (..\src\Umbraco.Web.UI\xslt\*.*) DO DEL %%A

echo Removing masterpage files
FOR %%A IN (..\src\Umbraco.Web.UI\masterpages\*.*) DO DEL %%A

echo Removing user control files
FOR %%A IN (..\src\Umbraco.Web.UI\usercontrols\*.*) DO DEL %%A

echo Removing view files
FOR %%A IN (..\src\Umbraco.Web.UI\Views\*.*) DO DEL %%A

echo Removing razor files
FOR %%A IN (..\src\Umbraco.Web.UI\macroScripts\*.*) DO DEL %%A

echo Removing media files
FOR %%A IN (..\src\Umbraco.Web.UI\media\*.*) DO DEL %%A

echo Removing script files
FOR %%A IN (..\src\Umbraco.Web.UI\scripts\*.*) DO DEL %%A

echo Removing css files
FOR %%A IN (..\src\Umbraco.Web.UI\css\*.*) DO DEL %%A

echo Removing Courier files
del ..\src\Umbraco.Web.UI\config\courier.config
del ..\src\Umbraco.Web.UI\umbraco\images\tray\courier.jpg
rmdir "..\src\Umbraco.Web.UI\umbraco\plugins\courier\*.*" /S /Q

echo Removing Contour files
del ..\src\Umbraco.Web.UI\umbraco\images\tray\contour.png
FOR %%A IN (..\src\Umbraco.Web.UI\umbraco\images\umbraco\icon_*.*) DO DEL %%A
rmdir "..\src\Umbraco.Web.UI\umbraco\plugins\umbracoContour\" /S /Q
del ..\src\Umbraco.Web.UI\umbraco\xslt\templates\UmbracoContour*.* /S /Q
rmdir "..\src\Umbraco.Web.UI\usercontrols\umbracoContour\" /S /Q

echo Start with a clean web.config
copy ..\src\Umbraco.Web.UI\web.Template.config ..\src\Umbraco.Web.UI\web.config /Y

echo "Umbraco install reverted to clean install"
pause
exit

:exit
exit

@ECHO OFF

:choice
set /P c=WARNING! Are you sure you want to continue, this will remove all package files, view files, sqlce database, etc... Press 'Y' to auto-remove all files/folders, 'N' to cancel or 'C' to prompt for each folder removal?
if /I "%c%" EQU "C" goto :prompt
if /I "%c%" EQU "Y" goto :auto
if /I "%c%" EQU "N" goto :exit
goto :choice

:prompt

echo Current folder: %CD%

echo Regenerating SQL CE database
SET buildfolder=%CD%
CD ..\tools\RegenerateUmbracoSQLCEDatabase\
RegenerateUmbracoSQLCEDatabase.exe %CD%\..\..\src\Umbraco.Web.UI
CD %buildfolder%

echo Removing bin files
del ..\src\Umbraco.Web.UI\bin\*.*

echo Building solution
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe ..\src\umbraco.sln /t:Clean,Build

echo Resetting installedPackages.config
echo ^<?xml version="1.0" encoding="utf-8"?^>^<packages^>^</packages^> >..\src\Umbraco.Web.UI\App_Data\packages\installed\installedPackages.config

echo Removing plugin cache files
del ..\src\Umbraco.Web.UI\App_Data\TEMP\PluginCache\*.*

echo Removing cache files and examine index
del ..\src\Umbraco.Web.UI\App_Data\TEMP\*.*

echo Removing log files
del ..\src\Umbraco.Web.UI\App_Data\Logs\*.*

echo Removing packages
del ..\src\Umbraco.Web.UI\App_Data\packages\*.*

echo Removing previews
del ..\src\Umbraco.Web.UI\App_Data\preview\*.*

echo Removing app code files (typically added by starterkits)
del ..\src\Umbraco.Web.UI\App_Code\*.*

echo Removing xslt files
del ..\src\Umbraco.Web.UI\xslt\*.*

echo Removing user control files
del ..\src\Umbraco.Web.UI\UserControls\*.*

echo Removing masterpage files
del ..\src\Umbraco.Web.UI\masterpages\*.*

echo Removing view files
del ..\src\Umbraco.Web.UI\Views\*.*

echo Removing razor files
del ..\src\Umbraco.Web.UI\macroScripts\*.*

echo Removing media files
del ..\src\Umbraco.Web.UI\media\*.*

echo Removing script files
del ..\src\Umbraco.Web.UI\scripts\*.*

echo Removing css files
del ..\src\Umbraco.Web.UI\css\*.*

echo "Umbraco install reverted to clean install"
pause
exit

:auto

echo Current folder: %CD%

echo Regenerating SQL CE database
SET buildfolder=%CD%
CD ..\tools\RegenerateUmbracoSQLCEDatabase\
RegenerateUmbracoSQLCEDatabase.exe %CD%\..\..\src\Umbraco.Web.UI
CD %buildfolder%

echo Removing bin files
 FOR %%A IN (..\src\Umbraco.Web.UI\bin\*.*) DO DEL %%A

echo Building solution
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe ..\src\umbraco.sln /t:Clean,Build

echo Resetting installedPackages.config
echo ^<?xml version="1.0" encoding="utf-8"?^>^<packages^>^</packages^> >..\src\Umbraco.Web.UI\App_Data\packages\installed\installedPackages.config

echo Removing plugin cache files
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\TEMP\PluginCache\*.*) DO DEL %%A

echo Removing cache files and examine index
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\TEMP\*.*) DO DEL %%A

echo Removing log files
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\Logs\*.*) DO DEL %%A

echo Removing packages
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\packages\*.*) DO DEL %%A

echo Removing previews
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\preview\*.*) DO DEL %%A

echo Removing app code files (typically added by starterkits)
FOR %%A IN (..\src\Umbraco.Web.UI\App_Code\*.*) DO DEL %%A

echo Removing xslt files
FOR %%A IN (..\src\Umbraco.Web.UI\xslt\*.*) DO DEL %%A

echo Removing masterpage files
FOR %%A IN (..\src\Umbraco.Web.UI\masterpages\*.*) DO DEL %%A

echo Removing user control files
FOR %%A IN (..\src\Umbraco.Web.UI\usercontrols\*.*) DO DEL %%A

echo Removing view files
FOR %%A IN (..\src\Umbraco.Web.UI\Views\*.*) DO DEL %%A

echo Removing razor files
FOR %%A IN (..\src\Umbraco.Web.UI\macroScripts\*.*) DO DEL %%A

echo Removing media files
FOR %%A IN (..\src\Umbraco.Web.UI\media\*.*) DO DEL %%A

echo Removing script files
FOR %%A IN (..\src\Umbraco.Web.UI\scripts\*.*) DO DEL %%A

echo Removing css files
FOR %%A IN (..\src\Umbraco.Web.UI\css\*.*) DO DEL %%A

echo Removing Courier files
del ..\src\Umbraco.Web.UI\config\courier.config
del ..\src\Umbraco.Web.UI\umbraco\images\tray\courier.jpg
rmdir "..\src\Umbraco.Web.UI\umbraco\plugins\courier\" /S /Q

echo Removing Contour files
del ..\src\Umbraco.Web.UI\umbraco\images\tray\contour.png
FOR %%A IN (..\src\Umbraco.Web.UI\umbraco\images\umbraco\icon_*.*) DO DEL %%A
rmdir "..\src\Umbraco.Web.UI\umbraco\plugins\umbracoContour\" /S /Q
del ..\src\Umbraco.Web.UI\umbraco\xslt\templates\UmbracoContour*.* /S /Q
rmdir "..\src\Umbraco.Web.UI\usercontrols\umbracoContour\" /S /Q

echo Start with a clean web.config
copy ..\src\Umbraco.Web.UI\web.Template.config ..\src\Umbraco.Web.UI\web.config /Y

echo "Umbraco install reverted to clean install"
pause
exit

:exit
exit

Correct path to Courier

Correct path to Courier


add hosts.bat

add hosts.bat


if exist "C:\Program Files\R\R-3.0.0\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.0.0\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.0.1\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.0.1\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.0.2\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.0.2\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.0.3\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.0.3\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.1.0\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.1.0\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.1.1\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.1.1\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.1.2\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.1.2\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.2.0\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.2.0\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.2.1\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.2.1\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.2.2\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.2.2\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.2.3\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.2.3\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.2.4\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.2.4\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.2.5\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.2.5\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.3.3\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.3.3\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.4.3\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.4.3\bin\i386\R.exe"
if exist "C:\Program Files\R\R-3.4.4\bin\i386\R.exe" set R_HOME="C:\Program Files\R\R-3.4.4\bin\i386\R.exe"

Update setup.bat

Update setup.bat

Latest version of R added to the list...


@echo off
start "" "C:\Program Files (x86)\Atlassian\SourceTree\SourceTree.exe" -f %~dpn1

@echo off
set directory=%~f1
if %directory:~-1%==\ set directory=%directory:~0,-1%
start "" "C:\Program Files (x86)\Atlassian\SourceTree\SourceTree.exe" -f %directory%

Remove trailing slash from directory

Remove trailing slash from directory


git checkout gh-pages
git merge master
npm start mol mol/app/supplies mol/perf/render mol/perf/uibench
git commit -a -m "Update" && git push || git checkout master

git checkout gh-pages
git merge master
npm start mol mol/app/hello mol/app/supplies mol/perf/render mol/perf/uibench
git commit -a -m "Update" && git push || git checkout master

Build mol/app/hello on deploy.

Build mol/app/hello on deploy.


gfortran leparagliding.f
mkdir -p ${LIBRARY_PREFIX}/bin
COPY a.exe ${LIBRARY_PREFIX}/bin/leparagliding.exe

gfortran leparagliding.f
mkdir -p %LIBRARY_PREFIX%/bin
COPY a.exe ${LIBRARY_PREFIX}/bin/leparagliding.exe

Update bld.bat

Update bld.bat


rm -r C:\TestCordovaWindows8\TestOutput
md C:\TestCordovaWindows8\
..\bin\create C:\TestCordovaWindows8\TestOutput
cd C:\TestCordovaWindows8\TestOutput\
.\cordova\build

test create script

test create script


@ECHO OFF
SETLOCAL
SETLOCAL EnableExtensions EnableDelayedExpansion

ECHO [NOTE] This script only process pictures in current folder

SET LF=^

REM Two empty lines are required!

REM Get number of pictures
SET count=0
FOR %%x in (*.jpg) DO SET /a count+=1

REM Get script directory
SET startDirectory=%~dp0

REM Check that the script can run
IF NOT EXIST "exiftool.exe" (
	IF NOT EXIST "C:\ProgramData\Chocolatey\bin\exiftool.exe" (
		IF NOT EXIST "%startDirectory%Apps\exiftool\exiftool.exe" (
			ECHO [ERROR] ExifTool not found
			GOTO :EOF
		) ELSE (
			SET exif="%startDirectory%Apps\exiftool\exiftool.exe"
		)
	) ELSE (
		SET exif="C:\ProgramData\Chocolatey\bin\exiftool.exe"
	)
) ELSE (
    SET exif="exiftool.exe"
)

IF %count% EQU 0 (
    ECHO [ERROR] No pictures found in current folder
    GOTO :EOF
)

IF "%1" == "" (

    ECHO No name provided
	SET /P answer="Do you want to enter a name (Y/n)? "
    IF /I {!answer!}=={n} (GOTO :NONAME)
    IF /I {!answer!}=={no} (GOTO :NONAME)

	SET /P name="Enter your name: "
	GOTO :CHECK

	:NONAME
    SET /P answer="Do you want to continue (Y/n)? "
    IF /I {!answer!}=={n} (GOTO :NO)
    IF /I {!answer!}=={no} (GOTO :NO)

    ECHO [INFO] Not using a name
    SET name=
    GOTO :CHECK

    :NO
    ECHO [ERROR] Operation aborted
    GOTO :EOF

) ELSE (

    SET name=%1

)

:CHECK

SET /P answer="Do you want to check the pictures have a datetime (Y/n)? "
IF /i {!answer!}=={n} (GOTO :PROCESS)
IF /i {!answer!}=={no} (GOTO :PROCESS)

SET number=1
SET wrong=0
FOR %%x in (*.jpg) DO (
    ECHO [WORK] Checking "%%x" (!number!/%count%^)
    REM Get the date at which the picture has been taken
    SET datetime=
    FOR /f %%i in ('CALL %exif% -d "%%Y-%%m-%%d" -DateTimeOriginal -S -s "%%x"') DO SET datetime=%%i
    IF [!datetime!] == [] (
        SET /a wrong+=1
    )
    SET /a number+=1
)
ECHO [INFO] %wrong% picture(s) do not have a datetime

SET /P answer="Do you want to continue (Y/n)? "
IF /i {!answer!}=={n} (GOTO :END)
IF /i {!answer!}=={no} (GOTO :END)

:PROCESS

REM Get first argument fully qualified path name
SET file=%~f1

SET /P answer="Do you want to sort the pictures by datetime taken (Y/n)? "
IF /i {!answer!}=={n} (GOTO :NOSORTING)
IF /i {!answer!}=={no} (GOTO :NOSORTING)

ECHO [INFO] Sorting pictures
CALL %exif% "-FileName<DateTimeOriginal" -d "%%%%Y-%%%%m-%%%%d_%%%%H.%%%%M.%%%%S%%%%%%%%-c.%%%%%%%%e" .

:NOSORTING

IF NOT [%name%] == [] (

    SET /P answer="Do you want to rename pictures (Y/n)? "
    IF /i {!answer!}=={n} (GOTO :METADATA)
    IF /i {!answer!}=={no} (GOTO :METADATA)

	SET includetime=1
	SET /P answer="Do you want to include time taken on top of the date (Y/n)? "
    IF /i {!answer!}=={n} (SET includetime=0)
    IF /i {!answer!}=={no} (SET includetime=0)

    SET number=1
    FOR %%x in (*.jpg) DO (
        REM Get the date at which the picture has been taken
		IF !includetime! EQU 1 (
			FOR /f %%i in ('CALL %exif% -d "%%Y-%%m-%%d-%%H.%%M.%%S" -DateTimeOriginal -S -s "%%x"') DO SET datetime=%%i
		) ELSE (
			FOR /f %%i in ('CALL %exif% -d "%%Y-%%m-%%d" -DateTimeOriginal -S -s "%%x"') DO SET datetime=%%i
		)
        REM Get the picture number
        SET formattedValue=00!number!
        IF %count% GTR 99 (
            REM More than 99 pictures
            SET formattedValue=!formattedValue:~-3!
        ) ELSE (
            REM Less than 100 pictures
            SET formattedValue=!formattedValue:~-2!
        )
        REM Get extension
        FOR /f "delims=" %%a in ("%%x") DO SET "extension=%%~xa"
        REM Rename picture
        SET newName=!datetime!-%name%-!formattedValue!!extension!
        ECHO [WORK] Renaming "%%x" to "!newName!" (!number!/%count%^)
        RENAME "%%x" "!newName!"
        REM Increment picture number
        SET /a number+=1
    )
)

:METADATA

SET /P answer="Do you want to remove pictures metadata (Y/n)? "
IF /i {!answer!}=={n} (GOTO :SORTING)
IF /i {!answer!}=={no} (GOTO :SORTING)

SET number=1
FOR %%x in (*.jpg) DO (
    ECHO [WORK] Clearing "%%x" (!number!/%count%^)
    COPY "%%x" "%%x-PROCESSING" >NUL
    CALL %exif% -P -all= -all:all= -XMP:All= -IPTC:Keywords= -ThumbnailImage= -overwrite_original "%%x" >NUL
    CALL %exif% -overwrite_original -P -tagsFromFile "%%x-PROCESSING" -DateTimeOriginal "%%x" -Orientation "%%x" >NUL
    DEL "%%x-PROCESSING" >NUL
    SET /a number+=1
)

:SORTING

SET question=Do you want to sort pictures by!LF!- YYYY/MM/DD/Name (1)!LF!- YYYY/MM/DD (2)!LF!- MM/DD (3)!LF!- DD only (4)!LF!- Not sorting them (n)?
ECHO !question!
SET /P answer="Select your option: "
IF /i !answer! EQU 1 (GOTO :CUSTOM)
IF /i !answer! EQU 2 (GOTO :YEARS)
IF /i !answer! EQU 3 (GOTO :MONTHS)
IF /i !answer! EQU 4 (GOTO :DAYS)
IF /i {!answer!}=={n} (GOTO :END)
IF /i {!answer!}=={no} (GOTO :END)

:CUSTOM

CALL %exif% "-Directory<DateTimeOriginal" -d "%%%%Y/%%%%m/%%%%d/%name%" .
GOTO :END

:YEARS

CALL %exif% "-Directory<DateTimeOriginal" -d "%%%%Y/%%%%m/%%%%d" .
GOTO :END

:MONTHS

CALL %exif% "-Directory<DateTimeOriginal" -d "%%%%m/%%%%d" .
GOTO :END

:DAYS

CALL %exif% "-Directory<DateTimeOriginal" -d "%%%%d" .
GOTO :END

:END

ECHO [INFO] All operations are completed
ENDLOCAL

@ECHO OFF
SETLOCAL
SETLOCAL EnableExtensions EnableDelayedExpansion

ECHO [NOTE] This script only process pictures in current folder

SET LF=^

REM Two empty lines are required!

REM Get number of pictures
SET count=0
FOR %%x in (*.jpg) DO SET /a count+=1

REM Get script directory
SET startDirectory=%~dp0

REM Check that the script can run
IF NOT EXIST "exiftool.exe" (
	IF NOT EXIST "C:\ProgramData\Chocolatey\bin\exiftool.exe" (
		IF NOT EXIST "%startDirectory%Apps\exiftool\exiftool.exe" (
			ECHO [ERROR] ExifTool not found
			GOTO :EOF
		) ELSE (
			SET exif="%startDirectory%Apps\exiftool\exiftool.exe"
		)
	) ELSE (
		SET exif="C:\ProgramData\Chocolatey\bin\exiftool.exe"
	)
) ELSE (
    SET exif="exiftool.exe"
)

IF %count% EQU 0 (
    ECHO [ERROR] No pictures found in current folder
    GOTO :EOF
)

IF "%1" == "" (

    ECHO No name provided
	SET /P answer="Do you want to enter a name (Y/n)? "
    IF /I {!answer!}=={n} (GOTO :NONAME)
    IF /I {!answer!}=={no} (GOTO :NONAME)

	SET /P name="Enter your name: "
	GOTO :CHECK

	:NONAME
    SET /P answer="Do you want to continue (Y/n)? "
    IF /I {!answer!}=={n} (GOTO :NO)
    IF /I {!answer!}=={no} (GOTO :NO)

    ECHO [INFO] Not using a name
    SET name=
    GOTO :CHECK

    :NO
    ECHO [ERROR] Operation aborted
    GOTO :EOF

) ELSE (

    SET name=%1

)

:CHECK

SET /P answer="Do you want to check the pictures have a datetime (Y/n)? "
IF /i {!answer!}=={n} (GOTO :PROCESS)
IF /i {!answer!}=={no} (GOTO :PROCESS)

SET number=1
SET wrong=0
FOR %%x in (*.jpg) DO (
    ECHO [WORK] Checking "%%x" (!number!/%count%^)
    REM Get the date at which the picture has been taken
    SET datetime=
    FOR /f %%i in ('CALL %exif% -d "%%Y-%%m-%%d" -DateTimeOriginal -S -s "%%x"') DO SET datetime=%%i
    IF [!datetime!] == [] (
        SET /a wrong+=1
		ECHO [MISSING] "%%x" does not have a datetime
    )
    SET /a number+=1
)
ECHO [INFO] %wrong% picture(s) do not have a datetime

SET /P answer="Do you want to continue (Y/n)? "
IF /i {!answer!}=={n} (GOTO :END)
IF /i {!answer!}=={no} (GOTO :END)

:PROCESS

REM Get first argument fully qualified path name
SET file=%~f1

SET /P answer="Do you want to sort the pictures by datetime taken (Y/n)? "
IF /i {!answer!}=={n} (GOTO :NOSORTING)
IF /i {!answer!}=={no} (GOTO :NOSORTING)

ECHO [INFO] Sorting pictures
CALL %exif% "-FileName<DateTimeOriginal" -d "%%%%Y-%%%%m-%%%%d_%%%%H.%%%%M.%%%%S%%%%%%%%-c.%%%%%%%%e" .

:NOSORTING

IF NOT [%name%] == [] (

    SET /P answer="Do you want to rename pictures (Y/n)? "
    IF /i {!answer!}=={n} (GOTO :METADATA)
    IF /i {!answer!}=={no} (GOTO :METADATA)

	SET includetime=1
	SET /P answer="Do you want to include time taken on top of the date (Y/n)? "
    IF /i {!answer!}=={n} (SET includetime=0)
    IF /i {!answer!}=={no} (SET includetime=0)

    SET number=1
    FOR %%x in (*.jpg) DO (
        REM Get the date at which the picture has been taken
		IF !includetime! EQU 1 (
			FOR /f %%i in ('CALL %exif% -d "%%Y-%%m-%%d-%%H.%%M.%%S" -DateTimeOriginal -S -s "%%x"') DO SET datetime=%%i
		) ELSE (
			FOR /f %%i in ('CALL %exif% -d "%%Y-%%m-%%d" -DateTimeOriginal -S -s "%%x"') DO SET datetime=%%i
		)
        REM Get the picture number
        SET formattedValue=00!number!
        IF %count% GTR 99 (
            REM More than 99 pictures
            SET formattedValue=!formattedValue:~-3!
        ) ELSE (
            REM Less than 100 pictures
            SET formattedValue=!formattedValue:~-2!
        )
        REM Get extension
        FOR /f "delims=" %%a in ("%%x") DO SET "extension=%%~xa"
        REM Rename picture
        SET newName=!datetime!-%name%-!formattedValue!!extension!
        ECHO [WORK] Renaming "%%x" to "!newName!" (!number!/%count%^)
        RENAME "%%x" "!newName!"
        REM Increment picture number
        SET /a number+=1
    )
)

:METADATA

SET /P answer="Do you want to remove pictures metadata (Y/n)? "
IF /i {!answer!}=={n} (GOTO :SORTING)
IF /i {!answer!}=={no} (GOTO :SORTING)

SET number=1
FOR %%x in (*.jpg) DO (
    ECHO [WORK] Clearing "%%x" (!number!/%count%^)
    COPY "%%x" "%%x-PROCESSING" >NUL
    CALL %exif% -P -all= -all:all= -XMP:All= -IPTC:Keywords= -ThumbnailImage= -overwrite_original "%%x" >NUL
    CALL %exif% -overwrite_original -P -tagsFromFile "%%x-PROCESSING" -DateTimeOriginal "%%x" -Orientation "%%x" >NUL
    DEL "%%x-PROCESSING" >NUL
    SET /a number+=1
)

:SORTING

SET question=Do you want to sort pictures by!LF!- YYYY/MM/DD/Name (1)!LF!- YYYY/MM/DD (2)!LF!- MM/DD (3)!LF!- DD only (4)!LF!- Not sorting them (n)?
ECHO !question!
SET /P answer="Select your option: "
IF /i !answer! EQU 1 (GOTO :CUSTOM)
IF /i !answer! EQU 2 (GOTO :YEARS)
IF /i !answer! EQU 3 (GOTO :MONTHS)
IF /i !answer! EQU 4 (GOTO :DAYS)
IF /i {!answer!}=={n} (GOTO :END)
IF /i {!answer!}=={no} (GOTO :END)

:CUSTOM

CALL %exif% "-Directory<DateTimeOriginal" -d "%%%%Y/%%%%m/%%%%d/%name%" .
GOTO :END

:YEARS

CALL %exif% "-Directory<DateTimeOriginal" -d "%%%%Y/%%%%m/%%%%d" .
GOTO :END

:MONTHS

CALL %exif% "-Directory<DateTimeOriginal" -d "%%%%m/%%%%d" .
GOTO :END

:DAYS

CALL %exif% "-Directory<DateTimeOriginal" -d "%%%%d" .
GOTO :END

:END

ECHO [INFO] All operations are completed
ENDLOCAL

Add a message indicating if a picture is missing a datetime