@echo off

echo tester.bat

if exist "%program%.cpp" (
  echo %program%.cpp is selected.
  echo compiling ...
  g++ -o "%program%" "%program%.cpp" -Wall -O2 -std=c++11
  if exist "%program%.exe" (
    if exist "%program%.txt" (
      set input=%program%.txt
      echo %input% is found. redirect stdin to %input%
      echo running ...
      "%program%" < "%input%"
    ) else (
      echo running ...
      "%program%"
    )
    if exist "%program%.out" (
      echo.
      echo %program%.out is found.
      echo output:
      type "%program%.out"
    )
  ) else (
    echo compilation failed.
  )
) else (
  echo program is not set.
)

@echo off

echo tester.bat

if exist "%program%.cpp" (
  echo %program%.cpp is selected.
  echo compiling ...
  g++ -o "%program%" "%program%.cpp" -Wall -O2 -std=c++11
  if %ERRORLEVEL% equ 0 (
    if exist "%program%.txt" (
      echo %program%.txt is found. redirect stdin to %program%.txt
      echo running ...
      "%program%" < "%program%.txt"
    ) else (
      echo running ...
      "%program%"
    )
    if exist "%program%.out" (
      echo.
      echo %program%.out is found.
      echo output:
      type "%program%.out"
    )
  ) else (
    echo compilation failed.
  )
) else (
  echo program is not set.
)

Fix bugs

Fix bugs

Usage of set input=%program%.txt can cause some trouble, old program should not run if g++ does not return 0


echo off
echo The file ring_ext.h.light will replace the file ring_ext.h
echo This change execlude the libraries MySQL, OpenSSL and LibCurl from the project
echo To build use the light version of the batch files like buildvclight.bat
del ring_ext.h
copy ring_ext.h.light ring_ext.h

Add file configlight.bat

Add file configlight.bat


@echo off

set LEIN_VERSION=1.4.0-SNAPSHOT

rem it is possible to set LEIN_JAR variable manually
rem if it's set, don't overwrite it
if "x%LEIN_JAR%" == "x" goto SET_LEIN
goto ARGS_HANDLING

:SET_LEIN
set LEIN_DIR=%~dp0
set LEIN_JAR=%LEIN_DIR%leiningen-%LEIN_VERSION%-standalone.jar

:ARGS_HANDLING
if "x%1" == "xself-install" goto SELF_INSTALL
if "x%1" == "xupgrade"      goto NO_UPGRADE

if not exist "%LEIN_JAR%" goto NO_LEIN_JAR

rem ##################################################
rem count number of command line arguments
rem
set ARGCOUNT=0
for %%a in (%*) do set /a ARGCOUNT+=1
rem ##################################################

rem ##################################################
rem add jars found under "lib" directory to CLASSPATH
rem

call :FIND_DIR_CONTAINING_UPWARDS project.clj

if "%DIR_CONTAINING%" neq "" cd "%DIR_CONTAINING%"

setLocal EnableDelayedExpansion
set CP="
for /R ./lib %%a in (*.jar) do (
   set CP=!CP!;%%a
)
set CP=!CP!"

set CLASSPATH="%LEIN_JAR%";%CP%;"%CLASSPATH%"
if "x%DEBUG%" == "x" goto RUN
echo CLASSPATH=%CLASSPATH%
rem ##################################################

:RUN
if "x%1" == "xrepl" goto RUN_REPL
if "%ARGCOUNT%" == "2" goto RUN_ARG2
if "%ARGCOUNT%" == "3" goto RUN_ARG3
java -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\")"
goto EOF

:RUN_ARG2
java -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\" \"%2\")"
goto EOF

:RUN_ARG3
java -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\" \"%2\" \"%3\")"
goto EOF

:RUN_REPL
%RLWRAP% java -client %JAVA_OPTS% -cp src;classes;%CLASSPATH% clojure.main %2 %3 %4
goto EOF

:NO_LEIN_JAR
echo.
echo "%LEIN_JAR%" can not be found.
echo You can try running "lein self-install"
echo or change LEIN_JAR environment variable
echo or edit lein.bat to set appropriate LEIN_JAR path.
echo.
goto EOF

:SELF_INSTALL
if exist "%LEIN_JAR%" (
    echo %LEIN_JAR% already exists. Delete and retry.
    goto EOF
)
set HTTP_CLIENT=wget -O
wget>nul 2>&1
if ERRORLEVEL 9009 (
    curl>nul 2>&1
    if ERRORLEVEL 9009 goto NO_HTTP_CLIENT
    set HTTP_CLIENT=curl -f -L -o
)
set LEIN_JAR_URL=http://github.com/downloads/technomancy/leiningen/leiningen-%LEIN_VERSION%-standalone.jar
%HTTP_CLIENT% "%LEIN_JAR%" %LEIN_JAR_URL%
if ERRORLEVEL 1 (
    del "%LEIN_JAR%">nul 2>&1
    goto DOWNLOAD_FAILED
)
goto EOF

:DOWNLOAD_FAILED
echo.
echo *** DOWNLOAD FAILED! Check URL/Version. ***
echo.
goto EOF

:NO_HTTP_CLIENT
echo.
echo ERROR: Wget/Curl not found. Make sure at least either of Wget and Curl is
echo        installed and is in PATH. You can get them from URLs below:
echo.
echo Wget: "http://users.ugent.be/~bpuype/wget/"
echo Curl: "http://curl.haxx.se/dlwiz/?type=bin&os=Win32&flav=-&ver=2000/XP"
echo.
goto EOF

:NO_UPGRADE
echo.
echo Upgrade feature is not available on Windows. Please edit the value of
echo variable LEIN_VERSION in file %~f0
echo then run "lein self-install".
echo.
goto EOF

rem Find directory containing filename supplied in first argument
rem looking in current directory, and looking up the parent
rem chain until we find it, or run out
rem returns result in %DIR_CONTAINING%
rem empty string if we don't find it
:FIND_DIR_CONTAINING_UPWARDS
set DIR_CONTAINING=%CD%
set LAST_DIR=

:LOOK_AGAIN
if "%DIR_CONTAINING%" == "%LAST_DIR%" (
    rem didn't find it
    set DIR_CONTAINING=
    goto :EOF
)

if EXIST "%DIR_CONTAINING%\%1" (
    rem found it - use result in DIR_CONTAINING
    goto :EOF
)

set LAST_DIR=%DIR_CONTAINING%
call :GET_PARENT_PATH "%DIR_CONTAINING%\.."
set DIR_CONTAINING=%PARENT_PATH%
goto :LOOK_AGAIN

:GET_PARENT_PATH
set PARENT_PATH=%~f1
goto :EOF

:EOF

@echo off

set LEIN_VERSION=1.4.0-SNAPSHOT

setLocal EnableDelayedExpansion

rem it is possible to set LEIN_JAR variable manually
rem if it's set, don't overwrite it
if "x%LEIN_JAR%" == "x" goto SET_LEIN
goto ARGS_HANDLING

:SET_LEIN
set LEIN_DIR=%~dp0
set LEIN_JAR=%LEIN_DIR%leiningen-%LEIN_VERSION%-standalone.jar

:ARGS_HANDLING
if "x%1" == "xself-install" goto SELF_INSTALL
if "x%1" == "xupgrade"      goto NO_UPGRADE

if not exist "%LEIN_JAR%" goto NO_LEIN_JAR

rem ##################################################
rem count number of command line arguments
rem
set ARGCOUNT=0
for %%a in (%*) do set /a ARGCOUNT+=1
rem ##################################################

rem ##################################################
rem add jars found under "lib" directory to CLASSPATH
rem

call :FIND_DIR_CONTAINING_UPWARDS project.clj

if "%DIR_CONTAINING%" neq "" cd "%DIR_CONTAINING%"

set CP="
for /R ./lib %%a in (*.jar) do (
   set CP=!CP!;%%a
)
set CP=!CP!"

set CLASSPATH="%LEIN_JAR%";%CP%;"%CLASSPATH%"
if "x%DEBUG%" == "x" goto RUN
echo CLASSPATH=%CLASSPATH%
rem ##################################################

:RUN
if "x%1" == "xrepl" goto RUN_REPL
if "%ARGCOUNT%" == "2" goto RUN_ARG2
if "%ARGCOUNT%" == "3" goto RUN_ARG3
java -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\")"
goto EOF

:RUN_ARG2
java -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\" \"%2\")"
goto EOF

:RUN_ARG3
java -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\" \"%2\" \"%3\")"
goto EOF

:RUN_REPL
%RLWRAP% java -client %JAVA_OPTS% -cp src;classes;%CLASSPATH% clojure.main %2 %3 %4
goto EOF

:NO_LEIN_JAR
echo.
echo "%LEIN_JAR%" can not be found.
echo You can try running "lein self-install"
echo or change LEIN_JAR environment variable
echo or edit lein.bat to set appropriate LEIN_JAR path.
echo.
goto EOF

:SELF_INSTALL
if exist "%LEIN_JAR%" (
    echo %LEIN_JAR% already exists. Delete and retry.
    goto EOF
)
set HTTP_CLIENT=wget -O
wget>nul 2>&1
if ERRORLEVEL 9009 (
    curl>nul 2>&1
    if ERRORLEVEL 9009 goto NO_HTTP_CLIENT
    set HTTP_CLIENT=curl -f -L -o
)
set LEIN_JAR_URL=http://github.com/downloads/technomancy/leiningen/leiningen-%LEIN_VERSION%-standalone.jar
%HTTP_CLIENT% "%LEIN_JAR%" %LEIN_JAR_URL%
if ERRORLEVEL 1 (
    del "%LEIN_JAR%">nul 2>&1
    goto DOWNLOAD_FAILED
)
goto EOF

:DOWNLOAD_FAILED
echo.
echo *** DOWNLOAD FAILED! Check URL/Version. ***
echo.
goto EOF

:NO_HTTP_CLIENT
echo.
echo ERROR: Wget/Curl not found. Make sure at least either of Wget and Curl is
echo        installed and is in PATH. You can get them from URLs below:
echo.
echo Wget: "http://users.ugent.be/~bpuype/wget/"
echo Curl: "http://curl.haxx.se/dlwiz/?type=bin&os=Win32&flav=-&ver=2000/XP"
echo.
goto EOF

:NO_UPGRADE
echo.
echo Upgrade feature is not available on Windows. Please edit the value of
echo variable LEIN_VERSION in file %~f0
echo then run "lein self-install".
echo.
goto EOF

rem Find directory containing filename supplied in first argument
rem looking in current directory, and looking up the parent
rem chain until we find it, or run out
rem returns result in %DIR_CONTAINING%
rem empty string if we don't find it
:FIND_DIR_CONTAINING_UPWARDS
set DIR_CONTAINING=%CD%
set LAST_DIR=

:LOOK_AGAIN
if "%DIR_CONTAINING%" == "%LAST_DIR%" (
    rem didn't find it
    set DIR_CONTAINING=
    goto :EOF
)

if EXIST "%DIR_CONTAINING%\%1" (
    rem found it - use result in DIR_CONTAINING
    goto :EOF
)

set LAST_DIR=%DIR_CONTAINING%
call :GET_PARENT_PATH "%DIR_CONTAINING%\.."
set DIR_CONTAINING=%PARENT_PATH%
goto :LOOK_AGAIN

:GET_PARENT_PATH
set PARENT_PATH=%~f1
goto :EOF

:EOF

Move setLocal command higher up the file.


nuget install OpenCover -Version 4.6.519 -OutputDirectory tools
nuget install coveralls.net -Version 0.412.0 -OutputDirectory tools

.\tools\OpenCover.4.6.519\tools\OpenCover.Console.exe -target:"vstest.console.exe" -filter:"+[*]* -[*.*Tests]*" -excludebyfile:"*.g.cs" -targetargs:".\tests\Konves.TextGraph.UnitTests\bin\Release\Konves.TextGraph.UnitTests.dll" -register:user
.\tools\coveralls.net.0.412\tools\csmacnz.Coveralls.exe --opencover -i .\results.xml

nuget install OpenCover -Version 4.6.519 -OutputDirectory tools
nuget install coveralls.net -Version 0.412.0 -OutputDirectory tools

.\tools\OpenCover.4.6.519\tools\OpenCover.Console.exe -target:"vstest.console.exe" -filter:"+[*]* -[*.*Tests]*" -excludebyfile:"*.g.cs" -targetargs:".\tests\Konves.TextGraph.UnitTests\bin\Release\Konves.TextGraph.UnitTests.dll .\tests\Konves.TextGraph.UnitTests\bin\Release\Konves.TextGraph.HtmlParser.UnitTests.dll .\tests\Konves.TextGraph.UnitTests\bin\Release\Konves.TextGraph.MarkdownParser.UnitTests.dll" -register:user
.\tools\coveralls.net.0.412\tools\csmacnz.Coveralls.exe --opencover -i .\results.xml

Add tests to test coverage script

Add tests to test coverage script


@echo off
rem autorun
SETLOCAL EnableDelayedExpansion

rem ---------------------- Check arguments -------------------------------
rem Arguments are: <CPU's to use> <64/32bit> <full/partial build>
SET CPUS=%1

