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

@echo off

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

setlocal
pushd "%_NAM%"

:: Apply local patches

sed -e "s/-march=i486 -Wall::-D_MT:MINGW32:-lws2_32/-march=i686 -mtune=generic -m32 -fno-ident -flto -ffat-lto-objects -frandom-seed=__RANDOM_SEED__ -static-libgcc -Wall::-D_MT:MINGW32:-lws2_32/g" -i Configure
sed -e "s/-DWIN32_LEAN_AND_MEAN -DUNICODE/-DWIN32_LEAN_AND_MEAN -m64 -fno-ident -flto -ffat-lto-objects -frandom-seed=__RANDOM_SEED__ -static-libgcc -DUNICODE/g" -i Configure
sed -e "s/windres -o rc.o/windres $(SHARED_RCFLAGS) -o rc.o/g" -i Makefile.shared

:: Build

set MAKE=mingw32-make

if "%_CPU%" == "win32" set SHARED_RCFLAGS=-F pe-i386
if "%_CPU%" == "win64" set SHARED_RCFLAGS=-F pe-x86-64

del /s *.o *.a *.exe >> nul 2>&1
if "%_CPU%" == "win32" perl Configure mingw   shared no-unit-test no-ssl2 no-ssl3 no-rc5 no-idea "--prefix=%CD:\=/%"
if "%_CPU%" == "win64" perl Configure mingw64 shared no-unit-test no-ssl2 no-ssl3 no-rc5 no-idea "--prefix=%CD:\=/%"
sh -c "mingw32-make depend"
sh -c "mingw32-make"

:: Make steps for determinism

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

:: Strip debug info

strip -p -s apps\openssl.exe

python ..\peclean.py apps\openssl.exe
python ..\peclean.py apps\*.dll
python ..\peclean.py engines\*.dll

