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

@rem TODO(jtattermusch): make this generate less output
@rem TODO(jtattermusch): use tools/bazel script to keep the versions in sync
choco install bazel -y --version 0.29.1 --limit-output

cd github/grpc
set PATH=C:\tools\msys64\usr\bin;C:\Python27;%PATH%

@rem Generate a random UUID and store in "bazel_invocation_ids" artifact file
powershell -Command "[guid]::NewGuid().ToString()" >%KOKORO_ARTIFACTS_DIR%/bazel_invocation_ids
set /p BAZEL_INVOCATION_ID=<%KOKORO_ARTIFACTS_DIR%/bazel_invocation_ids

@rem TODO(jtattermusch): windows RBE should be able to use the same credentials as Linux RBE.
bazel --bazelrc=tools/remote_build/windows.bazelrc build --invocation_id="%BAZEL_INVOCATION_ID%" --workspace_status_command=tools/remote_build/workspace_status_kokoro.sh :all --google_credentials=%KOKORO_GFILE_DIR%/rbe-windows-credentials.json
set BAZEL_EXITCODE=%errorlevel%

@rem TODO(jtattermusch): upload results to bigquery

exit /b %BAZEL_EXITCODE%

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

@rem TODO(jtattermusch): make this generate less output
@rem TODO(jtattermusch): use tools/bazel script to keep the versions in sync
@rem TODO(jtattermusch): https://github.com/bazelbuild/bazel/issues/9369 prevents upgrade to 0.29.1
choco install bazel -y --version 0.29.0 --limit-output

cd github/grpc
set PATH=C:\tools\msys64\usr\bin;C:\Python27;%PATH%

@rem Generate a random UUID and store in "bazel_invocation_ids" artifact file
powershell -Command "[guid]::NewGuid().ToString()" >%KOKORO_ARTIFACTS_DIR%/bazel_invocation_ids
set /p BAZEL_INVOCATION_ID=<%KOKORO_ARTIFACTS_DIR%/bazel_invocation_ids

@rem TODO(jtattermusch): windows RBE should be able to use the same credentials as Linux RBE.
bazel --bazelrc=tools/remote_build/windows.bazelrc build --invocation_id="%BAZEL_INVOCATION_ID%" --workspace_status_command=tools/remote_build/workspace_status_kokoro.sh :all --google_credentials=%KOKORO_GFILE_DIR%/rbe-windows-credentials.json
set BAZEL_EXITCODE=%errorlevel%

@rem TODO(jtattermusch): upload results to bigquery

exit /b %BAZEL_EXITCODE%

use bazel 0.29.0 on windows

use bazel 0.29.0 on windows


@echo off
rem
rem Uninstall Cygwin.
rem See http://cygwin.com/faq/faq-nochunks.html#faq.setup.uninstall-all
rem

setlocal

set _ROOTDIR=C:\cygwin
set _PREFIX=CYGWIN-UNINSTALL:

goto :main

:check_rootdir
    echo %_PREFIX% Checking if %_ROOTDIR% is valid
    if exist "%_ROOTDIR%" goto :endif_rootdir
        echo %_PREFIX% ERROR: ROOTDIR "%_ROOTDIR%" does not exist.
        exit /b 1
    :endif_rootdir
    if exist "%_ROOTDIR%\Cygwin.ico" goto :endif_cygwin_ico
        echo %_PREFIX% ERROR: ROOTDIR "%_ROOTDIR%" does not appear to be a Cygwin directory.
        exit /b 1
    :endif_cygwin_ico
goto :eof

:check_admin
    rem Check for ADMIN privileges
    rem https://sites.google.com/site/eneerge/home/BatchGotAdmin

    echo %_PREFIX% Checking for Administrator privileges
    >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
    if "%ERRORLEVEL%" EQU "0" goto :endif_check_admin
        echo %_PREFIX% ERROR: You do not have Administrator privileges
        echo %_PREFIX% Rerun from a "Run as Administrator" command prompt
        exit /b 1
    :endif_check_admin
goto :eof

:uninstall_lsa
    echo %_PREFIX% Checking if cyglsa is hooked into OS
    reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages" | findstr cyglsa > NUL:
    if %ERRORLEVEL% NEQ 0 goto :eof

    echo %_PREFIX% Checking for sane Authentication Packages value
    for /f "usebackq tokens=4-9" %%f in (`reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages"`) do set _AP_VALUE=%%f
    set _AP_VALUEQ=%_AP_VALUE:\0=?%
    for /f "usebackq delims=? tokens=1,2,3" %%f in ('%_AP_VALUEQ%') do (
        set _AP_VALUE_0=%%f
        set _AP_VALUE_1=%%g
        set _AP_VALUE_2=%%h
    )
    if not "%_AP_VALUE_0%" == "msv1_0" goto :lsa_bad
    echo %_AP_VALUE_1% | findstr cyglsa > NUL:
    if %ERRORLEVEL% NEQ 0 goto :lsa_bad
    if not "%_AP_VALUE_2%" == "" goto :lsa_bad

    echo %_PREFIX% Unhooking cyglsa
    reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages" /t REG_MULTI_SZ /f /d msv1_0
    echo %_PREFIX% Please reboot and rerun this script
    exit /b 1

    :lsa_bad
    echo %_PREFIX% ERROR: Don't know how to handle Authentication Packages value of %_AP_VALUE%
    exit /b 1
goto :eof

:stop_services
    echo %_PREFIX% Stopping Cygwin services
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do %_ROOTDIR%\bin\cygrunsrv --stop %%s
goto :eof

:remove_services
    echo %_PREFIX% Removing Cygwin services
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do %_ROOTDIR%\bin\cygrunsrv --remove %%s
goto :eof

:clean_registry
    echo %_PREFIX% Removing Software\Cygwin from registry
    reg delete HKLM\Software\Cygwin /va /f > NUL: 2>&1
    reg delete HKLM\Software\Wow6432Node\Cygwin /va /f > NUL: 2>&1
    reg delete HKCU\Software\Cygwin /va /f > NUL: 2>&1
goto :eof

:remove_cygwin_dir
    echo %_PREFIX% Removing %_ROOTDIR%
    rd /s /q %_ROOTDIR%
goto :eof

:remove_local_users
    echo %_PREFIX% Remove sshd and cyg_server local users!
goto :eof

:main
    call :check_rootdir ||exit /b 1
    call :check_admin ||exit /b 1
    call :uninstall_lsa ||exit /b 1
    call :stop_services ||exit /b 1
    call :remove_services ||exit /b 1
    call :clean_registry ||exit /b 1
    rem call :remove_shortcuts ||exit /b 1
    call :remove_cygwin_dir ||exit /b 1
    call :remove_local_users ||exit /b 1

@echo off
rem
rem Uninstall Cygwin.
rem See http://cygwin.com/faq/faq-nochunks.html#faq.setup.uninstall-all
rem

setlocal

set _ROOTDIR=C:\cygwin
set _PREFIX=CYGWIN-UNINSTALL:

goto :main

:check_rootdir
    echo %_PREFIX% Checking if %_ROOTDIR% is valid
    if exist "%_ROOTDIR%" goto :endif_rootdir
        echo %_PREFIX% ERROR: ROOTDIR "%_ROOTDIR%" does not exist.
        exit /b 1
    :endif_rootdir
    if exist "%_ROOTDIR%\Cygwin.ico" goto :endif_cygwin_ico
        echo %_PREFIX% ERROR: ROOTDIR "%_ROOTDIR%" does not appear to be a Cygwin directory.
        exit /b 1
    :endif_cygwin_ico
goto :eof

:check_admin
    rem Check for ADMIN privileges
    rem https://sites.google.com/site/eneerge/home/BatchGotAdmin

    echo %_PREFIX% Checking for Administrator privileges
    >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
    if "%ERRORLEVEL%" EQU "0" goto :endif_check_admin
        echo %_PREFIX% ERROR: You do not have Administrator privileges
        echo %_PREFIX% Rerun from a "Run as Administrator" command prompt
        exit /b 1
    :endif_check_admin
goto :eof

:uninstall_lsa
    echo %_PREFIX% Checking if cyglsa is hooked into OS
    reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages" | findstr cyglsa > NUL:
    if %ERRORLEVEL% NEQ 0 exit /b 0

    echo %_PREFIX% Checking for sane Authentication Packages value
    for /f "usebackq tokens=4-9" %%f in (`reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages"`) do set _AP_VALUE=%%f
    set _AP_VALUEQ=%_AP_VALUE:\0=?%
    for /f "usebackq delims=? tokens=1,2,3" %%f in ('%_AP_VALUEQ%') do (
        set _AP_VALUE_0=%%f
        set _AP_VALUE_1=%%g
        set _AP_VALUE_2=%%h
    )
    if not "%_AP_VALUE_0%" == "msv1_0" goto :lsa_bad
    echo %_AP_VALUE_1% | findstr cyglsa > NUL:
    if %ERRORLEVEL% NEQ 0 goto :lsa_bad
    if not "%_AP_VALUE_2%" == "" goto :lsa_bad

    echo %_PREFIX% Unhooking cyglsa
    reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages" /t REG_MULTI_SZ /f /d msv1_0
    echo %_PREFIX% Please reboot and rerun this script
    exit /b 1

    :lsa_bad
    echo %_PREFIX% ERROR: Don't know how to handle Authentication Packages value of %_AP_VALUE%
    exit /b 1
goto :eof

:stop_services
    echo %_PREFIX% Stopping Cygwin services
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do %_ROOTDIR%\bin\cygrunsrv --stop %%s
goto :eof

:remove_services
    echo %_PREFIX% Removing Cygwin services
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do %_ROOTDIR%\bin\cygrunsrv --remove %%s
goto :eof

:clean_registry
    echo %_PREFIX% Removing Software\Cygwin from registry
    reg delete HKLM\Software\Cygwin /va /f > NUL: 2>&1
    reg delete HKLM\Software\Wow6432Node\Cygwin /va /f > NUL: 2>&1
    reg delete HKCU\Software\Cygwin /va /f > NUL: 2>&1
goto :eof

:remove_cygwin_dir
    echo %_PREFIX% Removing %_ROOTDIR%
    rd /s /q %_ROOTDIR%
goto :eof

:remove_local_users
    echo %_PREFIX% Remove sshd and cyg_server local users!
goto :eof

:main
    call :check_rootdir ||exit /b 1
    call :check_admin ||exit /b 1
    call :uninstall_lsa ||exit /b 1
    call :stop_services ||exit /b 1
    call :remove_services ||exit /b 1
    call :clean_registry ||exit /b 1
    rem call :remove_shortcuts ||exit /b 1
    call :remove_cygwin_dir ||exit /b 1
    call :remove_local_users ||exit /b 1

fix success return from uninstall_lsa

cygwin-uninstall.bat: fix success return from uninstall_lsa


@echo off
IF "%1" EQU "" GOTO Help

IF "%2" NEQ ""   SET _=%2\%1
IF "%2" EQU ""   SET _=%CD%\%1

rem if we're in the starter script shell, create the only struct that corresponds to the current env
rem otherwise - retain the old behavior, create structs for all the known build combinations and don't cd

cmd /c "exit /b 0"

if "%PHP_SDK_ARCH%" NEQ "" (
	if "%PHP_SDK_VS%" NEQ "" (
		MD %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%\deps\bin
		MD %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%\deps\lib
		MD %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%\deps\include
		cd %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%
		goto exit
	)
	goto create_all
) else (
:create_all
	MD %_%\vc14\x86\deps\bin
	MD %_%\vc14\x86\deps\lib
	MD %_%\vc14\x86\deps\include
	MD %_%\vc14\x64\deps\bin
	MD %_%\vc14\x64\deps\lib
	MD %_%\vc14\x64\deps\include
)

set _=

GOTO EXIT

:help
echo phpsdk_buildtree ^<nameofthetree^> [PATH]
echo  Create the common directory structure used by the PHP SDK

:EXIT
exit /b %errorlevel%

@echo off
IF "%1" EQU "" GOTO Help

IF "%2" NEQ ""   SET _=%2\%1
IF "%2" EQU ""   SET _=%CD%\%1

rem if we're in the starter script shell, create the only struct that corresponds to the current env
rem otherwise - retain the old behavior, create structs for all the known build combinations and don't cd

cmd /c "exit /b 0"

if "%PHP_SDK_ARCH%" NEQ "" (
	if "%PHP_SDK_VS%" NEQ "" (
		MD %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%\deps\bin
		MD %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%\deps\lib
		MD %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%\deps\include
		cd %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%
		goto exit
	)
	goto create_all
) else (
:create_all
	for %%i in (vc14 vc15 vs16) do (
		MD %_%\%%i\x86\deps\bin
		MD %_%\%%i\x86\deps\lib
		MD %_%\%%i\x86\deps\include
		MD %_%\%%i\x64\deps\bin
		MD %_%\%%i\x64\deps\lib
		MD %_%\%%i\x64\deps\include
	)
)

set _=

GOTO EXIT

:help
echo phpsdk_buildtree ^<nameofthetree^> [PATH]
echo  Create the common directory structure used by the PHP SDK

:EXIT
exit /b %errorlevel%

Update :create_all part of phpsdk_buildtree.bat


echo ON

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

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

echo ON

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

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

Update bld.bat

Update bld.bat


mkdir build && cd build