if "%1"=="" (
SET CPUS=%NUMBER_OF_PROCESSORS%
rem setting it to 1 might avoid errors but also makes it take an hour...
rem %NUMBER_OF_PROCESSORS% manually changed to 1... because MSVC because loves to get all tangled up in internal errors when specifying "big" numbers like 8 or 24 :s
)
echo Running autobuild in %CPUS% separate processes!

SET ARCH=%2

if NOT "%2"=="32" (
if NOT "%2"=="64" (
echo "First argument should be architecture i.e 32 or 64 bits"
echo "So e.g. run: 'autobuild 32' if you want to build an x86 version."
echo "But for now the default of 64-bit will be set."
SET ARCH=64
))

SET BUILDSTYLE=%3

if "%3"=="" (
SET BUILDSTYLE=full
)

echo "Building %ARCH% bits JASP"

rem I am assuming we are starting from (SOMEDIR)\jasp-desktop\Tools  and that (SOMEDIR) contains folders like jasp-required-files and stuff like that
rem At least by default
SET STARTDIR=%CD%

rem --- default values ---
SET JASP_BASE_DIR_DEFAULT=%STARTDIR%\..\..
SET QTDIR_DEFAULT=C:\Qt
SET QTVER_DEFAULT=5.12.7
SET RTOOLSDIR_DEFAULT=C:\Rtools
SET WIX_DEFAULT=C:\Program Files (x86)\WiX Toolset v3.11
SET MSVCDIR_DEFAULT=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community

rem ---------------------- Setting up environmet -------------------------------

rem for the rest we will check if the user has overridden any particular values manually
if "%JASP_BASE_DIR%"=="" (
    SET "JASP_BASE_DIR=%JASP_BASE_DIR_DEFAULT%"
    echo Using default JASP_BASE_DIR the folder containing required files and where the wix folder will be built, of:
    echo "%JASP_BASE_DIR_DEFAULT%", to change set the JASP_BASE_DIR environment variable to your install location
) else (
    echo JASP_BASE_DIR: "%JASP_BASE_DIR%"
)

SET JASP_DESKTOP_DEFAULT=%JASP_BASE_DIR%\jasp-desktop
SET JASP_REQUIRED_FILES_DIR_DEFAULT=%JASP_BASE_DIR%\jasp-required-files

if "%QTDIR%"=="" (
    SET "QTDIR=%QTDIR_DEFAULT%"
    echo Using default QTDIR "%QTDIR_DEFAULT%", to change set the QTDIR environment variable to your install location
) else (
    echo QTDIR: "%QTDIR%"
)

if "%QTVER%"=="" (
    SET "QTVER=%QTVER_DEFAULT%"
    echo Using default QTVER "%QTVER_DEFAULT%", to change set the QTVER environment variable to your preferred version
) else (
    echo QTVER: "%QTVER%"
)

if "%RTOOLSDIR%"=="" (
    SET "RTOOLSDIR=%RTOOLSDIR_DEFAULT%"
    echo Using default RTOOLSDIR "%RTOOLSDIR_DEFAULT%", to change set the RTOOLSDIR environment variable to your install location
) else (
    echo RTOOLSDIR: "%RTOOLSDIR%"
)

if "%WIX%"=="" (
    SET "WIX=%WIX_DEFAULT%"
    echo Using default WIX "%WIX_DEFAULT%", to change set the WIX environment variable to your install location
) else (
    echo WIX: "%WIX%"
)

if "%MSVCDIR%"=="" (
    SET "MSVCDIR=%MSVCDIR_DEFAULT%"
    echo Using default MSVCDIR "%MSVCDIR_DEFAULT%", to change set the MSVCDIR environment variable to your install location
) else (
    echo MSVCDIR: "%MSVCDIR%"
)

if "%JASP_DESKTOP%"=="" (
    SET "JASP_DESKTOP=%JASP_DESKTOP_DEFAULT%"
    echo Using default JASP_DESKTOP "%JASP_DESKTOP_DEFAULT%", to change set the JASP_DESKTOP environment variable to your folder
) else (
    echo JASP_DESKTOP: "%JASP_DESKTOP%"
)

if "%JASP_REQUIRED_FILES_DIR%"=="" (
    SET "JASP_REQUIRED_FILES_DIR=%JASP_REQUIRED_FILES_DIR_DEFAULT%"
    echo Using default JASP_REQUIRED_FILES_DIR "%JASP_REQUIRED_FILES_DIR_DEFAULT%", to change set the JASP_REQUIRED_FILES_DIR environment variable to your folder
) else (
    echo JASP_REQUIRED_FILES_DIR: "%JASP_REQUIRED_FILES_DIR%"
)

echo checking if script is ran from Tools
cd ..
if not exist Tools (
    echo This script MUST be run from %JASP_DESKTOP%\Tools!
    exit /b 2
)
cd %STARTDIR%

SET JASP_WIX_DIR=jasp-wix-installer-%ARCH%
SET JASP_INSTALL_DIR=jasp-installer-files-%ARCH%
SET JASP_BUILD_DIR=jasp-build-%ARCH%
SET JASP_R_INTERFACE=JASP-R-Interface
SET JOM=%QTDIR%\Tools\QtCreator\bin\jom.exe

SET VCVARS_DIR="%MSVCDIR%\VC\Auxiliary\Build"

if "%ARCH%" == "64" (
SET MINGWDIR=%RTOOLSDIR%\mingw_64\bin
SET QTVCDIR=%QTDIR%\%QTVER%\msvc2017_64\bin
SET WIXARCH="x64"
SET COPY_R_ARCH="x64"
) else (
SET MINGWDIR=%RTOOLSDIR%\mingw_32\bin
SET QTVCDIR=%QTDIR%\%QTVER%\msvc2017\bin
SET WIXARCH="x86"
SET COPY_R_ARCH="i386"
)

echo JASP will be built for %ARCH% bits

echo checking for existence specified directories

if not exist "%JASP_BASE_DIR%" (
    echo The desired JASP_BASE_DIR directory "%JASP_BASE_DIR%" does not exist!
    exit /b 11
)

if not exist "%JASP_DESKTOP%" (
    echo The desired jasp git directory "%JASP_DESKTOP%" does not exist!
    exit /b 11
)

if not exist "%JASP_REQUIRED_FILES_DIR%" (
    echo The desired jasp required files directory "%JASP_REQUIRED_FILES_DIR%" does not exist!
    exit /b 11
)

if not exist "%QTVCDIR%" (
    echo The desired QT binary directory "%QTVCDIR%" does not exist!
    exit /b 11
)

if not exist "%MINGWDIR%" (
    echo The desired Rtools binary directory "%MINGWDIR%" does not exist!
    exit /b 11
)

if not exist "%MSVCDIR%" (
    echo The desired Visual Studio directory "%MSVCDIR%" does not exist!
    exit /b 11
)

if not exist %VCVARS_DIR% (
    echo The desired Visual Studio environment setup CMD location %VCVARS_DIR% does not exist!
    exit /b 11
)

rem Setting up Visual Studio Environment
call %VCVARS_DIR%\vcvars%ARCH%.bat

SET PATH=%MINGWDIR%;%QTVCDIR%;%PATH%

rem you uncomment the following goto to skip building JASP, but it assumes that you did in fact build it previously in the normal location (see BUILDSTYLE argument though)
rem goto skipbuilding
rem goto copyR

if "%BUILDSTYLE%"=="wix" GOTO skipbuilding

rem We are not updating the sources from this script. if we are running from buildbot it will update the sources for us and
rem otherwise we will just use whatever the user currently has on drive.

cd %JASP_BASE_DIR%

if "%BUILDSTYLE%"=="full" (
echo Make sure we have a fresh JASP_WIX_DIR etc
    rmdir /Q /S %JASP_WIX_DIR%
    mkdir %JASP_WIX_DIR%
) else (
    echo Reusing old JASP_WIX_DIR
)

cd %JASP_WIX_DIR%

if "%BUILDSTYLE%"=="full" (
    echo Creating a fresh build dir
    rmdir /Q /S %JASP_BUILD_DIR%
    mkdir %JASP_BUILD_DIR%
) else (
    echo reusing old build dir
)

if "%BUILDSTYLE%"=="full" (
    echo Copy the required files for JASP
    if not exist %JASP_REQUIRED_FILES_DIR%\%ARCH% (
        echo Sadly enough the required binaries-folder "%JASP_REQUIRED_FILES_DIR%\%ARCH%" does not exist!
        exit /b 3
    )
    xcopy %JASP_REQUIRED_FILES_DIR%\%ARCH% %JASP_BUILD_DIR% /S

    echo Make symbolic link to R
    if not exist %JASP_REQUIRED_FILES_DIR%\R (
        echo Sadly enough the required R-folder "%JASP_REQUIRED_FILES_DIR%\R" does not exist!
        exit /b 4
    )
    cd %JASP_BUILD_DIR%
    mklink /D R %JASP_REQUIRED_FILES_DIR%\R
) else (
    echo Keeping the required files as they were.
    cd %JASP_BUILD_DIR%
)

echo Check for the existence of CRYPTKEY in the local environment and set it as a property in qmake if so.
if not "%CRYPTKEY%"=="" (
    %QTVCDIR%\qmake -set ENVIRONMENT_CRYPTKEY %CRYPTKEY%
    echo Using custom cryptkey (%CRYPTKEY%)
)

if "%BUILDSTYLE%"=="full" (
    echo Creating directory for JASP-R-Interface "%JASP_R_INTERFACE%"
    mkdir %JASP_R_INTERFACE%
)
cd %JASP_R_INTERFACE%
rem echo %JASP_DESKTOP%\%JASP_R_INTERFACE%\%JASP_R_INTERFACE%.pro
echo Building JASP-R-Interface in %JASP_R_INTERFACE%
if "%BUILDSTYLE%"=="full" (
    %QTVCDIR%\qmake.exe %JASP_DESKTOP%\%JASP_R_INTERFACE%\%JASP_R_INTERFACE%.pro -spec win32-g++
)
%MINGWDIR%\mingw32-make.exe  -j%CPUS% || exit /B 5

cd ..
echo "Building JASP"
if "%BUILDSTYLE%"=="full" (
    %QTVCDIR%\qmake.exe %JASP_DESKTOP%\JASP.pro -spec win32-msvc
)
%JOM% -j%CPUS%  || exit /B 6

%QTVCDIR%\qmake -set ENVIRONMENT_CRYPTKEY ""

:setup

echo "Preparing the installer"

cd %JASP_BASE_DIR%\%JASP_WIX_DIR%
echo Creating a fresh install dir
rmdir /Q /S %JASP_INSTALL_DIR%
mkdir  %JASP_INSTALL_DIR%

cd %JASP_INSTALL_DIR%

echo copy icon
COPY %JASP_DESKTOP%\JASP-Desktop\icon.ico /Y

echo copy AGPL txt
COPY %JASP_DESKTOP%\COPYING.txt  AGPL.txt /Y

echo copying JASP.exe, JASPEngine.exe, *.R and *.dll from build dir
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\JASP.exe /Y
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\JASPEngine.exe /Y
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\*.R /Y
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\*.dll /Y

echo Running windeployqt on JASP.exe
%QTVCDIR%\windeployqt.exe --no-compiler-runtime -core -gui -webenginewidgets -webchannel -svg -network -printsupport -xml -qml -quick -quickwidgets --qmldir %JASP_DESKTOP%\JASP-Desktop JASP.exe

echo copy resources
XCOPY  %JASP_DESKTOP%\Resources /E /I Resources

echo copy help
XCOPY  %JASP_DESKTOP%\Resources\Help /E /I Help

:copyR
echo running copyR.cmd script as "%JASP_DESKTOP%\Tools\copyR.cmd %JASP_REQUIRED_FILES_DIR%\R %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%\R %COPY_R_ARCH%"
call %JASP_DESKTOP%\Tools\copyR.cmd %JASP_REQUIRED_FILES_DIR%\R %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%\R %COPY_R_ARCH%

echo copy JAGS to installer preparation folder
XCOPY %JASP_REQUIRED_FILES_DIR%\%ARCH%\JAGS /E /I %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%\JAGS

:skipbuilding

echo Making zip-version of installer
powershell Compress-Archive "%JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%\*" "%JASP_BASE_DIR%\%JASP_WIX_DIR%\JASP.zip"

echo Melting and Coalescing MSI

cd %JASP_BASE_DIR%\%JASP_WIX_DIR%

SET MERGEMODULENAME=Microsoft_VC141_CRT_%WIXARCH%.msm

COPY "%VCToolsRedistDir%\MergeModules\%MERGEMODULENAME%" /Y
"%WIX%\bin\heat.exe" dir .\%JASP_INSTALL_DIR% -cg JASPFiles -gg -scom -sreg -sfrag -srd -dr INSTALLLOCATION -var var.JASP_INSTALL_DIR -out JASPFilesFragment.wxs || exit /B 7

COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\jasp.wxi /Y
"%WIX%\bin\candle" -arch %WIXARCH% -dJASP_INSTALL_DIR=%JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%  JASPFilesFragment.wxs  || exit /B 8

COPY %JASP_DESKTOP%\Tools\wix\jasp.wxs /Y
"%WIX%\bin\candle" -dRedistMergeModule=%MERGEMODULENAME% -arch %WIXARCH% -dJASP_DESKTOP_DIR=%JASP_DESKTOP% -ext WixUIExtension -ext WixUtilExtension jasp.wxs || exit /B 9