touch -c apps/openssl.exe    -r CHANGES
touch -c apps/*.dll          -r CHANGES
touch -c engines/*.dll       -r CHANGES
touch -c include/openssl/*.h -r CHANGES
touch -c *.a                 -r CHANGES
touch -c *.lib               -r CHANGES

:: Create package

set _BAS=%_NAM%-%_VER%-%_CPU%-mingw
if not "%APPVEYOR_REPO_BRANCH%" == "master" set _BAS=%_BAS%-test
set _DST=%TEMP%\%_BAS%

xcopy /y /q    apps\openssl.exe "%_DST%\"
xcopy /y /q    apps\*.dll       "%_DST%\"
xcopy /y /q    engines\*.dll    "%_DST%\engines\"
 copy /y       apps\openssl.cnf "%_DST%\openssl.cfg"
xcopy /y /s /q include\*.*      "%_DST%\include\"
xcopy /y /q    ms\applink.c     "%_DST%\include\openssl\"
 copy /y       CHANGES          "%_DST%\CHANGES.txt"
 copy /y       LICENSE          "%_DST%\LICENSE.txt"
 copy /y       README           "%_DST%\README.txt"
 copy /y       FAQ              "%_DST%\FAQ.txt"
 copy /y       NEWS             "%_DST%\NEWS.txt"

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

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

touch -c %_DST:\=/%/engines         -r CHANGES
touch -c %_DST:\=/%/include/openssl -r CHANGES
touch -c %_DST:\=/%/include         -r CHANGES
touch -c %_DST:\=/%/lib             -r CHANGES
touch -c %_DST:\=/%                 -r CHANGES

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

popd
endlocal

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

@echo off

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

setlocal
pushd "%_NAM%"

:: Apply local patches

sed -e "s/-march=i486 -Wall::-D_MT:MINGW32:-lws2_32/-march=i686 -mtune=generic -m32 -fno-ident -flto -ffat-lto-objects -frandom-seed=__RANDOM_SEED__ -static-libgcc -Wall::-D_MT:MINGW32:-lws2_32/g" -i Configure
sed -e "s/-DWIN32_LEAN_AND_MEAN -DUNICODE/-DWIN32_LEAN_AND_MEAN -m64 -fno-ident -flto -ffat-lto-objects -frandom-seed=__RANDOM_SEED__ -static-libgcc -DUNICODE/g" -i Configure
sed -e "s/windres -o rc.o/windres $(SHARED_RCFLAGS) -o rc.o/g" -i Makefile.shared

:: Build

set MAKE=mingw32-make

if "%_CPU%" == "win32" set SHARED_RCFLAGS=-F pe-i386
if "%_CPU%" == "win64" set SHARED_RCFLAGS=-F pe-x86-64

del /s *.o *.a *.exe >> nul 2>&1
if "%_CPU%" == "win32" perl Configure mingw   shared no-unit-test no-ssl2 no-ssl3 no-rc5 no-idea        "--prefix=%CD:\=/%"
:: Disable asm in 64-bit builds. It makes linking the static libs fail in LTO mode:
::   C:\Users\...\AppData\Local\Temp\ccUO3sBD.s: Assembler messages:
::   C:\Users\...\AppData\Local\Temp\ccUO3sBD.s:23710: Error: operand type mismatch for `div'
::   lto-wrapper.exe: fatal error: gcc.exe returned 1 exit status
::   compilation terminated.
::   C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lto-wrapper failed
::   collect2.exe: error: ld returned 1 exit status
if "%_CPU%" == "win64" perl Configure mingw64 shared no-unit-test no-ssl2 no-ssl3 no-rc5 no-idea no-asm "--prefix=%CD:\=/%"
sh -c "mingw32-make depend"
sh -c "mingw32-make"

:: Make steps for determinism

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

:: Strip debug info

strip -p -s apps\openssl.exe

python ..\peclean.py apps\openssl.exe
python ..\peclean.py apps\*.dll
python ..\peclean.py engines\*.dll

touch -c apps/openssl.exe    -r CHANGES
touch -c apps/*.dll          -r CHANGES
touch -c engines/*.dll       -r CHANGES
touch -c include/openssl/*.h -r CHANGES
touch -c *.a                 -r CHANGES
touch -c *.lib               -r CHANGES

:: Create package

set _BAS=%_NAM%-%_VER%-%_CPU%-mingw
if not "%APPVEYOR_REPO_BRANCH%" == "master" set _BAS=%_BAS%-test
set _DST=%TEMP%\%_BAS%

xcopy /y /q    apps\openssl.exe "%_DST%\"
xcopy /y /q    apps\*.dll       "%_DST%\"
xcopy /y /q    engines\*.dll    "%_DST%\engines\"
 copy /y       apps\openssl.cnf "%_DST%\openssl.cfg"
xcopy /y /s /q include\*.*      "%_DST%\include\"
xcopy /y /q    ms\applink.c     "%_DST%\include\openssl\"
 copy /y       CHANGES          "%_DST%\CHANGES.txt"
 copy /y       LICENSE          "%_DST%\LICENSE.txt"
 copy /y       README           "%_DST%\README.txt"
 copy /y       FAQ              "%_DST%\FAQ.txt"
 copy /y       NEWS             "%_DST%\NEWS.txt"

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

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

touch -c %_DST:\=/%/engines         -r CHANGES
touch -c %_DST:\=/%/include/openssl -r CHANGES
touch -c %_DST:\=/%/include         -r CHANGES
touch -c %_DST:\=/%/lib             -r CHANGES
touch -c %_DST:\=/%                 -r CHANGES

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

popd
endlocal

disable asm for win64 again

mk-openssl.bat: disable asm for win64 again

and document the reason.


cd dist
git commit -a -m %*
git tag %*
cd ..
git commit -a -m %*
git tag %*
git submodule update --remote
cd dist
git push
git push origin tags/%*
cd ..
git push
git push origin tags/%*

cd dist
git fetch
git reset --hard origin/master
cd ..
call gulpw
cd dist
git commit -a -m %*
git tag %*
cd ..
git commit -a -m %*
git tag %*
cd dist
git push origin HEAD:master
git push origin tags/%*
cd ..
git push
git push origin tags/%*

improve release.bat

improve release.bat


@echo ofF

rem Add necessary dirs to the path
set PHP_SDK_BIN_PATH=%~dp0\..
set PHP_SDK_PATH=%PHP_SDK_BIN_PATH%\..
set PHP_SDK_MSYS2_PATH=%PHP_SDK_PATH%\..\msys2\usr\bin

set PATH=%PHP_SDK_BIN_PATH%;%PHP_SDK_MSYS2_PATH%;%PATH%

rem @echo ofF

rem Add necessary dirs to the path
set PHP_SDK_BIN_PATH=%~dp0
set PHP_SDK_PATH=%PHP_SDK_BIN_PATH%..
set PHP_SDK_MSYS2_PATH=%PHP_SDK_PATH%\msys2\usr\bin

set PATH=%PHP_SDK_BIN_PATH%;%PHP_SDK_MSYS2_PATH%;%PATH%

fix setvars batch

fix setvars batch


@echo off
REM
REM install.bat [master | next]
REM
REM Download GamePlay resources from HTTP server and extract from ZIP
REM
REM Helps prevent repo bloat due to large binary files since they can
REM be hosted separately.
REM

REM Production URL
set prefix=http://www.gameplay3d.org

set branchname=%1
if "%branchname%" == "" (
  set branchname=next
)

set filename=gameplay-deps-%branchname%

echo Downloading %filename%.zip from %prefix%
%~d0
cd %~dp0
> temp.cs ECHO using System;
>> temp.cs ECHO using System.Net;
>> temp.cs ECHO using System.ComponentModel;
>> temp.cs ECHO class Program
>> temp.cs ECHO {
>> temp.cs ECHO     static string file = "%filename%.zip";
>> temp.cs ECHO     static string url = "%prefix%/" + file;
>> temp.cs ECHO     static bool done = false;
>> temp.cs ECHO     static void Main(string[] args)
>> temp.cs ECHO     {
>> temp.cs ECHO         try
>> temp.cs ECHO         {
>> temp.cs ECHO             WebClient client = new WebClient();
>> temp.cs ECHO             client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
>> temp.cs ECHO             client.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCompleted);
>> temp.cs ECHO             Console.Write("Downloading " + url + ": 0%%    ");
>> temp.cs ECHO             client.DownloadFileAsync(new Uri(url), file);
>> temp.cs ECHO             while (!done) System.Threading.Thread.Sleep(1000);
>> temp.cs ECHO         }
>> temp.cs ECHO         catch (Exception x)
>> temp.cs ECHO         {
>> temp.cs ECHO             Console.WriteLine("Error: " + x.Message);
>> temp.cs ECHO         }
>> temp.cs ECHO     }
>> temp.cs ECHO     static void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
>> temp.cs ECHO     {
>> temp.cs ECHO         Console.Write("\rDownloading " + url + ": " + e.ProgressPercentage + "%%    ");
>> temp.cs ECHO     }
>> temp.cs ECHO     static void DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
>> temp.cs ECHO     {
>> temp.cs ECHO         Console.WriteLine("\rDownloading " + url + ": Done.    ");
>> temp.cs ECHO         done = true;
>> temp.cs ECHO     }
>> temp.cs ECHO }
> temp1.vbs ECHO Dim strFileURL, strHDLocation
>> temp1.vbs ECHO strFileURL = WScript.Arguments(0)
>> temp1.vbs ECHO strHDLocation = WScript.Arguments(1)
>> temp1.vbs ECHO Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
>> temp1.vbs ECHO objXMLHTTP.open "GET", strFileURL, false
>> temp1.vbs ECHO objXMLHTTP.send()
>> temp1.vbs ECHO If objXMLHTTP.Status = 200 Then
>> temp1.vbs ECHO Set objADOStream = CreateObject("ADODB.Stream")
>> temp1.vbs ECHO objADOStream.Open
>> temp1.vbs ECHO objADOStream.Type = 1
>> temp1.vbs ECHO objADOStream.Write objXMLHTTP.ResponseBody
>> temp1.vbs ECHO objADOStream.Position = 0
>> temp1.vbs ECHO Set objFSO = Createobject("Scripting.FileSystemObject")
>> temp1.vbs ECHO If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
>> temp1.vbs ECHO Set objFSO = Nothing
>> temp1.vbs ECHO objADOStream.SaveToFile strHDLocation
>> temp1.vbs ECHO objADOStream.Close
>> temp1.vbs ECHO Set objADOStream = Nothing
>> temp1.vbs ECHO End if
>> temp1.vbs ECHO Set objXMLHTTP = Nothing

if not exist %windir%\Microsoft.NET\Framework\v2.0.50727\NUL goto USE_VBS_AS_FALLBACK
%windir%\Microsoft.NET\Framework\v2.0.50727\csc temp.cs
temp.exe
del temp.exe
goto :EXTRACT

:USE_VBS_AS_FALLBACK
cscript temp1.vbs %prefix%/%filename%.zip %filename%.zip

:EXTRACT
echo Extracting %filename%.zip... please standby...
%~d0
cd %~dp0
> temp2.vbs ECHO Dim fileName, workingDir
>> temp2.vbs ECHO fileName = WScript.Arguments(0)
>> temp2.vbs ECHO workingDir = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
>> temp2.vbs ECHO Set objShell = CreateObject("Shell.Application")
>> temp2.vbs ECHO Set objSource = objShell.NameSpace(workingDir ^& "\" ^& fileName).Items()
>> temp2.vbs ECHO Set objTarget = objShell.NameSpace(workingDir ^& "\")
>> temp2.vbs ECHO intOptions = 256
>> temp2.vbs ECHO objTarget.CopyHere objSource, intOptions
cscript temp2.vbs %filename%.zip
echo Cleaning up...
del temp.cs
del temp1.vbs
del temp2.vbs
del %filename%.zip
echo Done.

@echo off
REM
REM install.bat [master | next]
REM
REM Download GamePlay resources from HTTP server and extract from ZIP
REM
REM Helps prevent repo bloat due to large binary files since they can
REM be hosted separately.
REM

REM Production URL
set prefix=http://www.gameplay3d.org

set branchname=%1
if "%branchname%" == "" (
  set branchname=next
)

set filename=gameplay-deps-%branchname%

echo Downloading %filename%.zip from %prefix%
%~d0
cd %~dp0
> temp.cs ECHO using System;
>> temp.cs ECHO using System.Net;
>> temp.cs ECHO using System.ComponentModel;
>> temp.cs ECHO class Program
>> temp.cs ECHO {
>> temp.cs ECHO     static string file = "%filename%.zip";
>> temp.cs ECHO     static string url = "%prefix%/" + file;
>> temp.cs ECHO     static bool done = false;
>> temp.cs ECHO     static void Main(string[] args)
>> temp.cs ECHO     {
>> temp.cs ECHO         try
>> temp.cs ECHO         {
>> temp.cs ECHO             WebClient client = new WebClient();
>> temp.cs ECHO             client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
>> temp.cs ECHO             client.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCompleted);
>> temp.cs ECHO             Console.Write("Downloading " + url + ": 0%%    ");
>> temp.cs ECHO             client.DownloadFileAsync(new Uri(url), file);
>> temp.cs ECHO             while (!done) System.Threading.Thread.Sleep(1000);
>> temp.cs ECHO         }
>> temp.cs ECHO         catch (Exception x)
>> temp.cs ECHO         {
>> temp.cs ECHO             Console.WriteLine("Error: " + x.Message);
>> temp.cs ECHO         }
>> temp.cs ECHO     }
>> temp.cs ECHO     static void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
>> temp.cs ECHO     {
>> temp.cs ECHO         Console.Write("\rDownloading " + url + ": " + e.ProgressPercentage + "%%    ");
>> temp.cs ECHO     }
>> temp.cs ECHO     static void DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
>> temp.cs ECHO     {
>> temp.cs ECHO         Console.WriteLine("\rDownloading " + url + ": Done.    ");
>> temp.cs ECHO         done = true;
>> temp.cs ECHO     }
>> temp.cs ECHO }
> temp1.vbs ECHO Dim strFileURL, strHDLocation
>> temp1.vbs ECHO strFileURL = WScript.Arguments(0)
>> temp1.vbs ECHO strHDLocation = WScript.Arguments(1)
>> temp1.vbs ECHO Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
>> temp1.vbs ECHO objXMLHTTP.open "GET", strFileURL, false
>> temp1.vbs ECHO objXMLHTTP.send()
>> temp1.vbs ECHO If objXMLHTTP.Status = 200 Then
>> temp1.vbs ECHO Set objADOStream = CreateObject("ADODB.Stream")
>> temp1.vbs ECHO objADOStream.Open
>> temp1.vbs ECHO objADOStream.Type = 1
>> temp1.vbs ECHO objADOStream.Write objXMLHTTP.ResponseBody
>> temp1.vbs ECHO objADOStream.Position = 0
>> temp1.vbs ECHO Set objFSO = Createobject("Scripting.FileSystemObject")
>> temp1.vbs ECHO If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
>> temp1.vbs ECHO Set objFSO = Nothing
>> temp1.vbs ECHO objADOStream.SaveToFile strHDLocation
>> temp1.vbs ECHO objADOStream.Close
>> temp1.vbs ECHO Set objADOStream = Nothing
>> temp1.vbs ECHO End if
>> temp1.vbs ECHO Set objXMLHTTP = Nothing

if exist %windir%\Microsoft.NET\Framework\v2.0.50727\NUL (
    %windir%\Microsoft.NET\Framework\v2.0.50727\csc temp.cs
) else (
if exist %windir%\Microsoft.NET\Framework\v4.0.30319\NUL (
    %windir%\Microsoft.NET\Framework\v4.0.30319\csc temp.cs
) else (
    goto USE_VBS_AS_FALLBACK
))
temp.exe
del temp.exe
goto :EXTRACT

:USE_VBS_AS_FALLBACK
cscript temp1.vbs %prefix%/%filename%.zip %filename%.zip

:EXTRACT
echo Extracting %filename%.zip... please standby...
%~d0
cd %~dp0
> temp2.vbs ECHO Dim fileName, workingDir
>> temp2.vbs ECHO fileName = WScript.Arguments(0)
>> temp2.vbs ECHO workingDir = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
>> temp2.vbs ECHO Set objShell = CreateObject("Shell.Application")
>> temp2.vbs ECHO Set objSource = objShell.NameSpace(workingDir ^& "\" ^& fileName).Items()
>> temp2.vbs ECHO Set objTarget = objShell.NameSpace(workingDir ^& "\")
>> temp2.vbs ECHO intOptions = 256
>> temp2.vbs ECHO objTarget.CopyHere objSource, intOptions
cscript temp2.vbs %filename%.zip
echo Cleaning up...
del temp.cs
del temp1.vbs
del temp2.vbs
del %filename%.zip
echo Done.

Add Windows 8 support for .NET downloader in the install script.


@echo off
gem build XYGui.gemspec & gem install -l XYGui-0.1.0.gem

Create install.cmd

Create install.cmd


@ECHO OFF
SETLOCAL
SET EL=0

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

IF /I "%msvs_toolset%"=="" ECHO msvs_toolset unset, defaulting to 14 && SET msvs_toolset=14
IF /I "%msvs_version%"=="" ECHO msvs_version unset, defaulting to 2015 && SET msvs_version=2015

SET PATH=%CD%;%PATH%
IF NOT "%NODE_RUNTIME%"=="" SET "TOOLSET_ARGS=%TOOLSET_ARGS% --runtime=%NODE_RUNTIME%"
IF NOT "%NODE_RUNTIME_VERSION%"=="" SET "TOOLSET_ARGS=%TOOLSET_ARGS% --target=%NODE_RUNTIME_VERSION%"

ECHO APPVEYOR^: %APPVEYOR%
ECHO nodejs_version^: %nodejs_version%
ECHO platform^: %platform%
ECHO msvs_toolset^: %msvs_toolset%
ECHO msvs_version^: %msvs_version%
ECHO TOOLSET_ARGS^: %TOOLSET_ARGS%

ECHO activating VS command prompt
:: NOTE this call makes the x64 -> X64
IF /I "%platform%"=="x64" ECHO x64 && CALL "C:\Program Files (x86)\Microsoft Visual Studio %msvs_toolset%.0\VC\vcvarsall.bat" amd64
IF /I "%platform%"=="x86" ECHO x86 && CALL "C:\Program Files (x86)\Microsoft Visual Studio %msvs_toolset%.0\VC\vcvarsall.bat" x86
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO using compiler^: && CALL cl
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO using MSBuild^: && CALL msbuild /version && ECHO.
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO downloading/installing node
IF /I "%platform%"=="x64" powershell Install-Product node $env:nodejs_version x64
IF /I "%platform%"=="x86" powershell Install-Product node $env:nodejs_version x86
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

powershell Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO available node.exe^:
call where node
ECHO available npm^:
call where npm

ECHO node^: && call node -v
call node -e "console.log('  - arch:',process.arch,'\n  - argv:',process.argv,'\n  - execPath:',process.execPath)"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO npm^: && CALL npm -v
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO ===== where npm puts stuff START ============
ECHO npm root && CALL npm root
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO npm root -g && CALL npm root -g
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO npm bin && CALL npm bin
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO npm bin -g && CALL npm bin -g
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET NPM_BIN_DIR=
FOR /F "tokens=*" %%i in ('CALL npm bin -g') DO SET NPM_BIN_DIR=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF /I "%NPM_BIN_DIR%"=="%CD%" ECHO ERROR npm bin -g equals local directory && SET ERRORLEVEL=1 && GOTO ERROR
ECHO ===== where npm puts stuff END ============

IF "%nodejs_version:~0,1%"=="4" CALL npm install node-gyp@3.x
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF "%nodejs_version:~0,1%"=="5" CALL npm install node-gyp@3.x
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

CALL npm install --build-from-source --msvs_version=%msvs_version% %TOOLSET_ARGS% --loglevel=http
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

FOR /F "tokens=*" %%i in ('"CALL node_modules\.bin\node-pre-gyp reveal module %TOOLSET_ARGS% --silent"') DO SET MODULE=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
FOR /F "tokens=*" %%i in ('node -e "console.log(process.execPath)"') DO SET NODE_EXE=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

dumpbin /DEPENDENTS "%NODE_EXE%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
dumpbin /DEPENDENTS "%MODULE%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

IF "%NODE_RUNTIME%"=="electron" GOTO CHECK_ELECTRON_TEST_ERRORLEVEL

::skipping check for errorlevel npm test result when using io.js
::@springmeyer: how to proceed?
IF NOT "%nodejs_version%"=="1.8.1" IF NOT "%nodejs_version%"=="2.0.0" GOTO CHECK_NPM_TEST_ERRORLEVEL

ECHO calling npm test
CALL npm test
ECHO ==========================================
ECHO ==========================================
ECHO ==========================================

GOTO NPM_TEST_FINISHED

:CHECK_ELECTRON_TEST_ERRORLEVEL
ECHO installing electron
CALL npm install -g "electron@%NODE_RUNTIME_VERSION%"
ECHO installing electron-mocha
CALL npm install -g electron-mocha
ECHO preparing tests
CALL electron "test/support/createdb-electron.js"
DEL "test\support\createdb-electron.js"
ECHO calling electron-mocha
CALL electron-mocha -R spec --timeout 480000
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO NPM_TEST_FINISHED

:CHECK_NPM_TEST_ERRORLEVEL
ECHO calling npm test
CALL npm test
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

:NPM_TEST_FINISHED
ECHO packaging for node-gyp
CALL node_modules\.bin\node-pre-gyp package %TOOLSET_ARGS%
::make commit message env var shorter
SET CM=%APPVEYOR_REPO_COMMIT_MESSAGE%
IF NOT "%CM%" == "%CM:[publish binary]=%" (ECHO publishing && CALL node_modules\.bin\node-pre-gyp --msvs_version=%msvs_version% publish %TOOLSET_ARGS%) ELSE (ECHO not publishing)
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

GOTO DONE

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

:DONE
ECHO ~~~~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

EXIT /b %EL%

@ECHO OFF
SETLOCAL
SET EL=0

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

IF /I "%msvs_toolset%"=="" ECHO msvs_toolset unset, defaulting to 14 && SET msvs_toolset=14
IF /I "%msvs_version%"=="" ECHO msvs_version unset, defaulting to 2015 && SET msvs_version=2015

SET PATH=%CD%;%PATH%
IF "%msvs_toolset%"=="12" SET msvs_version=2013
IF NOT "%NODE_RUNTIME%"=="" SET "TOOLSET_ARGS=%TOOLSET_ARGS% --runtime=%NODE_RUNTIME%"
IF NOT "%NODE_RUNTIME_VERSION%"=="" SET "TOOLSET_ARGS=%TOOLSET_ARGS% --target=%NODE_RUNTIME_VERSION%"

ECHO APPVEYOR^: %APPVEYOR%
ECHO nodejs_version^: %nodejs_version%
ECHO platform^: %platform%
ECHO msvs_toolset^: %msvs_toolset%
ECHO msvs_version^: %msvs_version%
ECHO TOOLSET_ARGS^: %TOOLSET_ARGS%

ECHO activating VS command prompt
:: NOTE this call makes the x64 -> X64
IF /I "%platform%"=="x64" ECHO x64 && CALL "C:\Program Files (x86)\Microsoft Visual Studio %msvs_toolset%.0\VC\vcvarsall.bat" amd64
IF /I "%platform%"=="x86" ECHO x86 && CALL "C:\Program Files (x86)\Microsoft Visual Studio %msvs_toolset%.0\VC\vcvarsall.bat" x86
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO using compiler^: && CALL cl
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO using MSBuild^: && CALL msbuild /version && ECHO.
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO downloading/installing node
IF /I "%platform%"=="x64" powershell Install-Product node $env:nodejs_version x64
IF /I "%platform%"=="x86" powershell Install-Product node $env:nodejs_version x86
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

powershell Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO available node.exe^:
call where node
ECHO available npm^:
call where npm

ECHO node^: && call node -v
call node -e "console.log('  - arch:',process.arch,'\n  - argv:',process.argv,'\n  - execPath:',process.execPath)"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO npm^: && CALL npm -v
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO ===== where npm puts stuff START ============
ECHO npm root && CALL npm root
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO npm root -g && CALL npm root -g
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

ECHO npm bin && CALL npm bin
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO npm bin -g && CALL npm bin -g
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

SET NPM_BIN_DIR=
FOR /F "tokens=*" %%i in ('CALL npm bin -g') DO SET NPM_BIN_DIR=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF /I "%NPM_BIN_DIR%"=="%CD%" ECHO ERROR npm bin -g equals local directory && SET ERRORLEVEL=1 && GOTO ERROR
ECHO ===== where npm puts stuff END ============

IF "%nodejs_version:~0,1%"=="4" CALL npm install node-gyp@3.x
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
IF "%nodejs_version:~0,1%"=="5" CALL npm install node-gyp@3.x
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

CALL npm install --build-from-source --msvs_version=%msvs_version% %TOOLSET_ARGS% --loglevel=http
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

FOR /F "tokens=*" %%i in ('"CALL node_modules\.bin\node-pre-gyp reveal module %TOOLSET_ARGS% --silent"') DO SET MODULE=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
FOR /F "tokens=*" %%i in ('node -e "console.log(process.execPath)"') DO SET NODE_EXE=%%i
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

dumpbin /DEPENDENTS "%NODE_EXE%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
dumpbin /DEPENDENTS "%MODULE%"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

IF "%NODE_RUNTIME%"=="electron" GOTO CHECK_ELECTRON_TEST_ERRORLEVEL

::skipping check for errorlevel npm test result when using io.js
::@springmeyer: how to proceed?
IF NOT "%nodejs_version%"=="1.8.1" IF NOT "%nodejs_version%"=="2.0.0" GOTO CHECK_NPM_TEST_ERRORLEVEL

ECHO calling npm test
CALL npm test
ECHO ==========================================
ECHO ==========================================
ECHO ==========================================

GOTO NPM_TEST_FINISHED

:CHECK_ELECTRON_TEST_ERRORLEVEL
ECHO installing electron
CALL npm install -g "electron@%NODE_RUNTIME_VERSION%"
ECHO installing electron-mocha
CALL npm install -g electron-mocha
ECHO preparing tests
CALL electron "test/support/createdb-electron.js"
DEL "test\support\createdb-electron.js"
ECHO calling electron-mocha
CALL electron-mocha -R spec --timeout 480000
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO NPM_TEST_FINISHED

:CHECK_NPM_TEST_ERRORLEVEL
ECHO calling npm test
CALL npm test
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

:NPM_TEST_FINISHED
ECHO packaging for node-gyp
CALL node_modules\.bin\node-pre-gyp package %TOOLSET_ARGS%
::make commit message env var shorter
SET CM=%APPVEYOR_REPO_COMMIT_MESSAGE%
IF NOT "%CM%" == "%CM:[publish binary]=%" (ECHO publishing && CALL node_modules\.bin\node-pre-gyp --msvs_version=%msvs_version% publish %TOOLSET_ARGS%) ELSE (ECHO not publishing)
IF %ERRORLEVEL% NEQ 0 GOTO ERROR

GOTO DONE

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

:DONE
ECHO ~~~~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

EXIT /b %EL%

fix accidentally removed msvs_version=2013 support (for node v4)


echo ON

if "%PY3K%" == "1" (
  powershell -Command "Get-Content "engine\SCons\Util.py" | select -First 38" > engine\SCons\Util.back
  if errorlevel 1 exit 1
  more +39 engine\SCons\Util.py >> engine\SCons\Util.back
  if errorlevel 1 exit 1
  more engine\SCons\Util.back
  if errorlevel 1 exit 1
  del engine\SCons\Util.py
  if errorlevel 1 exit 1
  move engine\SCons\Util.back engine\SCons\Util.py
  if errorlevel 1 exit 1
  2to3 --output-dir=engine\SCons3 -W -n engine\SCons
  if errorlevel 1 exit 1
  rmdir engine\SCons /s /q
  if errorlevel 1 exit 1
  move engine\SCons3 engine/SCons
  if errorlevel 1 exit 1
  powershell -Command "Get-Content ".\script\scons" | select -First 58" > script\scons.back
  if errorlevel 1 exit 1
  more +64 script\scons >> script\scons.back
  if errorlevel 1 exit 1
  del script\scons
  if errorlevel 1 exit 1
  move script\scons.back script\scons
  if errorlevel 1 exit 1
  2to3 -w -n script\scons
  if errorlevel 1 exit 1
  2to3 -w -n script\sconsign
  if errorlevel 1 exit 1
  2to3 -w -n script\scons-time
  if errorlevel 1 exit 1
  powershell -Command "Get-Content ".\setup.py" | select -First 49" > setup.back
  if errorlevel 1 exit 1
  more +54 setup.py >> setup.back
  if errorlevel 1 exit 1
  del setup.py
  if errorlevel 1 exit 1
  move setup.back setup.py
  if errorlevel 1 exit 1
)

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

echo ON

if "%PY3K%" == "1" (
  powershell -Command "(gc engine\SCons\Errors.py) -replace 'exceptions', 'builtins --no-test' | Out-File engine\SCons\Errors.py"
  powershell -Command "Get-Content "engine\SCons\Util.py" | select -First 38" > engine\SCons\Util.back
  if errorlevel 1 exit 1
  more +39 engine\SCons\Util.py >> engine\SCons\Util.back
  if errorlevel 1 exit 1
  more engine\SCons\Util.back
  if errorlevel 1 exit 1
  del engine\SCons\Util.py
  if errorlevel 1 exit 1
  move engine\SCons\Util.back engine\SCons\Util.py
  if errorlevel 1 exit 1
  2to3 --output-dir=engine\SCons3 -W -n engine\SCons
  if errorlevel 1 exit 1
  rmdir engine\SCons /s /q
  if errorlevel 1 exit 1
  move engine\SCons3 engine/SCons
  if errorlevel 1 exit 1
  powershell -Command "Get-Content ".\script\scons" | select -First 58" > script\scons.back
  if errorlevel 1 exit 1
  more +64 script\scons >> script\scons.back
  if errorlevel 1 exit 1
  del script\scons
  if errorlevel 1 exit 1
  move script\scons.back script\scons
  if errorlevel 1 exit 1
  2to3 -w -n script\scons
  if errorlevel 1 exit 1
  2to3 -w -n script\sconsign
  if errorlevel 1 exit 1
  2to3 -w -n script\scons-time
  if errorlevel 1 exit 1
  powershell -Command "Get-Content ".\setup.py" | select -First 49" > setup.back
  if errorlevel 1 exit 1
  more +54 setup.py >> setup.back
  if errorlevel 1 exit 1
  del setup.py
  if errorlevel 1 exit 1
  move setup.back setup.py
  if errorlevel 1 exit 1
)

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

Update bld.bat

Update bld.bat


echo ON

if "%PY3K%" == "1" (
  2to3 --output-dir=engine\SCons3 -W -n engine\SCons
  rmdir engine\SCons /s /q
  move engine\SCons3 engine/SCons
  powershell -Command "Get-Content ".\script\scons" | select -First 58" > script\scons.back
  more +64 script\scons >> script\scons.back
  del script\scons
  move script\scons.back script\scons
  2to3 -w -n script\scons
  2to3 -w -n script\sconsign
  2to3 -w -n script\scons-time
  powershell -Command "Get-Content ".\setup.py" | select -First 49" > setup.back
  more +54 setup.py >> setup.back
  del setup.py
  move setup.back setup.py
)

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

echo ON

if "%PY3K%" == "1" (
  powershell -Command "Get-Content ".\engine\SCons\Util.py" | select -First 38" > \engine\SCons\Util.back
  more +40 \engine\SCons\Util.py >> \engine\SCons\Util.back
  del \engine\SCons\Util.py
  move \engine\SCons\Util.back \engine\SCons\Util.py
  2to3 --output-dir=engine\SCons3 -W -n engine\SCons
  rmdir engine\SCons /s /q
  move engine\SCons3 engine/SCons
  powershell -Command "Get-Content ".\script\scons" | select -First 58" > script\scons.back
  more +64 script\scons >> script\scons.back
  del script\scons
  move script\scons.back script\scons
  2to3 -w -n script\scons
  2to3 -w -n script\sconsign
  2to3 -w -n script\scons-time
  powershell -Command "Get-Content ".\setup.py" | select -First 49" > setup.back
  more +54 setup.py >> setup.back
  del setup.py
  move setup.back setup.py
)

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

Update bld.bat

Update bld.bat


echo ON

:: Set the right msvc version according to Python version
if "%PY_VER%"=="2.7" (
    set MSVC_VER=9.0
    set LIB_VER=90
) else if "%PY_VER%"=="3.4" (
    set MSVC_VER=10.0
    set LIB_VER=100
) else (
    set MSVC_VER=14.0
    set LIB_VER=140
)

call bootstrap.bat
if errorlevel 1 exit 1

echo Architecture: %ARCH%

CALL b2 install toolset=msvc-%MSVC_VER% ^
        address-model=%ARCH% ^
        variant=release ^
        threading=multi ^
        link=shared ^
        define=BOOST_ALL_NO_LIB ^
        -j%CPU_COUNT% ^
        --with-python ^
        --layout=system ^
        --build-dir=buildboost ^
        --prefix=%LIBRARY_PREFIX%
IF errorlevel 1 exit 1

move %LIBRARY_LIB%\boost_*.dll "%LIBRARY_BIN%"
IF errorlevel 1 exit 1

echo OFF

echo ON

:: Set the right msvc version according to Python version
if "%PY_VER%"=="2.7" (
    set MSVC_VER=9.0
    set LIB_VER=90
) else if "%PY_VER%"=="3.4" (
    set MSVC_VER=10.0
    set LIB_VER=100
) else (
    set MSVC_VER=14.0
    set LIB_VER=140
)

call bootstrap.bat
if errorlevel 1 exit 1

echo Architecture: %ARCH%

CALL b2 install toolset=msvc-%MSVC_VER% ^
        address-model=%ARCH% ^
        variant=release ^
        threading=multi ^
        link=static,shared ^
        define=BOOST_ALL_NO_LIB ^
        -j%CPU_COUNT% ^
        --with-python ^
        --layout=system ^
        --build-dir=buildboost ^
        --prefix=%LIBRARY_PREFIX%
IF errorlevel 1 exit 1

move %LIBRARY_LIB%\boost_*.dll "%LIBRARY_BIN%"
IF errorlevel 1 exit 1

echo OFF

Correct Boost recipe

Correct Boost recipe


REM Monero Simplewallet Launcher, (c) 2016 bigreddmachine.
REM https://github.com/Monero-Monitor/monero-wallet-chrome
REM
REM This script allows simplewallet to be run in rpc mode easily and quickly. User passwords
REM are secured by passing them as a terminal input, rather than requiring them to be stored
REM as clear text in the script.
REM
REM This script is released under the MIT License.

@echo off
cls
set FILE=ChromeWallet.bin

echo.
echo ====================================================================================
echo                             Monero Simplewallet Launcher
echo.
echo Copyright (c) 2016 bigreddmachine.
echo Released under the MIT License as part of Monero Wallet for Chrome.
echo https://github.com/monero-monitor/monero-wallet-chrome
echo ====================================================================================
echo.

if exist %FILE% (
    REM If this script has been run previously, a wallet should already exist. Start it in RPC mode.

    echo Launching simplewallet in RPC mode, listening on localhost (127.0.0.1), port 18082.
    echo.
    set /p PASS=Please enter your password:

    start "simplewallet --wallet-file %FILE% --password %PASS% --rpc-bind-ip 127.0.0.1 --rpc-bind-port 18082"

    echo Launching simplewallet...
    echo.
    sleep 3
    echo ----------------------

    echo.
    echo Returning wallet address:

    if (curl --fail -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"getaddress"}' -H 'Content-Type: application/json'; then

        echo.
        echo.
        echo Simplewallet is now running in RPC mode. To shutdown simplewallet, choose 'Stop Wallet' in the extension's menu.
        echo.
        echo Thank you for using Monero Wallet for Chrome! You may now close this window.
        echo.

    ) else (

        echo.
        echo Please check if your extension shows that simplewallet online. If not,
        echo please check your password and try again.
        echo.

    )
) else (
    REM The first time this script is run, open the command line wallet.

    echo You have not created a wallet yet. This script will help you do that.
    echo.
    echo To create a wallet, follow the prompts. Enter a password, then pick a
    echo language for your wallet.
    echo.
    echo Once you have created a wallet, simplewallet will open and a prompt
    echo line will appear. Type 'refresh', then once it is done type 'exit'.
    echo You are then ready to use Monero Wallet for Chrome.
    echo.

    set /p userinput=When you are ready to begin, press enter...

    echo.
    echo ----------
    set /p NEWPASS=Please pick a password for your new wallet:
    echo ----------
    echo.

    simplewallet --generate-new-wallet %FILE% --password %NEWPASS%

    echo.
    echo ----------
    echo.

    if exist %FILE% (
        echo   Everything looks good. You can now start your wallet in RPC mode at any time by re-running this script.
        echo.
        echo   Closing Monero Simplewallet Launcher...
        echo.
        echo.
    )
)

REM Monero Simplewallet Launcher, (c) 2016 bigreddmachine.
REM https://github.com/Monero-Monitor/monero-wallet-chrome
REM
REM This script allows simplewallet to be run in rpc mode easily and quickly. User passwords
REM are secured by passing them as a terminal input, rather than requiring them to be stored
REM as clear text in the script.
REM
REM This script is released under the MIT License.

@echo off
cls
set WALLET_FILENAME=wallet.bin
set PROGRAM_DIR=C:\Program Files\MoneroWallet

echo.
echo ====================================================================================
echo                       Monero Simplewallet Launcher for Windows
echo.
echo Copyright (c) 2016 bigreddmachine.
echo Released under the MIT License as part of Monero Wallet for Chrome.
echo https://github.com/monero-monitor/monero-wallet-chrome
echo ====================================================================================
echo.

set WALLET_DIR=%PROGRAM_DIR%\wallet
IF not exist %WALLET_DIR% (mkdir %WALLET_DIR%)
set FILE=%WALLET_DIR%\%WALLET_FILENAME%

echo Which Monero daemon would you like to connect to?
echo   1. remote (node.moneroclub.com:8880)
echo   2. local  (127.0.0.1:18081)
echo   3. custom
echo.
set /p DAEMON=Please make a selection:

if NOT %DAEMON% == 1 if NOT %DAEMON% == 2 if NOT %DAEMO% == 3 (
    set -p exitinput=Invalid daemon selection. Press enter to quit.
    exit
)

if %DAEMON% == 1 (
    set USE_DAEMON=node.moneroclub.com:8880
)
if %DAEMON% == 2 (
    set USE_DAEMON=127.0.0.1:18081
)
if %DAEMON% == 3 (
    set /p USE_DAEMON=Please enter custom daemon (ex: 192.168.0.1:18081):
)

echo.
echo ----------------------
echo.

if exist %FILE% (
    REM If this script has been run previously, a wallet should already exist. Start it in RPC mode.

    echo Launching simplewallet in RPC mode, listening on localhost (127.0.0.1), port 18082.
    echo.
    set /p PASS=Please enter your password:

    echo Launching simplewallet...
    echo.

    start "%PROGRAM_DIR%\simplewallet --wallet-file %FILE% --password %PASS% --rpc-bind-ip 127.0.0.1 --rpc-bind-port 18082 --daemon-address %USE_DAEMON%"

    echo Simplewallet should now be running in RPC mode. You can verify this by checking if
    echo your Chrome extension says "online". It may take a few seconds for the wallet to
    echo connect to simplewallet. If it fails to come online, please check your password
    echo and try again.
    echo.
    echo To shutdown simplewallet, choose 'Stop Wallet' in the extension's menu.
    echo.
    echo Thank you for using Monero Wallet for Chrome! You may now close this window.
    echo.

) else (
    REM The first time this script is run, open the command line wallet.

    echo You have not created a wallet yet. This script will help you do that.
    echo.
    echo To create a wallet, follow the prompts. Enter a password, then pick a
    echo language for your wallet.
    echo.
    echo Once you have created a wallet, simplewallet will open and a prompt
    echo line will appear. Type 'refresh', then once it is done type 'exit'.
    echo You are then ready to use Monero Wallet for Chrome.
    echo.

    set /p userinput=When you are ready to begin, press enter...

    echo.
    echo ----------
    set /p NEWPASS=Please pick a password for your new wallet:
    echo.
    set /p CONFIRM_NEWPASS=Confirm password:
    if NOT %NEWPASS% == %CONFIRM_NEWPASS% (
        echo Your passwords do not match. Please restart the script and try again.
        echo.
        set /p userinput=Press "enter" to exit.
        exit
    )
    echo ----------
    echo.

    %PROGRAM_DIR%\simplewallet --generate-new-wallet %FILE% --password %NEWPASS%  --daemon-address %USE_DAEMON%

    echo.
    echo ----------
    echo.

    if exist %FILE% (
        echo Everything looks good. You can now start your wallet in RPC mode at any time by re-running this script.
        echo.
        set /p userinput=Press "enter" to exit Monero Simplewallet Launcher.
    ) else (
        echo There seems to have been an issue creating your wallet.
        echo.
        set /p userinput=Press "enter" to exit.
    )
)

echo.

Bring Windows launch script in line with Unix scripts

Untested. Use at your own risk.


@echo on

set APPVEYOR_CI=1

:: Check prerequisites
set _msbuildexe="%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe.  Please see http://www.microsoft.com/en-us/download/details.aspx?id=40760. && goto :eof

set _gacutilexe="%ProgramFiles(x86)%\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe"
if not exist %_gacutilexe% echo Error: Could not find gacutil.exe.  && goto :eof

.\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages
@if ERRORLEVEL 1 echo Error: Nuget restore failed  && goto :eof

::Build
%_gacutilexe%  /i lkg\FSharp-2.0.50726.900\bin\FSharp.Core.dll
@if ERRORLEVEL 1 echo Error: gacutil failed && goto :eof

%_msbuildexe% src\fsharp-proto-build.proj
@if ERRORLEVEL 1 echo Error: compiler proto build failed && goto :eof

ngen install lib\proto\fsc-proto.exe

%_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true
@if ERRORLEVEL 1 echo Error: library debug build failed && goto :eof

%_msbuildexe% src/fsharp-compiler-build.proj /p:UseNugetPackages=true
@if ERRORLEVEL 1 echo Error: compile debug build failed && goto :eof

REM We don't build new net20 FSharp.Core anymore
REM %_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=net20
REM @if ERRORLEVEL 1 echo Error: library net20 debug build failed && goto :eof

%_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable47
@if ERRORLEVEL 1 echo Error: library portable47 debug build failed && goto :eof

REM Dropped for faster build
REM %_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable7
REM @if ERRORLEVEL 1 echo Error: library portable7 debug build failed && goto :eof

%_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable78
@if ERRORLEVEL 1 echo Error: library portable78 debug build failed && goto :eof

REM Dropped for faster build
REM %_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable259
REM @if ERRORLEVEL 1 echo Error: library portable259 debug build failed && goto :eof

%_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true
@if ERRORLEVEL 1 echo Error: library unittests debug build failed && goto :eof

REM Dropped for faster build
REM %_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable47
@REM if ERRORLEVEL 1 echo Error: library unittests debug build failed portable47 && goto :eof

REM Dropped for faster build
REM %_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable7
REM @if ERRORLEVEL 1 echo Error: library unittests debug build failed portable7 && goto :eof

REM Dropped for faster build
REM %_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable78
REM @if ERRORLEVEL 1 echo Error: library unittests debug build failed portable78 && goto :eof

@echo on
call src\update.cmd debug -ngen

@echo on
call tests\BuildTestTools.cmd debug
REM @if ERRORLEVEL 1 echo Error: 'tests\BuildTestTools.cmd debug' failed && goto :eof

@echo on

pushd tests
call RunTests.cmd debug fsharp Smoke
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd debug fsharpqa Smoke' failed && goto :eof

REM Disabled while working out perl problem, see https://github.com/Microsoft/visualfsharp/pull/169
REM call RunTests.cmd debug fsharpqa Smoke
REM @if ERRORLEVEL 1 echo Error: 'RunTests.cmd debug fsharpqa Smoke' failed && goto :eof

set PATH=%PATH%;%~dp0%packages\NUnit.Runners.2.6.3\tools\
call RunTests.cmd debug coreunit
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd debug coreunit' failed && goto :eof

popd

@echo on

set APPVEYOR_CI=1

:: Check prerequisites
set _msbuildexe="%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe.  Please see http://www.microsoft.com/en-us/download/details.aspx?id=40760. && goto :eof

set _gacutilexe="%ProgramFiles(x86)%\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe"
if not exist %_gacutilexe% echo Error: Could not find gacutil.exe.  && goto :eof

.\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages
@if ERRORLEVEL 1 echo Error: Nuget restore failed  && goto :eof

::Build
%_gacutilexe%  /i lkg\FSharp-2.0.50726.900\bin\FSharp.Core.dll
@if ERRORLEVEL 1 echo Error: gacutil failed && goto :eof

%_msbuildexe% src\fsharp-proto-build.proj
@if ERRORLEVEL 1 echo Error: compiler proto build failed && goto :eof

ngen install lib\proto\fsc-proto.exe

%_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true
@if ERRORLEVEL 1 echo Error: library debug build failed && goto :eof

%_msbuildexe% src/fsharp-compiler-build.proj /p:UseNugetPackages=true
@if ERRORLEVEL 1 echo Error: compile debug build failed && goto :eof

REM We don't build new net20 FSharp.Core anymore
REM %_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=net20
REM @if ERRORLEVEL 1 echo Error: library net20 debug build failed && goto :eof

%_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable47
@if ERRORLEVEL 1 echo Error: library portable47 debug build failed && goto :eof

REM Dropped for faster build
REM %_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable7
REM @if ERRORLEVEL 1 echo Error: library portable7 debug build failed && goto :eof

%_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable78
@if ERRORLEVEL 1 echo Error: library portable78 debug build failed && goto :eof

REM Dropped for faster build
REM %_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable259
REM @if ERRORLEVEL 1 echo Error: library portable259 debug build failed && goto :eof

%_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true
@if ERRORLEVEL 1 echo Error: library unittests debug build failed && goto :eof

REM Dropped for faster build
REM %_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable47
@REM if ERRORLEVEL 1 echo Error: library unittests debug build failed portable47 && goto :eof

REM Dropped for faster build
REM %_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable7
REM @if ERRORLEVEL 1 echo Error: library unittests debug build failed portable7 && goto :eof

REM Dropped for faster build
REM %_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable78
REM @if ERRORLEVEL 1 echo Error: library unittests debug build failed portable78 && goto :eof

@echo on
call src\update.cmd debug -ngen

@echo on
call tests\BuildTestTools.cmd debug
REM @if ERRORLEVEL 1 echo Error: 'tests\BuildTestTools.cmd debug' failed && goto :eof

@echo on

pushd tests

REM Disabled while working out perl problem, see https://github.com/Microsoft/visualfsharp/pull/169
REM call RunTests.cmd debug fsharp Smoke
REM @if ERRORLEVEL 1 echo Error: 'RunTests.cmd debug fsharpqa Smoke' failed && goto :eof

REM Disabled while working out perl problem, see https://github.com/Microsoft/visualfsharp/pull/169
REM call RunTests.cmd debug fsharpqa Smoke
REM @if ERRORLEVEL 1 echo Error: 'RunTests.cmd debug fsharpqa Smoke' failed && goto :eof

set PATH=%PATH%;%~dp0%packages\NUnit.Runners.2.6.3\tools\
call RunTests.cmd debug coreunit
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd debug coreunit' failed && goto :eof

popd

disable fsharp pending perl fix

disable fsharp pending perl fix


@setlocal enabledelayedexpansion

REM Parse Arguments.

set RoslynRoot=%~dp0
set BuildConfiguration=Debug

REM Because override the C#/VB toolset to build against our LKG package, it is important
REM that we do not reuse MSBuild nodes from other jobs/builds on the machine. Otherwise,
REM we'll run into issues such as https://github.com/dotnet/roslyn/issues/6211.
set MSBuildAdditionalCommandLineArgs=/nologo /m /nodeReuse:false /consoleloggerparameters:Verbosity=minimal /filelogger /fileloggerparameters:Verbosity=normal
set BuildAndTestBuildTarget=BuildAndTest

:ParseArguments
if "%1" == "" goto :DoneParsing
if /I "%1" == "/?" call :Usage && exit /b 1
if /I "%1" == "/debug" set BuildConfiguration=Debug&&shift&& goto :ParseArguments
if /I "%1" == "/release" set BuildConfiguration=Release&&shift&& goto :ParseArguments
if /I "%1" == "/test32" set Test64=false&&shift&& goto :ParseArguments
if /I "%1" == "/test64" set Test64=true&&shift&& goto :ParseArguments
if /I "%1" == "/testDeterminism" set TestDeterminism=true&&shift&& goto :ParseArguments
if /I "%1" == "/testBuildCorrectness" set TestBuildCorrectness=true&&shift&& goto :ParseArguments
if /I "%1" == "/testPerfCorrectness" set TestPerfCorrectness=true&&shift&& goto :ParseArguments
if /I "%1" == "/testPerfRun" set TestPerfRun=true&&shift&& goto :ParseArguments
if /I "%1" == "/testVsi" set TestVsi=true&&shift&& goto :ParseArguments
if /I "%1" == "/skipTest" set BuildAndTestBuildTarget=Build&&shift&&goto :ParseArguments
if /I "%1" == "/skipCommitPrinting" set SkipCommitPrinting=1&&shift&&goto :ParseArguments

REM /buildTimeLimit is the time limit, measured in minutes, for the Jenkins job that runs
REM the build. The Jenkins script netci.groovy passes the time limit to this script.
if /I "%1" == "/buildTimeLimit" set BuildTimeLimit=%2&&shift&&shift&& goto :ParseArguments

call :Usage && exit /b 1
:DoneParsing

REM This script takes the presence of the /buildTimeLimit option as an indication that it
REM should run the tests under the control of the ProcessWatchdog, which, if the tests
REM exceed the time limit, will take a screenshot, obtain memory dumps from the test
REM process and all its descendants, and shut those processes down.
REM
REM Developers building from the command line will presumably not pass /buildTimeLimit,
REM and so the tests will not run under the ProcessWatchdog.
if not "%BuildTimeLimit%" == "" (
    set CurrentDate=%date%
    set CurrentTime=%time: =0%
    set BuildStartTime=!CurrentDate:~-4!-!CurrentDate:~-10,2!-!CurrentDate:~-7,2!T!CurrentTime!
    set RunProcessWatchdog=true
) else (
    set RunProcessWatchdog=false
)

REM Restore the NuGet packages
call "%RoslynRoot%\Restore.cmd" || goto :BuildFailed
call "%RoslynRoot%SetDevCommandPrompt.cmd" || goto :BuildFailed

REM Ensure the binaries directory exists because msbuild can fail when part of the path to LogFile isn't present.
set bindir=%RoslynRoot%Binaries
if not exist "%bindir%" mkdir "%bindir%" || goto :BuildFailed

if defined testBuildCorrectness (
    powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\test-build-correctness.ps1" %RoslynRoot% "%bindir%\%BuildConfiguration%" || goto :BuildFailed
    call :TerminateBuildProcesses
    exit /b 0
)

REM Output the commit that we're building, for reference in Jenkins logs
if not "%SkipCommitPrinting" == "1" (
    echo Building this commit:
    git show --no-patch --pretty=raw HEAD
)

REM Build with the real assembly version, since that's what's contained in the bootstrap compiler redirects
msbuild %MSBuildAdditionalCommandLineArgs% /p:UseShippingAssemblyVersion=true /p:InitialDefineConstants=BOOTSTRAP "%RoslynRoot%build\Toolset\Toolset.csproj" /p:NuGetRestorePackages=false /p:Configuration=%BuildConfiguration% /fileloggerparameters:LogFile="%bindir%\Bootstrap.log" || goto :BuildFailed
powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\check-msbuild.ps1" "%bindir%\Bootstrap.log" || goto :BuildFailed

if not exist "%bindir%\Bootstrap" mkdir "%bindir%\Bootstrap" || goto :BuildFailed
move "Binaries\%BuildConfiguration%\Exes\Toolset\*" "%bindir%\Bootstrap" || goto :BuildFailed

REM Clean the previous build
msbuild %MSBuildAdditionalCommandLineArgs% /t:Clean build/Toolset/Toolset.csproj /p:Configuration=%BuildConfiguration%  /fileloggerparameters:LogFile="%bindir%\BootstrapClean.log" || goto :BuildFailed

call :TerminateBuildProcesses || goto :BuildFailed

if defined TestDeterminism (
    powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\test-determinism.ps1" "%bindir%\Bootstrap" || goto :BuildFailed
    call :TerminateBuildProcesses || goto :BuildFailed
    exit /b 0
)

if defined TestPerfCorrectness (
    msbuild %MSBuildAdditionalCommandLineArgs% Roslyn.sln /p:Configuration=%BuildConfiguration% /p:DeployExtension=false || goto :BuildFailed
    .\Binaries\%BuildConfiguration%\Exes\Perf.Runner\Roslyn.Test.Performance.Runner.exe --ci-test || goto :BuildFailed
    exit /b 0
)

if defined TestPerfRun (
    msbuild %MSBuildAdditionalCommandLineArgs% Roslyn.sln /p:Configuration=%BuildConfiguration% /p:DeployExtension=false || goto :BuildFailed

    if defined GIT_BRANCH (
        REM Check if we have credentials to upload to benchview
        if defined BV_UPLOAD_SAS_TOKEN (
            set "EXTRA_PERF_RUNNER_ARGS=--report-benchview --branch "%GIT_BRANCH%""

            REM Check if we are in a PR or this is a rolling submission
            if defined ghprbPullTitle (
                set "EXTRA_PERF_RUNNER_ARGS=!EXTRA_PERF_RUNNER_ARGS! --benchview-submission-name ""[%ghprbPullAuthorLogin%] PR %ghprbPullId%: %ghprbPullTitle%"" --benchview-submission-type private"
            ) else (
                set "EXTRA_PERF_RUNNER_ARGS=!EXTRA_PERF_RUNNER_ARGS! --benchview-submission-type rolling"
            )
            mkdir ".\Binaries\%BuildConfiguration%\tools\"
            REM Get the benchview tools - Place alongside Roslyn.Test.Performance.Runner.exe
            call "%RoslynRoot%\build\scripts\install_benchview_tools.cmd" ".\Binaries\%BuildConfiguration%\tools\" || goto :BuildFailed
            dir ".\Binaries\%BuildConfiguration%\"
        )
    )

    call :TerminateBuildProcesses || goto :BuildFailed

    .\Binaries\%BuildConfiguration%\Exes\Perf.Runner\Roslyn.Test.Performance.Runner.exe --no-trace-upload !EXTRA_PERF_RUNNER_ARGS! || goto :BuildFailed
    exit /b 0
)

msbuild %MSBuildAdditionalCommandLineArgs% /p:BootstrapBuildPath="%bindir%\Bootstrap" BuildAndTest.proj /t:%BuildAndTestBuildTarget% /p:Configuration=%BuildConfiguration% /p:Test64=%Test64% /p:TestVsi=%TestVsi% /p:RunProcessWatchdog=%RunProcessWatchdog% /p:BuildStartTime=%BuildStartTime% /p:"ProcDumpExe=%ProcDumpExe%" /p:BuildTimeLimit=%BuildTimeLimit% /p:PathMap="%RoslynRoot%=q:\roslyn" /p:Feature=pdb-path-determinism /fileloggerparameters:LogFile="%bindir%\Build.log";verbosity=diagnostic /p:DeployExtension=false || goto :BuildFailed
powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\check-msbuild.ps1" "%bindir%\Build.log" || goto :BuildFailed

call :TerminateBuildProcesses || goto :BuildFailed

REM Ensure caller sees successful exit.
exit /b 0

:Usage
@echo Usage: cibuild.cmd [/debug^|/release] [/test32^|/test64] [/restore]
@echo   /debug   Perform debug build.  This is the default.
@echo   /release Perform release build.
@echo   /test32  Run unit tests in the 32-bit runner.  This is the default.
@echo   /test64  Run units tests in the 64-bit runner.
@echo.
@goto :eof

:BuildFailed
echo Build failed with ERRORLEVEL %ERRORLEVEL%
call :TerminateBuildProcesses
exit /b 1

:TerminateBuildProcesses
@REM Kill any instances VBCSCompiler.exe to release locked files, ignoring stderr if process is not open
@REM This prevents future CI runs from failing while trying to delete those files.
@REM Kill any instances of msbuild.exe to ensure that we never reuse nodes (e.g. if a non-roslyn CI run
@REM left some floating around).

@REM An error-level of 1 means that the process was found, but could not be killed.
echo Killing all build-related processes
taskkill /F /IM msbuild.exe > nul 2>&1
if %ERRORLEVEL% == 1 (
  echo ERROR: taskkill for msbuild.exe failed
  exit /b 1
)

taskkill /F /IM vbcscompiler.exe > nul 2>&1
if %ERRORLEVEL% == 1 (
  echo ERROR: taskkill for vbcscompiler.exe failed
  exit /b 1
)

exit /b 0

@setlocal enabledelayedexpansion

REM Parse Arguments.

set RoslynRoot=%~dp0
set BuildConfiguration=Debug

REM Because override the C#/VB toolset to build against our LKG package, it is important
REM that we do not reuse MSBuild nodes from other jobs/builds on the machine. Otherwise,
REM we'll run into issues such as https://github.com/dotnet/roslyn/issues/6211.
set MSBuildAdditionalCommandLineArgs=/nologo /m /nodeReuse:false /consoleloggerparameters:Verbosity=minimal /filelogger /fileloggerparameters:Verbosity=normal
set BuildAndTestBuildTarget=BuildAndTest

:ParseArguments
if "%1" == "" goto :DoneParsing
if /I "%1" == "/?" call :Usage && exit /b 1
if /I "%1" == "/debug" set BuildConfiguration=Debug&&shift&& goto :ParseArguments
if /I "%1" == "/release" set BuildConfiguration=Release&&shift&& goto :ParseArguments
if /I "%1" == "/test32" set Test64=false&&shift&& goto :ParseArguments
if /I "%1" == "/test64" set Test64=true&&shift&& goto :ParseArguments
if /I "%1" == "/testDeterminism" set TestDeterminism=true&&shift&& goto :ParseArguments
if /I "%1" == "/testBuildCorrectness" set TestBuildCorrectness=true&&shift&& goto :ParseArguments
if /I "%1" == "/testPerfCorrectness" set TestPerfCorrectness=true&&shift&& goto :ParseArguments
if /I "%1" == "/testPerfRun" set TestPerfRun=true&&shift&& goto :ParseArguments
if /I "%1" == "/testVsi" set TestVsi=true&&shift&& goto :ParseArguments
if /I "%1" == "/skipTest" set BuildAndTestBuildTarget=Build&&shift&&goto :ParseArguments
if /I "%1" == "/skipCommitPrinting" set SkipCommitPrinting=1&&shift&&goto :ParseArguments

REM /buildTimeLimit is the time limit, measured in minutes, for the Jenkins job that runs
REM the build. The Jenkins script netci.groovy passes the time limit to this script.
if /I "%1" == "/buildTimeLimit" set BuildTimeLimit=%2&&shift&&shift&& goto :ParseArguments

call :Usage && exit /b 1
:DoneParsing

REM This script takes the presence of the /buildTimeLimit option as an indication that it
REM should run the tests under the control of the ProcessWatchdog, which, if the tests
REM exceed the time limit, will take a screenshot, obtain memory dumps from the test
REM process and all its descendants, and shut those processes down.
REM
REM Developers building from the command line will presumably not pass /buildTimeLimit,
REM and so the tests will not run under the ProcessWatchdog.
if not "%BuildTimeLimit%" == "" (
    set CurrentDate=%date%
    set CurrentTime=%time: =0%
    set BuildStartTime=!CurrentDate:~-4!-!CurrentDate:~-10,2!-!CurrentDate:~-7,2!T!CurrentTime!
    set RunProcessWatchdog=true
) else (
    set RunProcessWatchdog=false
)

REM Restore the NuGet packages
call "%RoslynRoot%\Restore.cmd" || goto :BuildFailed
call "%RoslynRoot%SetDevCommandPrompt.cmd" || goto :BuildFailed

REM Ensure the binaries directory exists because msbuild can fail when part of the path to LogFile isn't present.
set bindir=%RoslynRoot%Binaries
if not exist "%bindir%" mkdir "%bindir%" || goto :BuildFailed

if defined testBuildCorrectness (
    powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\test-build-correctness.ps1" %RoslynRoot% "%bindir%\%BuildConfiguration%" || goto :BuildFailed
    call :TerminateBuildProcesses
    exit /b 0
)

REM Output the commit that we're building, for reference in Jenkins logs
if not "%SkipCommitPrinting" == "1" (
    echo Building this commit:
    git show --no-patch --pretty=raw HEAD
)

REM Build with the real assembly version, since that's what's contained in the bootstrap compiler redirects
msbuild %MSBuildAdditionalCommandLineArgs% /p:UseShippingAssemblyVersion=true /p:InitialDefineConstants=BOOTSTRAP "%RoslynRoot%build\Toolset\Toolset.csproj" /p:NuGetRestorePackages=false /p:Configuration=%BuildConfiguration% /fileloggerparameters:LogFile="%bindir%\Bootstrap.log" || goto :BuildFailed
powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\check-msbuild.ps1" "%bindir%\Bootstrap.log" || goto :BuildFailed

if not exist "%bindir%\Bootstrap" mkdir "%bindir%\Bootstrap" || goto :BuildFailed
move "Binaries\%BuildConfiguration%\Exes\Toolset\*" "%bindir%\Bootstrap" || goto :BuildFailed

REM Clean the previous build
msbuild %MSBuildAdditionalCommandLineArgs% /t:Clean build/Toolset/Toolset.csproj /p:Configuration=%BuildConfiguration%  /fileloggerparameters:LogFile="%bindir%\BootstrapClean.log" || goto :BuildFailed

call :TerminateBuildProcesses || goto :BuildFailed

if defined TestDeterminism (
    powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\test-determinism.ps1" "%bindir%\Bootstrap" || goto :BuildFailed
    call :TerminateBuildProcesses || goto :BuildFailed
    exit /b 0
)

if defined TestPerfCorrectness (
    msbuild %MSBuildAdditionalCommandLineArgs% Roslyn.sln /p:Configuration=%BuildConfiguration% /p:DeployExtension=false || goto :BuildFailed
    .\Binaries\%BuildConfiguration%\Exes\Perf.Runner\Roslyn.Test.Performance.Runner.exe --ci-test || goto :BuildFailed
    exit /b 0
)

if defined TestPerfRun (
    msbuild %MSBuildAdditionalCommandLineArgs% Roslyn.sln /p:Configuration=%BuildConfiguration% /p:DeployExtension=false || goto :BuildFailed

    if defined GIT_BRANCH (
        REM Check if we have credentials to upload to benchview
        if defined BV_UPLOAD_SAS_TOKEN (
            set "EXTRA_PERF_RUNNER_ARGS=--report-benchview --branch "%GIT_BRANCH%""

            REM Check if we are in a PR or this is a rolling submission
            if defined ghprbPullTitle (
                set "EXTRA_PERF_RUNNER_ARGS=!EXTRA_PERF_RUNNER_ARGS! --benchview-submission-name ""[%ghprbPullAuthorLogin%] PR %ghprbPullId%: %ghprbPullTitle%"" --benchview-submission-type private"
            ) else (
                set "EXTRA_PERF_RUNNER_ARGS=!EXTRA_PERF_RUNNER_ARGS! --benchview-submission-type rolling"
            )
            mkdir ".\Binaries\%BuildConfiguration%\tools\"
            REM Get the benchview tools - Place alongside Roslyn.Test.Performance.Runner.exe
            call "%RoslynRoot%\build\scripts\install_benchview_tools.cmd" ".\Binaries\%BuildConfiguration%\tools\" || goto :BuildFailed
            dir ".\Binaries\%BuildConfiguration%\"
        )
    )

    call :TerminateBuildProcesses || goto :BuildFailed

    .\Binaries\%BuildConfiguration%\Exes\Perf.Runner\Roslyn.Test.Performance.Runner.exe  --search-directory=".\\Binaries\\%BuildConfiguration%\\Dlls\\Perf.Tests\\" --no-trace-upload !EXTRA_PERF_RUNNER_ARGS! || goto :BuildFailed
    exit /b 0
)

msbuild %MSBuildAdditionalCommandLineArgs% /p:BootstrapBuildPath="%bindir%\Bootstrap" BuildAndTest.proj /t:%BuildAndTestBuildTarget% /p:Configuration=%BuildConfiguration% /p:Test64=%Test64% /p:TestVsi=%TestVsi% /p:RunProcessWatchdog=%RunProcessWatchdog% /p:BuildStartTime=%BuildStartTime% /p:"ProcDumpExe=%ProcDumpExe%" /p:BuildTimeLimit=%BuildTimeLimit% /p:PathMap="%RoslynRoot%=q:\roslyn" /p:Feature=pdb-path-determinism /fileloggerparameters:LogFile="%bindir%\Build.log";verbosity=diagnostic /p:DeployExtension=false || goto :BuildFailed
powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\check-msbuild.ps1" "%bindir%\Build.log" || goto :BuildFailed

call :TerminateBuildProcesses || goto :BuildFailed

REM Ensure caller sees successful exit.
exit /b 0

:Usage
@echo Usage: cibuild.cmd [/debug^|/release] [/test32^|/test64] [/restore]
@echo   /debug   Perform debug build.  This is the default.
@echo   /release Perform release build.
@echo   /test32  Run unit tests in the 32-bit runner.  This is the default.
@echo   /test64  Run units tests in the 64-bit runner.
@echo.
@goto :eof

:BuildFailed
echo Build failed with ERRORLEVEL %ERRORLEVEL%
call :TerminateBuildProcesses
exit /b 1

:TerminateBuildProcesses
@REM Kill any instances VBCSCompiler.exe to release locked files, ignoring stderr if process is not open
@REM This prevents future CI runs from failing while trying to delete those files.
@REM Kill any instances of msbuild.exe to ensure that we never reuse nodes (e.g. if a non-roslyn CI run
@REM left some floating around).

@REM An error-level of 1 means that the process was found, but could not be killed.
echo Killing all build-related processes
taskkill /F /IM msbuild.exe > nul 2>&1
if %ERRORLEVEL% == 1 (
  echo ERROR: taskkill for msbuild.exe failed
  exit /b 1
)

taskkill /F /IM vbcscompiler.exe > nul 2>&1
if %ERRORLEVEL% == 1 (
  echo ERROR: taskkill for vbcscompiler.exe failed
  exit /b 1
)

exit /b 0

add correct script search location (#17276)

* add correct script search location

* escape


@ECHO OFF

rem %~dp0 is the expanded pathname of the current script under NT
set LOCAL_FOP_HOME=
if "%OS%"=="Windows_NT" set LOCAL_FOP_HOME=%~dp0

set LIBDIR=%LOCAL_FOP_HOME%lib
set LOCALCLASSPATH=%LOCAL_FOP_HOME%build\fop.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xml-apis.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xercesImpl-2.2.1.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.4.1.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\batik.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\avalon-framework-4.1.4.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-io-1.0-dev.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jimi-1.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_core.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_codec.jar
java -cp %LOCALCLASSPATH% org.apache.fop.apps.Fop %1 %2 %3 %4 %5 %6 %7 %8

@ECHO OFF

rem %~dp0 is the expanded pathname of the current script under NT
set LOCAL_FOP_HOME=
if "%OS%"=="Windows_NT" set LOCAL_FOP_HOME=%~dp0

set LIBDIR=%LOCAL_FOP_HOME%lib
set LOCALCLASSPATH=%LOCAL_FOP_HOME%build\fop.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xml-apis.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xercesImpl-2.2.1.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.4.1.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\batik.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\avalon-framework-4.1.4.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-io-dev-20030703.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jimi-1.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_core.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_codec.jar
java -cp %LOCALCLASSPATH% org.apache.fop.apps.Fop %1 %2 %3 %4 %5 %6 %7 %8

Adjust to version change of Commons IO

Adjust to version change of Commons IO

git-svn-id: 102839466c3b40dd9c7e25c0a1a6d26afc40150a@196594 13f79535-47bb-0310-9956-ffa450edef68


SET GOPATH=%CD%\cf-release-repo
SET GATSPATH=%GOPATH%\src\github.com\cloudfoundry\cf-acceptance-tests
SET GOPATH=%GOPATH%;%GATSPATH%\Godeps\_workspace

SET PATH=C:\Go\bin;%PATH%
SET PATH=C:\Program Files\Git\cmd\;%PATH%
SET PATH=%GOPATH%\bin;%PATH
SET PATH=C:\Program Files\GnuWin32\bin;%PATH%
SET PATH=C:\Program Files\cURL\bin;%PATH%
SET PATH=%CD%;%PATH%

SET /p DOMAIN=<%CD%\cli-pools\name
call %CD%\cli\ci\tasks\create-cats-config.bat
SET CONFIG=%CD%\config.json

pushd %CD%\cf-cli-binaries
	gzip -d cf-cli-binaries.tgz
	tar -xvf cf-cli-binaries.tar
	MOVE %CD%\cf-cli_winx64.exe ..\cf.exe
popd

go get -v github.com/onsi/ginkgo/ginkgo
REM
REM cd %GATSPATH%
REM ginkgo.exe -r -slowSpecThreshold=120 -nodes=2 -skip=NO_DIEGO_SUPPORT . apps backend_compatibility detect docker internet_dependent security_groups ssh routing

SET GOPATH=%CD%\cf-release-repo
SET GATSPATH=%GOPATH%\src\github.com\cloudfoundry\cf-acceptance-tests
SET GOPATH=%GOPATH%;%GATSPATH%\Godeps\_workspace

SET PATH=C:\Go\bin;%PATH%
SET PATH=C:\Program Files\Git\cmd\;%PATH%
SET PATH=%GOPATH%\bin;%PATH%
SET PATH=C:\Program Files\GnuWin32\bin;%PATH%
SET PATH=C:\Program Files\cURL\bin;%PATH%
SET PATH=%CD%;%PATH%

SET /p DOMAIN=<%CD%\cli-pools\name
call %CD%\cli\ci\tasks\create-cats-config.bat
SET CONFIG=%CD%\config.json

pushd %CD%\cf-cli-binaries
	gzip -d cf-cli-binaries.tgz
	tar -xvf cf-cli-binaries.tar
	MOVE %CD%\cf-cli_winx64.exe ..\cf.exe
popd

go get -v github.com/onsi/ginkgo/ginkgo
REM
REM cd %GATSPATH%
REM ginkgo.exe -r -slowSpecThreshold=120 -nodes=2 -skip=NO_DIEGO_SUPPORT . apps backend_compatibility detect docker internet_dependent security_groups ssh routing

Fix Path

Fix Path

[#114532269]

Signed-off-by: Jeff Pak <9d750c79dc1952140f693c4bda214b11dba3d64d@emc.com>


ghc --make site.hs
upx site.exe --best
pause

ghc --make site.hs -O3
upx site.exe --best
pause

Update build script

Update build script


@ECHO ON

REM This is based on Scott Hanselman's GetRuby.cmd
REM https://github.com/shanselman/march-is-for-makers/blob/master/getruby.cmd

REM Put Tex in Path
REM You can also use %TEMP% but it is cleared on site restart. Tools is persistent.
SET PATH=%PATH%;D:\home\site\deployments\tools\t\miktex-portable\miktex\bin

REM I am in the repository folder
pushd D:\home\site\deployments\tools
if not exist t md t
cd t
if exist miktex-portable goto end

echo No LaTeX, need to get it!

REM  get miktex portable from https://miktex.org/download/ctan/systems/win32/miktex/setup/windows-x86/miktex-portable-2.9.6942.exe
curl -L -o miktex-portable.exe https://miktex.org/download/ctan/systems/win32/miktex/setup/windows-x86/miktex-portable-2.9.6942.exe
REM Azure puts 7zip here!
EcHO START Unzipping MikTex
d:\7zip\7za x -y -omiktex-portable miktex-portable.exe> outmiktex
EcHO DONE Unzipping MikTex

REM We probably should clean up these huge files or we will run out of quota

:end
popd
REM Install the url package
mpm --install=url
REM Build the pdf
pdflatex.exe resume.tex -halt-on-error

REM KuduSync is after this!

@ECHO ON

REM This is based on Scott Hanselman's GetRuby.cmd
REM https://github.com/shanselman/march-is-for-makers/blob/master/getruby.cmd

REM Put Tex in Path
REM You can also use %TEMP% but it is cleared on site restart. Tools is persistent.
SET PATH=%PATH%;D:\home\site\deployments\tools\t\miktex-portable\texmfs\install\miktex\bin

REM I am in the repository folder
pushd D:\home\site\deployments\tools
if not exist t md t
cd t
if exist miktex-portable goto end

echo No LaTeX, need to get it!

REM  get miktex portable from https://miktex.org/download/ctan/systems/win32/miktex/setup/windows-x86/miktex-portable-2.9.6942.exe
curl -L -o miktex-portable.exe https://miktex.org/download/ctan/systems/win32/miktex/setup/windows-x86/miktex-portable-2.9.6942.exe
REM Azure puts 7zip here!
EcHO START Unzipping MikTex
d:\7zip\7za x -y -omiktex-portable miktex-portable.exe> outmiktex
EcHO DONE Unzipping MikTex

REM We probably should clean up these huge files or we will run out of quota

:end
popd
REM Install the url package
mpm --install=url
REM Build the pdf
pdflatex.exe resume.tex -halt-on-error

REM KuduSync is after this!

fix path

fix path


cd obridge-main
call mvn clean package assembly:single

pause

cd ..
cd obridge-maven-plugin
call mvn clean package install

pause

cd ..
cd obridge-generator-test
call mvn clean package

pause

build and test all

script: build and test all


@echo off
setlocal

pushd %~dp0\..

set VSCODEUSERDATADIR=%TMP%\vscodeuserfolder-%RANDOM%-%TIME:~6,5%

:: Tests in the extension host
call .\scripts\code.bat %~dp0\..\extensions\vscode-api-tests\testWorkspace --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\singlefolder-tests --disableExtensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

call .\scripts\code.bat %~dp0\..\extensions\vscode-api-tests\testworkspace.code-workspace --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\workspace-tests --disableExtensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

call .\scripts\code.bat %~dp0\..\extensions\vscode-colorize-tests\test --extensionDevelopmentPath=%~dp0\..\extensions\vscode-colorize-tests --extensionTestsPath=%~dp0\..\extensions\vscode-colorize-tests\out --disableExtensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

call .\scripts\code.bat $%~dp0\..\extensions\emmet\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test --disableExtensions --user-data-dir=%VSCODEUSERDATADIR% .
if %errorlevel% neq 0 exit /b %errorlevel%

:: Integration & performance tests in AMD
call .\scripts\test.bat --runGlob **\*.integrationTest.js %*
if %errorlevel% neq 0 exit /b %errorlevel%

# Tests in commonJS (HTML, CSS, JSON language server tests...)
call .\scripts\node-electron.bat .\node_modules\mocha\bin\_mocha .\extensions\*\server\out\test\**\*.test.js
if %errorlevel% neq 0 exit /b %errorlevel%

rmdir /s /q %VSCODEUSERDATADIR%

popd

endlocal

@echo off
setlocal

pushd %~dp0\..

set VSCODEUSERDATADIR=%TMP%\vscodeuserfolder-%RANDOM%-%TIME:~6,5%

:: Tests in the extension host
call .\scripts\code.bat %~dp0\..\extensions\vscode-api-tests\testWorkspace --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\singlefolder-tests --disableExtensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

call .\scripts\code.bat %~dp0\..\extensions\vscode-api-tests\testworkspace.code-workspace --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\workspace-tests --disableExtensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

call .\scripts\code.bat %~dp0\..\extensions\vscode-colorize-tests\test --extensionDevelopmentPath=%~dp0\..\extensions\vscode-colorize-tests --extensionTestsPath=%~dp0\..\extensions\vscode-colorize-tests\out --disableExtensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

call .\scripts\code.bat $%~dp0\..\extensions\emmet\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test --disableExtensions --user-data-dir=%VSCODEUSERDATADIR% .
if %errorlevel% neq 0 exit /b %errorlevel%

call .\scripts\code.bat $%~dp0\..\extensions\search-rg\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\search-rg --extensionTestsPath=%~dp0\..\extensions\search-rg\out\test --disableExtensions --user-data-dir=%VSCODEUSERDATADIR% .
if %errorlevel% neq 0 exit /b %errorlevel%

:: Integration & performance tests in AMD
call .\scripts\test.bat --runGlob **\*.integrationTest.js %*
if %errorlevel% neq 0 exit /b %errorlevel%

# Tests in commonJS (HTML, CSS, JSON language server tests...)
call .\scripts\node-electron.bat .\node_modules\mocha\bin\_mocha .\extensions\*\server\out\test\**\*.test.js
if %errorlevel% neq 0 exit /b %errorlevel%

rmdir /s /q %VSCODEUSERDATADIR%

popd

endlocal

Add search-rg integration tests to windows


@ECHO OFF
:USAGE
:START
:INITIALIZE
    SETLOCAL ENABLEDELAYEDEXPANSION
    SET BASE_DIR=%~DP0
    SET IN_VAR_NAME=%1
    SET IN_VALUE=%2

:CODE
    SET GLOBALS_FILE=%BASE_DIR%\globals.txt
    SET REFERENCE=!%IN_VAR_NAME%!
    CALL SET-GLOBAL %GLOBALS_FILE% %REFERENCE% %IN_VALUE%

:RETURN
    ENDLOCAL

:EOF

Set value for a reference given a variable


cd C:\projects\resin\src\Sir.Search\bin\Release
dotnet nuget push Resin.Search.0.4.0.4.nupkg --api-key [apikey] --source https://api.nuget.org/v3/index.json

add nuget package publishing script

add nuget package publishing script


Fix conversion bat

Fix conversion bat


@rem msbuild cefclient.vcxproj /t:clean /p:Configuration=Release /p:Platform=Win32
msbuild cefclient.vcxproj /p:Configuration=Release /p:Platform=Win32
copy Release\cefclient.exe ..\tilemill\node_modules\topcube\cefclient\cefclient.exe

copy exe into tilemill to deploy

copy exe into tilemill to deploy


@echo off
@setlocal
setlocal EnableDelayedExpansion

echo Unit Tests
pushd %~dp0\..

echo ""
echo Regular tests
dub test -q --build=unittest-cov
echo Unthreaded tests
dub run -q -c unittest-unthreaded --build=unittest-cov
echo Light tests
dub run -q -c unittest-light --build=unittest

popd

echo ""
echo Integration tests
echo ""

echo Issue 61
pushd %~dp0\..\tests\integration_tests\issue61
dub run --build=unittest
if %errorlevel% neq 0 exit /b %errorlevel%
popd

echo Issue 109
pushd %~dp0\..\tests\integration_tests\issue109
dub run --build=unittest
if %errorlevel% neq 0 exit /b %errorlevel%
popd

echo Issue 116
pushd %~dp0\..\tests\integration_tests\issue116
dub run --build=unittest
if %errorlevel% neq 0 exit /b %errorlevel%
popd

echo runTestsMain
pushd %~dp0\..\tests\integration_tests\runTestsMain
dub run --build=unittest
if %errorlevel% neq 0 exit /b %errorlevel%
popd

for /D %%D in ("subpackages\*") do (
    echo %%D
    dub test --root=%%D
    if !errorlevel! neq 0 exit /b !errorlevel!
)

@echo off
@setlocal
setlocal EnableDelayedExpansion

echo Unit Tests
cd %~dp0\..

echo ""
echo Regular tests
dub test -q --build=unittest-cov
echo Unthreaded tests
dub run -q -c unittest-unthreaded --build=unittest-cov
echo Light tests
dub run -q -c unittest-light --build=unittest

echo ""
echo Integration tests
echo ""

echo Issue 61
pushd tests\integration_tests\issue61
dub run --build=unittest
if %errorlevel% neq 0 exit /b %errorlevel%
popd

echo Issue 109
pushd tests\integration_tests\issue109
dub run --build=unittest
if %errorlevel% neq 0 exit /b %errorlevel%
popd

echo Issue 116
pushd tests\integration_tests\issue116
dub run --build=unittest
if %errorlevel% neq 0 exit /b %errorlevel%
popd

echo runTestsMain
pushd tests\integration_tests\runTestsMain
dub run --build=unittest
if %errorlevel% neq 0 exit /b %errorlevel%
popd

for /D %%D in ("subpackages\*") do (
    echo %%D
    dub test --root=%%D
    if !errorlevel! neq 0 exit /b !errorlevel!
)

fix paths in ci.bat

fix paths in ci.bat


rm **\bin\* -re -fo
gitversion /output buildserver /updateassemblyinfo
call EasyNetQ.Core\build.cmd

gitversion /output buildserver /updateassemblyinfo
set basePath=%~dp0
cd %basePath%EasyNetQ
call build.cmd
cd %basePath%EasyNetQ.DI.Autofac
call build.cmd
cd %basePath%EasyNetQ.DI.LightInject
call build.cmd
cd %basePath%EasyNetQ.DI.Ninject
call build.cmd
cd %basePath%EasyNetQ.DI.SimpleInjector
call build.cmd
cd %basePath%EasyNetQ.DI.StructureMap
call build.cmd
cd %basePath%EasyNetQ.DI.Windsor
call build.cmd
cd %basePath%EasyNetQ.Serilog
call build.cmd

update build-core.bat

update build-core.bat


@ECHO OFF
set TOOLS_BIN=%~dp0
set JRUBY_BASE=%~dp0\..\jruby-1.7.11
set GEM_HOME=
set GEM_PATH=
set PATH=%TOOLS_BIN%\;%JRUBY_BASE%\bin;%PATH%

set JRUBY_OPTS="-J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Djruby.compile.invokedynamic=false -J-Djruby.compile.mode=OFF"
%JRUBY_BASE%\bin\jruby.bat %*

@ECHO OFF
set TOOLS_BIN=%~dp0
set JRUBY_BASE=%~dp0\..\jruby-1.7.11
set GEM_HOME=
set GEM_PATH=
set PATH=%TOOLS_BIN%\;%JRUBY_BASE%\bin;%PATH%

set JRUBY_OPTS='-J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Djruby.compile.invokedynamic=false -J-Djruby.compile.mode=OFF %JRUBY_OPTS%'
%JRUBY_BASE%\bin\jruby.bat %*

Append to JRUBY_OPTS instead of overriding it


@ECHO OFF

FOR %%a IN (.) DO SET PLUGIN_NAME=%%~na
ECHO Building %PLUGIN_NAME%...
SET PLUGIN_DIRECTORY=%CD%
SET SOURCEPAWN_COMPILER_DIRECTORY=%CD%

IF EXIST compiler_directory.txt FOR /F %%i IN (compiler_directory.txt) DO SET SOURCEPAWN_COMPILER_DIRECTORY=%%i
IF EXIST plugin_directory.txt FOR /F %%i IN (plugin_directory.txt) DO SET PLUGIN_DIRECTORY=%%i
IF EXIST game_directory.txt FOR /F %%i IN (game_directory.txt) DO SET GAME_DIRECTORY=%%i

SET BUILD_DIRECTORY=%PLUGIN_DIRECTORY%\build
SET SOURCEMOD_DIRECTORY=%BUILD_DIRECTORY%\addons\sourcemod

ECHO Plugin directory: %PLUGIN_DIRECTORY%
ECHO Compiler directory: %SOURCEPAWN_COMPILER_DIRECTORY%

%SOURCEPAWN_COMPILER_DIRECTORY%\spcomp.exe %SOURCEMOD_DIRECTORY%\scripting\%PLUGIN_NAME%.sp

SET PLUGINS_DIRECTORY=%SOURCEMOD_DIRECTORY%\plugins

IF NOT EXIST %PLUGINS_DIRECTORY% MKDIR %PLUGINS_DIRECTORY%
MOVE /Y %PLUGIN_NAME%.smx %PLUGINS_DIRECTORY%

IF DEFINED GAME_DIRECTORY (
	ECHO Copying build into %GAME_DIRECTORY%
	XCOPY /Y /S /Q /D %BUILD_DIRECTORY% %GAME_DIRECTORY%
)

PAUSE

@ECHO OFF

FOR %%a IN (.) DO SET PLUGIN_NAME=%%~na
ECHO Building %PLUGIN_NAME%...
SET PLUGIN_DIRECTORY=%CD%
SET SOURCEPAWN_COMPILER_DIRECTORY=%CD%

IF EXIST compiler_directory.txt FOR /F %%i IN (compiler_directory.txt) DO SET SOURCEPAWN_COMPILER_DIRECTORY=%%i
IF EXIST plugin_directory.txt FOR /F %%i IN (plugin_directory.txt) DO SET PLUGIN_DIRECTORY=%%i

SET BUILD_DIRECTORY=%PLUGIN_DIRECTORY%\build
SET SOURCEMOD_DIRECTORY=%BUILD_DIRECTORY%\addons\sourcemod

ECHO Plugin directory: %PLUGIN_DIRECTORY%
ECHO Compiler directory: %SOURCEPAWN_COMPILER_DIRECTORY%

%SOURCEPAWN_COMPILER_DIRECTORY%\spcomp.exe %SOURCEMOD_DIRECTORY%\scripting\%PLUGIN_NAME%.sp

SET PLUGINS_DIRECTORY=%SOURCEMOD_DIRECTORY%\plugins

IF NOT EXIST %PLUGINS_DIRECTORY% MKDIR %PLUGINS_DIRECTORY%
MOVE /Y %PLUGIN_NAME%.smx %PLUGINS_DIRECTORY%

IF EXIST game_directory.txt FOR /F %%i IN (game_directory.txt) DO (
	ECHO Copying build into %%i
	XCOPY /Y /S /Q /D %BUILD_DIRECTORY% %%i
)

PAUSE

support for multiple game directories

support for multiple game directories


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

:: Get the PlatformVersion from SystemInfo
for /f "delims=:; tokens=1,2" %%a in ('systeminfo') do (
  if "%%a" == "OS Version" set PlatformVersionRow=%%b
)

:: Extract the major/minor version (stripped)
for /f "delims=.; tokens=1,2" %%a in ("%PlatformVersionRow%") do (
  for /f "tokens=*" %%v in ("%%a") do set PlatformVersionMajor=%%v
  for /f "tokens=*" %%v in ("%%b") do set PlatformVersionMinor=%%v
)

echo ==^> Detected Windows Platform Version: %PlatformVersionMajor%.%PlatformVersionMinor%

:: Set some reasonable defaults
if not defined TEMP set TEMP=%LOCALAPPDATA%\Temp

:: Figure out which configuration management tool to use
if not defined CM echo ==^> ERROR: The "CM" variable was not found in the environment & goto exit1
if "%CM%" == "nocm"   goto nocm

if not defined CM_VERSION (
  echo ==^> ERROR: The "CM_VERSION" variable was not found in the environment
  set CM_VERSION=latest
)

if "%CM%" == "chef" goto omnitruck
if "%CM%" == "chefdk" goto omnitruck
if "%CM%" == "chef-workstation" goto omnitruck
if "%CM%" == "puppet" goto puppet
if "%CM%" == "salt"   goto salt

echo ==^> ERROR: Unknown value for environment variable CM: "%CM%"

goto exit1

::::::::::::
:omnitruck
::::::::::::

:: If we already have the CHEF_URL, then we don't need to use Omnitruck and we can move on
if defined CHEF_URL goto chef

:: Determine each component for using the Omnitruck API to get the desired Chef component
if not defined OMNITRUCK_CHANNEL set OMNITRUCK_CHANNEL=stable

:: Figure out the Omnitruck product
if "%CM%" == "chef" (
  set "OMNITRUCK_PRODUCT=chef"
) else if "%CM%" == "chefdk" (
  set "OMNITRUCK_PRODUCT=chefdk"
) else if "%CM%" == "chef-workstation" (
  set "OMNITRUCK_PRODUCT=chef-workstation"
) else (
  echo Unknown Chef Product: %CM%
  goto exit1
)

:: Deterine the other desired parameters here
if not defined OMNITRUCK_PLATFORM set OMNITRUCK_PLATFORM=windows
if not defined OMNITRUCK_VERSION set OMNITRUCK_VERSION=%CM_VERSION%

if not defined OMNITRUCK_MACHINE_ARCH (
  if "%PROCESSOR_ARCHITECTURE%" == "x86" (
    set OMNITRUCK_MACHINE_ARCH=x86
  ) else (
    set OMNITRUCK_MACHINE_ARCH=x64
  )
)

:: We exclude the platform version as the Omnitruck API doesn't seem to use this
:: set OMNITRUCK_PLATFORM_VERSION=

:: strip -1 if %OMNITRUCK_VERSION% ends in -1
set OMNITRUCK_VERSION=%OMNITRUCK_VERSION:-1=%

:: Use the Omnitruck API to determine the CHEF_URL
echo ==^> Getting %OMNITRUCK_PRODUCT% %OMNITRUCK_VERSION% %OMNITRUCK_MACHINE_ARCH% download URL
set url="https://omnitruck.chef.io/%OMNITRUCK_CHANNEL%/%OMNITRUCK_PRODUCT%/metadata?p=%OMNITRUCK_PLATFORM%&m=%OMNITRUCK_MACHINE_ARCH%&v=%OMNITRUCK_VERSION%"
set filename="%TEMP%\omnitruck.txt"

echo "==^> Using Chef Omnitruck API URL: !url!"
powershell -command "(New-Object System.Net.WebClient).DownloadFile('!url!', '!filename!')"

if not exist "%TEMP%\omnitruck.txt" (
  echo Unable to download metadata for %OMNITRUCK_PRODUCT% %OMNITRUCK_VERSION% on the %OMNITRUCK_CHANNEL% channel for %OMNITRUCK_PLATFORM% %OMNITRUCK_MACHINE_ARCH%

) else (
  for /f "tokens=2 usebackq" %%a in (`findstr "url" "%TEMP%\omnitruck.txt"`) do (
      set CHEF_URL=%%a
  )
)

if not defined CHEF_URL (
  echo Could not determine the %OMNITRUCK_PRODUCT% %OMNITRUCK_VERSION% download url...
  goto exit1
)
echo "==^> Got %OMNITRUCK_PRODUCT% download URL: !CHEF_URL!"

goto chef

::::::::::::
:chef
::::::::::::
if not defined CHEF_OPTIONS set CHEF_OPTIONS=%CM_OPTIONS%

for %%i in ("%CHEF_URL%") do set CHEF_MSI=%%~nxi
set CHEF_DIR=%TEMP%\chef
set CHEF_PATH=%CHEF_DIR%\%CHEF_MSI%

echo ==^> Creating "%CHEF_DIR%"
mkdir "%CHEF_DIR%"
pushd "%CHEF_DIR%"

if exist "%SystemRoot%\_download.cmd" (
  call "%SystemRoot%\_download.cmd" "%CHEF_URL%" "%CHEF_PATH%"
) else (
  echo ==^> Downloading %CHEF_URL% to %CHEF_PATH%
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile(\"%CHEF_URL%\", '%CHEF_PATH%')" <NUL
)
if not exist "%CHEF_PATH%" goto exit1

echo ==^> Installing %CM% %CM_VERSION%
msiexec /qb /i "%CHEF_PATH%" /l*v "%CHEF_DIR%\chef.log" %CHEF_OPTIONS%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: msiexec /qb /i "%CHEF_PATH%" /l*v "%CHEF_DIR%\chef.log" %CHEF_OPTIONS%
ver>nul

goto exit0

::::::::::::
:puppet
::::::::::::
if not defined PUPPET_OPTIONS set PUPPET_OPTIONS=%CM_OPTIONS%

:: if "%CM_VERSION%" == "latest" set CM_VERSION=3.8.7

if not defined PUPPET_URL set PUPPET_64_URL=https://downloads.puppetlabs.com/windows/puppet-x64-%CM_VERSION%.msi
if not defined PUPPET_URL set PUPPET_64_URL=https://downloads.puppetlabs.com/windows/puppet-%CM_VERSION%.msi

if defined ProgramFiles(x86) (
  set PUPPET_URL=%PUPPET_64_URL%
) else (
  set PUPPET_URL=%PUPPET_32_URL%
)

for %%i in ("%PUPPET_URL%") do set PUPPET_MSI=%%~nxi
set PUPPET_DIR=%TEMP%\puppet
set PUPPET_PATH=%PUPPET_DIR%\%PUPPET_MSI%

echo ==^> Creating "%PUPPET_DIR%"
mkdir "%PUPPET_DIR%"
pushd "%PUPPET_DIR%"

:: todo support CM_VERSION variable
if exist "%SystemRoot%\_download.cmd" (
  call "%SystemRoot%\_download.cmd" "%PUPPET_URL%" "%PUPPET_PATH%"
) else (
  echo ==^> Downloading %PUPPET_URL% to %PUPPET_PATH%
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%PUPPET_URL%', '%PUPPET_PATH%')" <NUL
)
if not exist "%PUPPET_PATH%" goto exit1

echo ==^> Installing Puppet client %CM_VERSION%
:: see http://docs.puppetlabs.com/pe/latest/install_windows.html
msiexec /qb /i "%PUPPET_PATH%" /l*v "%PUPPET_DIR%\puppet.log" %PUPPET_OPTIONS%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: msiexec /qb /i "%PUPPET_PATH%" /l*v "%PUPPET_DIR%\puppet.log" %PUPPET_OPTIONS%
ver>nul

goto exit0

::::::::::::
:salt
::::::::::::
if not defined SALT_OPTIONS set SALT_OPTIONS=%CM_OPTIONS%
if not defined SALT_REVISION set SALT_REVISION=stable

set SALT_DIR=%TEMP%\salt
echo ==^> Creating "%SALT_DIR%"
mkdir "%SALT_DIR%"
pushd "%SALT_DIR%"

:: If we're on a platform where salt-bootstrap is buggy, then fall back to just
:: using the regular salt-repository method.
if "%PlatformVersionMajor%" == "5" goto saltrepository
if "%PlatformVersionMajor%" == "6" if "%PlatformVersionMinor%" == "0" goto saltrepository
if "%PlatformVersionMajor%" == "6" if "%PlatformVersionMinor%" == "1" goto saltrepository

::::::::::::
:saltbootstrap
::::::::::::

:: We hardcode the CM_VERSION here to workaround saltstack/salt-bootstrap#1394
if "%CM_VERSION%" == "latest" set CM_VERSION=2019.2.2

set SALT_URL=http://raw.githubusercontent.com/saltstack/salt-bootstrap/%SALT_REVISION%/bootstrap-salt.ps1

set SALT_PATH=%SALT_DIR%\bootstrap-salt.ps1
set SALT_DOWNLOAD=%SALT_DIR%\bootstrap-salt.download.ps1

echo ==^> Downloading %SALT_URL% to %SALT_DOWNLOAD%
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%SALT_URL%', '%SALT_DOWNLOAD%')" <NUL

if not exist "%SALT_DOWNLOAD%" goto exit1
echo ==^> Patching bootstrap-salt.ps1 at %SALT_DOWNLOAD%
powershell -command "(get-content \"%SALT_DOWNLOAD%\") -replace \"'Tls,Tls11,Tls12'\", \"0xc0,0x300,0xc00\" | set-content \"%SALT_PATH%\""

echo ==^> Installing Salt minion with %SALT_PATH%
if "%CM_VERSION%" == "latest" (
  powershell "%SALT_PATH%" %SALT_OPTIONS%
) else (
  powershell "%SALT_PATH%" -version "%CM_VERSION%" %SALT_OPTIONS%
)

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: "%SALT_PATH%" -version "%CM_VERSION%" %SALT_OPTIONS%
ver>nul

goto exit0

::::::::::::
:saltrepository
::::::::::::

if not defined SALT_PYTHONVERSION set SALT_PYTHONVERSION=Py3

if not defined SALT_ARCH (
  if "%PROCESSOR_ARCHITECTURE%" == "x86" (
    set SALT_ARCH=x86
  ) else (
    set SALT_ARCH=AMD64
  )
)

if "%CM_VERSION%" == "latest" (
  set SALT_URL=http://repo.saltstack.com/windows/Salt-Minion-Latest-%SALT_PYTHONVERSION%-%SALT_ARCH%-Setup.exe
) else (
  set SALT_URL=http://repo.saltstack.com/windows/Salt-Minion-%CM_VERSION%-%SALT_PYTHONVERSION%-%SALT_ARCH%-Setup.exe
)

set SALT_PATH=%SALT_DIR%\Salt-Minion-Setup.exe

echo ==^> Downloading %SALT_URL% to %SALT_PATH%
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%SALT_URL%', '%SALT_PATH%')" <NUL

echo ==^> Installing Salt minion %CM_VERSION%-%SALT_PYTHONVERSION% with %SALT_PATH%

"%SALT_PATH%" /S %SALT_OPTIONS%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: "%SALT_PATH%" /S %SALT_OPTIONS%
ver>nul

goto exit0

::::::::::::
:nocm
::::::::::::

echo ==^> Building box without a configuration management tool

:exit0

@ping 127.0.0.1
@ver>nul

@goto :exit

:exit1

@ping 127.0.0.1
@verify other 2>nul

:exit

@echo ==^> Script exiting with errorlevel %ERRORLEVEL%
@exit /b %ERRORLEVEL%

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

:: Get the PlatformVersion from SystemInfo
for /f "delims=:; tokens=1,2" %%a in ('systeminfo') do (
  if "%%a" == "OS Version" set PlatformVersionRow=%%b
)

:: Extract the major/minor version (stripped)
for /f "delims=.; tokens=1,2" %%a in ("%PlatformVersionRow%") do (
  for /f "tokens=*" %%v in ("%%a") do set PlatformVersionMajor=%%v
  for /f "tokens=*" %%v in ("%%b") do set PlatformVersionMinor=%%v
)

echo ==^> Detected Windows Platform Version: %PlatformVersionMajor%.%PlatformVersionMinor%

:: Set some reasonable defaults
if not defined TEMP set TEMP=%LOCALAPPDATA%\Temp

:: Figure out which configuration management tool to use
if not defined CM echo ==^> ERROR: The "CM" variable was not found in the environment & goto exit1
if "%CM%" == "nocm"   goto nocm

if not defined CM_VERSION (
  echo ==^> ERROR: The "CM_VERSION" variable was not found in the environment
  set CM_VERSION=latest
)

if "%CM%" == "chef" goto omnitruck
if "%CM%" == "chefdk" goto omnitruck
if "%CM%" == "chef-workstation" goto omnitruck
if "%CM%" == "puppet" goto puppet
if "%CM%" == "salt"   goto salt

echo ==^> ERROR: Unknown value for environment variable CM: "%CM%"

goto exit1

::::::::::::
:omnitruck
::::::::::::

:: If we already have the CHEF_URL, then we don't need to use Omnitruck and we can move on
if defined CHEF_URL goto chef

:: Determine each component for using the Omnitruck API to get the desired Chef component
if not defined OMNITRUCK_CHANNEL set OMNITRUCK_CHANNEL=stable

:: Figure out the Omnitruck product
if "%CM%" == "chef" (
  set "OMNITRUCK_PRODUCT=chef"
) else if "%CM%" == "chefdk" (
  set "OMNITRUCK_PRODUCT=chefdk"
) else if "%CM%" == "chef-workstation" (
  set "OMNITRUCK_PRODUCT=chef-workstation"
) else (
  echo Unknown Chef Product: %CM%
  goto exit1
)

:: Deterine the other desired parameters here
if not defined OMNITRUCK_PLATFORM set OMNITRUCK_PLATFORM=windows
if not defined OMNITRUCK_VERSION set OMNITRUCK_VERSION=%CM_VERSION%

if not defined OMNITRUCK_MACHINE_ARCH (
  if "%PROCESSOR_ARCHITECTURE%" == "x86" (
    set OMNITRUCK_MACHINE_ARCH=x86
  ) else (
    set OMNITRUCK_MACHINE_ARCH=x64
  )
)

:: We exclude the platform version as the Omnitruck API doesn't seem to use this
:: set OMNITRUCK_PLATFORM_VERSION=

:: strip -1 if %OMNITRUCK_VERSION% ends in -1
set OMNITRUCK_VERSION=%OMNITRUCK_VERSION:-1=%

:: Use the Omnitruck API to determine the CHEF_URL
echo ==^> Getting %OMNITRUCK_PRODUCT% %OMNITRUCK_VERSION% %OMNITRUCK_MACHINE_ARCH% download URL
set url="https://omnitruck.chef.io/%OMNITRUCK_CHANNEL%/%OMNITRUCK_PRODUCT%/metadata?p=%OMNITRUCK_PLATFORM%&m=%OMNITRUCK_MACHINE_ARCH%&v=%OMNITRUCK_VERSION%"
set filename="%TEMP%\omnitruck.txt"

echo "==^> Using Chef Omnitruck API URL: !url!"
powershell -command "(New-Object System.Net.WebClient).DownloadFile('!url!', '!filename!')"

if not exist "%TEMP%\omnitruck.txt" (
  echo Unable to download metadata for %OMNITRUCK_PRODUCT% %OMNITRUCK_VERSION% on the %OMNITRUCK_CHANNEL% channel for %OMNITRUCK_PLATFORM% %OMNITRUCK_MACHINE_ARCH%

) else (
  for /f "tokens=2 usebackq" %%a in (`findstr "url" "%TEMP%\omnitruck.txt"`) do (
      set CHEF_URL=%%a
  )
)

if not defined CHEF_URL (
  echo Could not determine the %OMNITRUCK_PRODUCT% %OMNITRUCK_VERSION% download url...
  goto exit1
)
echo "==^> Got %OMNITRUCK_PRODUCT% download URL: !CHEF_URL!"

goto chef

::::::::::::
:chef
::::::::::::
if not defined CHEF_OPTIONS set CHEF_OPTIONS=%CM_OPTIONS%

for %%i in ("%CHEF_URL%") do set CHEF_MSI=%%~nxi
set CHEF_DIR=%TEMP%\chef
set CHEF_PATH=%CHEF_DIR%\%CHEF_MSI%

echo ==^> Creating "%CHEF_DIR%"
mkdir "%CHEF_DIR%"
pushd "%CHEF_DIR%"

if exist "%SystemRoot%\_download.cmd" (
  call "%SystemRoot%\_download.cmd" "%CHEF_URL%" "%CHEF_PATH%"
) else (
  echo ==^> Downloading %CHEF_URL% to %CHEF_PATH%
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile(\"%CHEF_URL%\", '%CHEF_PATH%')" <NUL
)
if not exist "%CHEF_PATH%" goto exit1

echo ==^> Installing %CM% %CM_VERSION%
msiexec /qb /i "%CHEF_PATH%" /l*v "%CHEF_DIR%\chef.log" %CHEF_OPTIONS%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: msiexec /qb /i "%CHEF_PATH%" /l*v "%CHEF_DIR%\chef.log" %CHEF_OPTIONS%
ver>nul

goto exit0

::::::::::::
:puppet
::::::::::::
if not defined PUPPET_OPTIONS set PUPPET_OPTIONS=%CM_OPTIONS%

if "%CM_VERSION%" == "latest" set CM_VERSION=6.3.0

if not defined PUPPET_URL set PUPPET_64_URL=https://downloads.puppetlabs.com/windows/puppet/puppet-agent-%CM_VERSION%-x64.msi
if not defined PUPPET_URL set PUPPET_32_URL=https://downloads.puppetlabs.com/windows/puppet/puppet-agent-%CM_VERSION%-x86.msi

if defined ProgramFiles(x86) (
  set PUPPET_URL=%PUPPET_64_URL%
) else (
  set PUPPET_URL=%PUPPET_32_URL%
)

for %%i in ("%PUPPET_URL%") do set PUPPET_MSI=%%~nxi
set PUPPET_DIR=%TEMP%\puppet
set PUPPET_PATH=%PUPPET_DIR%\%PUPPET_MSI%

echo ==^> Creating "%PUPPET_DIR%"
mkdir "%PUPPET_DIR%"
pushd "%PUPPET_DIR%"

:: todo support CM_VERSION variable
if exist "%SystemRoot%\_download.cmd" (
  call "%SystemRoot%\_download.cmd" "%PUPPET_URL%" "%PUPPET_PATH%"
) else (
  echo ==^> Downloading %PUPPET_URL% to %PUPPET_PATH%
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%PUPPET_URL%', '%PUPPET_PATH%')" <NUL
)
if not exist "%PUPPET_PATH%" goto exit1

echo ==^> Installing Puppet client %CM_VERSION%
:: see http://docs.puppetlabs.com/pe/latest/install_windows.html
msiexec /qb /i "%PUPPET_PATH%" /l*v "%PUPPET_DIR%\puppet.log" %PUPPET_OPTIONS%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: msiexec /qb /i "%PUPPET_PATH%" /l*v "%PUPPET_DIR%\puppet.log" %PUPPET_OPTIONS%
ver>nul

goto exit0

::::::::::::
:salt
::::::::::::
if not defined SALT_OPTIONS set SALT_OPTIONS=%CM_OPTIONS%
if not defined SALT_REVISION set SALT_REVISION=stable

set SALT_DIR=%TEMP%\salt
echo ==^> Creating "%SALT_DIR%"
mkdir "%SALT_DIR%"
pushd "%SALT_DIR%"

:: If we're on a platform where salt-bootstrap is buggy, then fall back to just
:: using the regular salt-repository method.
if "%PlatformVersionMajor%" == "5" goto saltrepository
if "%PlatformVersionMajor%" == "6" if "%PlatformVersionMinor%" == "0" goto saltrepository
if "%PlatformVersionMajor%" == "6" if "%PlatformVersionMinor%" == "1" goto saltrepository

::::::::::::
:saltbootstrap
::::::::::::

:: We hardcode the CM_VERSION here to workaround saltstack/salt-bootstrap#1394
if "%CM_VERSION%" == "latest" set CM_VERSION=2019.2.2

set SALT_URL=http://raw.githubusercontent.com/saltstack/salt-bootstrap/%SALT_REVISION%/bootstrap-salt.ps1

set SALT_PATH=%SALT_DIR%\bootstrap-salt.ps1
set SALT_DOWNLOAD=%SALT_DIR%\bootstrap-salt.download.ps1

echo ==^> Downloading %SALT_URL% to %SALT_DOWNLOAD%
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%SALT_URL%', '%SALT_DOWNLOAD%')" <NUL

if not exist "%SALT_DOWNLOAD%" goto exit1
echo ==^> Patching bootstrap-salt.ps1 at %SALT_DOWNLOAD%
powershell -command "(get-content \"%SALT_DOWNLOAD%\") -replace \"'Tls,Tls11,Tls12'\", \"0xc0,0x300,0xc00\" | set-content \"%SALT_PATH%\""

echo ==^> Installing Salt minion with %SALT_PATH%
if "%CM_VERSION%" == "latest" (
  powershell "%SALT_PATH%" %SALT_OPTIONS%
) else (
  powershell "%SALT_PATH%" -version "%CM_VERSION%" %SALT_OPTIONS%
)

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: "%SALT_PATH%" -version "%CM_VERSION%" %SALT_OPTIONS%
ver>nul

goto exit0

::::::::::::
:saltrepository
::::::::::::

if not defined SALT_PYTHONVERSION set SALT_PYTHONVERSION=Py3

if not defined SALT_ARCH (
  if "%PROCESSOR_ARCHITECTURE%" == "x86" (
    set SALT_ARCH=x86
  ) else (
    set SALT_ARCH=AMD64
  )
)

if "%CM_VERSION%" == "latest" (
  set SALT_URL=http://repo.saltstack.com/windows/Salt-Minion-Latest-%SALT_PYTHONVERSION%-%SALT_ARCH%-Setup.exe
) else (
  set SALT_URL=http://repo.saltstack.com/windows/Salt-Minion-%CM_VERSION%-%SALT_PYTHONVERSION%-%SALT_ARCH%-Setup.exe
)

set SALT_PATH=%SALT_DIR%\Salt-Minion-Setup.exe

echo ==^> Downloading %SALT_URL% to %SALT_PATH%
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%SALT_URL%', '%SALT_PATH%')" <NUL

echo ==^> Installing Salt minion %CM_VERSION%-%SALT_PYTHONVERSION% with %SALT_PATH%

"%SALT_PATH%" /S %SALT_OPTIONS%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: "%SALT_PATH%" /S %SALT_OPTIONS%
ver>nul

goto exit0

::::::::::::
:nocm
::::::::::::

echo ==^> Building box without a configuration management tool

:exit0

@ping 127.0.0.1
@ver>nul

@goto :exit

:exit1

@ping 127.0.0.1
@verify other 2>nul

:exit

@echo ==^> Script exiting with errorlevel %ERRORLEVEL%
@exit /b %ERRORLEVEL%

Fix URL on puppet cmtool

Fix URL on puppet cmtool