cmake -G "NMake Makefiles"^
    -DCMAKE_BUILD_TYPE=Release^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX%^
    -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX%^
    -DDART_MSVC_DEFAULT_OPTIONS=ON^
    -DDART_VERBOSE=ON^
    %SRC_DIR%

if errorlevel 1 exit 1

nmake
if errorlevel 1 exit 1

nmake install
if errorlevel 1 exit 1

mkdir build && cd build

# Build with Clang toolset
set "CC=clang-cl.exe"
set "CXX=clang-cl.exe"

cmake -G "NMake Makefiles"^
    -DCMAKE_BUILD_TYPE=Release^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX%^
    -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX%^
    -DDART_MSVC_DEFAULT_OPTIONS=ON^
    -DDART_VERBOSE=ON^
    %SRC_DIR%

if errorlevel 1 exit 1

nmake
if errorlevel 1 exit 1

nmake install
if errorlevel 1 exit 1

Update bld.bat

Update bld.bat


echo OFF

set UPLOAD_TARGETS=python-parse python-pkgtk

if "%ANACONDA_USERNAME%" == "" (
  set /p ANACONDA_USERNAME="Username: "
) else (
  echo Username: %ANACONDA_USERNAME%;
)

if "%ANACONDA_PASSWORD%" == "" (
  set /p ANACONDA_USERNAME=%ANACONDA_USERNAME%%"'s password: "
) else (
  echo %ANACONDA_USERNAME%'s password: [secure];
)

set ANACONDA_UPLOAD_FLAGS=-c conda-forge %ANACONDA_UPLOAD_FLAGS%
if "%ANACONDA_CHANNEL%" == "" (
    set ANACONDA_CHANNEL=statiskit
) else (
    echo Using anaconda channel: %ANACONDA_CHANNEL%
    set ANACONDA_UPLOAD_FLAGS=-c statiskit "%ANACONDA_UPLOAD_FLAGS%
)

echo ON

conda install -n root anaconda-client
if %errorlevel% neq 0 (
  exit /b %errorlevel%
)

echo OFF

echo y|anaconda login --username %ANACONDA_USERNAME% --password %ANACONDA_PASSWORD%
if %errorlevel% neq 0 (
  exit /b %errorlevel%
)

echo ON

git clone https://gist.github.com/c491cb08d570beeba2c417826a50a9c3.git toolchain
if %errorlevel% neq 0 (
  anaconda logout
  exit /b %errorlevel%
)
cd toolchain
call config.bat
if %errorlevel% neq 0 (
  cd ..
  anaconda logout
  rmdir toolchain /s /q
  exit /b %errorlevel%
)
cd ..
rmdir toolchain /s /q

for %%x in (%UPLOAD_TARGETS%) do (
  <nul set /p="for /f %%%%i in ('conda build " >> _upload.bat
  <nul set /p=%%x >> _upload.bat
  <nul set /p=" -c " >> _upload.bat
  <nul set /p=%ANACONDA_CHANNEL% >> _upload.bat
  <nul set /p=" " >> _upload.bat
  <nul set /p=%ANACONDA_UPLOAD_FLAGS% >> _upload.bat
  <nul set /p=" --output') ( set UPLOAD_FILE=%%%%i )" >> _upload.bat
  echo. >> _upload.bat
  <nul set /p="anaconda upload --user " >> _upload.bat
  <nul set /p=%ANACONDA_CHANNEL% >> _upload.bat
  <nul set /p=" %%UPLOAD_FILE%%" >> _upload.bat
  echo. >> _upload.bat
  <nul set /p="if %%errorlevel%% neq 0 " >> _upload.bat
  echo upload failed >> _upload.bat
  more _upload.bat
  call _upload.bat
  del _upload.bat
)

anaconda logout

echo OFF

set UPLOAD_TARGETS=python-parse python-pkgtk

if "%ANACONDA_USERNAME%" == "" (
  set /p ANACONDA_USERNAME="Username: "
) else (
  echo Username: %ANACONDA_USERNAME%;
)

if "%ANACONDA_PASSWORD%" == "" (
  set /p ANACONDA_USERNAME=%ANACONDA_USERNAME%%"'s password: "
) else (
  echo %ANACONDA_USERNAME%'s password: [secure];
)

set ANACONDA_UPLOAD_FLAGS=-c conda-forge %ANACONDA_UPLOAD_FLAGS%
if "%ANACONDA_CHANNEL%" == "" (
    set ANACONDA_CHANNEL=statiskit
) else (
    echo Using anaconda channel: %ANACONDA_CHANNEL%
    set ANACONDA_UPLOAD_FLAGS=-c statiskit "%ANACONDA_UPLOAD_FLAGS%
)

echo ON

conda install -n root anaconda-client
if %errorlevel% neq 0 (
  exit /b %errorlevel%
)

echo OFF

echo y|anaconda login --username %ANACONDA_USERNAME% --password %ANACONDA_PASSWORD%
if %errorlevel% neq 0 (
  exit /b %errorlevel%
)

echo ON

git clone https://gist.github.com/c491cb08d570beeba2c417826a50a9c3.git toolchain
if %errorlevel% neq 0 (
  anaconda logout
  exit /b %errorlevel%
)
cd toolchain
call config.bat
if %errorlevel% neq 0 (
  cd ..
  anaconda logout
  rmdir toolchain /s /q
  exit /b %errorlevel%
)
cd ..
rmdir toolchain /s /q

for %%x in (%UPLOAD_TARGETS%) do (
  <nul set /p="for /f %%%%i in ('conda build " >> _upload.bat
  <nul set /p=%%x >> _upload.bat
  <nul set /p=" -c " >> _upload.bat
  <nul set /p=%ANACONDA_CHANNEL% >> _upload.bat
  <nul set /p=" " >> _upload.bat
  <nul set /p=%ANACONDA_UPLOAD_FLAGS% >> _upload.bat
  <nul set /p=" --output') set UPLOAD_FILE=%%%%i" >> _upload.bat
  echo. >> _upload.bat
  <nul set /p="anaconda upload --user " >> _upload.bat
  <nul set /p=%ANACONDA_CHANNEL% >> _upload.bat
  <nul set /p=" %%UPLOAD_FILE%%" >> _upload.bat
  echo. >> _upload.bat
  <nul set /p="if %%errorlevel%% neq 0 " >> _upload.bat
  echo echo upload failed >> _upload.bat
  more _upload.bat
  call _upload.bat
  del _upload.bat
)

anaconda logout

Update upload.bat

Update upload.bat


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

:: This script is shamefully borrowed from:
:: //third_party/tensorflow/tools/ci_build/release/common_win.bat.oss

echo on

@REM
@REM Set Environment Variables
@REM
SET PY_EXE=C:\%PYTHON_DIRECTORY%\python.exe
SET PIP_EXE=C:\%PYTHON_DIRECTORY%\Scripts\pip.exe
SET PATH=%PATH%;C:\%PYTHON_DIRECTORY%

%PIP_EXE% install flatbuffers==1.12 --upgrade --no-deps
%PIP_EXE% install setuptools --upgrade
%PIP_EXE% install numpy==1.16.0 --upgrade --no-deps

@REM
@REM Setup Bazel
@REM
:: Download Bazel from github and make sure its found in PATH.
SET BAZEL_VERSION=3.1.0
md C:\tools\bazel\
wget -q https://github.com/bazelbuild/bazel/releases/download/%BAZEL_VERSION%/bazel-%BAZEL_VERSION%-windows-x86_64.exe -O C:/tools/bazel/bazel.exe
SET PATH=C:\tools\bazel;%PATH%
bazel version

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

:: This script is shamefully borrowed from:
:: //third_party/tensorflow/tools/ci_build/release/common_win.bat.oss

echo on

@REM
@REM Set Environment Variables
@REM
SET PY_EXE=C:\%PYTHON_DIRECTORY%\python.exe
SET PIP_EXE=C:\%PYTHON_DIRECTORY%\Scripts\pip.exe
SET PATH=C:\%PYTHON_DIRECTORY%;C:\%PYTHON_DIRECTORY%\Scripts;%PATH%

%PIP_EXE% install flatbuffers==1.12 --upgrade --no-deps
%PIP_EXE% install setuptools --upgrade
%PIP_EXE% install numpy==1.16.0 --upgrade --no-deps

@REM
@REM Setup Bazel
@REM
:: Download Bazel from github and make sure its found in PATH.
SET BAZEL_VERSION=3.1.0
md C:\tools\bazel\
wget -q https://github.com/bazelbuild/bazel/releases/download/%BAZEL_VERSION%/bazel-%BAZEL_VERSION%-windows-x86_64.exe -O C:/tools/bazel/bazel.exe
SET PATH=C:\tools\bazel;%PATH%
bazel version

Add pip path into PATH.

Add pip path into PATH.

PiperOrigin-RevId: 332185787


c:\Users\%username%\AppData\Roaming\npm\brunch w --server
PAUSE

Update the launch.bat.

Update the launch.bat.


update build script

update build script


@echo off

setlocal

set PATH=%PATH%;%CD%\tools

set WGET_ARGS=--no-check-certificate
set UNZIP_ARGS=-q

set BASEURL=https://s3.amazonaws.com/rstudio-buildtools/
set BOOST_FILE=boost-1.44-win.zip
set MINGW_FILE=mingw64-2010-10-03.zip
set GIN_FILE=gin-1.5.zip
set GWT_FILE=gwt-2.3.0.zip
set JUNIT_FILE=junit-4.9b3.jar

if not exist boost-win (
  wget %WGET_ARGS% "%BASEURL%%BOOST_FILE%"
  echo Unzipping %BOOST_FILE%
  unzip %UNZIP_ARGS% "%BOOST_FILE%"
  del "%BOOST_FILE%"
)

if not exist mingw64 (
  wget %WGET_ARGS% "%BASEURL%%MINGW_FILE%"
  echo Unzipping %MINGW_FILE%
  unzip %UNZIP_ARGS% "%MINGW_FILE%"
  del "%MINGW_FILE%"
)

mkdir ..\..\src\gwt\lib
pushd ..\..\src\gwt\lib

if not exist gin\1.5 (
  wget %WGET_ARGS% "%BASEURL%%GIN_FILE%"
  mkdir gin\1.5
  echo Unzipping %GIN_FILE%
  unzip %UNZIP_ARGS% "%GIN_FILE%" -d gin\1.5
  del "%GIN_FILE%"
)

if not exist gwt\2.3.0 (
  wget %WGET_ARGS% "%BASEURL%%GWT_FILE%"
  echo Unzipping %GWT_FILE%
  unzip %UNZIP_ARGS% "%GWT_FILE%"
  mkdir gwt
  move gwt-2.3.0 gwt\2.3.0
  del "%GWT_FILE%"
)

if not exist %JUNIT_FILE% (
  wget %WGET_ARGS% "%BASEURL%%JUNIT_FILE%"
)

@echo off

setlocal

set PATH=%PATH%;%CD%\tools

set WGET_ARGS=--no-check-certificate
set UNZIP_ARGS=-q

set BASEURL=https://s3.amazonaws.com/rstudio-buildtools/
set BOOST_FILE=boost-1.44-win.zip
set MINGW_FILE=mingw64-2010-10-03.zip
set GIN_FILE=gin-1.5.zip
set GWT_FILE=gwt-2.4.0.zip
set JUNIT_FILE=junit-4.9b3.jar

if not exist boost-win (
  wget %WGET_ARGS% "%BASEURL%%BOOST_FILE%"
  echo Unzipping %BOOST_FILE%
  unzip %UNZIP_ARGS% "%BOOST_FILE%"
  del "%BOOST_FILE%"
)

if not exist mingw64 (
  wget %WGET_ARGS% "%BASEURL%%MINGW_FILE%"
  echo Unzipping %MINGW_FILE%
  unzip %UNZIP_ARGS% "%MINGW_FILE%"
  del "%MINGW_FILE%"
)

mkdir ..\..\src\gwt\lib
pushd ..\..\src\gwt\lib

if not exist gin\1.5 (
  wget %WGET_ARGS% "%BASEURL%%GIN_FILE%"
  mkdir gin\1.5
  echo Unzipping %GIN_FILE%
  unzip %UNZIP_ARGS% "%GIN_FILE%" -d gin\1.5
  del "%GIN_FILE%"
)

if not exist gwt\2.4.0 (
  wget %WGET_ARGS% "%BASEURL%%GWT_FILE%"
  echo Unzipping %GWT_FILE%
  unzip %UNZIP_ARGS% "%GWT_FILE%"
  mkdir gwt
  move gwt-2.4.0 gwt\2.4.0
  del "%GWT_FILE%"
)

if not exist %JUNIT_FILE% (
  wget %WGET_ARGS% "%BASEURL%%JUNIT_FILE%"
)

Upgrade Windows dependency script to GWT 2.4


C:\msys64\usr\bin\bash --login -c "pacman -S --noconfirm mingw-w64-x86_64-cmake"
C:\msys64\usr\bin\bash --login -c "pacman -S --noconfirm mingw-w64-x86_64-zlib"

Add zlib depedency

Add zlib depedency


@echo off
goto continue