"%WIX%\bin\light" -dRedistMergeModule=%MERGEMODULENAME% -ext WixUIExtension -ext WixUtilExtension -out JASP.msi JASPFilesFragment.wixobj jasp.wixobj || exit /B 10

cd %STARTDIR%

:end
endlocal

@echo off
rem autorun
SETLOCAL EnableDelayedExpansion

rem ---------------------- Check arguments -------------------------------
rem Arguments are: <CPU's to use> <64/32bit> <full/partial build>
SET CPUS=%1

if "%1"=="" (
SET CPUS=%NUMBER_OF_PROCESSORS%
rem setting it to 1 might avoid errors but also makes it take an hour...
rem %NUMBER_OF_PROCESSORS% manually changed to 1... because MSVC because loves to get all tangled up in internal errors when specifying "big" numbers like 8 or 24 :s
)
echo Running autobuild in %CPUS% separate processes!

SET ARCH=%2

if NOT "%2"=="32" (
if NOT "%2"=="64" (
echo "First argument should be architecture i.e 32 or 64 bits"
echo "So e.g. run: 'autobuild 32' if you want to build an x86 version."
echo "But for now the default of 64-bit will be set."
SET ARCH=64
))

SET BUILDSTYLE=%3

if "%3"=="" (
SET BUILDSTYLE=full
)

echo "Building %ARCH% bits JASP"

rem I am assuming we are starting from (SOMEDIR)\jasp-desktop\Tools  and that (SOMEDIR) contains folders like jasp-required-files and stuff like that
rem At least by default
SET STARTDIR=%CD%

rem --- default values ---
SET JASP_BASE_DIR_DEFAULT=%STARTDIR%\..\..
SET QTDIR_DEFAULT=C:\Qt
SET QTVER_DEFAULT=5.12.7
SET RTOOLSDIR_DEFAULT=C:\Rtools
SET WIX_DEFAULT=C:\Program Files (x86)\WiX Toolset v3.11
SET MSVCDIR_DEFAULT=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community

rem ---------------------- Setting up environmet -------------------------------

rem for the rest we will check if the user has overridden any particular values manually
if "%JASP_BASE_DIR%"=="" (
    SET "JASP_BASE_DIR=%JASP_BASE_DIR_DEFAULT%"
    echo Using default JASP_BASE_DIR the folder containing required files and where the wix folder will be built, of:
    echo "%JASP_BASE_DIR_DEFAULT%", to change set the JASP_BASE_DIR environment variable to your install location
) else (
    echo JASP_BASE_DIR: "%JASP_BASE_DIR%"
)

SET JASP_DESKTOP_DEFAULT=%JASP_BASE_DIR%\jasp-desktop
SET JASP_REQUIRED_FILES_DIR_DEFAULT=%JASP_BASE_DIR%\jasp-required-files

if "%QTDIR%"=="" (
    SET "QTDIR=%QTDIR_DEFAULT%"
    echo Using default QTDIR "%QTDIR_DEFAULT%", to change set the QTDIR environment variable to your install location
) else (
    echo QTDIR: "%QTDIR%"
)

if "%QTVER%"=="" (
    SET "QTVER=%QTVER_DEFAULT%"
    echo Using default QTVER "%QTVER_DEFAULT%", to change set the QTVER environment variable to your preferred version
) else (
    echo QTVER: "%QTVER%"
)

if "%RTOOLSDIR%"=="" (
    SET "RTOOLSDIR=%RTOOLSDIR_DEFAULT%"
    echo Using default RTOOLSDIR "%RTOOLSDIR_DEFAULT%", to change set the RTOOLSDIR environment variable to your install location
) else (
    echo RTOOLSDIR: "%RTOOLSDIR%"
)

if "%WIX%"=="" (
    SET "WIX=%WIX_DEFAULT%"
    echo Using default WIX "%WIX_DEFAULT%", to change set the WIX environment variable to your install location
) else (
    echo WIX: "%WIX%"
)

if "%MSVCDIR%"=="" (
    SET "MSVCDIR=%MSVCDIR_DEFAULT%"
    echo Using default MSVCDIR "%MSVCDIR_DEFAULT%", to change set the MSVCDIR environment variable to your install location
) else (
    echo MSVCDIR: "%MSVCDIR%"
)

if "%JASP_DESKTOP%"=="" (
    SET "JASP_DESKTOP=%JASP_DESKTOP_DEFAULT%"
    echo Using default JASP_DESKTOP "%JASP_DESKTOP_DEFAULT%", to change set the JASP_DESKTOP environment variable to your folder
) else (
    echo JASP_DESKTOP: "%JASP_DESKTOP%"
)

if "%JASP_REQUIRED_FILES_DIR%"=="" (
    SET "JASP_REQUIRED_FILES_DIR=%JASP_REQUIRED_FILES_DIR_DEFAULT%"
    echo Using default JASP_REQUIRED_FILES_DIR "%JASP_REQUIRED_FILES_DIR_DEFAULT%", to change set the JASP_REQUIRED_FILES_DIR environment variable to your folder
) else (
    echo JASP_REQUIRED_FILES_DIR: "%JASP_REQUIRED_FILES_DIR%"
)

echo checking if script is ran from Tools
cd ..
if not exist Tools (
    echo This script MUST be run from %JASP_DESKTOP%\Tools!
    exit /b 2
)
cd %STARTDIR%

SET JASP_WIX_DIR=jasp-wix-installer-%ARCH%
SET JASP_INSTALL_DIR=jasp-installer-files-%ARCH%
SET JASP_BUILD_DIR=jasp-build-%ARCH%
SET JASP_R_INTERFACE=JASP-R-Interface
SET JOM=%QTDIR%\Tools\QtCreator\bin\jom.exe

SET VCVARS_DIR="%MSVCDIR%\VC\Auxiliary\Build"

if "%ARCH%" == "64" (
SET MINGWDIR=%RTOOLSDIR%\mingw_64\bin
SET QTVCDIR=%QTDIR%\%QTVER%\msvc2017_64\bin
SET WIXARCH="x64"
SET COPY_R_ARCH="x64"
) else (
SET MINGWDIR=%RTOOLSDIR%\mingw_32\bin
SET QTVCDIR=%QTDIR%\%QTVER%\msvc2017\bin
SET WIXARCH="x86"
SET COPY_R_ARCH="i386"
)

echo JASP will be built for %ARCH% bits

echo checking for existence specified directories

if not exist "%JASP_BASE_DIR%" (
    echo The desired JASP_BASE_DIR directory "%JASP_BASE_DIR%" does not exist!
    exit /b 11
)

if not exist "%JASP_DESKTOP%" (
    echo The desired jasp git directory "%JASP_DESKTOP%" does not exist!
    exit /b 11
)

if not exist "%JASP_REQUIRED_FILES_DIR%" (
    echo The desired jasp required files directory "%JASP_REQUIRED_FILES_DIR%" does not exist!
    exit /b 11
)

if not exist "%QTVCDIR%" (
    echo The desired QT binary directory "%QTVCDIR%" does not exist!
    exit /b 11
)

if not exist "%MINGWDIR%" (
    echo The desired Rtools binary directory "%MINGWDIR%" does not exist!
    exit /b 11
)

if not exist "%MSVCDIR%" (
    echo The desired Visual Studio directory "%MSVCDIR%" does not exist!
    exit /b 11
)

if not exist %VCVARS_DIR% (
    echo The desired Visual Studio environment setup CMD location %VCVARS_DIR% does not exist!
    exit /b 11
)

rem Setting up Visual Studio Environment
call %VCVARS_DIR%\vcvars%ARCH%.bat

SET PATH=%MINGWDIR%;%QTVCDIR%;%PATH%

rem you uncomment the following goto to skip building JASP, but it assumes that you did in fact build it previously in the normal location (see BUILDSTYLE argument though)
rem goto skipbuilding
rem goto copyR

if "%BUILDSTYLE%"=="wix" GOTO skipbuilding

rem We are not updating the sources from this script. if we are running from buildbot it will update the sources for us and
rem otherwise we will just use whatever the user currently has on drive.

cd %JASP_BASE_DIR%

if "%BUILDSTYLE%"=="full" (
echo Make sure we have a fresh JASP_WIX_DIR etc
    rmdir /Q /S %JASP_WIX_DIR%
    mkdir %JASP_WIX_DIR%
) else (
    echo Reusing old JASP_WIX_DIR
)

cd %JASP_WIX_DIR%

if "%BUILDSTYLE%"=="full" (
    echo Creating a fresh build dir
    rmdir /Q /S %JASP_BUILD_DIR%
    mkdir %JASP_BUILD_DIR%
) else (
    echo reusing old build dir
)

if "%BUILDSTYLE%"=="full" (
    echo Copy the required files for JASP
    if not exist %JASP_REQUIRED_FILES_DIR%\%ARCH% (
        echo Sadly enough the required binaries-folder "%JASP_REQUIRED_FILES_DIR%\%ARCH%" does not exist!
        exit /b 3
    )
    xcopy %JASP_REQUIRED_FILES_DIR%\%ARCH% %JASP_BUILD_DIR% /S

    echo Make symbolic link to R
    if not exist %JASP_REQUIRED_FILES_DIR%\R (
        echo Sadly enough the required R-folder "%JASP_REQUIRED_FILES_DIR%\R" does not exist!
        exit /b 4
    )
    cd %JASP_BUILD_DIR%
    mklink /D R %JASP_REQUIRED_FILES_DIR%\R
) else (
    echo Keeping the required files as they were.
    cd %JASP_BUILD_DIR%
)

echo Check for the existence of CRYPTKEY in the local environment and set it as a property in qmake if so.
if not "%CRYPTKEY%"=="" (
    %QTVCDIR%\qmake -set ENVIRONMENT_CRYPTKEY %CRYPTKEY%
    echo Using custom cryptkey (%CRYPTKEY%)
)

if "%BUILDSTYLE%"=="full" (
    echo Creating directory for JASP-R-Interface "%JASP_R_INTERFACE%"
    mkdir %JASP_R_INTERFACE%
)
cd %JASP_R_INTERFACE%
rem echo %JASP_DESKTOP%\%JASP_R_INTERFACE%\%JASP_R_INTERFACE%.pro
echo Building JASP-R-Interface in %JASP_R_INTERFACE%
if "%BUILDSTYLE%"=="full" (
    %QTVCDIR%\qmake.exe %JASP_DESKTOP%\%JASP_R_INTERFACE%\%JASP_R_INTERFACE%.pro -spec win32-g++
)
%MINGWDIR%\mingw32-make.exe  -j%CPUS% || exit /B 5

cd ..
echo "Building JASP"
if "%BUILDSTYLE%"=="full" (
    %QTVCDIR%\qmake.exe %JASP_DESKTOP%\JASP.pro -spec win32-msvc
)
%JOM% -j%CPUS%  || exit /B 6

%QTVCDIR%\qmake -set ENVIRONMENT_CRYPTKEY ""

:setup

echo "Preparing the installer"

cd %JASP_BASE_DIR%\%JASP_WIX_DIR%
echo Creating a fresh install dir
rmdir /Q /S %JASP_INSTALL_DIR%
mkdir  %JASP_INSTALL_DIR%

cd %JASP_INSTALL_DIR%

echo copy icon
COPY %JASP_DESKTOP%\JASP-Desktop\icon.ico /Y

echo copy AGPL txt
COPY %JASP_DESKTOP%\COPYING.txt  AGPL.txt /Y

echo copying JASP.exe, JASPEngine.exe, *.R and *.dll from build dir
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\JASP.exe /Y
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\JASPEngine.exe /Y
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\*.R /Y
COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\*.dll /Y

echo Running windeployqt on JASP.exe
%QTVCDIR%\windeployqt.exe --no-compiler-runtime -core -gui -webenginewidgets -webchannel -svg -network -printsupport -xml -qml -quick -quickwidgets --qmldir %JASP_DESKTOP%\JASP-Desktop JASP.exe

echo copy resources
XCOPY  %JASP_DESKTOP%\Resources /E /I Resources

echo copy help
XCOPY  %JASP_DESKTOP%\Resources\Help /E /I Help

:copyR
echo running copyR.cmd script as "%JASP_DESKTOP%\Tools\copyR.cmd %JASP_REQUIRED_FILES_DIR%\R %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%\R %COPY_R_ARCH%"
call %JASP_DESKTOP%\Tools\copyR.cmd %JASP_REQUIRED_FILES_DIR%\R %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%\R %COPY_R_ARCH%

echo copy JAGS to installer preparation folder
XCOPY %JASP_REQUIRED_FILES_DIR%\%ARCH%\JAGS /E /I %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%\JAGS

:skipbuilding

echo Making zip-version of installer
powershell Compress-Archive "%JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%\*" "%JASP_BASE_DIR%\%JASP_WIX_DIR%\JASP.zip"

echo Melting and Coalescing MSI

cd %JASP_BASE_DIR%\%JASP_WIX_DIR%

SET MERGEMODULENAME=Microsoft_VC141_CRT_%WIXARCH%.msm

COPY "%VCToolsRedistDir%\MergeModules\%MERGEMODULENAME%" /Y
"%WIX%\bin\heat.exe" dir .\%JASP_INSTALL_DIR% -cg JASPFiles -gg -scom -sreg -sfrag -srd -dr INSTALLLOCATION -var var.JASP_INSTALL_DIR -out JASPFilesFragment.wxs || exit /B 7

COPY %JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_BUILD_DIR%\jasp.wxi /Y
"%WIX%\bin\candle" -arch %WIXARCH% -dJASP_INSTALL_DIR=%JASP_BASE_DIR%\%JASP_WIX_DIR%\%JASP_INSTALL_DIR%  JASPFilesFragment.wxs  || exit /B 8

COPY %JASP_DESKTOP%\Tools\wix\jasp.wxs /Y
"%WIX%\bin\candle" -dRedistMergeModule=%MERGEMODULENAME% -arch %WIXARCH% -dJASP_DESKTOP_DIR=%JASP_DESKTOP% -ext WixUIExtension -ext WixUtilExtension jasp.wxs || exit /B 9

"%WIX%\bin\light" -sval -dRedistMergeModule=%MERGEMODULENAME% -ext WixUIExtension -ext WixUtilExtension -out JASP.msi JASPFilesFragment.wixobj jasp.wixobj || exit /B 10

cd %STARTDIR%

:end
endlocal

Disable ICE validation on Windows

Disable ICE validation on Windows

As described here: https://stackoverflow.com/questions/1064580/wix-3-0-throws-error-217-while-being-executed-by-continuous-integration
Because running as a non-admin user gives me:
```
light.exe : error LGHT0217 : Error executing ICE action 'ICE01'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".
light.exe : error LGHT0217 : Error executing ICE action 'ICE02'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".
light.exe : error LGHT0217 : Error executing ICE action 'ICE03'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".
light.exe : error LGHT0217 : Error executing ICE action 'ICE04'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".
light.exe : error LGHT0217 : Error executing ICE action 'ICE05'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".
light.exe : error LGHT0217 : Error executing ICE action 'ICE06'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".
light.exe : error LGHT0217 : Error executing ICE action 'ICE07'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".
light.exe : error LGHT0216 : An unexpected Win32 exception with error code 0x643 occurred: Action - 'ICE09' Fatal error during installation
```


@if "%config%" == "" set config=Debug

@set path=%cd%\tools\VsixUtil;%path%

@echo Installing `%config%` build of GitHub for Vidual Studio
vsixutil /install "%cd%\build\%config%\GitHub.VisualStudio.vsix" /s Enterprise;Professional;Community

@if "%config%" == "" set config=Debug

@set path=%cd%\tools\VsixUtil;%path%

@echo Installing `%config%` build of GitHub for Visual Studio
vsixutil /install "%cd%\build\%config%\GitHub.VisualStudio.vsix" /s Enterprise;Professional;Community

fix typo in echo command

fix typo in echo command


REM   Copyright 2014 Attila Szegedi, Daniel Dekany, Jonathan Revusky
REM
REM   Licensed under the Apache License, Version 2.0 (the "License");
REM   you may not use this file except in compliance with the License.
REM   You may obtain a copy of the License at
REM
REM   http://www.apache.org/licenses/LICENSE-2.0
REM
REM   Unless required by applicable law or agreed to in writing, software
REM   distributed under the License is distributed on an "AS IS" BASIS,
REM   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM   See the License for the specific language governing permissions and
REM   limitations under the License.
REM
REM   ------------------------------------------------------------------------
REM
REM   This file is a modified version of the file that comes with Ant 1.5.
REM   The original version is copyrighted by The Apache Software Foundation.
REM   The original copyright notice follows:
REM
REM   Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
REM   reserved.

if "%FMPP_BAT_DEBUG%" == "on" echo [DEBUG] lcp.bat invoked with: %1

set _CLASSPATHCOMPONENT=%1
if ""%1""=="""" goto gotAllArgs
shift

:argCheck
if ""%1""=="""" goto gotAllArgs
set _CLASSPATHCOMPONENT=%_CLASSPATHCOMPONENT% %1
shift
goto argCheck

:gotAllArgs
set LOCALCLASSPATH=%_CLASSPATHCOMPONENT%;%LOCALCLASSPATH%

add lcp.bat to fix windows dependency

add lcp.bat to fix windows dependency


Add the script to install vim and later some other tools.


set /p versionNumber=

REM clean up
del builds\im-only-resting-%versionNumber%.zip
rd /q /s builds\im-only-resting-%versionNumber%
rd /q /s builds\im-only-resting

REM preparing staging dir
mkdir staging
copy LICENSE staging
copy NOTICE staging
copy Ior\bin\Release\im-only-resting.exe staging
copy Ior\bin\Release\libtidy.dll staging
copy Ior\bin\Release\Newtonsoft.Json.dll staging
copy Ior\bin\Release\PropertyGridEx.dll staging
copy Ior\bin\Release\RestSharp.dll staging
copy Ior\bin\Release\TidyManaged.dll staging
copy Ior\bin\Release\Utils.dll staging
copy Ior\bin\Release\NLog.config staging
copy Ior\bin\Release\NLog.dll staging
copy Ior\bin\Release\System.Net.Http.dll staging
copy Ior\bin\Release\System.Net.Http.WebRequest.dll staging
copy Ior\bin\Release\SciLexer.dll staging
copy Ior\bin\Release\SciLexer64.dll staging
copy Ior\bin\Release\ScintillaNET.dll staging

REM zip staging files
cd staging
"..\tools\7z\7za.exe" a -tzip "..\builds\im-only-resting-%versionNumber%.zip" *
cd ..

REM extract build
"tools\7z\7za.exe" e "builds\im-only-resting-%versionNumber%.zip" -o"builds\im-only-resting-%versionNumber%"
"tools\7z\7za.exe" e "builds\im-only-resting-%versionNumber%.zip" -o"builds\im-only-resting"

REM clean up
rd /q /s staging

pause

set /p versionNumber=

REM clean up
del builds\im-only-resting-%versionNumber%.zip
rd /q /s builds\im-only-resting-%versionNumber%
rd /q /s builds\im-only-resting

REM preparing staging dir
mkdir staging
copy LICENSE staging
copy NOTICE staging
copy Ior\bin\Release\im-only-resting.exe staging
copy Ior\bin\Release\libtidy.dll staging
copy Ior\bin\Release\Newtonsoft.Json.dll staging
copy Ior\bin\Release\PropertyGridEx.dll staging
copy Ior\bin\Release\TidyManaged.dll staging
copy Ior\bin\Release\Utils.dll staging
copy Ior\bin\Release\NLog.config staging
copy Ior\bin\Release\NLog.dll staging
copy Ior\bin\Release\System.Net.Http.dll staging
copy Ior\bin\Release\System.Net.Http.WebRequest.dll staging
copy Ior\bin\Release\SciLexer.dll staging
copy Ior\bin\Release\SciLexer64.dll staging
copy Ior\bin\Release\ScintillaNET.dll staging

REM zip staging files
cd staging
"..\tools\7z\7za.exe" a -tzip "..\builds\im-only-resting-%versionNumber%.zip" *
cd ..

REM extract build
"tools\7z\7za.exe" e "builds\im-only-resting-%versionNumber%.zip" -o"builds\im-only-resting-%versionNumber%"
"tools\7z\7za.exe" e "builds\im-only-resting-%versionNumber%.zip" -o"builds\im-only-resting"

REM clean up
rd /q /s staging

pause

remove old obsolete file copy from archive-release.bat


@echo off

mkdir build
cd build

rem Need to handle Python 3.x case at some point (Visual Studio 2010)
if %ARCH%==32 (
    set CMAKE_CONFIG="Release|Win32"
  if %PY_VER% LSS 3 (
	set GENERATOR="Visual Studio 9 2008"
  ) else (
	set GENERATOR="Visual Studio 10"
  )
)
if %ARCH%==64 (
    set CMAKE_CONFIG="Release|x64"
  if %PY_VER% LSS 3 (
	set GENERATOR="Visual Studio 9 2008 Win64"
  ) else (
	set GENERATOR="Visual Studio 10 Win64"
  )
)

rem The Python lib has no period in the
rem version string, so we remove it here.
set PY_VER_NO_DOT=%PY_VER:.=%

cmake ..\tools\python -LAH -G%GENERATOR% ^
-DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
-DBUILD_SHARED_LIBS=1 ^
-DBoost_USE_STATIC_LIBS=0 ^
-DBoost_USE_STATIC_RUNTIME=0 ^
-DBOOST_INCLUDEDIR="%LIBRARY_INC%" ^
-DBOOST_LIBRARYDIR="%LIBRARY_LIB%" ^
-DPYTHON_LIBRARY="%PREFIX%\libs\python%PY_VER_NO_DOT%.lib" ^
-DPYTHON_INCLUDE_DIR="%PREFIX%\include" ^
-DDLIB_NO_GUI_SUPPORT=1 ^
-DDLIB_USE_BLAS=0 ^
-DDLIB_USE_LAPACK=0

cmake --build . --config %CMAKE_CONFIG% --target ALL_BUILD
cmake --build . --config %CMAKE_CONFIG% --target INSTALL

rem Copy the dlib libraries and the dlls it depends upon
rem Unfortunately, they have to be put in the root.
move "..\python_examples\*.dll" "%SP_DIR%"
move "..\python_examples\dlib.lib" "%SP_DIR%"
move "..\python_examples\dlib.pyd" "%SP_DIR%"

@echo off

mkdir build
cd build

rem Need to handle Python 3.x case at some point (Visual Studio 2010)
if %ARCH%==32 (
  set CMAKE_CONFIG="Release"

  if %PY_VER% LSS 3 (
	set GENERATOR="Visual Studio 9 2008"
  ) else (
	set GENERATOR="Visual Studio 10"
  )
)
if %ARCH%==64 (
  set CMAKE_CONFIG="Release"

  if %PY_VER% LSS 3 (
	set GENERATOR="Visual Studio 9 2008 Win64"
  ) else (
	set GENERATOR="Visual Studio 10 Win64"
  )
)

set CMAKE_COMMAND="%LIBRARY_BIN%\bin\cmake.exe"
set CMAKE_ROOT="%LIBRARY_BIN%\share\cmake-3.3"

rem The Python lib has no period in the
rem version string, so we remove it here.
set PY_VER_NO_DOT=%PY_VER:.=%

%CMAKE_COMMAND% ..\tools\python -LAH -G%GENERATOR% ^
-DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
-DBUILD_SHARED_LIBS=1 ^
-DBoost_USE_STATIC_LIBS=0 ^
-DBoost_USE_STATIC_RUNTIME=0 ^
-DBOOST_INCLUDEDIR="%LIBRARY_INC%" ^
-DBOOST_LIBRARYDIR="%LIBRARY_LIB%" ^
-DPYTHON3=%PY3K% ^
-DPYTHON_LIBRARY="%PREFIX%\libs\python%PY_VER_NO_DOT%.lib" ^
-DPYTHON_INCLUDE_DIR="%PREFIX%\include" ^
-DDLIB_LINK_WITH_SQLITE3=0 ^
-DDLIB_LINK_WITH_LIBPNG=1 ^
-DPNG_INCLUDE_DIR="%LIBRARY_INC%" ^
-DPNG_PNG_INCLUDE_DIR="%LIBRARY_INC%" ^
-DDLIB_LINK_WITH_LIBJPEG=1 ^
-DDLIB_NO_GUI_SUPPORT=1 ^
-DDLIB_USE_BLAS=0 ^
-DDLIB_USE_LAPACK=0

%CMAKE_COMMAND% --build . --config %CMAKE_CONFIG% --target ALL_BUILD
%CMAKE_COMMAND% --build . --config %CMAKE_CONFIG% --target INSTALL

rem Copy the dlib libraries and the dlls it depends upon
rem Unfortunately, they have to be put in the root.
cp "%LIBRARY_BIN%\libpng16.dll" "%SP_DIR%\libpng16.dll"
move "..\python_examples\*.dll" "%SP_DIR%"
move "..\python_examples\dlib.lib" "%SP_DIR%"
move "..\python_examples\dlib.pyd" "%SP_DIR%"

Enable png and jpeg on windows

Enable png and jpeg on windows


@ECHO OFF

IF "%1"=="" GOTO :usage
IF "%2"=="" GOTO :usage
IF "%3"=="" GOTO :usage
IF "%4"=="" GOTO :usage
IF "%5"=="" GOTO :usage

@ECHO "SET DOCKER_HOST TO %1"
SET DOCKER_HOST=%1

@ECHO "BUILD DOCKER IMAGE"
docker --tls --tlscacert="%2\ca.pem" --tlscert="%2\cert.pem" --tlskey="%2\key.pem" build -t jcorioland/vorlonjs:0.2.1
docker --tls --tlscacert="%2\ca.pem" --tlscert="%2\cert.pem" --tlskey="%2\key.pem" tag -f jcorioland/vorlonjs:0.2.1 jcorioland/vorlonjs:latest

@ECHO "LOG INTO DOCKER HUB"
docker --tls --tlscacert="%2\ca.pem" --tlscert="%2\cert.pem" --tlskey="%2\key.pem" login --username="%3" --password="%4" --email="%5" https://index.docker.io/v1/

@ECHO "PUSH IMAGE INTO DOCKER HUB"
docker --tls --tlscacert="%2\ca.pem" --tlscert="%2\cert.pem" --tlskey="%2\key.pem" push jcorioland/vorlonjs:0.2.1