:showUsage
echo Usage: %0 ^<mode^> ^<name^> ^<max-memory^> "<vmarg-list>" ^<app-classname^> ^<app-args^>...
echo    ^<mode^>: fg    run as foreground process in current shell
echo              bg    run as background process in new shell
echo              debug run as foreground process in current shell in debug mode ^(suspend=n^)
echo              debug-suspend   run as foreground process in current shell in debug mode ^(suspend=y^)
echo              NOTE: for all debug modes environment variable DEBUG_ADDRESS may be set to
echo                    override default debug address of 127.0.0.1:18001
echo    ^<name^>: application name used for naming console window
echo    ^<max-memory^>: maximum memory heap size in MB ^(e.g., 768M or 2G^).  Use "" if default should be used.
echo                  This will generally be upto 1/4 of the physical memory available to the OS.  On
echo                  some systems the default could be much less (particularly for 32-bit OS).
echo    ^<vmarg-list^>: pass-thru args ^(e.g.,  "-Xmx512M -Dmyvar=1 -DanotherVar=2"^) - use
echo                empty "" if vmargs not needed
echo    ^<app-classname^>: application classname ^(e.g., ghidra.GhidraRun ^)
echo    ^<app-args^>...: arguments to be passed to the application
echo.
echo    Example:
echo       %0 debug Ghidra 768M "" ghidra.GhidraRun
exit /B 1

:continue

:: Delay the expansion of our loop items below since the value is being updated as the loop works
setlocal enabledelayedexpansion

:: See if we were doubled clicked or run from a command prompt
set DOUBLE_CLICKED=n
for /f "tokens=2" %%# in ("%cmdcmdline%") do if /i "%%#" equ "/c" set DOUBLE_CLICKED=y

:: Sets SUPPORT_DIR to the directory that contains this file (ends with '\')
::
:: '% ~' dereferences the value in param 0
:: 'd' - drive
:: 'p' - path (without filename)
set "SUPPORT_DIR=%~dp0"

::
:: Parse arguments
::
set VMARG_LIST=
set ARGS=
set INDEX=0
for %%A in (%*) do (
	set /A INDEX=!INDEX!+1
	if "!INDEX!"=="1" ( set MODE=%%A
	) else if "!INDEX!"=="2" ( set APPNAME=%%A
	) else if "!INDEX!"=="3" ( set MAXMEM=%%~A
	) else if "!INDEX!"=="4" ( if not "%%~A"=="" set VMARG_LIST=%%~A
	) else if "!INDEX!"=="5" ( set CLASSNAME=%%~A
	) else set ARGS=!ARGS! %%A
)

if %INDEX% geq 5 goto continue1
echo Incorrect launch usage - missing argument^(s^)
goto showUsage

:continue1

::
:: Production Environment
::
set "INSTALL_DIR=%SUPPORT_DIR%..\"
set "CPATH=%INSTALL_DIR%Ghidra\Framework\Utility\lib\Utility.jar"
set "LS_CPATH=%SUPPORT_DIR%LaunchSupport.jar"
set "DEBUG_LOG4J=%SUPPORT_DIR%debug.log4j.xml"

if exist "%INSTALL_DIR%Ghidra" goto continue2

::
:: Development Environment
::
set "INSTALL_DIR=%INSTALL_DIR%..\..\..\"
set "CPATH=%INSTALL_DIR%Ghidra\Framework\Utility\bin\main"
set "LS_CPATH=%INSTALL_DIR%GhidraBuild\LaunchSupport\bin\main"
set "DEBUG_LOG4J=%INSTALL_DIR%Ghidra\RuntimeScripts\Common\support\debug.log4j.xml"
if not exist "%LS_CPATH%" (
	echo Ghidra cannot launch in development mode because Eclipse has not compiled its class files.
	set ERRORLEVEL=1
	goto exit1
)

:continue2

:: This is to force Java to use the USERPROFILE directory for user.home
if exist "%USERPROFILE%" (
	set VMARG_LIST=%VMARG_LIST% -Duser.home="%USERPROFILE%"
)

:: Make sure some kind of java is on the path.  It's required to run the LaunchSupport program.
java -version >nul 2>nul
if not %ERRORLEVEL% == 0 (
	echo Java runtime not found.  Please refer to the Ghidra Installation Guide's Troubleshooting section.
	goto exit1
)

:: Get the JDK that will be used to launch Ghidra
set JAVA_HOME=
for /f "delims=*" %%i in ('java -cp "%LS_CPATH%" LaunchSupport "%INSTALL_DIR%\" -jdk_home -save') do set JAVA_HOME=%%i
if "%JAVA_HOME%" == "" (
	:: No JDK has been setup yet.  Let the user choose one.
	java -cp "%LS_CPATH%" LaunchSupport "%INSTALL_DIR%\" -jdk_home -ask

	:: Now that the user chose one, try again to get the JDK that will be used to launch Ghidra
	for /f "delims=*" %%i in ('java -cp "%LS_CPATH%" LaunchSupport "%INSTALL_DIR%\" -jdk_home -save') do set JAVA_HOME=%%i
	if "!JAVA_HOME!" == "" (
		echo.
		echo Failed to find a supported JDK.  Please refer to the Ghidra Installation Guide's Troubleshooting section.
		set ERRORLEVEL=1
		goto exit1
	)
)
set "JAVA_CMD=%JAVA_HOME%\bin\java"

:: Get the configurable VM arguments from the launch properties
for /f "delims=*" %%i in ('java -cp "%LS_CPATH%" LaunchSupport "%INSTALL_DIR%\" -vmargs') do set VMARG_LIST=%VMARG_LIST% %%i

:: Set Max Heap Size if specified
if not "%MAXMEM%"=="" (
	set VMARG_LIST=%VMARG_LIST% -Xmx%MAXMEM%
)

set BACKGROUND=n
set DEBUG=n
set SUSPEND=n

if "%MODE%"=="debug" (
	set DEBUG=y
)

if "%MODE%"=="debug-suspend" (
	set DEBUG=y
	set SUSPEND=y
)

if "%DEBUG%"=="y" (
	if "%DEBUG_ADDRESS%"=="" (
		set DEBUG_ADDRESS=127.0.0.1:18001
	)

	set VMARG_LIST=!VMARG_LIST! -Dlog4j.configuration="!DEBUG_LOG4J!"
	set VMARG_LIST=!VMARG_LIST! -agentlib:jdwp=transport=dt_socket,server=y,suspend=!SUSPEND!,address=!DEBUG_ADDRESS!
	goto continue3
)

if "%MODE%"=="fg" (
	goto continue3
)

if "%MODE%"=="bg" (
	set BACKGROUND=y
	goto continue3
)

echo "Incorrect launch usage - invalid launch mode: %MODE%"
exit /B 1

:continue3

set CMD_ARGS=%FORCE_JAVA_VERSION% %JAVA_USER_HOME_DIR_OVERRIDE% %VMARG_LIST% -cp "%CPATH%" ghidra.GhidraLauncher %CLASSNAME% %ARGS%

if "%BACKGROUND%"=="y" (
	set JAVA_CMD=!JAVA_CMD!w
	start "%APPNAME%" /I /B "!JAVA_CMD!" %CMD_ARGS%

	REM If our process dies immediately, output something so the user knows to run in debug mode.
	REM Otherwise they'll never see any error output from background mode.
	REM NOTE: The below check isn't perfect because they might have other javaw's running, but
	REM without the PID of the thing we launched, it's the best we can do (maybe use WMI?).
	REM Worst case, they just won't see the error message.
	%SystemRoot%\System32\timeout.exe /NOBREAK 1 > NUL
	%SystemRoot%\System32\tasklist.exe | %SystemRoot%\System32\findstr.exe "javaw" > NUL
	if not "!ERRORLEVEL!"=="0" (
		echo Exited with error.  Run in foreground ^(fg^) mode for more details.
	)
) else (
	"%JAVA_CMD%" %CMD_ARGS%
)

:exit1
if not %ERRORLEVEL% == 0 (
	if "%DOUBLE_CLICKED%"=="y" (
		pause
	)
)

exit /B %ERRORLEVEL%

@echo off
goto continue

:showUsage
echo Usage: %0 ^<mode^> ^<name^> ^<max-memory^> "<vmarg-list>" ^<app-classname^> ^<app-args^>...
echo    ^<mode^>: fg    run as foreground process in current shell
echo              bg    run as background process in new shell
echo              debug run as foreground process in current shell in debug mode ^(suspend=n^)
echo              debug-suspend   run as foreground process in current shell in debug mode ^(suspend=y^)
echo              NOTE: for all debug modes environment variable DEBUG_ADDRESS may be set to
echo                    override default debug address of 127.0.0.1:18001
echo    ^<name^>: application name used for naming console window
echo    ^<max-memory^>: maximum memory heap size in MB ^(e.g., 768M or 2G^).  Use "" if default should be used.
echo                  This will generally be upto 1/4 of the physical memory available to the OS.  On
echo                  some systems the default could be much less (particularly for 32-bit OS).
echo    ^<vmarg-list^>: pass-thru args ^(e.g.,  "-Xmx512M -Dmyvar=1 -DanotherVar=2"^) - use
echo                empty "" if vmargs not needed
echo    ^<app-classname^>: application classname ^(e.g., ghidra.GhidraRun ^)
echo    ^<app-args^>...: arguments to be passed to the application
echo.
echo    Example:
echo       %0 debug Ghidra 768M "" ghidra.GhidraRun
exit /B 1

:continue

:: Delay the expansion of our loop items below since the value is being updated as the loop works
setlocal enabledelayedexpansion

:: See if we were doubled clicked or run from a command prompt
set DOUBLE_CLICKED=n
for /f "tokens=2" %%# in ("%cmdcmdline%") do if /i "%%#" equ "/c" set DOUBLE_CLICKED=y

:: Sets SUPPORT_DIR to the directory that contains this file (ends with '\')
::
:: '% ~' dereferences the value in param 0
:: 'd' - drive
:: 'p' - path (without filename)
set "SUPPORT_DIR=%~dp0"

::
:: Parse arguments
::
set VMARG_LIST=
set ARGS=
set INDEX=0
for %%A in (%*) do (
	set /A INDEX=!INDEX!+1
	if "!INDEX!"=="1" ( set MODE=%%A
	) else if "!INDEX!"=="2" ( set APPNAME=%%A
	) else if "!INDEX!"=="3" ( set MAXMEM=%%~A
	) else if "!INDEX!"=="4" ( if not "%%~A"=="" set VMARG_LIST=%%~A
	) else if "!INDEX!"=="5" ( set CLASSNAME=%%~A
	) else set ARGS=!ARGS! %%A
)

if %INDEX% geq 5 goto continue1
echo Incorrect launch usage - missing argument^(s^)
goto showUsage

:continue1

::
:: Production Environment
::
set "INSTALL_DIR=%SUPPORT_DIR%.."
set "CPATH=%INSTALL_DIR%\Ghidra\Framework\Utility\lib\Utility.jar"
set "LS_CPATH=%SUPPORT_DIR%\LaunchSupport.jar"
set "DEBUG_LOG4J=%SUPPORT_DIR%\debug.log4j.xml"

if exist "%INSTALL_DIR%\Ghidra" goto continue2

::
:: Development Environment
::
set "INSTALL_DIR=%INSTALL_DIR%\..\..\.."
set "CPATH=%INSTALL_DIR%\Ghidra\Framework\Utility\bin\main"
set "LS_CPATH=%INSTALL_DIR%\GhidraBuild\LaunchSupport\bin\main"
set "DEBUG_LOG4J=%INSTALL_DIR%\Ghidra\RuntimeScripts\Common\support\debug.log4j.xml"
if not exist "%LS_CPATH%" (
	echo Ghidra cannot launch in development mode because Eclipse has not compiled its class files.
	set ERRORLEVEL=1
	goto exit1
)

:continue2

:: This is to force Java to use the USERPROFILE directory for user.home
if exist "%USERPROFILE%" (
	set VMARG_LIST=%VMARG_LIST% -Duser.home="%USERPROFILE%"
)

:: Make sure some kind of java is on the path.  It's required to run the LaunchSupport program.
java -version >nul 2>nul
if not %ERRORLEVEL% == 0 (
	echo Java runtime not found.  Please refer to the Ghidra Installation Guide's Troubleshooting section.
	goto exit1
)

:: Get the JDK that will be used to launch Ghidra
set JAVA_HOME=
for /f "delims=*" %%i in ('java -cp "%LS_CPATH%" LaunchSupport "%INSTALL_DIR%" -jdk_home -save') do set JAVA_HOME=%%i
if "%JAVA_HOME%" == "" (
	:: No JDK has been setup yet.  Let the user choose one.
	java -cp "%LS_CPATH%" LaunchSupport "%INSTALL_DIR%" -jdk_home -ask

	:: Now that the user chose one, try again to get the JDK that will be used to launch Ghidra
	for /f "delims=*" %%i in ('java -cp "%LS_CPATH%" LaunchSupport "%INSTALL_DIR%" -jdk_home -save') do set JAVA_HOME=%%i
	if "!JAVA_HOME!" == "" (
		echo.
		echo Failed to find a supported JDK.  Please refer to the Ghidra Installation Guide's Troubleshooting section.
		set ERRORLEVEL=1
		goto exit1
	)
)
set "JAVA_CMD=%JAVA_HOME%\bin\java"

:: Get the configurable VM arguments from the launch properties
for /f "delims=*" %%i in ('java -cp "%LS_CPATH%" LaunchSupport "%INSTALL_DIR%" -vmargs') do set VMARG_LIST=%VMARG_LIST% %%i

:: Set Max Heap Size if specified
if not "%MAXMEM%"=="" (
	set VMARG_LIST=%VMARG_LIST% -Xmx%MAXMEM%
)

set BACKGROUND=n
set DEBUG=n
set SUSPEND=n

if "%MODE%"=="debug" (
	set DEBUG=y
)

if "%MODE%"=="debug-suspend" (
	set DEBUG=y
	set SUSPEND=y
)

if "%DEBUG%"=="y" (
	if "%DEBUG_ADDRESS%"=="" (
		set DEBUG_ADDRESS=127.0.0.1:18001
	)

	set VMARG_LIST=!VMARG_LIST! -Dlog4j.configuration="!DEBUG_LOG4J!"
	set VMARG_LIST=!VMARG_LIST! -agentlib:jdwp=transport=dt_socket,server=y,suspend=!SUSPEND!,address=!DEBUG_ADDRESS!
	goto continue3
)

if "%MODE%"=="fg" (
	goto continue3
)

if "%MODE%"=="bg" (
	set BACKGROUND=y
	goto continue3
)

echo "Incorrect launch usage - invalid launch mode: %MODE%"
exit /B 1

:continue3

set CMD_ARGS=%FORCE_JAVA_VERSION% %JAVA_USER_HOME_DIR_OVERRIDE% %VMARG_LIST% -cp "%CPATH%" ghidra.GhidraLauncher %CLASSNAME% %ARGS%

if "%BACKGROUND%"=="y" (
	set JAVA_CMD=!JAVA_CMD!w
	start "%APPNAME%" /I /B "!JAVA_CMD!" %CMD_ARGS%

	REM If our process dies immediately, output something so the user knows to run in debug mode.
	REM Otherwise they'll never see any error output from background mode.
	REM NOTE: The below check isn't perfect because they might have other javaw's running, but
	REM without the PID of the thing we launched, it's the best we can do (maybe use WMI?).
	REM Worst case, they just won't see the error message.
	%SystemRoot%\System32\timeout.exe /NOBREAK 1 > NUL
	%SystemRoot%\System32\tasklist.exe | %SystemRoot%\System32\findstr.exe "javaw" > NUL
	if not "!ERRORLEVEL!"=="0" (
		echo Exited with error.  Run in foreground ^(fg^) mode for more details.
	)
) else (
	"%JAVA_CMD%" %CMD_ARGS%
)

:exit1
if not %ERRORLEVEL% == 0 (
	if "%DOUBLE_CLICKED%"=="y" (
		pause
	)
)

exit /B %ERRORLEVEL%

Fix #2176 removing both backslash from path

As suggested #3121 squashed and rebased on brach Ghidra_10.0.
Thanks to @topia for fix a missing \


move /Y c:\shinken\bin\shinken-poller c:\shinken\bin\shinken-poller.py
move /Y c:\shinken\bin\shinken-reactionner c:\shinken\bin\shinken-reactionner.py
move /Y c:\shinken\bin\shinken-scheduler c:\shinken\bin\shinken-scheduler.py
move /Y c:\shinken\bin\shinken-arbiter c:\shinken\bin\shinken-arbiter.py
move /Y c:\shinken\bin\shinken-broker c:\shinken\bin\shinken-broker.py
move /Y c:\shinken\bin\shinken-receiver c:\shinken\bin\shinken-receiver.py

c:\shinken\windows\instsrv.exe "Shinken-Arbiter" "c:\shinken\windows\srvany.exe"

c:\shinken\windows\instsrv.exe "Shinken-Scheduler" "c:\shinken\windows\srvany.exe"

c:\shinken\windows\instsrv.exe "Shinken-Poller" "c:\shinken\windows\srvany.exe"

c:\shinken\windows\instsrv.exe "Shinken-Reactionner" "c:\shinken\windows\srvany.exe"

c:\shinken\windows\instsrv.exe "Shinken-Broker" "c:\shinken\windows\srvany.exe"

c:\shinken\windows\instsrv.exe "Shinken-Receiver" "c:\shinken\windows\srvany.exe"

@echo off
Title Shinken installation script for Windows V0.1
echo.
cls
REM Shinken installation script for Windows
REM
REM
REM  V 0.1
REM
REM Copyright (C) 2011 :
REM        * E. Beaulieu - Shinken_install_batch@zebux.org
REM
REM Shinken installationscript for Windows is free software: you can redistribute it and/or modify
REM it under the terms of the GNU Affero General Public License as published by
REM the Free Software Foundation, either version 3 of the License, or
REM (at your option) any later version.
REM
REM Shinken installationscript for Windows is distributed in the hope that it will be useful,
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
REM GNU Affero General Public License for more details.
REM
REM You should have received a copy of the GNU Affero General Public License
REM along with Shinken.  If not, see <http://www.gnu.org/licenses/>.
REM

:: Path initialisation
set PATH_ROOT=c:\shinken\
set PATH_BIN=c:\shinken\bin
set PATH_INSTSRV= c:\shinken\windows

:: Check if the user want to install or remove Shinken
set /p CONT=Do you want [I]ntsall or [R]emove Shinken? (I/R)
if not *%CONT:~0,1% == *I if not *%CONT:~0,1% == *i goto remove

:: Check needed programs
if exist %PATH_INSTSRV%\instsrv.exe goto main
echo You need to install  %PATH_INSTSRV%\instsrv.exe from Microsoft Website !!!
echo  http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD
start /w iexplorer  http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD
pause
exit

:main
cls
color 71
echo                ͻ
echo
echo                     Installation de Shinken
echo
echo                 Please do not close this Windows!
echo
echo                ͼ

:: Check path installation
if exist %PATH_ROOT% goto begin
echo The Shinken directory : %PATH_ROOT% does not exist ! Please create it and reinstall Shinken.
pause
goto end

:begin
move /Y %PATH_BIN%\shinken-poller %PATH_BIN%\shinken-poller.py
move /Y %PATH_BIN%\shinken-reactionner %PATH_BIN%\shinken-reactionner.py
move /Y %PATH_BIN%\shinken-scheduler %PATH_BIN%\shinken-scheduler.py
move /Y %PATH_BIN%\shinken-arbiter %PATH_BIN%\shinken-arbiter.py
move /Y %PATH_BIN%\shinken-broker %PATH_BIN%\shinken-broker.py
move /Y %PATH_BIN%\shinken-receiver %PATH_BIN%\shinken-receiver.py

%PATH_INSTSRV%\instsrv.exe "Shinken-Arbiter" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Scheduler" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Poller" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Reactionner" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Broker" %PATH_INSTSRV%"\srvany.exe"
%PATH_INSTSRV%\instsrv.exe "Shinken-Receiver" %PATH_INSTSRV%"\srvany.exe"

echo Windows Registry Editor Version 5.00  > %tmp%\Shinken_registry.reg
echo. >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Arbiter\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe"  >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken"  >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-arbiter.py -c c:\\shinken\\etc\\nagios-windows.ini"  >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Broker\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-broker.py -c c:\\shinken\\etc\\brokerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Poller\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-poller.py -c c:\\shinken\\etc\\pollerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Reactionner\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-reactionner.py -c c:\\shinken\\etc\\reactionnerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Reactionner\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-reactionner.py -c c:\\shinken\\etc\\reactionnerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Shinken-Scheduler\Parameters] >> %tmp%\Shinken_registry.reg
echo "Application"="c:\\Python26\\python.exe" >> %tmp%\Shinken_registry.reg
echo "AppDirectory"="c:\\shinken" >> %tmp%\Shinken_registry.reg
echo "AppParameters"="c:\\shinken\\bin\\shinken-scheduler.py -c c:\\shinken\\etc\\schedulerd-windows.ini" >> %tmp%\Shinken_registry.reg
echo.  >> %tmp%\Shinken_registry.reg

start /w reg inmport %tmp%\Shinken_registry.reg

pause
goto end

:remove
::Remove shinken
color C0
Echo
echo                ͻ
echo
echo                     Shinken uninstallation
echo
echo                                  Please wait ...
echo
echo                ͼ

%PATH_INSTSRV%\instsrv.exe "Shinken-Arbiter" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Scheduler" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Poller" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Reactionner" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Broker" remove
%PATH_INSTSRV%\instsrv.exe "Shinken-Receiver" remove

echo Please remove the Shinken directory : %PATH_ROOT%
pause
exit

:end
color
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo   Please Go to http://www.shinken-monitoring.org/wiki/shinken_10min_start for how to launch the discovery pass
pause

Add : (Eric Beaulieu) new install bat script for Windows.


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

:: Environment variables that control make.bat:
::
:: GOROOT_FINAL: The expected final Go root, baked into binaries.
:: The default is the location of the Go tree during the build.
::
:: GOHOSTARCH: The architecture for host tools (compilers and
:: binaries).  Binaries of this type must be executable on the current
:: system, so the only common reason to set this is to set
:: GOHOSTARCH=386 on an amd64 machine.
::
:: GOARCH: The target architecture for installed packages and tools.
::
:: GOOS: The target operating system for installed packages and tools.
::
:: GO_GCFLAGS: Additional go tool compile arguments to use when
:: building the packages and commands.
::
:: GO_LDFLAGS: Additional go tool link arguments to use when
:: building the commands.
::
:: CGO_ENABLED: Controls cgo usage during the build. Set it to 1
:: to include all cgo related files, .c and .go file with "cgo"
:: build directive, in the build. Set it to 0 to ignore them.
::
:: CC: Command line to run to compile C code for GOHOSTARCH.
:: Default is "gcc".
::
:: CC_FOR_TARGET: Command line to run compile C code for GOARCH.
:: This is used by cgo. Default is CC.
::
:: FC: Command line to run to compile Fortran code.
:: This is used by cgo. Default is "gfortran".

@echo off

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

set GOBUILDFAIL=0

if exist make.bat goto ok
echo Must run make.bat from Go src directory.
goto fail
:ok

:: Clean old generated file that will cause problems in the build.
del /F ".\pkg\runtime\runtime_defs.go" 2>NUL

:: Set GOROOT for build.
cd ..
set GOROOT_TEMP=%CD%
set GOROOT=
cd src
set vflag=
if x%1==x-v set vflag=-v
if x%2==x-v set vflag=-v
if x%3==x-v set vflag=-v
if x%4==x-v set vflag=-v

if not exist ..\bin\tool mkdir ..\bin\tool

:: Calculating GOROOT_BOOTSTRAP
if not "x%GOROOT_BOOTSTRAP%"=="x" goto bootstrapset
for /f "tokens=*" %%g in ('where go 2^>nul') do (
	if "x%GOROOT_BOOTSTRAP%"=="x" (
		for /f "tokens=*" %%i in ('%%g env GOROOT 2^>nul') do (
			if /I not "%%i"=="%GOROOT_TEMP%" (
				set GOROOT_BOOTSTRAP=%%i
			)
		)
	)
)
if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\go1.17" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\go1.17
if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\sdk\go1.17" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\sdk\go1.17
if "x%GOROOT_BOOTSTRAP%"=="x" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\Go1.4

:bootstrapset
if not exist "%GOROOT_BOOTSTRAP%\bin\go.exe" goto bootstrapfail
set GOROOT=%GOROOT_TEMP%
set GOROOT_TEMP=

echo Building Go cmd/dist using %GOROOT_BOOTSTRAP%
if x%vflag==x-v echo cmd/dist
setlocal
set GOROOT=%GOROOT_BOOTSTRAP%
set GOOS=
set GOARCH=
set GOBIN=
set GOEXPERIMENT=
set GO111MODULE=off
set GOENV=off
set GOFLAGS=
"%GOROOT_BOOTSTRAP%\bin\go.exe" build -o cmd\dist\dist.exe .\cmd\dist
endlocal
if errorlevel 1 goto fail
.\cmd\dist\dist.exe env -w -p >env.bat
if errorlevel 1 goto fail
call env.bat
del env.bat
if x%vflag==x-v echo.

if x%1==x--dist-tool goto copydist
if x%2==x--dist-tool goto copydist
if x%3==x--dist-tool goto copydist
if x%4==x--dist-tool goto copydist

set bootstrapflags=
if x%1==x--no-clean set bootstrapflags=--no-clean
if x%2==x--no-clean set bootstrapflags=--no-clean
if x%3==x--no-clean set bootstrapflags=--no-clean
if x%4==x--no-clean set bootstrapflags=--no-clean
if x%1==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner
if x%2==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner
if x%3==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner
if x%4==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner

:: Run dist bootstrap to complete make.bash.
:: Bootstrap installs a proper cmd/dist, built with the new toolchain.
:: Throw ours, built with Go 1.4, away after bootstrap.
.\cmd\dist\dist.exe bootstrap -a %vflag% %bootstrapflags%
if errorlevel 1 goto fail
del .\cmd\dist\dist.exe
goto end

:: DO NOT ADD ANY NEW CODE HERE.
:: The bootstrap+del above are the final step of make.bat.
:: If something must be added, add it to cmd/dist's cmdbootstrap,
:: to avoid needing three copies in three different shell languages
:: (make.bash, make.bat, make.rc).

:copydist
mkdir "%GOTOOLDIR%" 2>NUL
copy cmd\dist\dist.exe "%GOTOOLDIR%\"
goto end

:bootstrapfail
echo ERROR: Cannot find %GOROOT_BOOTSTRAP%\bin\go.exe
echo Set GOROOT_BOOTSTRAP to a working Go tree ^>= Go 1.4.

:fail
set GOBUILDFAIL=1
if x%GOBUILDEXIT%==x1 exit %GOBUILDFAIL%

:end

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

:: Environment variables that control make.bat:
::
:: GOROOT_FINAL: The expected final Go root, baked into binaries.
:: The default is the location of the Go tree during the build.
::
:: GOHOSTARCH: The architecture for host tools (compilers and
:: binaries).  Binaries of this type must be executable on the current
:: system, so the only common reason to set this is to set
:: GOHOSTARCH=386 on an amd64 machine.
::
:: GOARCH: The target architecture for installed packages and tools.
::
:: GOOS: The target operating system for installed packages and tools.
::
:: GO_GCFLAGS: Additional go tool compile arguments to use when
:: building the packages and commands.
::
:: GO_LDFLAGS: Additional go tool link arguments to use when
:: building the commands.
::
:: CGO_ENABLED: Controls cgo usage during the build. Set it to 1
:: to include all cgo related files, .c and .go file with "cgo"
:: build directive, in the build. Set it to 0 to ignore them.
::
:: CC: Command line to run to compile C code for GOHOSTARCH.
:: Default is "gcc".
::
:: CC_FOR_TARGET: Command line to run compile C code for GOARCH.
:: This is used by cgo. Default is CC.
::
:: FC: Command line to run to compile Fortran code.
:: This is used by cgo. Default is "gfortran".

@echo off

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

set GOBUILDFAIL=0

if exist make.bat goto ok
echo Must run make.bat from Go src directory.
goto fail
:ok

:: Clean old generated file that will cause problems in the build.
del /F ".\pkg\runtime\runtime_defs.go" 2>NUL

:: Set GOROOT for build.
cd ..
set GOROOT_TEMP=%CD%
set GOROOT=
cd src
set vflag=
if x%1==x-v set vflag=-v
if x%2==x-v set vflag=-v
if x%3==x-v set vflag=-v
if x%4==x-v set vflag=-v

if not exist ..\bin\tool mkdir ..\bin\tool

:: Calculating GOROOT_BOOTSTRAP
if not "x%GOROOT_BOOTSTRAP%"=="x" goto bootstrapset
for /f "tokens=*" %%g in ('where go 2^>nul') do (
	if "x%GOROOT_BOOTSTRAP%"=="x" (
		for /f "tokens=*" %%i in ('%%g env GOROOT 2^>nul') do (
			if /I not "%%i"=="%GOROOT_TEMP%" (
				set GOROOT_BOOTSTRAP=%%i
			)
		)
	)
)
if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\go1.17" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\go1.17
if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\sdk\go1.17" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\sdk\go1.17
if "x%GOROOT_BOOTSTRAP%"=="x" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\Go1.4

:bootstrapset
if not exist "%GOROOT_BOOTSTRAP%\bin\go.exe" goto bootstrapfail
set GOROOT=%GOROOT_TEMP%
set GOROOT_TEMP=

echo Building Go cmd/dist using %GOROOT_BOOTSTRAP%
if x%vflag==x-v echo cmd/dist
setlocal
set GOROOT=%GOROOT_BOOTSTRAP%
set GOOS=
set GOARCH=
set GOBIN=
set GOEXPERIMENT=
set GO111MODULE=off
set GOENV=off
set GOFLAGS=
"%GOROOT_BOOTSTRAP%\bin\go.exe" build -o cmd\dist\dist.exe .\cmd\dist
endlocal
if errorlevel 1 goto fail
.\cmd\dist\dist.exe env -w -p >env.bat
if errorlevel 1 goto fail
call .\env.bat
del env.bat
if x%vflag==x-v echo.

if x%1==x--dist-tool goto copydist
if x%2==x--dist-tool goto copydist
if x%3==x--dist-tool goto copydist
if x%4==x--dist-tool goto copydist

set bootstrapflags=
if x%1==x--no-clean set bootstrapflags=--no-clean
if x%2==x--no-clean set bootstrapflags=--no-clean
if x%3==x--no-clean set bootstrapflags=--no-clean
if x%4==x--no-clean set bootstrapflags=--no-clean
if x%1==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner
if x%2==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner
if x%3==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner
if x%4==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner

:: Run dist bootstrap to complete make.bash.
:: Bootstrap installs a proper cmd/dist, built with the new toolchain.
:: Throw ours, built with Go 1.4, away after bootstrap.
.\cmd\dist\dist.exe bootstrap -a %vflag% %bootstrapflags%
if errorlevel 1 goto fail
del .\cmd\dist\dist.exe
goto end

:: DO NOT ADD ANY NEW CODE HERE.
:: The bootstrap+del above are the final step of make.bat.
:: If something must be added, add it to cmd/dist's cmdbootstrap,
:: to avoid needing three copies in three different shell languages
:: (make.bash, make.bat, make.rc).

:copydist
mkdir "%GOTOOLDIR%" 2>NUL
copy cmd\dist\dist.exe "%GOTOOLDIR%\"
goto end

:bootstrapfail
echo ERROR: Cannot find %GOROOT_BOOTSTRAP%\bin\go.exe
echo Set GOROOT_BOOTSTRAP to a working Go tree ^>= Go 1.4.

:fail
set GOBUILDFAIL=1
if x%GOBUILDEXIT%==x1 exit %GOBUILDFAIL%

:end

call env.bat with .\env.bat

make.bat: call env.bat with .\env.bat

When set NoDefaultCurrentDirectoryInExePath=1, call env.bat does not work.

Change-Id: If63b02e236079681bdadadbdebc0b39abce01219
Reviewed-on: https://go-review.googlesource.com/c/go/+/405774
TryBot-Result: Gopher Robot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Dmitri Shuralyov <d181b7fea0ec87c86ba5a890ab716db52498e3ba@google.com>
Reviewed-by: Bryan Mills <1c8aad60184261ccede67f5c63a0d2a3bf3c9ff4@google.com>
Auto-Submit: Bryan Mills <1c8aad60184261ccede67f5c63a0d2a3bf3c9ff4@google.com>
Run-TryBot: Bryan Mills <1c8aad60184261ccede67f5c63a0d2a3bf3c9ff4@google.com>


REM brand Python with conda-forge startup message
python %RECIPE_DIR%\brand_python.py
if errorlevel 1 exit 1

REM Compile python, extensions and external libraries
if "%ARCH%"=="64" (
   set PLATFORM=x64
   set VC_PATH=x64
   set BUILD_PATH=amd64
) else (
   set PLATFORM=Win32
   set VC_PATH=x86
   set BUILD_PATH=win32
)

cd PCbuild
call build.bat -e -p %PLATFORM%
if errorlevel 1 exit 1
cd ..

REM Populate the root package directory
for %%x in (python36.dll python.exe pythonw.exe) do (
    copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX%
    if errorlevel 1 exit 1
)

for %%x in (python.pdb python36.pdb pythonw.pdb) do (
    copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX%
    if errorlevel 1 exit 1
)

copy %SRC_DIR%\LICENSE %PREFIX%\LICENSE_PYTHON.txt
if errorlevel 1 exit 1

REM Populate the DLLs directory
mkdir %PREFIX%\DLLs
xcopy /s /y %SRC_DIR%\PCBuild\%BUILD_PATH%\*.pyd %PREFIX%\DLLs\
if errorlevel 1 exit 1
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\sqlite3.dll %PREFIX%\DLLs\
if errorlevel 1 exit 1
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\tcl86t.dll %PREFIX%\DLLs\
if errorlevel 1 exit 1
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\tk86t.dll %PREFIX%\DLLs\
if errorlevel 1 exit 1

copy /Y %SRC_DIR%\PC\icons\py.ico %PREFIX%\DLLs\
if errorlevel 1 exit 1
copy /Y %SRC_DIR%\PC\icons\pyc.ico %PREFIX%\DLLs\
if errorlevel 1 exit 1

REM Populate the Tools directory
mkdir %PREFIX%\Tools
xcopy /s /y /i %SRC_DIR%\Tools\demo %PREFIX%\Tools\demo
if errorlevel 1 exit 1
xcopy /s /y /i %SRC_DIR%\Tools\i18n %PREFIX%\Tools\i18n
if errorlevel 1 exit 1
xcopy /s /y /i %SRC_DIR%\Tools\parser %PREFIX%\Tools\parser
if errorlevel 1 exit 1
xcopy /s /y /i %SRC_DIR%\Tools\pynche %PREFIX%\Tools\pynche
if errorlevel 1 exit 1
xcopy /s /y /i %SRC_DIR%\Tools\scripts %PREFIX%\Tools\scripts
if errorlevel 1 exit 1

del %PREFIX%\Tools\demo\README
if errorlevel 1 exit 1
del %PREFIX%\Tools\pynche\README
if errorlevel 1 exit 1
del %PREFIX%\Tools\pynche\pynche
if errorlevel 1 exit 1
del %PREFIX%\Tools\scripts\README
if errorlevel 1 exit 1
del %PREFIX%\Tools\scripts\dutree.doc
if errorlevel 1 exit 1
del %PREFIX%\Tools\scripts\idle3
if errorlevel 1 exit 1

move /y %PREFIX%\Tools\scripts\2to3 %PREFIX%\Tools\scripts\2to3.py
if errorlevel 1 exit 1
move /y %PREFIX%\Tools\scripts\pydoc3 %PREFIX%\Tools\scripts\pydoc3.py
if errorlevel 1 exit 1
move /y %PREFIX%\Tools\scripts\pyvenv %PREFIX%\Tools\scripts\pyvenv.py
if errorlevel 1 exit 1

REM Populate the tcl directory
if "%ARCH%"=="64" (
   xcopy /s /y /i %SRC_DIR%\externals\tcltk64\lib %PREFIX%\tcl
   if errorlevel 1 exit 1
) else (
   xcopy /s /y /i %SRC_DIR%\externals\tcltk\lib %PREFIX%\tcl
   if errorlevel 1 exit 1
)

REM Populate the include directory
xcopy /s /y %SRC_DIR%\Include %PREFIX%\include\
if errorlevel 1 exit 1

copy /Y %SRC_DIR%\PC\pyconfig.h %PREFIX%\include\
if errorlevel 1 exit 1

REM Populate the Scripts directory
IF NOT exist %SCRIPTS% (mkdir %SCRIPTS%)
if errorlevel 1 exit 1

for %%x in (idle pydoc) do (
    copy /Y %SRC_DIR%\Tools\scripts\%%x3 %SCRIPTS%\%%x
    if errorlevel 1 exit 1
)

copy /Y %SRC_DIR%\Tools\scripts\2to3 %SCRIPTS%
if errorlevel 1 exit 1

REM Populate the libs directory
mkdir %PREFIX%\libs
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python36.lib %PREFIX%\libs\
if errorlevel 1 exit 1
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python3.lib %PREFIX%\libs\
if errorlevel 1 exit 1
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter.lib %PREFIX%\libs\
if errorlevel 1 exit 1

REM Populate the Lib directory
del %PREFIX%\libs\libpython*.a
xcopy /s /y %SRC_DIR%\Lib %PREFIX%\Lib\
if errorlevel 1 exit 1

REM bytecode compile the standard library

rd /s /q %STDLIB_DIR%\lib2to3\tests\
if errorlevel 1 exit 1

%PYTHON% -Wi %STDLIB_DIR%\compileall.py -f -q -x "bad_coding|badsyntax|py2_" %STDLIB_DIR%
if errorlevel 1 exit 1

REM Pickle lib2to3 Grammar
%PYTHON% -m lib2to3 --help

REM brand Python with conda-forge startup message
python %RECIPE_DIR%\brand_python.py
if errorlevel 1 exit 1

REM Compile python, extensions and external libraries
if "%ARCH%"=="64" (
   set PLATFORM=x64
   set VC_PATH=x64
   set BUILD_PATH=amd64
) else (
   set PLATFORM=Win32
   set VC_PATH=x86
   set BUILD_PATH=win32
)

cd PCbuild
call build.bat -e -p %PLATFORM%
if errorlevel 1 exit 1
cd ..

REM Populate the root package directory
for %%x in (python36.dll python.exe pythonw.exe) do (
    copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX%
    if errorlevel 1 exit 1
)

for %%x in (python.pdb python36.pdb pythonw.pdb) do (
    copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX%
    if errorlevel 1 exit 1
)

copy %SRC_DIR%\LICENSE %PREFIX%\LICENSE_PYTHON.txt
if errorlevel 1 exit 1

REM Populate the DLLs directory
mkdir %PREFIX%\DLLs
xcopy /s /y %SRC_DIR%\PCBuild\%BUILD_PATH%\*.pyd %PREFIX%\DLLs\
if errorlevel 1 exit 1
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\sqlite3.dll %PREFIX%\DLLs\
if errorlevel 1 exit 1
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\tcl86t.dll %PREFIX%\DLLs\
if errorlevel 1 exit 1
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\tk86t.dll %PREFIX%\DLLs\
if errorlevel 1 exit 1

copy /Y %SRC_DIR%\PC\icons\py.ico %PREFIX%\DLLs\
if errorlevel 1 exit 1
copy /Y %SRC_DIR%\PC\icons\pyc.ico %PREFIX%\DLLs\
if errorlevel 1 exit 1

REM Populate the Tools directory
mkdir %PREFIX%\Tools
xcopy /s /y /i %SRC_DIR%\Tools\demo %PREFIX%\Tools\demo
if errorlevel 1 exit 1
xcopy /s /y /i %SRC_DIR%\Tools\i18n %PREFIX%\Tools\i18n
if errorlevel 1 exit 1
xcopy /s /y /i %SRC_DIR%\Tools\parser %PREFIX%\Tools\parser
if errorlevel 1 exit 1
xcopy /s /y /i %SRC_DIR%\Tools\pynche %PREFIX%\Tools\pynche
if errorlevel 1 exit 1
xcopy /s /y /i %SRC_DIR%\Tools\scripts %PREFIX%\Tools\scripts
if errorlevel 1 exit 1

del %PREFIX%\Tools\demo\README
if errorlevel 1 exit 1
del %PREFIX%\Tools\pynche\README
if errorlevel 1 exit 1
del %PREFIX%\Tools\pynche\pynche
if errorlevel 1 exit 1
del %PREFIX%\Tools\scripts\README
if errorlevel 1 exit 1
del %PREFIX%\Tools\scripts\dutree.doc
if errorlevel 1 exit 1
del %PREFIX%\Tools\scripts\idle3
if errorlevel 1 exit 1

move /y %PREFIX%\Tools\scripts\2to3 %PREFIX%\Tools\scripts\2to3.py
if errorlevel 1 exit 1
move /y %PREFIX%\Tools\scripts\pydoc3 %PREFIX%\Tools\scripts\pydoc3.py
if errorlevel 1 exit 1
move /y %PREFIX%\Tools\scripts\pyvenv %PREFIX%\Tools\scripts\pyvenv.py
if errorlevel 1 exit 1

REM Populate the tcl directory
if "%ARCH%"=="64" (
   xcopy /s /y /i %SRC_DIR%\externals\tcltk64\lib %PREFIX%\tcl
   if errorlevel 1 exit 1
) else (
   xcopy /s /y /i %SRC_DIR%\externals\tcltk\lib %PREFIX%\tcl
   if errorlevel 1 exit 1
)

REM Populate the include directory
xcopy /s /y %SRC_DIR%\Include %PREFIX%\include\
if errorlevel 1 exit 1

copy /Y %SRC_DIR%\PC\pyconfig.h %PREFIX%\include\
if errorlevel 1 exit 1

REM Populate the Scripts directory
IF NOT exist %SCRIPTS% (mkdir %SCRIPTS%)
if errorlevel 1 exit 1

for %%x in (idle pydoc) do (
    copy /Y %SRC_DIR%\Tools\scripts\%%x3 %SCRIPTS%\%%x
    if errorlevel 1 exit 1
)

copy /Y %SRC_DIR%\Tools\scripts\2to3 %SCRIPTS%
if errorlevel 1 exit 1

REM Populate the libs directory
mkdir %PREFIX%\libs
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python36.lib %PREFIX%\libs\
if errorlevel 1 exit 1
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python3.lib %PREFIX%\libs\
if errorlevel 1 exit 1
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter.lib %PREFIX%\libs\
if errorlevel 1 exit 1

REM Populate the Lib directory
del %PREFIX%\libs\libpython*.a
xcopy /s /y %SRC_DIR%\Lib %PREFIX%\Lib\
if errorlevel 1 exit 1
REM Remove test data and ensurepip stubs to save space
rd /s /q %PREFIX%\Lib\test
if errorlevel 1 exit 1
rd /s /q %PREFIX%\Lib\ensurepip
if errorlevel 1 exit 1

REM bytecode compile the standard library

rd /s /q %STDLIB_DIR%\lib2to3\tests\
if errorlevel 1 exit 1

%PYTHON% -Wi %STDLIB_DIR%\compileall.py -f -q -x "bad_coding|badsyntax|py2_" %STDLIB_DIR%
if errorlevel 1 exit 1

REM Pickle lib2to3 Grammar
%PYTHON% -m lib2to3 --help

Remove test data and ensurepip in Windows build


SET PYJNIUS_SHARE=%PREFIX%\share\pyjnius
SET JDK_HOME=%JAVA_HOME%
mkdir "%PYJNIUS_SHARE%"

call ant all
if errorlevel 1 exit 1
"%PYTHON%" setup.py build_ext --inplace -f
if errorlevel 1 exit 1

:: run tests
cd tests
if errorlevel 1 exit 1
set CLASSPATH=..\build\test-classes;..\build\classes
set PYTHONPATH=..
:: TODO
:: ignore tests for now
:: will need to fix this in the future!
nostests -v
if errorlevel 1 exit 1

:: install and copy
cd ..
pip install --no-deps .
if errorlevel 1 exit 1
copy build\pyjnius.jar "%PYJNIUS_SHARE%"
if errorlevel 1 exit 1

:: ensure that PYJNIUS_JAR is set correctly
mkdir "%PREFIX%\etc\conda\activate.d"
echo SET "PYJNIUS_JAR_BACKUP=%%PYJNIUS_JAR%%" > "%PREFIX%\etc\conda\activate.d\pyjnius.bat"
echo SET "PYJNIUS_JAR=%%CONDA_PREFIX%%\share\pyjnius\pyjnius.jar" >> "%PREFIX%\etc\conda\activate.d\pyjnius.bat"
echo SET "JDK_HOME_BACKUP=%%JDK_HOME%%" >> "%PREFIX%\etc\conda\activate.d\pyjnius.bat"
echo SET "JDK_HOME=%%JAVA_HOME%%" >> "%PREFIX%\etc\conda\activate.d\pyjnius.bat"
mkdir "%PREFIX%\etc\conda\deactivate.d"
echo SET "PYJNIUS_JAR=%%PYJNIUS_JAR_BACKUP%%" > "%PREFIX%\etc\conda\deactivate.d\pyjnius.bat"
echo SET "PYJNIUS_JAR_BACKUP=''" >> "%PREFIX%\etc\conda\deactivate.d\pyjnius.bat"
echo SET "JDK_HOME=%%JDK_HOME_BACKUP%%" >> "%PREFIX%\etc\conda\deactivate.d\pyjnius.bat"
echo SET "JDK_HOME_BACKUP=''" >> "%PREFIX%\etc\conda\deactivate.d\pyjnius.bat"

SET PYJNIUS_SHARE=%PREFIX%\share\pyjnius
SET JDK_HOME=%JAVA_HOME%
mkdir "%PYJNIUS_SHARE%"

call ant all
if errorlevel 1 exit 1
"%PYTHON%" setup.py build_ext --inplace -f
if errorlevel 1 exit 1

:: run tests
cd tests
if errorlevel 1 exit 1
set CLASSPATH=..\build\test-classes;..\build\classes
set PYTHONPATH=..
:: TODO
:: ignore tests for now
:: will need to fix this in the future!
nosetests -v
if errorlevel 1 exit 1

:: install and copy
cd ..
pip install --no-deps .
if errorlevel 1 exit 1
copy build\pyjnius.jar "%PYJNIUS_SHARE%"
if errorlevel 1 exit 1

:: ensure that PYJNIUS_JAR is set correctly
mkdir "%PREFIX%\etc\conda\activate.d"
echo SET "PYJNIUS_JAR_BACKUP=%%PYJNIUS_JAR%%" > "%PREFIX%\etc\conda\activate.d\pyjnius.bat"
echo SET "PYJNIUS_JAR=%%CONDA_PREFIX%%\share\pyjnius\pyjnius.jar" >> "%PREFIX%\etc\conda\activate.d\pyjnius.bat"
echo SET "JDK_HOME_BACKUP=%%JDK_HOME%%" >> "%PREFIX%\etc\conda\activate.d\pyjnius.bat"
echo SET "JDK_HOME=%%JAVA_HOME%%" >> "%PREFIX%\etc\conda\activate.d\pyjnius.bat"
mkdir "%PREFIX%\etc\conda\deactivate.d"
echo SET "PYJNIUS_JAR=%%PYJNIUS_JAR_BACKUP%%" > "%PREFIX%\etc\conda\deactivate.d\pyjnius.bat"
echo SET "PYJNIUS_JAR_BACKUP=''" >> "%PREFIX%\etc\conda\deactivate.d\pyjnius.bat"
echo SET "JDK_HOME=%%JDK_HOME_BACKUP%%" >> "%PREFIX%\etc\conda\deactivate.d\pyjnius.bat"
echo SET "JDK_HOME_BACKUP=''" >> "%PREFIX%\etc\conda\deactivate.d\pyjnius.bat"

Fix nosetests typo

Fix nosetests typo


"%R%" CMD INSTALL --build . %R_ARGS%
IF %ERRORLEVEL% NEQ 0 exit /B 1

make sure we have no windows line endings


echo ON

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

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

echo ON

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

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

Update bld.bat

Update bld.bat


@echo off
call "GetDependencies.bat"
echo
START CMD /C "dnx -p Adaptive.ReactiveTrader.Server.ReferenceDataRead dev"
START CMD /C "dnx -p Adaptive.ReactiveTrader.Server.Pricing dev"
START CMD /C "dnx -p Adaptive.ReactiveTrader.Server.TradeExecution dev"
START CMD /C "dnx -p Adaptive.ReactiveTrader.Server.Blotter dev"
START CMD /C "dnx -p Adaptive.ReactiveTrader.Server.Analytics dev"

START CMD /C "dotnet run -p Adaptive.ReactiveTrader.Server.ReferenceDataRead config.dev.json"
START CMD /C "dotnet run -p Adaptive.ReactiveTrader.Server.Pricing config.dev.json"
START CMD /C "dotnet run -p Adaptive.ReactiveTrader.Server.TradeExecution config.dev.json"
START CMD /C "dotnet run -p Adaptive.ReactiveTrader.Server.Blotter config.dev.json"
START CMD /C "dotnet run -p Adaptive.ReactiveTrader.Server.Analytics config.dev.json"

update start services bat

update start services bat


call setExampleEnv.bat

set XAP_LOOKUP_GROUPS=HK

rem PLEASE replace localhost with relevant HOSTNAME in production
set XAP_LOOKUP_LOCATORS=localhost:4166

set EXT_JAVA_OPTIONS=%EXT_JAVA_OPTIONS% -Dcom.sun.jini.reggie.initialUnicastDiscoveryPort=4166
set EXT_JAVA_OPTIONS=%EXT_JAVA_OPTIONS% -Dcom.gigaspaces.system.registryPort=10098
set EXT_JAVA_OPTIONS=%EXT_JAVA_OPTIONS% -Dcom.gigaspaces.start.httpPort=9813
set EXT_JAVA_OPTIONS=%EXT_JAVA_OPTIONS% -Dcom.gs.zones=HK

rem Modify this as needed
set GSC_JAVA_OPTIONS=-Xmx128m

%GS_HOME%\bin\gs-agent.bat gsa.gsm 1 gsa.gsc 2

call setExampleEnv.bat

set XAP_LOOKUP_GROUPS=HK

rem PLEASE replace localhost with relevant HOSTNAME in production
set XAP_LOOKUP_LOCATORS=localhost:4166

set EXT_JAVA_OPTIONS=%EXT_JAVA_OPTIONS% -Dcom.sun.jini.reggie.initialUnicastDiscoveryPort=4166
set EXT_JAVA_OPTIONS=%EXT_JAVA_OPTIONS% -Dcom.gigaspaces.system.registryPort=10098
set EXT_JAVA_OPTIONS=%EXT_JAVA_OPTIONS% -Dcom.gigaspaces.start.httpPort=9813
set EXT_JAVA_OPTIONS=%EXT_JAVA_OPTIONS% -Dcom.gs.zones=HK

rem Modify this as needed
set XAP_GSC_OPTIONS=-Xmx128m

%GS_HOME%\bin\gs-agent.bat gsa.gsm 1 gsa.gsc 2

Update startAgent-HK.bat

Update startAgent-HK.bat


::
:: Microsoft Azure SDK for Net - Generate library code
:: Copyright (C) Microsoft Corporation. All Rights Reserved.
::

@echo off
setlocal
set autoRestVersion=0.17.0-Nightly20160629
set source=-Source https://www.myget.org/F/autorest/api/v2

set resSpecFile="https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-resources/resources/2016-07-01/swagger/resources.json"
set lockSpecFile="https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-resources/locks/2015-01-01/swagger/locks.json"
set featureSpecFile="https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-resources/features/2015-12-01/swagger/features.json"
set subscriptionSpecFile="https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-resources/subscriptions/2016-06-01/swagger/subscriptions.json"
set policySpecFile="https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-resources/policy/2016-04-01/swagger/policy.json"

set repoRoot=%~dp0..\..\..\..
set generateFolder=%~dp0Generated

if exist %generateFolder% rd /S /Q  %generateFolder%

call "%repoRoot%\tools\autorest.gen.cmd" %resSpecFile% Microsoft.Azure.Management.ResourceManager %autoRestVersion% %generateFolder%
call "%repoRoot%\tools\autorest.gen.cmd" %lockSpecFile% Microsoft.Azure.Management.ResourceManager %autoRestVersion% %generateFolder%
call "%repoRoot%\tools\autorest.gen.cmd" %featureSpecFile% Microsoft.Azure.Management.ResourceManager %autoRestVersion% %generateFolder%
call "%repoRoot%\tools\autorest.gen.cmd" %subscriptionSpecFile% Microsoft.Azure.Management.ResourceManager %autoRestVersion% %generateFolder%
call "%repoRoot%\tools\autorest.gen.cmd" %policySpecFile% Microsoft.Azure.Management.ResourceManager %autoRestVersion% %generateFolder%

endlocal

::
:: Microsoft Azure SDK for Net - Generate library code
:: Copyright (C) Microsoft Corporation. All Rights Reserved.
::

@echo off
setlocal
set autoRestVersion=0.17.0-Nightly20160629
set source=-Source https://www.myget.org/F/autorest/api/v2

set resSpecFile="https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-resources/resources/2016-09-01/swagger/resources.json"
set lockSpecFile="https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-resources/locks/2015-01-01/swagger/locks.json"
set featureSpecFile="https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-resources/features/2015-12-01/swagger/features.json"
set subscriptionSpecFile="https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-resources/subscriptions/2016-06-01/swagger/subscriptions.json"
set policySpecFile="https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-resources/policy/2016-04-01/swagger/policy.json"

set repoRoot=%~dp0..\..\..\..
set generateFolder=%~dp0Generated

if exist %generateFolder% rd /S /Q  %generateFolder%

call "%repoRoot%\tools\autorest.gen.cmd" %resSpecFile% Microsoft.Azure.Management.ResourceManager %autoRestVersion% %generateFolder%
call "%repoRoot%\tools\autorest.gen.cmd" %lockSpecFile% Microsoft.Azure.Management.ResourceManager %autoRestVersion% %generateFolder%
call "%repoRoot%\tools\autorest.gen.cmd" %featureSpecFile% Microsoft.Azure.Management.ResourceManager %autoRestVersion% %generateFolder%
call "%repoRoot%\tools\autorest.gen.cmd" %subscriptionSpecFile% Microsoft.Azure.Management.ResourceManager %autoRestVersion% %generateFolder%
call "%repoRoot%\tools\autorest.gen.cmd" %policySpecFile% Microsoft.Azure.Management.ResourceManager %autoRestVersion% %generateFolder%

endlocal

Update generate.cmd to use the latest resources spec


Create back_zip.bat

Create back_zip.bat


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

:: Accepts one argument, the system's architecture (amd64 or i386).

@echo off

set DEVICE_NAME=outline-tap0

:: Check whether the device already exists.
netsh interface show interface name=%DEVICE_NAME% >nul
if %errorlevel% equ 0 (
  echo %DEVICE_NAME% already exists.
  exit /b
)

:: Add the device, recording the names of devices before and after to help
:: us find the name of the new device:
::  - While we could limit the search to devices having ServiceName=tap0901,
::    that will cause wmic to output just "no instances available" when there
::    are no other TAP devices present, messing up the diff.
::  - Pipe wmic output through find to suppress blank lines, which also mess up
::    the diff.
set BEFORE_DEVICES=%tmp%\outlineinstaller-tap-devices-before.txt
set AFTER_DEVICES=%tmp%\outlineinstaller-tap-devices-after.txt
set DEVICE_DIFF=%tmp%\outlineinstaller-new-tap-device.txt
wmic nic get netconnectionid /format:list | findstr "=" > %BEFORE_DEVICES%
tap-windows6\%1\tapinstall install tap-windows6\%1\OemVista.inf tap0901
if %errorlevel% neq 0 (
  echo Could not create TAP device.
  exit /b 1
)
wmic nic get netconnectionid /format:list | findstr "=" > %AFTER_DEVICES%

:: Find the name of the new device:
::  - Use a temp file to save/load the result to avoid escaping issues.
::  - Pipe input from /dev/null to prevent Powershell hanging, waiting for EOF.
powershell "(compare-object (cat %BEFORE_DEVICES%) (cat %AFTER_DEVICES%) | format-wide InputObject | out-string).split(\"=\")[1].trim()" > %DEVICE_DIFF% <nul
set /p NEW_DEVICE= < %DEVICE_DIFF%
echo New TAP device name: %NEW_DEVICE%

:: Rename the device.
netsh interface set interface name = "%NEW_DEVICE%" newname = "%DEVICE_NAME%"
if %errorlevel% neq 0 (
  echo Could not rename TAP device.
  exit /b 1
)

:: Give the device an IP address.
:: 10.0.85.x is a guess which we hope will work for most users (Docker for
:: Windows uses 10.0.75.x by default): if the address is already in use the
:: script will fail and the installer will show an error message to the user.
:: TODO: Actually search the system for an unused subnet or make the subnet
::       configurable in the Outline client.
netsh interface ip set address %DEVICE_NAME% static 10.0.85.2 255.255.255.0
if %errorlevel% neq 0 (
  echo Could not set TAP device subnet.
  exit /b 1
)

:: Windows has no system-wide DNS server; each network device can have its
:: "own" set of DNS servers. Windows seems to use the DNS server(s) of the
:: network device associated with the default gateway. This is good for us
:: as it means we do not have to modify the DNS settings of any other network
:: device in the system. Configure with OpenDNS and Dyn resolvers.
netsh interface ip set dnsservers %DEVICE_NAME% static address=208.67.222.222
if %errorlevel% neq 0 (
  echo Could not configure TAP device primary DNS.
  exit /b 1
)
netsh interface ip add dnsservers %DEVICE_NAME% 216.146.35.35 index=2
if %errorlevel% neq 0 (
  echo Could not configure TAP device secondary DNS.
  exit /b 1
)

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

:: Accepts one argument, the system's architecture (amd64 or i386).

@echo off

set DEVICE_NAME=outline-tap0

:: Check whether the device already exists.
netsh interface show interface name=%DEVICE_NAME% >nul
if %errorlevel% equ 0 (
  echo %DEVICE_NAME% already exists.
  exit /b
)

:: Add the device, recording the names of devices before and after to help
:: us find the name of the new device.
::
:: Note:
::  - While we could limit the search to devices having ServiceName=tap0901,
::    that will cause wmic to output just "no instances available" when there
::    are no other TAP devices present, messing up the diff.
::  - We do not use findstr, etc., to strip blank lines because those ancient tools
::    typically don't understand/output non-Latin characters (wmic *does*, even on
::    Windows 7).
set BEFORE_DEVICES=%tmp%\outlineinstaller-tap-devices-before.txt
set AFTER_DEVICES=%tmp%\outlineinstaller-tap-devices-after.txt
wmic nic get netconnectionid /format:list > %BEFORE_DEVICES%
tap-windows6\%1\tapinstall install tap-windows6\%1\OemVista.inf tap0901
if %errorlevel% neq 0 (
  echo Could not create TAP device.
  exit /b 1
)
wmic nic get netconnectionid /format:list > %AFTER_DEVICES%

:: Find the name of the new device and rename it.
::
:: Obviously, this command is a beast; roughly what it does, in this order, is:
::  - perform a diff on the before and after text files
::  - split the left column, InputObject, on the equals (=) sign
::  - remove leading/trailing space and blank lines with trim()
::  - store the result in NEW_DEVICE
::  - print NEW_DEVICE, for debugging (though non-Latin characters may appear as ?)
::  - invoke netsh
::
:: Running all this in one go helps reduce the need to deal with temporary
:: files and the character encoding headaches that follow.
::
:: Note that we pipe input from /dev/null to prevent Powershell hanging forever
:: waiting on EOF.
powershell "(compare-object (cat %BEFORE_DEVICES%) (cat %AFTER_DEVICES%) | format-wide InputObject | out-string).split(\"=\")[1].trim() | set-variable NEW_DEVICE; write-host \"New TAP device name: ${NEW_DEVICE}\"; netsh interface set interface name = \"${NEW_DEVICE}\" newname = \"%DEVICE_NAME%\"" <nul
if %errorlevel% neq 0 (
  echo Could not rename TAP device.
  exit /b 1
)

:: Give the device an IP address.
:: 10.0.85.x is a guess which we hope will work for most users (Docker for
:: Windows uses 10.0.75.x by default): if the address is already in use the
:: script will fail and the installer will show an error message to the user.
:: TODO: Actually search the system for an unused subnet or make the subnet
::       configurable in the Outline client.
netsh interface ip set address %DEVICE_NAME% static 10.0.85.2 255.255.255.0
if %errorlevel% neq 0 (
  echo Could not set TAP device subnet.
  exit /b 1
)

:: Windows has no system-wide DNS server; each network device can have its
:: "own" set of DNS servers. Windows seems to use the DNS server(s) of the
:: network device associated with the default gateway. This is good for us
:: as it means we do not have to modify the DNS settings of any other network
:: device in the system. Configure with OpenDNS and Dyn resolvers.
netsh interface ip set dnsservers %DEVICE_NAME% static address=208.67.222.222
if %errorlevel% neq 0 (
  echo Could not configure TAP device primary DNS.
  exit /b 1
)
netsh interface ip add dnsservers %DEVICE_NAME% 216.146.35.35 index=2
if %errorlevel% neq 0 (
  echo Could not configure TAP device secondary DNS.
  exit /b 1
)

make TAP device rename work with non-latin characters (#301)


@echo off
if exist "%VS140COMNTOOLS%" (
	set VCVARS="%VS140COMNTOOLS%..\..\VC\bin\"
	goto build
	)
else (goto missing)

:build

@set ENV32="%VCVARS%vcvars32.bat"
@set ENV64="%VCVARS%amd64\vcvars64.bat"

call "%ENV32%"
echo Swtich to x86 build env
cd luajit\src
call msvcbuild.bat
copy /Y lua51.dll ..\..\prebuilt\x86\slua.dll
cd ..\..

call "%ENV64%"
echo Swtich to x64 build env
cd luajit\src
call msvcbuild.bat
copy /Y lua51.dll ..\..\prebuilt\x64\slua.dll
cd ..\..

goto :eof

:missing
echo Can't find Visual Studio 2015.
goto :eof

add new win compile script

add new win compile script


call build.bat
call gui.bat
call server.bat

change runme.bat

change runme.bat


@echo Off
set config=%1
if "%config%" == "" (
   set config=Release
)

set version=1.0.0
if not "%PackageVersion%" == "" (
   set version=%PackageVersion%
)

set nuget=
if "%nuget%" == "" (
	set nuget=nuget
)

%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild src\OpinionatedCache.sln /p:Configuration="%config%" /m /v:M /fl /flp:LogFile=msbuild.log;Verbosity=diag /nr:false

mkdir Build
mkdir Build\lib
mkdir Build\lib\net40

%nuget% pack "src\OpinionatedCache.nuspec" -NoPackageAnalysis -verbosity detailed -o Build -Version %version% -p Configuration="%config%"

@echo Off
set config=%1
if "%config%" == "" (
   set config=Release
)

set version=1.0.0
if not "%PackageVersion%" == "" (
   set version=%PackageVersion%
)

set nuget=
if "%nuget%" == "" (
	set nuget=nuget
)

%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild src\OpinionatedCache.sln /p:Configuration="%config%" /m /v:M /fl /flp:LogFile=msbuild.log;Verbosity=diag /nr:false

mkdir Build
mkdir Build\lib
mkdir Build\lib\net40

%nuget% pack "src\opinionated-cache.nuspec" -NoPackageAnalysis -verbosity detailed -o Build -Version %version% -p Configuration="%config%"

Update build.bat

Update build.bat

Fixed name of output package.


IF NOT "%APPVEYOR_REPO_BRANCH%"=="master" exit /b 0
IF "%ANACONDA_USERNAME%"=="" exit /b 0
IF "%ANACONDA_PASSWORD%"=="" exit /b 0
CALL conda install -n root anaconda-client
IF %errorlevel% neq 0 exit /b %errorlevel%
CALL anaconda login --username "%ANACONDA_USERNAME%" --password "%ANACONDA_PASSWORD%" --hostname "AppVeyor%APPVEYOR_BUILD_NUMBER%"
IF %errorlevel% neq 0 exit /b %errorlevel%
FOR /f %%i in ('conda build python-pkgtk --output') DO (set CONDA_FILE=%%i)
set errorlevel_backup=%errorlevel%
set errorlevel=0
CALL anaconda upload --user statiskit %CONDA_FILE% || echo "upload failed"
set errorlevel=%errorlevel_backup%
CALL anaconda logout
IF %errorlevel% neq 0 exit /b %errorlevel%

Create upload.bat

Create upload.bat


@echo off
rem emsdk activate latest
emcc -O2 src/x-ray-kernel.cpp -o x-ray-kernel.js -s EXPORTED_FUNCTIONS="['_newScene']" -s TOTAL_MEMORY=167772160 -s USE_PTHREADS=1 -s SIMD=1

@echo off
rem emsdk activate latest
emcc -O2 src/x-ray-kernel.cpp -o bin/x-ray-kernel.js -s EXPORTED_FUNCTIONS="['_newScene']" -s TOTAL_MEMORY=167772160 -s USE_PTHREADS=1 -s SIMD=1

build file updated

build file updated


@echo off

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

set msbuildflags=/maxcpucount
set _ngenexe="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ngen.exe"
if not exist %_ngenexe% echo Note: Could not find ngen.exe.

set REGEXE32BIT=reg.exe
if not "%OSARCH%"=="x86" set REGEXE32BIT=%WINDIR%\syswow64\reg.exe

::See https://stackoverflow.com/a/17113667/111575 on 2^>NUL for suppressing the error "ERROR: The system was unable to find the specified registry key or value." from reg.exe, this fixes #3619
                                FOR /F "tokens=2* delims=	 " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\NETFXSDK\4.6.2\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL')  DO SET WINSDKNETFXTOOLS_x86=%%B
if "%WINSDKNETFXTOOLS_x86%"=="" FOR /F "tokens=2* delims=	 " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\NETFXSDK\4.6.1\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL')  DO SET WINSDKNETFXTOOLS_x86=%%B
if "%WINSDKNETFXTOOLS_x86%"=="" FOR /F "tokens=2* delims=	 " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\NETFXSDK\4.6\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL')  DO SET WINSDKNETFXTOOLS_x86=%%B
if "%WINSDKNETFXTOOLS_x86%"=="" FOR /F "tokens=2* delims=	 " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v8.1A\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL') DO SET WINSDKNETFXTOOLS_x86=%%B
if "%WINSDKNETFXTOOLS_x86%"=="" FOR /F "tokens=2* delims=	 " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL') DO SET WINSDKNETFXTOOLS_x86=%%B
if "%WINSDKNETFXTOOLS_x86%"=="" FOR /F "tokens=2* delims=	 " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL')  DO SET WINSDKNETFXTOOLS_x86=%%B
if "%WINSDKNETFXTOOLS_x86%"=="" FOR /F "tokens=2* delims=	 " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL') DO SET WINSDKNETFXTOOLS_x86=%%B

set WINSDKNETFXTOOLS_x64=%WINSDKNETFXTOOLS_x86%x64\

set SN32="%WINSDKNETFXTOOLS_x86%sn.exe"
set SN64="%WINSDKNETFXTOOLS_x64%sn.exe"

rem Disable strong-name validation for binaries that are delay-signed with the microsoft key
echo %SN32% -q -Vr *,b03f5f7f11d50a3a
%SN32% -q -Vr *,b03f5f7f11d50a3a

if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
    echo %SN64% -q -Vr *,b03f5f7f11d50a3a
    %SN64% -q -Vr *,b03f5f7f11d50a3a
)

::Build

%_ngenexe% install .\.nuget\NuGet.exe

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

%_ngenexe% install packages\FSharp.Compiler.Tools.4.1.27\tools\fsc.exe

set BUILD_NET40=1
set TEST_NET40_COREUNIT_SUITE=1

%_msbuildexe% src\fsharp-proto-build.proj /p:Configuration=Proto
@if ERRORLEVEL 1 echo Error: "%_msbuildexe% src\fsharp-proto-build.proj" failed  && goto :failure

%_ngenexe% install Proto\net40\bin\fsc-proto.exe

%_msbuildexe% %msbuildflags% build-everything.proj /p:TargetDotnetProfile=net40 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: "%_msbuildexe% %msbuildflags% src\fsharp-library-build.proj /p:TargetDotnetProfile=net40 /p:Configuration=Release" failed  && goto :failure

@echo "Finished"
goto :eof

:failure
exit /b 1

@echo off

:: Check prerequisites
if exist "%VS150COMNTOOLS%\..\..\MSBuild\15.0\Bin\MSBuild.exe" (
    set _msbuildexe="%VS150COMNTOOLS%\..\..\MSBuild\15.0\Bin\MSBuild.exe"
    goto :havemsbuild
)
if exist "%ProgramFiles(x86)%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe" (
    set _msbuildexe="%ProgramFiles(x86)%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe"
    goto :havemsbuild
)
if exist "%ProgramFiles%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe" (
    set _msbuildexe="%ProgramFiles%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe"
    goto :havemsbuild
)
echo Error: Could not find MSBuild.exe. && goto :failure
goto :eof

:havemsbuild

echo "_msbuildexe=%_msbuildexe%"
set msbuildflags=/maxcpucount
set _ngenexe="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ngen.exe"
if not exist %_ngenexe% echo Note: Could not find ngen.exe.

set REGEXE32BIT=reg.exe
if not "%OSARCH%"=="x86" set REGEXE32BIT=%WINDIR%\syswow64\reg.exe

::See https://stackoverflow.com/a/17113667/111575 on 2^>NUL for suppressing the error "ERROR: The system was unable to find the specified registry key or value." from reg.exe, this fixes #3619
                                FOR /F "tokens=2* delims=	 " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\NETFXSDK\4.6.2\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL')  DO SET WINSDKNETFXTOOLS_x86=%%B
if "%WINSDKNETFXTOOLS_x86%"=="" FOR /F "tokens=2* delims=	 " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\NETFXSDK\4.6.1\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL')  DO SET WINSDKNETFXTOOLS_x86=%%B
if "%WINSDKNETFXTOOLS_x86%"=="" FOR /F "tokens=2* delims=	 " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\NETFXSDK\4.6\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL')  DO SET WINSDKNETFXTOOLS_x86=%%B
if "%WINSDKNETFXTOOLS_x86%"=="" FOR /F "tokens=2* delims=	 " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v8.1A\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL') DO SET WINSDKNETFXTOOLS_x86=%%B
if "%WINSDKNETFXTOOLS_x86%"=="" FOR /F "tokens=2* delims=	 " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL') DO SET WINSDKNETFXTOOLS_x86=%%B
if "%WINSDKNETFXTOOLS_x86%"=="" FOR /F "tokens=2* delims=	 " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL')  DO SET WINSDKNETFXTOOLS_x86=%%B
if "%WINSDKNETFXTOOLS_x86%"=="" FOR /F "tokens=2* delims=	 " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL') DO SET WINSDKNETFXTOOLS_x86=%%B

set WINSDKNETFXTOOLS_x64=%WINSDKNETFXTOOLS_x86%x64\

set SN32="%WINSDKNETFXTOOLS_x86%sn.exe"
set SN64="%WINSDKNETFXTOOLS_x64%sn.exe"

rem Disable strong-name validation for binaries that are delay-signed with the microsoft key
echo %SN32% -q -Vr *,b03f5f7f11d50a3a
%SN32% -q -Vr *,b03f5f7f11d50a3a

if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
    echo %SN64% -q -Vr *,b03f5f7f11d50a3a
    %SN64% -q -Vr *,b03f5f7f11d50a3a
)