@ECHO "LOG OUT FROM DOCKER HUB"
docker --tls --tlscacert="%2\ca.pem" --tlscert="%2\cert.pem" --tlskey="%2\key.pem" logout

GOTO :eof

:usage
@ECHO Usage: %0 ^<DOCKER_HOST^> ^<CERT_FOLDER^> ^<DOCKER_HUB_USERNAME^> ^<DOCKER_HUB_PASSWORD^>
EXIT /B 1

@ECHO OFF

IF "%1"=="" GOTO :usage
IF "%2"=="" GOTO :usage
IF "%3"=="" GOTO :usage
IF "%4"=="" GOTO :usage
IF "%5"=="" GOTO :usage

@ECHO "SET DOCKER_HOST TO %1"
SET DOCKER_HOST=%1

@ECHO "BUILD DOCKER IMAGE"
docker --tls --tlscacert="%2\ca.pem" --tlscert="%2\cert.pem" --tlskey="%2\key.pem" rmi jcorioland/vorlonjs
docker --tls --tlscacert="%2\ca.pem" --tlscert="%2\cert.pem" --tlskey="%2\key.pem" build -t jcorioland/vorlonjs:0.2.1
docker --tls --tlscacert="%2\ca.pem" --tlscert="%2\cert.pem" --tlskey="%2\key.pem" tag -f jcorioland/vorlonjs jcorioland/vorlonjs:latest

@ECHO "LOG INTO DOCKER HUB"
docker --tls --tlscacert="%2\ca.pem" --tlscert="%2\cert.pem" --tlskey="%2\key.pem" login --username="%3" --password="%4" --email="%5" https://index.docker.io/v1/

@ECHO "PUSH IMAGE INTO DOCKER HUB"
docker --tls --tlscacert="%2\ca.pem" --tlscert="%2\cert.pem" --tlskey="%2\key.pem" push jcorioland/vorlonjs

@ECHO "LOG OUT FROM DOCKER HUB"
docker --tls --tlscacert="%2\ca.pem" --tlscert="%2\cert.pem" --tlskey="%2\key.pem" logout

GOTO :eof

:usage
@ECHO Usage: %0 ^<DOCKER_HOST^> ^<CERT_FOLDER^> ^<DOCKER_HUB_USERNAME^> ^<DOCKER_HUB_PASSWORD^>
EXIT /B 1

update docker build image script

update docker build image script


@setlocal enabledelayedexpansion

REM Parse Arguments.

set RoslynRoot=%~dp0
set BuildConfiguration=Debug
: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
call :Usage && exit /b 1
:DoneParsing

call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat"

REM Build the compiler so we can self host it for the full build
nuget.exe restore -verbosity quiet %RoslynRoot%build/ToolsetPackages/project.json
nuget.exe restore -verbosity quiet %RoslynRoot%build/Toolset.sln
msbuild /nologo /v:m /m %RoslynRoot%build/Toolset.sln /p:Configuration=%BuildConfiguration%

mkdir %RoslynRoot%Binaries\Bootstrap
move Binaries\%BuildConfiguration%\core-clr\* %RoslynRoot%Binaries\Bootstrap
msbuild /v:m /t:Clean build/Toolset.sln /p:Configuration=%BuildConfiguration%
taskkill /F /IM vbcscompiler.exe

msbuild /v:m /m /p:BootstrapBuildPath=%RoslynRoot%Binaries\Bootstrap BuildAndTest.proj /p:Configuration=%BuildConfiguration% /p:Test64=%Test64%
if ERRORLEVEL 1 (
    taskkill /F /IM vbcscompiler.exe
    echo Build failed
    exit /b 1
)

REM Kill any instances of VBCSCompiler.exe to release locked files;
REM otherwise future CI runs may fail while trying to delete those files.
taskkill /F /IM vbcscompiler.exe

REM Verify that our project.lock.json files didn't change as a result of
REM restore.  If they do then the commit changed the dependencies without
REM updating the lock files.
git diff --exit-code --quiet
if ERRORLEVEL 1 (
    echo Commit changed dependencies without updating project.lock.json
    git diff --exit-code
    exit /b 1
)