::Build

%_ngenexe% install .\.nuget\NuGet.exe

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

%_ngenexe% install packages\FSharp.Compiler.Tools.4.1.27\tools\fsc.exe

set BUILD_NET40=1
set TEST_NET40_COREUNIT_SUITE=1

%_msbuildexe% src\fsharp-proto-build.proj /p:Configuration=Proto
@if ERRORLEVEL 1 echo Error: "%_msbuildexe% src\fsharp-proto-build.proj" failed  && goto :failure

%_ngenexe% install Proto\net40\bin\fsc-proto.exe

%_msbuildexe% %msbuildflags% build-everything.proj /p:TargetDotnetProfile=net40 /p:Configuration=Release
@if ERRORLEVEL 1 echo Error: "%_msbuildexe% %msbuildflags% src\fsharp-library-build.proj /p:TargetDotnetProfile=net40 /p:Configuration=Release" failed  && goto :failure

@echo "Finished"
goto :eof

:failure
exit /b 1

fix build on windows

fix build on windows


@echo off

if exist bootstrap.cmd (
  call bootstrap.cmd
  if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
)

REM cls
set nuget_packages=packages
set paket_packages=packages

set nuget_path=NuGet.CommandLine/tools/NuGet.exe
set fake_path=FAKE/tools/FAKE.exe

REM resore paket build dependencies
if exist ".paket/paket.bootstrapper.exe" (
  echo Bootstrap paket
  .paket\paket.bootstrapper.exe %PAKET_VERSION%
  if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%

  echo restore paket packages
  .paket\paket.exe restore
  if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%

  set fake=%paket_packages%/%fake_path%
  set nuget=%paket_packages%/%nuget_path%
)
REM Download NuGet (if not already available because of paket)
if not exist %nuget% (
  if exist downloadNuget.fsx (
    if not exist %nuget_packages%/%nuget_path% (
      echo Bootstrap Nuget
      "C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0\fsi.exe" downloadNuget.fsx
      if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
    )
    set nuget=%nuget_packages%/%nuget_path%
  )
)
REM Restore Nuget build dependencies
if exist packages.config (
  if exist %nuget% (
    echo Resolve build dependencies
    "%nuget%" "install" "packages.config" "-OutputDirectory" %nuget_packages% "-ExcludeVersion"
    if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
  ) else (
    echo NuGet build dependencies file found but no NuGet.exe could be found, either add downloadNuget.fsx or add Nuget.Commandline as paket dependency!.
  )
)

REM FAKE could be available as nuget dependency
if not exist %fake% (
  set fake=%nuget_packages%/%fake_path%
  if not exist %fake% (
    echo Could not find FAKE in nuget or paket dependencies!
    exit /b 1
  )
)