REM It is okay and expected for taskkill to fail (it's a cleanup routine).  Ensure
REM caller sees successful exit.
exit /b 0

:Usage
@echo Usage: cibuild.cmd [/debug^|/release]
@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.
@goto :eof

@setlocal enabledelayedexpansion

REM Parse Arguments.

set RoslynRoot=%~dp0
set BuildConfiguration=Debug
: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
call :Usage && exit /b 1
:DoneParsing

call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat"

REM Build the compiler so we can self host it for the full build
nuget.exe restore -nocache -verbosity quiet %RoslynRoot%build/ToolsetPackages/project.json
nuget.exe restore -nocache -verbosity quiet %RoslynRoot%build/Toolset.sln
msbuild /nologo /v:m /m %RoslynRoot%build/Toolset.sln /p:Configuration=%BuildConfiguration%

mkdir %RoslynRoot%Binaries\Bootstrap
move Binaries\%BuildConfiguration%\core-clr\* %RoslynRoot%Binaries\Bootstrap
msbuild /v:m /t:Clean build/Toolset.sln /p:Configuration=%BuildConfiguration%
taskkill /F /IM vbcscompiler.exe

msbuild /v:m /m /p:BootstrapBuildPath=%RoslynRoot%Binaries\Bootstrap BuildAndTest.proj /p:Configuration=%BuildConfiguration% /p:Test64=%Test64%
if ERRORLEVEL 1 (
    taskkill /F /IM vbcscompiler.exe
    echo Build failed
    exit /b 1
)

REM Kill any instances of VBCSCompiler.exe to release locked files;
REM otherwise future CI runs may fail while trying to delete those files.
taskkill /F /IM vbcscompiler.exe

REM Verify that our project.lock.json files didn't change as a result of
REM restore.  If they do then the commit changed the dependencies without
REM updating the lock files.
git diff --exit-code --quiet
if ERRORLEVEL 1 (
    echo Commit changed dependencies without updating project.lock.json
    git diff --exit-code
    exit /b 1
)

REM It is okay and expected for taskkill to fail (it's a cleanup routine).  Ensure
REM caller sees successful exit.
exit /b 0

:Usage
@echo Usage: cibuild.cmd [/debug^|/release]
@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.
@goto :eof

Update cibuild.cmd to specify '-nocache'


@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem  Gradle startup script for Windows
@rem
@rem ##########################################################################

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

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

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

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

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

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega

Convert line endings from CRLF to LF.

Convert line endings from CRLF to LF.

+ This commit does not introduce any code change!


rem ensures conda is installed and installs gdsfactory package
rem https://gist.github.com/nimaid/a7d6d793f2eba4020135208a57f5c532
@echo off

set ORIGDIR="%CD%"

set MINICONDAPATH=%USERPROFILE%\Miniconda3
set CONDAEXE=%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%-condainstall.exe
set "OS="
set "MCLINK="

where conda >nul 2>nul
if %ERRORLEVEL% EQU 0 goto CONDAFOUND

:INSTALLCONDA
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS=32BIT || set OS=64BIT
if %OS%==32BIT set MCLINK=https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86.exe
if %OS%==64BIT set MCLINK=https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe

echo Downloading Miniconda3 (This will take while, please wait)...
powershell -Command "(New-Object Net.WebClient).DownloadFile('%MCLINK%', '%CONDAEXE%')" >nul 2>nul
if errorlevel 1 goto CONDAERROR

echo Installing Miniconda3 (This will also take a while, please wait)...
start /wait /min "Installing Miniconda3..." "%CONDAEXE%" /InstallationType=JustMe /S /D="%MINICONDAPATH%"
del "%CONDAEXE%"
if not exist "%MINICONDAPATH%\" (goto CONDAERROR)

"%MINICONDAPATH%\Scripts\conda.exe" init
if errorlevel 1 goto CONDAERROR

echo Miniconda3 has been installed!
goto END

:CONDAERROR
echo Miniconda3 install failed!
exit /B 1

:CONDAFOUND
echo Conda is already installed!
goto END

rem https://gist.github.com/maximlt/531419545b039fa33f8845e5bc92edd6
call conda create -f environment.yml
call conda activate gdsfactory

git clone https://github.com/gdsfactory/gdslib.git -b data
pre-commit install
gf tool install

:END
exit /B 0

rem ensures conda is installed and installs gdsfactory package
rem https://gist.github.com/nimaid/a7d6d793f2eba4020135208a57f5c532
@echo off

set ORIGDIR="%CD%"

set MINICONDAPATH=%USERPROFILE%\Miniconda3
set CONDAEXE=%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%-condainstall.exe
set "OS="
set "MCLINK="

where conda >nul 2>nul
if %ERRORLEVEL% EQU 0 goto CONDAFOUND

:INSTALLCONDA
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS=32BIT || set OS=64BIT
if %OS%==32BIT set MCLINK=https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86.exe
if %OS%==64BIT set MCLINK=https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe

echo Downloading Miniconda3 (This will take while, please wait)...
powershell -Command "(New-Object Net.WebClient).DownloadFile('%MCLINK%', '%CONDAEXE%')" >nul 2>nul
if errorlevel 1 goto CONDAERROR

echo Installing Miniconda3 (This will also take a while, please wait)...
start /wait /min "Installing Miniconda3..." "%CONDAEXE%" /InstallationType=JustMe /S /D="%MINICONDAPATH%"
del "%CONDAEXE%"
if not exist "%MINICONDAPATH%\" (goto CONDAERROR)

"%MINICONDAPATH%\Scripts\conda.exe" init
if errorlevel 1 goto CONDAERROR

echo Miniconda3 has been installed!
goto END

:CONDAERROR
echo Miniconda3 install failed!
exit /B 1

:CONDAFOUND
echo Conda is already installed!

rem https://gist.github.com/maximlt/531419545b039fa33f8845e5bc92edd6
call conda create -f environment.yml
call conda activate gdsfactory

git clone https://github.com/gdsfactory/gdslib.git -b data
pre-commit install
gf tool install

:END
exit /B 0

fix install.bat

fix install.bat


@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem  Gradle startup script for Windows
@rem
@rem ##########################################################################

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

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

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

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega

Add empty gradle project

Add empty gradle project


Copy all of .\bin to c:\bin, overwriting all


if exist "%VS150COMNTOOLS%" goto :EOF

:: Build Tools
if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" goto :VS2017_COMMUNITY
setx /M VS150COMNTOOLS "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\\"
goto :EOF

:: Community
:VS2017_COMMUNITY
if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community" goto :VS2017_PROFESSIONAL
setx /M VS150COMNTOOLS "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\Tools\\"
goto :EOF

:: Professional
:VS2017_PROFESSIONAL
if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional" goto :VS2017_ENTERPRISE
setx /M VS150COMNTOOLS "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\Common7\Tools\\"
goto :EOF

:: Enterprise
:VS2017_ENTERPRISE
if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise" goto :ERROR_NOT_FOUND
setx /M VS150COMNTOOLS "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\\"
goto :EOF

:ERROR_NOT_FOUND
echo Not found
pause

add vc

add vc


call npm install

@echo off

@echo if "%%~1"=="-FIXED_CTRL_C" ( > s.bat
@echo    shift >> s.bat
@echo ) else ( >> s.bat
@echo    call ^<NUL %%0 -FIXED_CTRL_C %%* >> s.bat
@echo    goto :EOF >> s.bat
@echo ) >> s.bat
@echo cd database >> s.bat
@echo i.vbs "start /WAIT restart.bat" >> s.bat
@echo cd .. >> s.bat
@echo start "Drathybot" node ../DrathybotAlpha >> s.bat

@echo CreateObject("Wscript.Shell").Run "s.bat", 0, True > Drathybot.vbs

mkdir database
cd database

@echo CreateObject("Wscript.Shell").Run "" ^& WScript.Arguments(0) ^& "", 0, False > i.vbs

@echo del db.log > start.bat
@echo "C:/Program Files/MongoDB/Server/3.0/bin/mongod.exe" --dbpath %%~dp0 --logpath db.log >> start.bat

@echo "C:/Program Files/MongoDB/Server/3.0/bin/mongo.exe" localhost:27017 --eval "db.adminCommand({shutdown : 1})" > stop.bat

@echo call stop.bat > restart.bat
@echo timeout 1 >> restart.bat
@echo wscript.exe i.vbs "start.bat" >> restart.bat
@echo exit >> restart.bat

cd ..
timeout 5

call npm install

@echo off

@echo if "%%~1"=="-FIXED_CTRL_C" ( > s.bat
@echo    shift >> s.bat
@echo ) else ( >> s.bat
@echo    call ^<NUL %%0 -FIXED_CTRL_C %%* >> s.bat
@echo    goto :EOF >> s.bat
@echo ) >> s.bat
@echo cd database >> s.bat
@echo i.vbs "start /WAIT restart.bat" >> s.bat
@echo cd .. >> s.bat
@echo start "Drathybot" node %~dp0 >> s.bat

@echo CreateObject("Wscript.Shell").Run "s.bat", 0, True > Drathybot.vbs

mkdir database
cd database

@echo CreateObject("Wscript.Shell").Run "" ^& WScript.Arguments(0) ^& "", 0, False > i.vbs

@echo del db.log > start.bat
@echo "C:/Program Files/MongoDB/Server/3.0/bin/mongod.exe" --dbpath %%~dp0 --logpath db.log >> start.bat

@echo "C:/Program Files/MongoDB/Server/3.0/bin/mongo.exe" localhost:27017 --eval "db.adminCommand({shutdown : 1})" > stop.bat

@echo call stop.bat > restart.bat
@echo timeout 1 >> restart.bat
@echo wscript.exe i.vbs "start.bat" >> restart.bat
@echo exit >> restart.bat

cd ..
timeout 5

Call node on the folder rather than on DrathybotAlpha


@echo off
SET CURRENT_PATH_PREINSTALL=%CD%
SET TURBO_ROOT=C:\turbo.lua
SET TURBO_LUAROCKS=%TURBO_ROOT%\luarocks
SET TURBO_LUAROCKS_BIN=%TURBO_LUAROCKS%\2.2
SET TURBO_ROCKS=%TURBO_ROOT%\rocks
SET TURBO_SRC=%TURBO_ROOT%\src
SET TURBO_OPENSSL_ROOT=%TURBO_ROOT%\OpenSSL
SET VCVARSALL_BAT="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"

echo ===========================
echo Thank you for trying Turbo.lua
echo This script will use Chocolatey to install dependencies. If they are already installed they will be skipped.
echo Current dependencies are:
echo Visual Studio 2013, Git, Mingw, Gnuwin, 7zip Command line tool, Strawberry Perl, (to compile OpenSSL).
echo Please abort installation now by clicking CTRL+C within 10 seconds.
echo ===========================
timeout /t 10

setx PATH "%PATH%;%TURBO_ROOT%;%TURBO_LUAROCKS_BIN" /M
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
choco install -y visualstudio2013professional git mingw gnuwin strawberryperl 7zip.commandline
call %VCVARSALL_BAT% amd64
SET PATH=%PATH%;%TURBO_ROOT%;%TURBO_LUAROCKS_BIN;C:\Program Files (x86)\Git\cmd;C:\GnuWin\bin;C:\tools\mingw64\bin;C:\Program Files (x86)\Windows Kits\8.1\bin\x64
rm -rf %TURBO_ROOT%
mkdir %TURBO_ROOT%
cd %TURBO_ROOT%
mkdir src
cd src

echo ===========================
echo Now building Turbo.lua C helper functions
echo ===========================
git clone https://github.com/kernelsauce/turbo.git
cd %TURBO_SRC%\turbo
mingw32-make SSL=none
mv libtffi_wrap.so libtffi_wrap.dll
setx TURBO_LIBTFFI "%TURBO_SRC%\turbo\libtffi_wrap.dll" /M
setx TURBO_LIBSSL "%TURBO_OPENSSL_ROOT%\lib\libeay32.dll" /M
SET TURBO_LIBTFFI=%TURBO_SRC%\turbo\libtffi_wrap.dll
SET TURBO_LIBSSL=%TURBO_OPENSSL_ROOT%\lib\libeay32.dll

echo ===========================
echo Now building OpenSSL from source to support SSL in Turbo.lua
echo ===========================
cd %TURBO_SRC%
wget --no-check-certificate https://www.openssl.org/source/openssl-1.0.2c.tar.gz
7z x openssl-1.0.2c.tar.gz
7z x openssl-1.0.2c.tar
cd openssl-1.0.2c
call perl Configure VC-WIN64A --prefix=%OPENSSL_ROOT%
call ms\do_win64a
call nmake -f ms\nt.mak
call nmake -f ms\nt.mak install

echo ===========================
echo Now building LuaJIT 2.
echo ===========================
cd %TURBO_SRC%
git clone http://luajit.org/git/luajit-2.0.git
cd %TURBO_SRC%\luajit-2.0\src
call msvcbuild
cp luajit.exe %TURBO_ROOT%
cp lua51.dll %TURBO_ROOT%

echo ===========================
echo Now downloading LuaRocks. A Lua package manager.
echo ===========================
cd %TURBO_SRC%
git clone https://github.com/keplerproject/luarocks.git
cd %TURBO_SRC%\luarocks
SET LUA_PATH=%TURBO_ROCKS%\share\lua\5.1\?.lua;%TURBO_ROCKS%\share\lua\5.1\?\init.lua;%TURBO_SRC%\turbo\?.lua;%TURBO_SRC%\turbo\turbo\?.lua
SET LUA_CPATH=%TURBO_ROCKS%\lib\lua\5.1\?.dll
setx LUA_PATH "%LUA_PATH%" /M
setx LUA_CPATH "%LUA_CPATH%" /M
call install.bat /TREE %TURBO_ROCKS% /P %TURBO_LUAROCKS% /INC %TURBO_SRC%\luajit-2.0\src /LIB %TURBO_SRC%\luajit-2.0\src /LUA %TURBO_ROOT% /Q
call luarocks install luasocket
call luarocks install luafilesystem

echo ===========================
echo Now compiling LuaSec for SSL support.
echo ===========================
cd %TURBO_SRC%
git clone https://github.com/kernelsauce/luasec.git
cd luasec
call luarocks make luasec-0.5-3.rockspec OPENSSL_INCDIR=%TURBO_OPENSSL_ROOT%\include OPENSSL_LIBDIR=%TURBO_OPENSSL_ROOT%\lib

cd %CURRENT_PATH_PREINSTALL%
echo ===========================
echo Turbo is now installed. Try it by running 'luajit %TURBO_SRC%\turbo\examples\helloworld.lua' and point your browser to http://localhost:8888.
echo Have a nice day!
echo ===========================
pause

SET CURRENT_PATH_PREINSTALL=%CD%
setx PATH "%PATH%;C:\turbo.lua;C:\turbo.lua\luarocks\2.2" /M
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
choco install -y visualstudio2013professional git mingw openssl.light gnuwin
SET PATH=%PATH%;C:\Program Files (x86)\Git\cmd;C:\GnuWin\bin;C:\tools\mingw64\bin;C:\Program Files (x86)\Windows Kits\8.1\bin\x64;C:\turbo.lua;C:\turbo.lua\luarocks\2.2
SET VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
rm -rf C:\turbo.lua
mkdir C:\turbo.lua
cd C:\turbo.lua
mkdir src
cd src

git clone https://github.com/kernelsauce/turbo.git
cd C:\turbo.lua\src\turbo
mingw32-make SSL=none
mv libtffi_wrap.so libtffi_wrap.dll
setx TURBO_LIBTFFI "C:\turbo.lua\src\turbo\libtffi_wrap.dll" /M
setx TURBO_LIBSSL "C:\Program Files\OpenSSL\libeay32.dll" /M
SET TURBO_LIBTFFI=C:\turbo.lua\src\turbo\libtffi_wrap.dll
SET TURBO_LIBSSL=C:\Program Files\OpenSSL\libeay32.dll

cd C:\turbo.lua\src
git clone http://luajit.org/git/luajit-2.0.git
cd C:\turbo.lua\src\luajit-2.0\src
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64
call msvcbuild
cp luajit.exe C:\turbo.lua
cp lua51.dll C:\turbo.lua

cd C:\turbo.lua\src
git clone https://github.com/keplerproject/luarocks.git
cd C:\turbo.lua\src\luarocks
SET LUA_PATH=C:\turbo.lua\rocks\share\lua\5.1\?.lua;C:\turbo.lua\rocks\share\lua\5.1\?\init.lua;C:\turbo.lua\src\turbo\?.lua;C:\turbo.lua\src\turbo\turbo\?.lua
SET LUA_CPATH=C:\turbo.lua\rocks\lib\lua\5.1\?.dll
setx LUA_PATH "%LUA_PATH%" /M
setx LUA_CPATH "%LUA_CPATH%" /M
call install.bat /TREE C:\turbo.lua\rocks\ /P C:\turbo.lua\luarocks\ /INC C:\turbo.lua\src\luajit-2.0\src /LIB C:\turbo.lua\src\luajit-2.0\src /LUA C:\turbo.lua /Q
call luarocks install luasocket
call luarocks install luafilesystem

cd %CURRENT_PATH_PREINSTALL%
echo ===========================
echo Turbo is now installed. Try it by running 'luajit C:\turbo.lua\src\turbo\examples\helloworld.lua' and point your browser to http://localhost:8888.
echo Have a nice day!
echo ===========================

Revert to old version of install.bat. New one unreliable. Will fix it.


:: Set primary and alternate DNS for IPv4/IPv6 on Windows Server 2000/2003/2008 & Windows XP/Vista/7

@ECHO OFF

SETLOCAL EnableDelayedExpansion

FOR /F "tokens=* delims=:" %%a IN ('IPCONFIG ^| FIND /I "ETHERNET ADAPTER"') DO (
SET adapterName=%%a

REM Removes "Ethernet adapter" from the front of the adapter name
SET adapterName=!adapterName:~17!

REM Removes the colon from the end of the adapter name
SET adapterName=!adapterName:~0,-1!

netsh interface ipv4 add dns name="!adapterName!" 127.0.0.1 index=1
netsh interface ipv6 add dns name="!adapterName!" ::1 index=1
)

ipconfig /flushdns

::Start KadNode
kadnode --config config.txt --peerfile peers.txt --port 53 --daemon

:: Set primary and alternate DNS for IPv4/IPv6 on Windows Server 2000/2003/2008 & Windows XP/Vista/7

@ECHO OFF

:: Change working directory to script location
cd %~dp0

SETLOCAL EnableDelayedExpansion

FOR /F "tokens=* delims=:" %%a IN ('IPCONFIG ^| FIND /I "ETHERNET ADAPTER"') DO (
SET adapterName=%%a

REM Removes "Ethernet adapter" from the front of the adapter name
SET adapterName=!adapterName:~17!

REM Removes the colon from the end of the adapter name
SET adapterName=!adapterName:~0,-1!

netsh interface ipv4 add dns name="!adapterName!" 127.0.0.1 index=1
netsh interface ipv6 add dns name="!adapterName!" ::1 index=1
)

ipconfig /flushdns

:: Start KadNode
.\kadnode.exe --config config.txt --peerfile peers.txt --port 53 --daemon

change working directory and start kadnode.exe


add helper-batchfile to update eclipse confgurations


@echo on

if NOT EXIST C:\projects\deps (
  mkdir C:\projects\deps
)
cd C:\projects\deps

::###########################################################################
:: Setup Compiler
::###########################################################################
if NOT EXIST llvm-installer.exe (
  appveyor DownloadFile http://llvm.org/pre-releases/win-snapshots/LLVM-5.0.0-r301646-win32.exe -FileName llvm-installer.exe
)
if "%CLANG_VERSION%"=="ToT" (
    START /WAIT llvm-installer.exe /S /D=C:\"Program Files\LLVM"
)
if DEFINED CLANG_VERSION  @set PATH="C:\Program Files\LLVM\bin";%PATH%
if DEFINED CLANG_VERSION  clang-cl -v

if DEFINED MINGW_PATH rename "C:\Program Files\Git\usr\bin\sh.exe" "sh-ignored.exe"
if DEFINED MINGW_PATH @set "PATH=%PATH:C:\Program Files (x86)\Git\bin=%"
if DEFINED MINGW_PATH @set "PATH=%PATH%;%MINGW_PATH%"
if DEFINED MINGW_PATH g++ -v

::###########################################################################
:: Install a recent CMake
::###########################################################################
if NOT EXIST cmake (
  appveyor DownloadFile https://cmake.org/files/v3.7/cmake-3.7.2-win64-x64.zip -FileName cmake.zip
  7z x cmake.zip -oC:\projects\deps > nul
  move C:\projects\deps\cmake-* C:\projects\deps\cmake
  rm cmake.zip
)
@set PATH=C:\projects\deps\cmake\bin;%PATH%
cmake --version

::###########################################################################
:: Install Ninja
::###########################################################################
if NOT EXIST ninja (
  appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.6.0/ninja-win.zip -FileName ninja.zip
  7z x ninja.zip -oC:\projects\deps\ninja > nul
  rm ninja.zip
)
@set PATH=C:\projects\deps\ninja;%PATH%
ninja --version

::###########################################################################
:: Setup the cached copy of LLVM
::###########################################################################
git clone --depth=1 http://llvm.org/git/llvm.git

@echo off

@echo on

if NOT EXIST C:\projects\deps (
  mkdir C:\projects\deps
)
cd C:\projects\deps

::###########################################################################
:: Setup Compiler
::###########################################################################
if NOT EXIST llvm-installer.exe (
  appveyor DownloadFile http://llvm.org/pre-releases/win-snapshots/LLVM-5.0.0-r303050-win32.exe -FileName llvm-installer.exe
)
if "%CLANG_VERSION%"=="ToT" (
    START /WAIT llvm-installer.exe /S /D=C:\"Program Files\LLVM"
)
if DEFINED CLANG_VERSION  @set PATH="C:\Program Files\LLVM\bin";%PATH%
if DEFINED CLANG_VERSION  clang-cl -v

if DEFINED MINGW_PATH rename "C:\Program Files\Git\usr\bin\sh.exe" "sh-ignored.exe"
if DEFINED MINGW_PATH @set "PATH=%PATH:C:\Program Files (x86)\Git\bin=%"
if DEFINED MINGW_PATH @set "PATH=%PATH%;%MINGW_PATH%"
if DEFINED MINGW_PATH g++ -v

::###########################################################################
:: Install a recent CMake
::###########################################################################
if NOT EXIST cmake (
  appveyor DownloadFile https://cmake.org/files/v3.7/cmake-3.7.2-win64-x64.zip -FileName cmake.zip
  7z x cmake.zip -oC:\projects\deps > nul
  move C:\projects\deps\cmake-* C:\projects\deps\cmake
  rm cmake.zip
)
@set PATH=C:\projects\deps\cmake\bin;%PATH%
cmake --version

::###########################################################################
:: Install Ninja
::###########################################################################
if NOT EXIST ninja (
  appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.6.0/ninja-win.zip -FileName ninja.zip
  7z x ninja.zip -oC:\projects\deps\ninja > nul
  rm ninja.zip
)
@set PATH=C:\projects\deps\ninja;%PATH%
ninja --version

::###########################################################################
:: Setup the cached copy of LLVM
::###########################################################################
git clone --depth=1 http://llvm.org/git/llvm.git

@echo off

Upgrade Clang version used by appveyor

Upgrade Clang version used by appveyor

git-svn-id: 756ef344af921d95d562d9e9f9389127a89a6314@304377 91177308-0d34-0410-b5e6-96231b3b80d8


@ECHO OFF
CALL :locate_file ADB "%LOCALAPPDATA%\Android\sdk\platform-tools\adb.exe"
CALL :locate_file JAVA "%JAVA_HOME%\bin\java.exe"
CALL :locate_file APK %~dp0gnirehtet.apk %~dp0app\build\outputs\apk\gnirehtet-release.apk %~dp0app\build\outputs\apk\gnirehtet-debug.apk
CALL :locate_file RELAY %~dp0relay.jar %~dp0relay\build\libs\relay.jar

::main
IF NOT "%2"=="" (
    FOR /f " tokens=2*" %%a IN ("%*") DO (
        IF "%%a"=="-d" ( SET serial= ) ELSE ( SET serial=-s %%a )
        SET dns=%%b
    )
)
IF NOT "%3"=="" (
    FOR /f " tokens=1*" %%a IN ("%dns%") DO (
        IF "%%a"=="-d" ( SET dns=%%b)
    )
)
CALL :do_%1 || CALL :do_help
GOTO :eof

:do_help
    ECHO Syntax: %~nx0 (install^|uninstall^|rt^|start^|stop^|relay^|killserver^|kill) ...
    ECHO.
    ECHO  %~nx0 install [serial]
    ECHO      Install the client on the Android device and exit.
    ECHO      If several devices are connected via adb, then serial must be
    ECHO      specified.
    ECHO.
    ECHO  %~nx0 uninstall [serial]
    ECHO      Uninstall the client from the Android device and exit.
    ECHO      If several devices are connected via adb, then serial must be
    ECHO      specified.
    ECHO.
    ECHO  %~nx0 reinstall [serial]
    ECHO      Uninstall then install.
    ECHO.
    ECHO  %~nx0 rt [serial] [DNS[,DNS2,...]]
    ECHO      Enable reverse tethering for exactly one device:
    ECHO        - install the client if necessary.
    ECHO        - start the client.
    ECHO        - start the relay server.
    ECHO      You'll have to stop the client and the server manually.
    ECHO.
    ECHO  %~nx0 start [serial] [DNS[,DNS2,...]]
    ECHO      Start a client on the Android device and exit.
    ECHO      If several devices are connected via adb, then serial must be
    ECHO      specified.
    ECHO      If DNS is given, then make the Android device use the specified
    ECHO      DNS server(s). Otherwise, use 8.8.8.8 (Google public DNS).
    ECHO      If the client is already started, then do nothing, and ignore
    ECHO      DNS servers parameter.
    ECHO      To use the host 'localhost' as DNS, use 10.0.2.2.
    ECHO.
    ECHO  %~nx0 stop [serial]
    ECHO      Stop the client on the Android device and exit.
    ECHO      If several devices are connected via adb, then serial must be
    ECHO      specified.
    ECHO.
    ECHO  %~nx0 relay
    ECHO      Start the relay server in the current terminal.
    ECHO.
    ECHO  %~nx0 killserver
    ECHO      Kills the relay server which opened from this utility.
    ECHO.
    ECHO  %~nx0 kill [serial]
    ECHO      Kills the relay server and the Android client.
    ECHO      If several devices are connected via adb, then serial must be
    ECHO      specified.
    ENDLOCAL
    EXIT /B 0

:locate_file
    SETLOCAL EnableDelayedExpansion
    FOR /f " tokens=1*" %%a IN ("%*") DO (
        SET VAR_NAME=%%a
        SET ALL_BUT_FIRST=%%b
    )
    CALL where /q %VAR_NAME%
    IF ERRORLEVEL 1 (
        FOR %%G IN (%ALL_BUT_FIRST%) DO (
            IF EXIST %%G (
                SET FNAME=%%G
            )
        )
        IF "!FNAME!"=="" (
            SET FNAME=%2 & ECHO cannot find file, using default diretory %2
        )
    ) ELSE (
        SET FNAME=%VAR_NAME%
    )
    ENDLOCAL&SET %VAR_NAME%=%FNAME%
    EXIT /B 0

:do_install
    ECHO Installing gnirehtet...
    CALL %ADB% %serial% install %APK%
    EXIT /B 0

:do_uninstall
    ECHO Uninstall gnirehtet...
    CALL %ADB% %serial% uninstall com.genymobile.gnirehtet
    EXIT /B 0

:do_reinstall
    SETLOCAL
    CALL :do_uninstall
    CALL :do_install
    ENDLOCAL
    EXIT /B 0

:do_stop
    ECHO Stopping gnirehtet...
    CALL %ADB% %serial% shell am startservice -a com.genymobile.gnirehtet.STOP
    EXIT /B 0 0

:do_relay
    ECHO Starting relay server...
    START /I "gnirehtet_relay_server" %JAVA% -jar %RELAY%
    EXIT /B 0

:do_start
    SETLOCAL
    IF NOT "%dns%"=="" (
        set dparam=--esa dnsServers %dns%
    )
    ECHO Starting gnirehtet...
    CALL %ADB% %serial% reverse tcp:31416 tcp:31416
    CALL %ADB% %serial% shell am startservice -a com.genymobile.gnirehtet.START %dparam%
    ENDLOCAL
    EXIT /B 0

:do_killserver
    SETLOCAL EnableDelayedExpansion
    SET filter="WINDOWTITLE EQ gnirehtet_relay_server"
    FOR /F "tokens=2" %%I in ('"TASKLIST /NH /FI %filter%"') DO SET PID=%%I 2>1
    TASKKILL /PID !PID!
    ENDLOCAL
    EXIT /B 0

:do_rt
    CALL :do_install
    CALL :do_relay
    CALL :do_start
    EXIT /B 0

:do_kill
    CALL :do_stop
    CALL :do_killserver
    EXIT /B 0

:eof
    SET dns=
    SET serial=
    SET ADB=
    SET JAVA=
    SET RELAY=
    SET APK=

@ECHO OFF
CALL :locate_file ADB "%LOCALAPPDATA%\Android\sdk\platform-tools\adb.exe"
CALL :locate_file JAVA "%JAVA_HOME%\bin\java.exe"
CALL :locate_file APK %~dp0gnirehtet.apk %~dp0app\build\outputs\apk\gnirehtet-release.apk %~dp0app\build\outputs\apk\gnirehtet-debug.apk
CALL :locate_file RELAY %~dp0relay.jar %~dp0relay\build\libs\relay.jar

::main
IF NOT "%2"=="" (
    FOR /f " tokens=2*" %%a IN ("%*") DO (
        IF "%%a"=="-d" ( SET serial= ) ELSE ( SET serial=-s %%a )
        SET dns=%%b
    )
)
IF NOT "%3"=="" (
    FOR /f " tokens=1*" %%a IN ("%dns%") DO (
        IF "%%a"=="-d" ( SET dns=%%b )
    )
)
CALL :do_%1 || CALL :do_help
GOTO :eof

:do_help
    ECHO Syntax: %~nx0 (install^|uninstall^|rt^|start^|stop^|relay^|killserver^|kill) ...
    ECHO.
    ECHO  %~nx0 install [serial]
    ECHO      Install the client on the Android device and exit.
    ECHO      If several devices are connected via adb, then serial must be
    ECHO      specified.
    ECHO.
    ECHO  %~nx0 uninstall [serial]
    ECHO      Uninstall the client from the Android device and exit.
    ECHO      If several devices are connected via adb, then serial must be
    ECHO      specified.
    ECHO.
    ECHO  %~nx0 reinstall [serial]
    ECHO      Uninstall then install.
    ECHO.
    ECHO  %~nx0 rt [serial] [DNS[,DNS2,...]]
    ECHO      Enable reverse tethering for exactly one device:
    ECHO        - install the client if necessary.
    ECHO        - start the client.
    ECHO        - start the relay server.
    ECHO      You'll have to stop the client and the server manually.
    ECHO.
    ECHO  %~nx0 start [serial] [DNS[,DNS2,...]]
    ECHO      Start a client on the Android device and exit.
    ECHO      If several devices are connected via adb, then serial must be
    ECHO      specified.
    ECHO      If DNS is given, then make the Android device use the specified
    ECHO      DNS server(s). Otherwise, use 8.8.8.8 (Google public DNS).
    ECHO      If the client is already started, then do nothing, and ignore
    ECHO      DNS servers parameter.
    ECHO      To use the host 'localhost' as DNS, use 10.0.2.2.
    ECHO.
    ECHO  %~nx0 stop [serial]
    ECHO      Stop the client on the Android device and exit.
    ECHO      If several devices are connected via adb, then serial must be
    ECHO      specified.
    ECHO.
    ECHO  %~nx0 relay
    ECHO      Start the relay server in the current terminal.
    ECHO.
    ECHO  %~nx0 killserver
    ECHO      Kills the relay server which opened from this utility.
    ECHO.
    ECHO  %~nx0 kill [serial]
    ECHO      Kills the relay server and the Android client.
    ECHO      If several devices are connected via adb, then serial must be
    ECHO      specified.
    ENDLOCAL
    EXIT /B 0

:locate_file
    SETLOCAL EnableDelayedExpansion
    FOR /f " tokens=1*" %%a IN ("%*") DO (
        SET VAR_NAME=%%a
        SET ALL_BUT_FIRST=%%b
    )
    CALL where /q %VAR_NAME%
    IF ERRORLEVEL 1 (
        FOR %%G IN (%ALL_BUT_FIRST%) DO (
            IF EXIST %%G (
                SET FNAME=%%G
            )
        )
        IF "!FNAME!"=="" (
            SET FNAME=%2 & ECHO cannot find file, using default diretory %2
        )
    ) ELSE (
        SET FNAME=%VAR_NAME%
    )
    ENDLOCAL&SET %VAR_NAME%=%FNAME%
    EXIT /B 0

:do_install
    ECHO Installing gnirehtet...
    CALL %ADB% %serial% install %APK%
    EXIT /B 0

:do_uninstall
    ECHO Uninstall gnirehtet...
    CALL %ADB% %serial% uninstall com.genymobile.gnirehtet
    EXIT /B 0

:do_reinstall
    SETLOCAL
    CALL :do_uninstall
    CALL :do_install
    ENDLOCAL
    EXIT /B 0

:do_stop
    ECHO Stopping gnirehtet...
    CALL %ADB% %serial% shell am startservice -a com.genymobile.gnirehtet.STOP
    EXIT /B 0 0

:do_relay
    ECHO Starting relay server...
    START /I "gnirehtet_relay_server" %JAVA% -jar %RELAY%
    EXIT /B 0

:do_start
    SETLOCAL
    IF NOT "%dns%"=="" (
        set dparam=--esa dnsServers %dns%
    )
    ECHO Starting gnirehtet...
    CALL %ADB% %serial% reverse tcp:31416 tcp:31416
    CALL %ADB% %serial% shell am startservice -a com.genymobile.gnirehtet.START %dparam%
    ENDLOCAL
    EXIT /B 0

:do_killserver
    SETLOCAL EnableDelayedExpansion
    SET filter="WINDOWTITLE EQ gnirehtet_relay_server"
    FOR /F "tokens=2" %%I in ('"TASKLIST /NH /FI %filter%"') DO SET PID=%%I 2>1
    TASKKILL /PID !PID!
    ENDLOCAL
    EXIT /B 0

:do_rt
    CALL :do_install
    CALL :do_relay
    CALL :do_start
    EXIT /B 0

:do_kill
    CALL :do_stop
    CALL :do_killserver
    EXIT /B 0

:eof
    SET dns=
    SET serial=
    SET ADB=
    SET JAVA=
    SET RELAY=
    SET APK=

Remove trailing spaces from gnirehtet.cmd


@echo off

set PYTHON=%~1
set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%

python -m pip install -r requirements.txt

set PYTHON=%~1
set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%

python install -r requirements.txt

Use pip command to install requirements.


rem This batch generates an executable file for Windows.
rem
rem Requirements:
rem   Windows 10
rem   Python 3.7
rem   PyInstaller
rem
rem Output:
rem   dist\nvpy-windows.zip
rem   dist\nvpy-windows-debug.zip

rem Remove build cache and executable files before starting build.
rmdir /q /s build
del dist\nvpy.exe
del dist\nvpy-debug.exe

rem Upgrade pyinstaller.
pip install --upgrade pyinstaller

rem When you generate windows binary, you need the certifi package.
rem See workaround code on nvpy.py for details.
pip install --upgrade certifi

rem Install dependencies.
rem When build nvpy on the clean environment, this process is required.
pip install --upgrade Markdown docutils simplenote

python setup.py clean

rem Generate one-folder bundles.
rem NOTE:
rem   The one-file bundles have a start-up performance issue.  Therefore, the one-file bundle is no longer provided.
pyinstaller -i nvpy\icons\nvpy.ico --add-binary "nvpy\icons\nvpy.gif;icons" -n nvpy       --windowed start-nvpy.py
pyinstaller -i nvpy\icons\nvpy.ico --add-binary "nvpy\icons\nvpy.gif;icons" -n nvpy-debug --console  start-nvpy.py
powershell -Command 'Compress-Archive dist/nvpy dist/nvpy-windows.zip'
powershell -Command 'Compress-Archive dist/nvpy-debug dist/nvpy-windows-debug.zip'

rem This batch generates an executable file for Windows.
rem
rem Requirements:
rem   Windows 10
rem   Python 3.7 and Python launcher
rem   PyInstaller
rem
rem Output:
rem   dist\nvpy-windows.zip
rem   dist\nvpy-windows-debug.zip

rem Remove build cache and executable files before starting build.
rmdir /q /s build
del dist\nvpy.exe
del dist\nvpy-debug.exe

rem Upgrade pyinstaller.
py -3 -m pip install --upgrade pyinstaller

rem When you generate windows binary, you need the certifi package.
rem See workaround code on nvpy.py for details.
py -3 -m pip install --upgrade certifi

rem Install dependencies.
rem When build nvpy on the clean environment, this process is required.
py -3 -m pip install --upgrade Markdown docutils simplenote

py -3 setup.py clean

rem Generate one-folder bundles.
rem NOTE:
rem   The one-file bundles have a start-up performance issue.  Therefore, the one-file bundle is no longer provided.
py -3 -m PyInstaller -i nvpy\icons\nvpy.ico --add-binary "nvpy\icons\nvpy.gif;icons" -n nvpy       --windowed start-nvpy.py
py -3 -m PyInstaller -i nvpy\icons\nvpy.ico --add-binary "nvpy\icons\nvpy.gif;icons" -n nvpy-debug --console  start-nvpy.py
powershell -Command 'Compress-Archive dist/nvpy dist/nvpy-windows.zip'
powershell -Command 'Compress-Archive dist/nvpy-debug dist/nvpy-windows-debug.zip'

use python lancher

use python lancher


# Turn work folder into GOPATH
export GOPATH=%SRC_DR%
export PATH=%GOPATH%\bin:$PATH

# Change to directory with main.go
pushd cmd\gh

# Build
go build -v -o %PKG_NAME%.exe .

# Install Binary into %PREFIX%\bin
mkdir -p %PREFIX%\bin
mv %PKG_NAME% %PREFIX%\bin\%PKG_NAME%

# Turn work folder into GOPATH
export GOPATH=%SRC_DR%
export PATH=%GOPATH%\bin:%PATH%

# Change to directory with main.go
pushd cmd\gh

# Build
go build -v -o %PKG_NAME%.exe .

# Install Binary into %PREFIX%\bin
mkdir -p %PREFIX%\bin
mv %PKG_NAME% %PREFIX%\bin\%PKG_NAME%

fix bld.bat

fix bld.bat


Add build.bat

Add build.bat


@rem ##########################################################################
@rem
@rem  Package script for Windows
@rem
@rem ##########################################################################

set currdir=%~dp0

echo Package minecraft forge on windows

@rem check for existing JAVA_HOME
if defined JAVA_HOME goto runSetup

@rem try locating 64 bit jdk 1.8.0_60
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_60
if exist "%JAVA_HOME%" goto runSetup

@rem try locating 32 bit jdk 1.8.0_60
set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_60
if exist "%JAVA_HOME%" goto runSetup

@rem bail
echo .
echo ERROR: JAVA_HOME is not set and could not be guessed.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:runSetup

@rem package gradlew

gradlew jar

@rem copyfiles

xcopy "%currdir%/build/libs/*.jar" "%appdata%/.minecraft"

goto mainEnd

:fail
echo Setup Failed
exit /b 1

:mainEnd
echo Setup Successful

package bat

package bat


@echo off

:: uninstall Python 2.7 64bit
MsiExec.exe /X {16E52445-1392-469F-9ADB-FC03AF00CD62} /QN

:: wipe the Python directory
::  DOS hack first create dir because Windows cannot test not existing without error message
md c:\Python27  1>nul 2>nul
rd /s /q c:\Python27 || echo Failure: c:\Python27 still exists, please find out why and repeat.

@echo off

:: uninstall Python 2.7.12 64bit
MsiExec.exe /X {9DA28CE5-0AA5-429E-86D8-686ED898C666} /QN

:: wipe the Python directory
::  DOS hack first create dir because Windows cannot test not existing without error message
md c:\Python27  1>nul 2>nul
rd /s /q c:\Python27 || echo Failure: c:\Python27 still exists, please find out why and repeat.

Change GUID for python 2.7.12

Change GUID for python 2.7.12


@echo off

rem Set external libraries directory.
set EXT_DIR=%cd%\..\..\..\..\extern

if not exist %EXT_DIR% (
	set EXT_DIR=
	echo ERROR: External libs dir is not set.
	pause
	goto END
)

rem Add installation directory pathes.
set INCLUDE=%EXT_DIR%\include;%INCLUDE%
set LIB=%EXT_DIR%\lib;%LIB%

rem Add Evas lib path
set EvasPath=%cd%\..\src\lib
set INCLUDE=%EvasPath%\..\modules\engines\gl_common;%EvasPath%;%EvasPath%\include;%INCLUDE%

if "%DXSDK_DIR%" == "" (
	echo WARNING: Microsoft DirectX SDK is not installed.
	pause
	goto END
)

rem Add DirectX includes and libraries dirs.
set INCLUDE="%DXSDK_DIR%Include";%INCLUDE%
set LIB="%DXSDK_DIR%Lib\x86";%LIB%

rem Add Evil lib path
set EvilInclude=%cd%\..\..\PROTO\evil\src\lib
set EvilCommon=%cd%\..\..\PROTO\evil\win32\common
set EvilOut=%cd%\..\..\PROTO\evil\win32\%PROJECT_TYPE%\out

rem Add Eet lib path
set EetInclude=%cd%\..\..\eet\src\lib
set EetOut=%cd%\..\..\eet\win32\%PROJECT_TYPE%\out

rem Add Eina lib path
set EinaInclude=%cd%\..\..\eina\src\include
set EinaCommon=%cd%\..\..\eina\win32\common
set EinaOut=%cd%\..\..\eina\win32\%PROJECT_TYPE%\out

set INCLUDE=%EvilCommon%;%cd%\common;%EetInclude%;%EvilInclude%;%EvilInclude%\dlfcn;%EvilInclude%\mman;%INCLUDE%
set INCLUDE=%EinaCommon%;%EinaInclude%;%INCLUDE%
set LIB=%EinaOut%;%EetOut%;%EvilOut%;%LIB%

:END

@echo off

rem Set external libraries directory.
set EXT_DIR=%cd%\..\..\..\extern

if not exist %EXT_DIR% (
	set EXT_DIR=
	echo ERROR: External libs dir is not set.
	pause
	goto END
)

rem Add installation directory pathes.
set INCLUDE=%EXT_DIR%\include;%EXT_DIR%\include\freetype2;%INCLUDE%
set LIB=%EXT_DIR%\lib;%LIB%

rem Add Evas lib path
set EvasPath=%cd%\..\src\lib
set INCLUDE=%EvasPath%\..\modules\engines\gl_common;%EvasPath%;%EvasPath%\include;%EvasPath%\cserve;%EvasPath%\file;%INCLUDE%

if "%DXSDK_DIR%" == "" (
	echo WARNING: Microsoft DirectX SDK is not installed.
	pause
	goto END
)

rem Add DirectX includes and libraries dirs.
set INCLUDE="%DXSDK_DIR%Include";%INCLUDE%
set LIB="%DXSDK_DIR%Lib\x86";%LIB%

rem Add Evil lib path
set EvilInclude=%cd%\..\..\evil\src\lib
set EvilCommon=%cd%\..\..\evil\win32\common
set EvilOut=%cd%\..\..\evil\win32\%PROJECT_TYPE%\out

rem Add Eet lib path
set EetInclude=%cd%\..\..\eet\src\lib
set EetOut=%cd%\..\..\eet\win32\%PROJECT_TYPE%\out

rem Add Eina lib path
set EinaInclude=%cd%\..\..\eina\src\include
set EinaCommon=%cd%\..\..\eina\win32\common
set EinaOut=%cd%\..\..\eina\win32\%PROJECT_TYPE%\out

set INCLUDE=%EvilCommon%;%cd%\common;%EetInclude%;%EvilInclude%;%EvilInclude%\dlfcn;%EvilInclude%\mman;%INCLUDE%
set INCLUDE=%EinaCommon%;%EinaInclude%;%INCLUDE%
set LIB=%EinaOut%;%EetOut%;%EvilOut%;%LIB%

:END

fix common configuration of VS

fix common configuration of VS

git-svn-id: 24a995eca3b83137dd7eab3408044d7832e202f7@42651 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33


set msbuild="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\amd64\MSBuild.exe"
set publish=%CD%\bin\publish
set target=%CD%\bin\publish

del /f /s /q "%target%"

%msbuild% "source\BulkCrapUninstaller.sln" /m /p:filealignment=512 /t:Restore;Rebuild /p:DeployOnBuild=true /p:PublishSingleFile=False /p:SelfContained=True /p:PublishProtocol=FileSystem /p:Configuration=Release /p=Platform:"Any CPU" /p:TargetFrameworks=net5.0-windows10.0.18362.0 /p:PublishDir="%target%" /p:RuntimeIdentifier=win-x64 /p:PublishReadyToRun=false /p:PublishTrimmed=False /verbosity:minimal

%msbuild% "source\BulkCrapUninstaller.sln" /m /p:filealignment=512 /t:Publish /p:DeployOnBuild=true /p:PublishSingleFile=False /p:SelfContained=True /p:PublishProtocol=FileSystem /p:Configuration=Release /p:Platform="Any CPU" /p:TargetFrameworks=net5.0-windows10.0.18362.0 /p:PublishDir="%target%" /p:RuntimeIdentifier=win-x64 /p:PublishReadyToRun=false /p:PublishTrimmed=False /verbosity:minimal

rem mv "%target%\BCU_manual.html" "%publish%\BCU_manual.html"
rem mv "%target%\Licence.txt" "%publish%\Licence.txt"
rem mv "%target%\PrivacyPolicy.txt" "%publish%\PrivacyPolicy.txt"

del /f /s /q "%target%\*.pdb"

pause

Add publish script

Add publish script


set DEPOT="%CD%"

IF NOT EXIST sfw.pro GOTO NOSOURCE
set CETESTCOMMAND=cetest -cache %QTDIR%\.qmake.cache -libpath \Windows

cd %DEPOT%\..\..\qa-dungeon\mainline\tests\wince\deploy\
call %CETESTCOMMAND%
cd %DEPOT%\tests\auto\servicemetadata
call %CETESTCOMMAND%
cd %DEPOT%\tests\auto\servicedatabase
call %CETESTCOMMAND%
cd %DEPOT%\tests\auto\databasemanager
call %CETESTCOMMAND%
cd %DEPOT%\tests\auto\qservicemanager"
call %CETESTCOMMAND%
cd %DEPOT%\tests\auto\qservicefilter
call %CETESTCOMMAND%
cd %DEPOT%\tests\auto\qserviceinterfacedescriptor
call %CETESTCOMMAND%
cd %DEPOT%\tests\auto\qabstractsecuritysession
call %CETESTCOMMAND%
GOTO EOF

:NOSOURCE
echo "Unable to find sfw.pro check current directory is serviceframework source"
GOTO EOF

:EOF
cd %DEPOT%

Add a easy rununitests script for WinCE

Add a easy rununitests script for WinCE

WinCE unittest must be run from the source directory


set DEPOT="%CD%"

IF NOT EXIST bearermanagement.pro GOTO NOSOURCE
set CETESTCOMMAND=cetest -cache %QTDIR%\.qmake.cache -libpath \Windows

IF NOT EXIST %DEPOT%\..\..\qa-dungeon\mainline\tests\wince\deploy\ GOTO SKIPDEPLOY
cd %DEPOT%\..\..\qa-dungeon\mainline\tests\wince\deploy\
call %CETESTCOMMAND%

:SKIPDEPLOY
cd %DEPOT%\..\..\qa-dungeon\mainline\tests\wince\deploy\
call %CETESTCOMMAND%
cd %DEPOT%\tests\auto\qnetworkconfiguration
call %CETESTCOMMAND%
cd %DEPOT%\tests\auto\qnetworkconfigmanager
call %CETESTCOMMAND%
cd %DEPOT%\tests\auto\qnetworksession
GOTO EOF

:NOSOURCE
echo "Unable to find bearermanagement.pro check current directory is bearermanagment source"
GOTO EOF

:EOF
cd %DEPOT%

Add a rununittests script for WinCE

Add a rununittests script for WinCE

Must be source directory to run test