echo start FAKE for the rest of the build procedure...
"%fake%" %* --fsiargs -d:WIN64 -d:FAKE build.fsx

@echo off

if exist bootstrap.cmd (
  call bootstrap.cmd
  if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
)

REM cls
set nuget_packages_dir=packages
set paket_packages_dir=packages

set nuget_path=NuGet.CommandLine/tools/NuGet.exe
set fake_path=FAKE/tools/FAKE.exe

REM resore paket build dependencies
if exist ".paket/paket.bootstrapper.exe" (
  echo Bootstrap paket
  .paket\paket.bootstrapper.exe %PAKET_VERSION%
  if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%

  echo restore paket packages
  .paket\paket.exe restore
  if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%

  set fake=%paket_packages_dir%/%fake_path%
  set nuget=%paket_packages_dir%/%nuget_path%
)
REM Download NuGet (if not already available because of paket)
if not exist %nuget% (
  if exist downloadNuget.fsx (
    if not exist %nuget_packages_dir%/%nuget_path% (
      echo Bootstrap Nuget
      "C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0\fsi.exe" downloadNuget.fsx
      if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
    )
    set nuget=%nuget_packages_dir%/%nuget_path%
  )
)
REM Restore Nuget build dependencies
if exist packages.config (
  if exist %nuget% (
    echo Resolve build dependencies
    "%nuget%" "install" "packages.config" "-OutputDirectory" %nuget_packages_dir% "-ExcludeVersion"
    if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
  ) else (
    echo NuGet build dependencies file found but no NuGet.exe could be found, either add downloadNuget.fsx or add Nuget.Commandline as paket dependency!.
  )
)

REM FAKE could be available as nuget dependency
if not exist %fake% (
  set fake=%nuget_packages_dir%/%fake_path%
  if not exist %fake% (
    echo Could not find FAKE in nuget or paket dependencies!
    exit /b 1
  )
)

echo start FAKE for the rest of the build procedure...
"%fake%" %* --fsiargs -d:WIN64 -d:FAKE build.fsx

Fix build

Fix build

Do not use `nuget_packages` as that conflicts with a variable used by paket internally.


@ECHO off
SETLOCAL

SET REPO_FOLDER=%~dp0
CD "%REPO_FOLDER%"

SET BUILD_FOLDER=.build
SET KOREBUILD_FOLDER=%BUILD_FOLDER%\KoreBuild-dotnet
SET KOREBUILD_VERSION=

SET NUGET_PATH=%BUILD_FOLDER%\NuGet.exe
SET NUGET_VERSION=latest
SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe

IF NOT EXIST %BUILD_FOLDER% (
    md %BUILD_FOLDER%
)

IF NOT EXIST %NUGET_PATH% (
    IF NOT EXIST %CACHED_NUGET% (
        echo Downloading latest version of NuGet.exe...
        IF NOT EXIST %LocalAppData%\NuGet (
            md %LocalAppData%\NuGet
        )
        @powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'"
    )

    copy %CACHED_NUGET% %NUGET_PATH% > nul
)

IF NOT EXIST %KOREBUILD_FOLDER% (
    SET KOREBUILD_DOWNLOAD_ARGS=
    IF NOT "%KOREBUILD_VERSION%"=="" (
        SET KOREBUILD_DOWNLOAD_ARGS=-version %KOREBUILD_VERSION%
    )

    %BUILD_FOLDER%\nuget.exe install KoreBuild-dotnet -ExcludeVersion -o %BUILD_FOLDER% -nocache -pre %KOREBUILD_DOWNLOAD_ARGS%
)

"%KOREBUILD_FOLDER%\build\KoreBuild.cmd" %*

@ECHO off
SETLOCAL

SET REPO_FOLDER=%~dp0
CD "%REPO_FOLDER%"

SET BUILD_FOLDER=.build
SET KOREBUILD_FOLDER=%BUILD_FOLDER%\KoreBuild-dotnet
SET KOREBUILD_VERSION=

SET NUGET_PATH=%BUILD_FOLDER%\NuGet.exe
SET NUGET_VERSION=latest
SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe

IF NOT EXIST %BUILD_FOLDER% (
    md %BUILD_FOLDER%
)

IF NOT EXIST %NUGET_PATH% (
    IF NOT EXIST %CACHED_NUGET% (
        echo Downloading latest version of NuGet.exe...
        IF NOT EXIST %LocalAppData%\NuGet (
            md %LocalAppData%\NuGet
        )
        @powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'"
    )

    copy %CACHED_NUGET% %NUGET_PATH% > nul
)

SET KOREBUILD_DOWNLOAD_ARGS=
IF NOT "%KOREBUILD_VERSION%"=="" (
    SET KOREBUILD_DOWNLOAD_ARGS=-version %KOREBUILD_VERSION%
)
IF NOT EXIST %KOREBUILD_FOLDER% (
    %BUILD_FOLDER%\nuget.exe install KoreBuild-dotnet -ExcludeVersion -o %BUILD_FOLDER% -nocache -pre %KOREBUILD_DOWNLOAD_ARGS%
)

"%KOREBUILD_FOLDER%\build\KoreBuild.cmd" %*

Update `build.cmd` to match latest template - aspnet/Universe#347 - `%KOREBUILD_VERSION%` doesn't work without this fix


@ECHO OFF
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*"

@ECHO OFF
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE"

Return the error code from build.cmd

Return the error code from build.cmd