:: Set the default arguments for build
set __BuildArch=x64
set __BuildType=Debug
set __BuildOS=Windows_NT

:: Set the various build properties here so that CMake and MSBuild can pick them up
set "__ProjectDir=%~dp0.."
:: remove trailing slash
if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
set "__SourceDir=%__ProjectDir%\src"
set "__PackagesDir=%__ProjectDir%\packages"
set "__RootBinDir=%__ProjectDir%\bin"
set "__LogsDir=%__RootBinDir%\Logs"
set __SkipTestBuild=
set "__DotNetCliPath=%__ProjectDir%\Tools\dotnetcli"

:Arg_Loop
if "%1" == "" goto ArgsDone

if /i "%1" == "/?"    goto Usage
if /i "%1" == "-?"    goto Usage
if /i "%1" == "/h"    goto Usage
if /i "%1" == "-h"    goto Usage
if /i "%1" == "/help" goto Usage
if /i "%1" == "-help" goto Usage

if /i "%1" == "x64"    (set __BuildArch=x64&&shift&goto Arg_Loop)
if /i "%1" == "x86"    (set __BuildArch=x86&&shift&goto Arg_Loop)
if /i "%1" == "arm"    (set __BuildArch=arm&&shift&goto Arg_Loop)

if /i "%1" == "debug"    (set __BuildType=Debug&shift&goto Arg_Loop)
if /i "%1" == "release"   (set __BuildType=Release&shift&goto Arg_Loop)

if /i "%1" == "clean"   (set __CleanBuild=1&shift&goto Arg_Loop)

if /i "%1" == "skiptests" (set __SkipTests=1&shift&goto Arg_Loop)
if /i "%1" == "skipvsdev" (set __SkipVsDev=1&shift&goto Arg_Loop)
if /i "%1" == "/dotnetclipath" (set __DotNetCliPath=%2&shift&shift&goto Arg_Loop)

if /i "%1" == "/officialbuildid" (set "__ExtraMsBuildParams=/p:OfficialBuildId=%2"&shift&shift&goto Arg_Loop)

echo Invalid command line argument: %1
exit /b 1
:ArgsDone

:: Set the remaining variables based upon the determined build configuration
set "__BinDir=%__RootBinDir%\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__ObjDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__IntermediatesDir=%__RootBinDir%\obj\Native\%__BuildOS%.%__BuildArch%.%__BuildType%\"
set "__NativeBuildLog=%__LogsDir%\Native_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
set "__BuildLog=%__LogsDir%\msbuild_%__BuildOS%__%__BuildArch%__%__BuildType%.log"

:: Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
set "__CMakeBinDir=%__BinDir%"
set "__CMakeBinDir=%__CMakeBinDir:\=/%"

:: Configure environment if we are doing a clean build.
if not defined __CleanBuild goto MakeDirs
echo Doing a clean build
echo.

:: Cleanup the previous output for the selected configuration
if exist "%__BinDir%" rd /s /q "%__BinDir%"
if exist "%__ObjDir%" rd /s /q "%__ObjDir%"
if exist "%__IntermediatesDir%" rd /s /q "%__IntermediatesDir%"

if exist "%__LogsDir%" del /f /q "%__LogsDir%\*_%__BuildOS%__%__BuildArch%__%__BuildType%.*"

:MakeDirs
if not exist "%__BinDir%" md "%__BinDir%"
if not exist "%__ObjDir%" md "%__ObjDir%"
if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%"
if not exist "%__LogsDir%" md "%__LogsDir%"

:CheckPrereqs
:: Check prerequisites
echo Checking pre-requisites...
echo.

:: Validate that PowerShell is accessibile.
for %%X in (powershell.exe) do (set __PSDir=%%~$PATH:X)
if defined __PSDir goto EvaluatePS
echo PowerShell is a prerequisite to build this repository.
echo See: https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md
exit /b 1

:EvaluatePS
:: Eval the output from probe-win1.ps1
for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& ""%__SourceDir%\Native\probe-win.ps1"""') do %%a

:: Default to highest Visual Studio version available
::
:: For VS2015 (and prior), only a single instance is allowed to be installed on a box
:: and VS140COMNTOOLS is set as a global environment variable by the installer. This
:: allows users to locate where the instance of VS2015 is installed.
::
:: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS
:: is no longer set as a global environment variable and is instead only set if the user
:: has launched the VS2017 Developer Command Prompt.
::
:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is
:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and
:: is already configured to use that toolset. Otherwise, we will fallback to using the VS2015
:: toolset if it is installed. Finally, we will fail the script if no supported VS instance
:: can be found.

if defined VisualStudioVersion goto :RunVCVars

set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if exist %_VSWHERE% (
  for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools
)
if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS%
if not exist "%_VSCOMNTOOLS%" goto :MissingVersion

call "%_VSCOMNTOOLS%\VsDevCmd.bat"

:RunVCVars
if "%VisualStudioVersion%"=="15.0" (
    goto :VS2017
) else if "%VisualStudioVersion%"=="14.0" (
    goto :VS2015
)

:MissingVersion
:: Can't find VS 2015 or 2017
echo Visual Studio 2017 is a pre-requisite to build this repository. Visual Studio 2015 also works.
echo See: https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md
exit /b 1

:VS2017
:: Setup vars for VS2017
set __VSVersion=vs2017
set __VSProductVersion=150
goto :CheckVSExistence

:VS2015
:: Setup vars for VS2015
set __VSVersion=vs2015
set __VSProductVersion=140
goto :CheckVSExistence

:CheckVSExistence
:: Does VS really exist?
if exist "!VS%__VSProductVersion%COMNTOOLS!\..\IDE\devenv.exe" goto CheckMSBuild
echo Visual Studio not installed in !VS%__VSProductVersion%COMNTOOLS!.
echo See: https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md
exit /b 1

:CheckMSBuild
if /i "%__VSVersion%" == "vs2017" (
    rem The MSBuild that is installed in the shared location is not compatible
    rem with VS2017 C++ projects. I must use the MSBuild located in
    rem C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe
    set _msbuildexe="%VSINSTALLDIR%\MSBuild\15.0\Bin\MSBuild.exe"
) else (
    set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
    if not exist !_msbuildexe! (set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe")
    if not exist !_msbuildexe! (echo Error: Could not find MSBuild.exe.  Please see https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md for build instructions. && exit /b 1)
)

rem Explicitly set Platform causes conflicts in managed project files. Clear it to allow building from VS x64 Native Tools Command Prompt
set Platform=

:: Set the environment for the native build
set __VCBuildArch=x86_amd64
if /i "%__BuildArch%" == "x86" (set __VCBuildArch=x86)

rem Tell nuget to always use repo-local nuget package cache. The "dotnet restore" invocations use the --packages
rem argument, but there are a few commands in publish and tests that do not.
set "NUGET_PACKAGES=%__PackagesDir%"

set BUILDVARS_DONE=1
exit /b 0

:Usage
echo.
echo Build the CoreRT repo.
echo.
echo Usage:
echo     %__ThisScriptShort% [option1] [option2] ...
echo.
echo All arguments are optional. The options are:
echo.
echo./? -? /h -h /help -help: view this message.
echo Build architecture: one of x64, x86, arm ^(default: x64^).
echo Build type: one of Debug, Checked, Release ^(default: Debug^).
echo Visual Studio version: vs2015, vs2017 ^(defaults to highest detected^).
echo clean: force a clean build ^(default is to perform an incremental build^).
echo skiptests: skip building tests ^(default: tests are built^).
exit /b 1

:: Set the default arguments for build
set __BuildArch=x64
set __BuildType=Debug
set __BuildOS=Windows_NT

:: Set the various build properties here so that CMake and MSBuild can pick them up
set "__ProjectDir=%~dp0.."
:: remove trailing slash
if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
set "__SourceDir=%__ProjectDir%\src"
set "__PackagesDir=%__ProjectDir%\packages"
set "__RootBinDir=%__ProjectDir%\bin"
set "__LogsDir=%__RootBinDir%\Logs"
set __SkipTestBuild=
set "__DotNetCliPath=%__ProjectDir%\Tools\dotnetcli"

:Arg_Loop
if "%1" == "" goto ArgsDone

if /i "%1" == "/?"    goto Usage
if /i "%1" == "-?"    goto Usage
if /i "%1" == "/h"    goto Usage
if /i "%1" == "-h"    goto Usage
if /i "%1" == "/help" goto Usage
if /i "%1" == "-help" goto Usage

if /i "%1" == "x64"    (set __BuildArch=x64&&shift&goto Arg_Loop)
if /i "%1" == "x86"    (set __BuildArch=x86&&shift&goto Arg_Loop)
if /i "%1" == "arm"    (set __BuildArch=arm&&shift&goto Arg_Loop)

if /i "%1" == "debug"    (set __BuildType=Debug&shift&goto Arg_Loop)
if /i "%1" == "release"   (set __BuildType=Release&shift&goto Arg_Loop)

if /i "%1" == "clean"   (set __CleanBuild=1&shift&goto Arg_Loop)

if /i "%1" == "skiptests" (set __SkipTests=1&shift&goto Arg_Loop)
if /i "%1" == "skipvsdev" (set __SkipVsDev=1&shift&goto Arg_Loop)
if /i "%1" == "/dotnetclipath" (set __DotNetCliPath=%2&shift&shift&goto Arg_Loop)

if /i "%1" == "/officialbuildid" (set "__ExtraMsBuildParams=/p:OfficialBuildId=%2"&shift&shift&goto Arg_Loop)

echo Invalid command line argument: %1
exit /b 1
:ArgsDone

:: Set the remaining variables based upon the determined build configuration
set "__BinDir=%__RootBinDir%\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__ObjDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__IntermediatesDir=%__RootBinDir%\obj\Native\%__BuildOS%.%__BuildArch%.%__BuildType%\"
set "__NativeBuildLog=%__LogsDir%\Native_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
set "__BuildLog=%__LogsDir%\msbuild_%__BuildOS%__%__BuildArch%__%__BuildType%.log"

:: Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
set "__CMakeBinDir=%__BinDir%"
set "__CMakeBinDir=%__CMakeBinDir:\=/%"

:: Configure environment if we are doing a clean build.
if not defined __CleanBuild goto MakeDirs
echo Doing a clean build
echo.

:: Cleanup the previous output for the selected configuration
if exist "%__BinDir%" rd /s /q "%__BinDir%"
if exist "%__ObjDir%" rd /s /q "%__ObjDir%"
if exist "%__IntermediatesDir%" rd /s /q "%__IntermediatesDir%"

if exist "%__LogsDir%" del /f /q "%__LogsDir%\*_%__BuildOS%__%__BuildArch%__%__BuildType%.*"

:MakeDirs
if not exist "%__BinDir%" md "%__BinDir%"
if not exist "%__ObjDir%" md "%__ObjDir%"
if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%"
if not exist "%__LogsDir%" md "%__LogsDir%"

:CheckPrereqs
:: Check prerequisites
echo Checking pre-requisites...
echo.

:: Validate that PowerShell is accessibile.
for %%X in (powershell.exe) do (set __PSDir=%%~$PATH:X)
if defined __PSDir goto EvaluatePS
echo PowerShell is a prerequisite to build this repository.
echo See: https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md
exit /b 1

:EvaluatePS
:: Eval the output from probe-win1.ps1
for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& ""%__SourceDir%\Native\probe-win.ps1"""') do %%a

:: Default to highest Visual Studio version available
::
:: For VS2015 (and prior), only a single instance is allowed to be installed on a box
:: and VS140COMNTOOLS is set as a global environment variable by the installer. This
:: allows users to locate where the instance of VS2015 is installed.
::
:: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS
:: is no longer set as a global environment variable and is instead only set if the user
:: has launched the VS2017 Developer Command Prompt.
::
:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is
:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and
:: is already configured to use that toolset. Otherwise, we will fallback to using the VS2015
:: toolset if it is installed. Finally, we will fail the script if no supported VS instance
:: can be found.

if defined VisualStudioVersion goto :RunVCVars

set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if exist %_VSWHERE% (
  for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools
)
if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS%
if not exist "%_VSCOMNTOOLS%" goto :MissingVersion

call "%_VSCOMNTOOLS%\VsDevCmd.bat"

:RunVCVars
if "%VisualStudioVersion%"=="15.0" (
    goto :VS2017
) else if "%VisualStudioVersion%"=="14.0" (
    goto :VS2015
)

:MissingVersion
:: Can't find VS 2015 or 2017
echo Visual Studio 2017 is a pre-requisite to build this repository. Visual Studio 2015 also works.
echo See: https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md
exit /b 1

:VS2017
:: Setup vars for VS2017
set __VSVersion=vs2017
set __VSProductVersion=150
if not exist "!VS%__VSProductVersion%COMNTOOLS!\..\..\VC\Auxiliary\Build\vcvarsall.bat" goto :MissingVisualC
goto :CheckMSBuild

:VS2015
:: Setup vars for VS2015
set __VSVersion=vs2015
set __VSProductVersion=140
if not exist "!VS%__VSProductVersion%COMNTOOLS!\..\..\VC\vcvarsall.bat" goto :MissingVisualC
goto :CheckMSBuild

:MissingVisualC
echo Could not find Visual C++ under !VS%__VSProductVersion%COMNTOOLS!. Visual C++ is a pre-requisite to build this repository.
echo See: https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md
exit /b 1

:CheckMSBuild
if /i "%__VSVersion%" == "vs2017" (
    rem The MSBuild that is installed in the shared location is not compatible
    rem with VS2017 C++ projects. I must use the MSBuild located in
    rem C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe
    set _msbuildexe="%VSINSTALLDIR%\MSBuild\15.0\Bin\MSBuild.exe"
) else (
    set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
    if not exist !_msbuildexe! (set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe")
)
if not exist !_msbuildexe! (echo Error: Could not find MSBuild.exe.  Please see https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md for build instructions. && exit /b 1)

rem Explicitly set Platform causes conflicts in managed project files. Clear it to allow building from VS x64 Native Tools Command Prompt
set Platform=

:: Set the environment for the native build
set __VCBuildArch=x86_amd64
if /i "%__BuildArch%" == "x86" (set __VCBuildArch=x86)

rem Tell nuget to always use repo-local nuget package cache. The "dotnet restore" invocations use the --packages
rem argument, but there are a few commands in publish and tests that do not.
set "NUGET_PACKAGES=%__PackagesDir%"

set BUILDVARS_DONE=1
exit /b 0

:Usage
echo.
echo Build the CoreRT repo.
echo.
echo Usage:
echo     %__ThisScriptShort% [option1] [option2] ...
echo.
echo All arguments are optional. The options are:
echo.
echo./? -? /h -h /help -help: view this message.
echo Build architecture: one of x64, x86, arm ^(default: x64^).
echo Build type: one of Debug, Checked, Release ^(default: Debug^).
echo Visual Studio version: vs2015, vs2017 ^(defaults to highest detected^).
echo clean: force a clean build ^(default is to perform an incremental build^).
echo skiptests: skip building tests ^(default: tests are built^).
exit /b 1

Check for Visual C++ in buildvars-setup.cmd (#4343)


@echo off

C:
chdir C:\Win32app\cygwin64\bin

bash --login -c "X -nodecoration -clipboard -ac -rootless :1 &"
bash --login -c "echo $DISPLAY; export DISPLAY=localhost:1; ssh -Y -l username public.ip.of.computer \"echo $DISPLAY; mate-session\""

Create startx11session.bat

Create startx11session.bat


@echo on

set "VSCMD_START_DIR=%CD%"
call "vcvars64.bat"
mkdir build
cd build
cmake .. -G"Visual Studio 15 2017 Win64" %CMAKE_OPT% -DCMAKE_CXX_FLAGS="-D_CRT_SECURE_NO_DEPRECATE /MT /EHsc %CFLAGS%"
if %ERRORLEVEL% neq 0 exit /B %ERRORLEVEL%
devenv /build Release aff3ct.sln
if %ERRORLEVEL% neq 0 exit /B %ERRORLEVEL%

mkdir %NAME%
mkdir %NAME%\bin\
mkdir %NAME%\lib\
mkdir %NAME%\inc\

 copy bin\Release\aff3ct.exe %NAME%\bin\
 copy lib\Release\aff3ct.lib %NAME%\lib\
xcopy ..\src\*               %NAME%\inc\ /s /e

move %NAME% ..\

@echo on
VS_PATH

set "VSCMD_START_DIR=%CD%"
call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat"

mkdir build
cd build
cmake .. -G"Visual Studio 15 2017 Win64" %CMAKE_OPT% -DCMAKE_CXX_FLAGS="-D_CRT_SECURE_NO_DEPRECATE /MT /EHsc %CFLAGS%"
if %ERRORLEVEL% neq 0 exit /B %ERRORLEVEL%
devenv /build Release aff3ct.sln
if %ERRORLEVEL% neq 0 exit /B %ERRORLEVEL%

mkdir %NAME%
mkdir %NAME%\bin\
mkdir %NAME%\lib\
mkdir %NAME%\inc\

 copy bin\Release\aff3ct.exe %NAME%\bin\
 copy lib\Release\aff3ct.lib %NAME%\lib\
xcopy ..\src\*               %NAME%\inc\ /s /e

move %NAME% ..\

CI: add full the path to vcvars64.bat script.


@echo off
setlocal
:: Variables
call :ProgramFiles32
set "path_android_sdk_anyone=%ProgramFiles32%\Android\android-sdk"
set "path_android_sdk_me=%LocalAppData%\Android\android-sdk"
set "path_android_sdk=%path_android_sdk_me%"
set "file_android_adb_log=%Temp%\android-adb.log"
set "file_android_sdk=%Temp%\AndroidSDK.exe"
set "file_android_sdk_log=%Temp%\android-sdk.log"
set "file_android_sdk_script=%path_android_sdk%\tools\android.bat"
set "url_android_sdk=http://dl.google.com/android/installer_r23.0.2-windows.exe"
set "opt_android_nullsoft=/D=%path_android_sdk%"
set "opt_android_sdk_packages=1,2,3,109,120"
:: Android SDK and ADB
call :Download "%url_android_sdk%" "%file_android_sdk%" && call :InstallNullSoft "%file_android_sdk%" "%opt_android_nullsoft%" || call :Abort "Unable to download and install Android SDK"
echo Updating Android SDK...
echo y|"%file_android_sdk_script%" update sdk -u -a -t %opt_android_sdk_packages% >"%file_android_sdk_log%" 2>&1
echo Updating Android ADB...
call "%file_android_sdk_script%" update adb >"%file_android_adb_log%" 2>&1
endlocal
exit /b 0
:Abort [Message] [_FUNCTION_] ~UI
call :Error %1 %2
call :__Abort 2>nul
exit /b 1
:__Abort
()
exit /b 1
:Download <URL> <Destination> ~UI/IO
echo Downloading %~nx2...
PowerShell -NoProfile -ExecutionPolicy RemoteSigned -Command "(New-Object System.Net.WebClient).DownloadFile('%~1', '%~2');"
exit /b
:Error [Message] [_FUNCTION_]
echo [ERROR] ^(Code = %ErrorLevel%^) %~2: %~1
exit /b %ErrorLevel%
:InstallNullSoft <EXE> [Options] ~UI/IO
echo Installing %~nx1...
"%~1" /S %~2
exit /b
:ProgramFiles32
set "ProgramFiles32=%ProgramFiles%"
if defined ProgramFiles(x86) set "ProgramFiles32=%ProgramFiles(x86)%"
exit /b 0 {ProgramFiles32}

Create AndroidSDK.bat

Create AndroidSDK.bat


@echo off
REM Copyright 1999-2012 Alibaba Group.
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 check JAVA_HOME & java
if "%JAVA_HOME%" == "" goto noJavaHome
if exist "%JAVA_HOME%\bin\java.exe" goto mainEntry
:noJavaHome
echo ---------------------------------------------------
echo Error: JAVA_HOME environment variable is not set.
echo ---------------------------------------------------
goto end

:mainEntry
REM set JAVA_OPTS
set "JAVA_OPTS=-server -Xms1024m -Xmx1024m -Xmn256m -Xss256k"
REM performance Options
set "JAVA_OPTS=%JAVA_OPTS% -XX:+AggressiveOpts"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseBiasedLocking"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseFastAccessorMethods"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseParNewGC"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+CMSParallelRemarkEnabled"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseCMSCompactAtFullCollection"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseCMSInitiatingOccupancyOnly"
set "JAVA_OPTS=%JAVA_OPTS% -XX:CMSInitiatingOccupancyFraction=75"
REM GC Log Options
REM set "JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCApplicationStoppedTime"
REM set "JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCTimeStamps"
REM set "JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDetails"
REM debug Options
REM set "JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8065,server=y,suspend=n"

REM set HOME_DIR
set "CURR_DIR=%cd%"
cd ..
set "COBAR_HOME=%cd%"
cd %CURR_DIR%
if exist "%COBAR_HOME%\bin\startup.bat" goto okHome
echo ---------------------------------------------------
echo Error: COBAR_HOME environment variable is not defined correctly.
echo ---------------------------------------------------
goto end

:okHome
set "APP_VERSION=1.3.0"

REM set COBAR_CLASSPATH
set "COBAR_CLASSPATH=%COBAR_HOME%\conf;%COBAR_HOME%\lib\classes"
set "COBAR_CLASSPATH=%COBAR_CLASSPATH%;%COBAR_HOME%\lib\cobar-server-%APP_VERSION%.jar"
set "COBAR_CLASSPATH=%COBAR_CLASSPATH%;%COBAR_HOME%\lib\log4j-1.2.16.jar"
REM FOR %%I IN ("%COBAR_HOME%\lib\*.jar") DO (
REM   set "COBAR_CLASSPATH=%COBAR_CLASSPATH%;%%I"
REM )
REM echo %COBAR_CLASSPATH%

REM startup Server
set "RUN_CMD="%JAVA_HOME%\bin\java.exe""
set "RUN_CMD=%RUN_CMD% -Dcobar.home="%COBAR_HOME%""
set "RUN_CMD=%RUN_CMD% -classpath "%COBAR_CLASSPATH%""
set "RUN_CMD=%RUN_CMD% %JAVA_OPTS%"
set "RUN_CMD=%RUN_CMD% com.alibaba.cobar.CobarStartup"
call %RUN_CMD%

:end

@echo off
REM Copyright 1999-2012 Alibaba Group.
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 check JAVA_HOME & java
if "%JAVA_HOME%" == "" goto noJavaHome
if exist "%JAVA_HOME%\bin\java.exe" goto mainEntry
:noJavaHome
echo ---------------------------------------------------
echo Error: JAVA_HOME environment variable is not set.
echo ---------------------------------------------------
goto end

:mainEntry
REM set JAVA_OPTS
set "JAVA_OPTS=-server -Xms1024m -Xmx1024m -Xmn256m -Xss256k"
REM performance Options
set "JAVA_OPTS=%JAVA_OPTS% -XX:+AggressiveOpts"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseBiasedLocking"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseFastAccessorMethods"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseParNewGC"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+CMSParallelRemarkEnabled"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseCMSCompactAtFullCollection"
set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseCMSInitiatingOccupancyOnly"
set "JAVA_OPTS=%JAVA_OPTS% -XX:CMSInitiatingOccupancyFraction=75"
REM GC Log Options
REM set "JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCApplicationStoppedTime"
REM set "JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCTimeStamps"
REM set "JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDetails"
REM debug Options
REM set "JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8065,server=y,suspend=n"

REM set HOME_DIR
set "CURR_DIR=%cd%"
cd ..
set "COBAR_HOME=%cd%"
cd %CURR_DIR%
if exist "%COBAR_HOME%\bin\startup.bat" goto okHome
echo ---------------------------------------------------
echo Error: COBAR_HOME environment variable is not defined correctly.
echo ---------------------------------------------------
goto end

:okHome
set "APP_VERSION=1.2.7"

REM set COBAR_CLASSPATH
set "COBAR_CLASSPATH=%COBAR_HOME%\conf;%COBAR_HOME%\lib\classes"
set "COBAR_CLASSPATH=%COBAR_CLASSPATH%;%COBAR_HOME%\lib\cobar-server-%APP_VERSION%.jar"
set "COBAR_CLASSPATH=%COBAR_CLASSPATH%;%COBAR_HOME%\lib\log4j-1.2.17.jar"
REM FOR %%I IN ("%COBAR_HOME%\lib\*.jar") DO (
REM   set "COBAR_CLASSPATH=%COBAR_CLASSPATH%;%%I"
REM )
REM echo %COBAR_CLASSPATH%

REM startup Server
set "RUN_CMD="%JAVA_HOME%\bin\java.exe""
set "RUN_CMD=%RUN_CMD% -Dcobar.home="%COBAR_HOME%""
set "RUN_CMD=%RUN_CMD% -classpath "%COBAR_CLASSPATH%""
set "RUN_CMD=%RUN_CMD% %JAVA_OPTS%"
set "RUN_CMD=%RUN_CMD% com.alibaba.cobar.CobarStartup"
call %RUN_CMD%

:end

fix startup.bat script

fix startup.bat script


..\bin\debug\TranslatorizerConsole.exe Language.resx es
PAUSE

add pause to bat file

add pause to bat file


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

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

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

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

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

:SelectNodeVersion

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

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

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

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

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

goto :EOF

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

:Deployment
echo Handling node.js deployment.

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

:: 2. Select node version
call :SelectNodeVersion

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

:: 4. Compile TypeScript
echo Transpiling TypeScript in %DEPLOYMENT_TARGET%...
call :ExecuteCmd tsc -p "%DEPLOYMENT_TARGET%" --sourceMap=false

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

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

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

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

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

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

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

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

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

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

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

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

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

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

:SelectNodeVersion

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

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

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

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

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

goto :EOF

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

:Deployment
echo Handling node.js deployment.

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

:: 2. Select node version
call :SelectNodeVersion

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

:: 4. Compile TypeScript
echo Transpiling TypeScript in %DEPLOYMENT_TARGET%...
call :ExecuteCmd tsc -p "%DEPLOYMENT_TARGET%"

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

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

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

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

remove --sourceMap option from tsc command in deploy.cmd


robocopy "%userprofile%/repos/web inspector" "%appdata%/sublime text 3/packages/web inspector" /s /xd .git* /xf .git* /xf *st3* /mir
attrib +r /s "%appdata%/sublime text 3/packages/web inspector/*py"

robocopy "%~dp0\.." "%appdata%/sublime text 3/packages/web inspector" /s /xd .git* /xf .git* /xf *st3* /mir
attrib +r /s "%appdata%/sublime text 3/packages/web inspector/*py"

Make update.bat generic wrt repo path

Make update.bat generic wrt repo path


@echo off
setlocal EnableExtensions

set BATDIR=%~dp0
if not exist "%USERPROFILE%" (
    echo [Error] Environment variable %%USERPROFILE%% is not set.
    goto :EOF
)

REM Check access priviledge
if exist "%TEMP%\makelinks.tmp" del "%TEMP%\makelinks.tmp"
(mklink "%TEMP%\makelinks.tmp" "%~0" 2>&1) > NUL
if not %ERRORLEVEL% == 0 (
    echo Failed to create symbolic link
    goto :EOF
)
del ".\makelinks.tmp" 2> NUL

call :MAIN "%USERPROFILE%\vimfiles\"
call :MAIN "%USERPROFILE%\.vim\"
call :MAIN "%USERPROFILE%\_vim\"
goto :EOF

REM ---------------------------------------------------------------------------
:MAIN
    set DOTVIM=%~f1
    call :MKDIR  "%DOTVIM%"
    call :MKLINK "%DOTVIM%vimrc" "%BATDIR%.vim\vimrc"
    call :MKDIR  "%DOTVIM%autoload"
    call :MKLINK "%DOTVIM%autoload\plug.vim" "%BATDIR%.vim\autoload\plug.vim"
    call :MKDIR  "%DOTVIM%ftplugin"
    for %%I in (%BATDIR%.vim\ftplugin\*.vim) do (
        call :MKLINK "%DOTVIM%ftplugin\%%~nxI" "%%~fI"
    )
    exit /b 0

:MKLINK
    set DEST=%~f1
    set SRC=%~f2
    if exist "%DEST%" del /q "%DEST%"
    mklink "%DEST%" "%SRC%" > NUL
    echo mklink "%DEST%" "%SRC%"
    exit /b 0

:MKDIR
    if not exist "%~f1" (
        mkdir "%~f1"
        echo mkdir "%~f1"
    ) else (
        echo mkdir "%~f1" ^(skip^)
    )
    exit /b 0

@echo off
setlocal EnableExtensions

set BATDIR=%~dp0
if not exist "%USERPROFILE%" (
    echo [Error] Environment variable %%USERPROFILE%% is not set.
    goto :EOF
)

REM Check access priviledge
if exist "%TEMP%\makelinks.tmp" del "%TEMP%\makelinks.tmp"
(mklink "%TEMP%\makelinks.tmp" "%~0" 2>&1) > NUL
if not %ERRORLEVEL% == 0 (
    echo Failed to create symbolic link
    goto :EOF
)
del ".\makelinks.tmp" 2> NUL

call :MKDIR "%USERPROFILE%\vimfiles\autoload"
call :MKDIR "%USERPROFILE%\.vim\autoload"
call :MKDIR "%USERPROFILE%\_vim\autoload"
call :MKLINK "%USERPROFILE%\vimfiles\vimrc" "%BATDIR%vimfiles\vimrc"
call :MKLINK "%USERPROFILE%\.vim\vimrc"     "%BATDIR%vimfiles\vimrc"
call :MKLINK "%USERPROFILE%\_vim\vimrc"     "%BATDIR%vimfiles\vimrc"
call :MKLINK "%USERPROFILE%\vimfiles\autoload\plug.vim" "%BATDIR%vimfiles\autoload\plug.vim"
call :MKLINK "%USERPROFILE%\.vim\autoload\plug.vim"     "%BATDIR%vimfiles\autoload\plug.vim"
call :MKLINK "%USERPROFILE%\_vim\autoload\plug.vim"     "%BATDIR%vimfiles\autoload\plug.vim"
goto :EOF

REM ---------------------------------------------------------------------------
:MKLINK
    set DEST=%~f1
    set SRC=%~f2
    if exist "%DEST%" del /q "%DEST%"
    mklink "%DEST%" "%SRC%" > NUL
    echo mklink "%DEST%" "%SRC%"
    exit /b 0

:MKDIR
    if not exist "%~f1" (
        echo mkdir "%~f1"
        mkdir "%~f1"
    )
    exit /b 0

Improve setup script for Windows

profile: Improve setup script for Windows


@for /F "delims=" %%a in ('findstr /rc:"^    version" build.gradle') do @set versionline=%%a
@echo Closing all java and javaw processes with window title format: HubTurbo V%versionline:~15,5%*.
@taskkill /fi "Windowtitle eq HubTurbo V%versionline:~15,5%*" /im "javaw.exe"
@taskkill /fi "Windowtitle eq HubTurbo V%versionline:~15,5%*" /im "java.exe"
@echo(
@echo Starting Gradle build. This will take a while...
@echo(
@call gradlew clean shadowJar --no-daemon
@for /F "delims=" %%a in ('findstr /rc:"^    version" build.gradle') do @set versionline=%%a
@echo(
@echo Starting HubTurbo V%versionline:~15,5%. You can close this cmd window once HubTurbo begins launching.
@start "" javaw -jar build/libs/HubTurbo-%versionline:~15,5%-all.jar
@exit

Add Windows build script to root folder

Add Windows build script to root folder

The script closes any running HubTurbo instances, starts a gradle build,
then runs the newly built HubTurbo, at which point the batch script exits
while HubTurbo will continue running.

The script runs the build in --no-daemon mode, otherwise the cmd.exe
window will not close after HubTurbo has finished launching.

rbar is short for "rebuild and run".


@echo off
SetLocal EnableDelayedExpansion
echo build a msi installer using local cli sources and python executables. You need to have curl.exe, unzip.exe and msbuild.exe available under PATH
echo.

set "PATH=%PATH%;%ProgramFiles%\Git\bin;%ProgramFiles%\Git\usr\bin;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin"

if "%CLI_VERSION%"=="" (
    echo Please set the CLI_VERSION environment variable, e.g. 2.0.13
    goto ERROR
)
set PYTHON_VERSION=3.8.9

set WIX_DOWNLOAD_URL="https://azurecliprod.blob.core.windows.net/msi/wix310-binaries-mirror.zip"
set PYTHON_DOWNLOAD_URL="https://azurecliprod.blob.core.windows.net/util/Python389-32.zip"
set PROPAGATE_ENV_CHANGE_DOWNLOAD_URL="https://azurecliprod.blob.core.windows.net/util/propagate_env_change.zip"

:: Set up the output directory and temp. directories
echo Cleaning previous build artifacts...
set OUTPUT_DIR=%~dp0..\out
if exist %OUTPUT_DIR% rmdir /s /q %OUTPUT_DIR%
mkdir %OUTPUT_DIR%

set ARTIFACTS_DIR=%~dp0..\artifacts
mkdir %ARTIFACTS_DIR%
set TEMP_SCRATCH_FOLDER=%ARTIFACTS_DIR%\cli_scratch
set BUILDING_DIR=%ARTIFACTS_DIR%\cli
set WIX_DIR=%ARTIFACTS_DIR%\wix
set PYTHON_DIR=%ARTIFACTS_DIR%\Python389-32
set PROPAGATE_ENV_CHANGE_DIR=%~dp0..\propagate_env_change

set REPO_ROOT=%~dp0..\..\..

::reset working folders
if exist %BUILDING_DIR% rmdir /s /q %BUILDING_DIR%
::rmdir always returns 0, so check folder's existence
if exist %BUILDING_DIR% (
    echo Failed to delete %BUILDING_DIR%.
    goto ERROR
)
mkdir %BUILDING_DIR%

if exist %TEMP_SCRATCH_FOLDER% rmdir /s /q %TEMP_SCRATCH_FOLDER%
if exist %TEMP_SCRATCH_FOLDER% (
    echo Failed to delete %TEMP_SCRATCH_FOLDER%.
    goto ERROR
)
mkdir %TEMP_SCRATCH_FOLDER%

if exist %REPO_ROOT%\privates (
    copy %REPO_ROOT%\privates\*.whl %TEMP_SCRATCH_FOLDER%
)

::ensure wix is available
if exist %WIX_DIR% (
    echo Using existing Wix at %WIX_DIR%
)
if not exist %WIX_DIR% (
    mkdir %WIX_DIR%
    pushd %WIX_DIR%
    echo Downloading Wix.
    curl -o wix-archive.zip %WIX_DOWNLOAD_URL% -k
    unzip -q wix-archive.zip
    if %errorlevel% neq 0 goto ERROR
    del wix-archive.zip
    echo Wix downloaded and extracted successfully.
    popd
)

::ensure Python is available
if exist %PYTHON_DIR% (
    echo Using existing Python at %PYTHON_DIR%
)
if not exist %PYTHON_DIR% (
    mkdir %PYTHON_DIR%
    pushd %PYTHON_DIR%
    echo Downloading Python.
    curl -o Python389-32.zip %PYTHON_DOWNLOAD_URL% -k
    unzip -q Python389-32.zip
    if %errorlevel% neq 0 goto ERROR
    del Python389-32.zip
    echo Python downloaded and extracted successfully.
    popd
)
set PYTHON_EXE=%PYTHON_DIR%\python.exe

robocopy %PYTHON_DIR% %BUILDING_DIR% /s /NFL /NDL

set CLI_SRC=%REPO_ROOT%\src
%BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --force-reinstall pycparser==2.18
for %%a in (%CLI_SRC%\azure-cli %CLI_SRC%\azure-cli-core %CLI_SRC%\azure-cli-telemetry) do (
   pushd %%a
   %BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --no-cache-dir --no-deps .
   popd
)
%BUILDING_DIR%\python.exe -m pip install -r %CLI_SRC%\azure-cli\requirements.py3.windows.txt

if %errorlevel% neq 0 goto ERROR

pushd %BUILDING_DIR%
%BUILDING_DIR%\python.exe %~dp0\patch_models_v2.py
%BUILDING_DIR%\python.exe %~dp0\remove_unused_api_versions.py
popd

echo Creating the wbin (Windows binaries) folder that will be added to the path...
mkdir %BUILDING_DIR%\wbin
copy %REPO_ROOT%\build_scripts\windows\scripts\az.cmd %BUILDING_DIR%\wbin\
copy %REPO_ROOT%\build_scripts\windows\scripts\az %BUILDING_DIR%\wbin\
if %errorlevel% neq 0 goto ERROR
copy %REPO_ROOT%\build_scripts\windows\resources\CLI_LICENSE.rtf %BUILDING_DIR%
copy %REPO_ROOT%\build_scripts\windows\resources\ThirdPartyNotices.txt %BUILDING_DIR%
copy %REPO_ROOT%\NOTICE.txt %BUILDING_DIR%

:: Remove .py and only deploy .pyc files
pushd %BUILDING_DIR%\Lib\site-packages
for /f %%f in ('dir /b /s *.pyc') do (
    set PARENT_DIR=%%~df%%~pf..
    echo !PARENT_DIR! | findstr /C:\Lib\site-packages\pip\ 1>nul
    if !errorlevel! neq  0 (
        set FILENAME=%%~nf
        set BASE_FILENAME=!FILENAME:~0,-11!
        set pyc=!BASE_FILENAME!.pyc
        del !PARENT_DIR!\!BASE_FILENAME!.py
        copy %%~f !PARENT_DIR!\!pyc! >nul
        del %%~f
    ) ELSE (
        echo --SKIP !PARENT_DIR! under pip
    )
)
popd

:: Remove __pycache__
echo remove pycache
for /d /r %BUILDING_DIR%\Lib\site-packages\pip %%d in (__pycache__) do (
    if exist %%d rmdir /s /q "%%d"
)

:: Remove aio
echo remove aio
for /d /r %BUILDING_DIR%\Lib\site-packages\azure\mgmt %%d in (aio) do (
    if exist %%d rmdir /s /q "%%d"
)

:: Remove dist-info
echo remove dist-info
pushd %BUILDING_DIR%\Lib\site-packages
for /d %%d in ("azure*.dist-info") do (
    if exist %%d rmdir /s /q "%%d"
)
popd

if %errorlevel% neq 0 goto ERROR

::ensure propagate_env_change.exe is available
if exist "%PROPAGATE_ENV_CHANGE_DIR%\propagate_env_change.exe" (
    echo Using existing propagate_env_change.exe at %PROPAGATE_ENV_CHANGE_DIR%
) else (
    pushd %PROPAGATE_ENV_CHANGE_DIR%
    echo Downloading propagate_env_change.exe.
    curl -o propagate_env_change.zip %PROPAGATE_ENV_CHANGE_DOWNLOAD_URL% -k
    unzip -q propagate_env_change.zip
    if %errorlevel% neq 0 goto ERROR
    del propagate_env_change.zip
    echo propagate_env_change.exe downloaded and extracted successfully.
    popd
)

echo Building MSI...
msbuild /t:rebuild /p:Configuration=Release %REPO_ROOT%\build_scripts\windows\azure-cli.wixproj

if %errorlevel% neq 0 goto ERROR

start %OUTPUT_DIR%

goto END

:ERROR
echo Error occurred, please check the output for details.
exit /b 1

:END
exit /b 0
popd

@echo off
SetLocal EnableDelayedExpansion

REM Double colon :: should not be used in parentheses blocks, so we use REM.
REM See https://stackoverflow.com/a/12407934/2199657

echo build a msi installer using local cli sources and python executables. You need to have curl.exe, unzip.exe and msbuild.exe available under PATH
echo.

set "PATH=%PATH%;%ProgramFiles%\Git\bin;%ProgramFiles%\Git\usr\bin;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin"

if "%CLI_VERSION%"=="" (
    echo Please set the CLI_VERSION environment variable, e.g. 2.0.13
    goto ERROR
)
set PYTHON_VERSION=3.10.3

set WIX_DOWNLOAD_URL="https://azurecliprod.blob.core.windows.net/msi/wix310-binaries-mirror.zip"
set PYTHON_DOWNLOAD_URL="https://www.python.org/ftp/python/3.10.3/python-3.10.3-embed-win32.zip"
set PROPAGATE_ENV_CHANGE_DOWNLOAD_URL="https://azurecliprod.blob.core.windows.net/util/propagate_env_change.zip"

REM https://pip.pypa.io/en/stable/installation/#get-pip-py
set GET_PIP_DOWNLOAD_URL="https://bootstrap.pypa.io/get-pip.py"

REM Set up the output directory and temp. directories
echo Cleaning previous build artifacts...
set OUTPUT_DIR=%~dp0..\out
if exist %OUTPUT_DIR% rmdir /s /q %OUTPUT_DIR%
mkdir %OUTPUT_DIR%

set ARTIFACTS_DIR=%~dp0..\artifacts
mkdir %ARTIFACTS_DIR%
set TEMP_SCRATCH_FOLDER=%ARTIFACTS_DIR%\cli_scratch
set BUILDING_DIR=%ARTIFACTS_DIR%\cli
set WIX_DIR=%ARTIFACTS_DIR%\wix
set PYTHON_DIR=%ARTIFACTS_DIR%\Python
set PROPAGATE_ENV_CHANGE_DIR=%~dp0..\propagate_env_change

set REPO_ROOT=%~dp0..\..\..

REM reset working folders
if exist %BUILDING_DIR% rmdir /s /q %BUILDING_DIR%
REM rmdir always returns 0, so check folder's existence
if exist %BUILDING_DIR% (
    echo Failed to delete %BUILDING_DIR%.
    goto ERROR
)
mkdir %BUILDING_DIR%

if exist %TEMP_SCRATCH_FOLDER% rmdir /s /q %TEMP_SCRATCH_FOLDER%
if exist %TEMP_SCRATCH_FOLDER% (
    echo Failed to delete %TEMP_SCRATCH_FOLDER%.
    goto ERROR
)
mkdir %TEMP_SCRATCH_FOLDER%

if exist %REPO_ROOT%\privates (
    copy %REPO_ROOT%\privates\*.whl %TEMP_SCRATCH_FOLDER%
)

REM ensure wix is available
if exist %WIX_DIR% (
    echo Using existing Wix at %WIX_DIR%
)
if not exist %WIX_DIR% (
    mkdir %WIX_DIR%
    pushd %WIX_DIR%
    echo Downloading Wix.
    curl --output wix-archive.zip %WIX_DOWNLOAD_URL%
    unzip wix-archive.zip
    if %errorlevel% neq 0 goto ERROR
    del wix-archive.zip
    echo Wix downloaded and extracted successfully.
    popd
)

REM ensure Python is available
if exist %PYTHON_DIR% (
    echo Using existing Python at %PYTHON_DIR%
)
if not exist %PYTHON_DIR% (
    echo Setting up Python and pip
    mkdir %PYTHON_DIR%
    pushd %PYTHON_DIR%

    echo Downloading Python
    curl --output python-archive.zip %PYTHON_DOWNLOAD_URL%
    unzip python-archive.zip
    if %errorlevel% neq 0 goto ERROR
    del python-archive.zip
    echo Python downloaded and extracted successfully

    REM Delete _pth file so that Lib\site-packages is included in sys.path
    REM https://github.com/pypa/pip/issues/4207#issuecomment-297396913
    REM https://docs.python.org/3.10/using/windows.html#finding-modules
    del python*._pth

    echo Installing pip
    curl --output get-pip.py %GET_PIP_DOWNLOAD_URL%
    %PYTHON_DIR%\python.exe get-pip.py
    del get-pip.py
    echo Pip set up successful

    dir .
    popd
)
set PYTHON_EXE=%PYTHON_DIR%\python.exe

robocopy %PYTHON_DIR% %BUILDING_DIR% /s /NFL /NDL

set CLI_SRC=%REPO_ROOT%\src
%BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --force-reinstall pycparser==2.18
for %%a in (%CLI_SRC%\azure-cli %CLI_SRC%\azure-cli-core %CLI_SRC%\azure-cli-telemetry) do (
   pushd %%a
   %BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --no-cache-dir --no-deps .
   popd
)
%BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --requirement %CLI_SRC%\azure-cli\requirements.py3.windows.txt

if %errorlevel% neq 0 goto ERROR

pushd %BUILDING_DIR%
%BUILDING_DIR%\python.exe %~dp0\patch_models_v2.py
%BUILDING_DIR%\python.exe %~dp0\remove_unused_api_versions.py
popd

echo Creating the wbin (Windows binaries) folder that will be added to the path...
mkdir %BUILDING_DIR%\wbin
copy %REPO_ROOT%\build_scripts\windows\scripts\az.cmd %BUILDING_DIR%\wbin\
copy %REPO_ROOT%\build_scripts\windows\scripts\az %BUILDING_DIR%\wbin\
if %errorlevel% neq 0 goto ERROR
copy %REPO_ROOT%\build_scripts\windows\resources\CLI_LICENSE.rtf %BUILDING_DIR%
copy %REPO_ROOT%\build_scripts\windows\resources\ThirdPartyNotices.txt %BUILDING_DIR%
copy %REPO_ROOT%\NOTICE.txt %BUILDING_DIR%

REM Remove .py and only deploy .pyc files
pushd %BUILDING_DIR%\Lib\site-packages
for /f %%f in ('dir /b /s *.pyc') do (
    set PARENT_DIR=%%~df%%~pf..
    echo !PARENT_DIR! | findstr /C:\Lib\site-packages\pip\ 1>nul
    if !errorlevel! neq  0 (
        REM Only take the file name without 'pyc' extension: e.g., (same below) __init__.cpython-310
        set FILENAME=%%~nf
        REM Truncate the '.cpython-310' postfix which is 12 chars long: __init__
        REM https://stackoverflow.com/a/636391/2199657
        set BASE_FILENAME=!FILENAME:~0,-12!
        REM __init__.pyc
        set pyc=!BASE_FILENAME!.pyc
        REM Delete ..\__init__.py
        del !PARENT_DIR!\!BASE_FILENAME!.py
        REM Copy to ..\__init__.pyc
        copy %%~f !PARENT_DIR!\!pyc! >nul
        REM Delete __init__.pyc
        del %%~f
    ) ELSE (
        echo --SKIP !PARENT_DIR! under pip
    )
)
popd

REM Remove __pycache__
echo remove pycache
for /d /r %BUILDING_DIR%\Lib\site-packages\pip %%d in (__pycache__) do (
    if exist %%d rmdir /s /q "%%d"
)

REM Remove aio
echo remove aio
for /d /r %BUILDING_DIR%\Lib\site-packages\azure\mgmt %%d in (aio) do (
    if exist %%d rmdir /s /q "%%d"
)

REM Remove dist-info
echo remove dist-info
pushd %BUILDING_DIR%\Lib\site-packages
for /d %%d in ("azure*.dist-info") do (
    if exist %%d rmdir /s /q "%%d"
)
popd

if %errorlevel% neq 0 goto ERROR

REM ensure propagate_env_change.exe is available
if exist "%PROPAGATE_ENV_CHANGE_DIR%\propagate_env_change.exe" (
    echo Using existing propagate_env_change.exe at %PROPAGATE_ENV_CHANGE_DIR%
) else (
    pushd %PROPAGATE_ENV_CHANGE_DIR%
    echo Downloading propagate_env_change.exe.
    curl --output propagate_env_change.zip %PROPAGATE_ENV_CHANGE_DOWNLOAD_URL%
    unzip propagate_env_change.zip
    if %errorlevel% neq 0 goto ERROR
    del propagate_env_change.zip
    echo propagate_env_change.exe downloaded and extracted successfully.
    popd
)

echo Building MSI...
msbuild /t:rebuild /p:Configuration=Release %REPO_ROOT%\build_scripts\windows\azure-cli.wixproj

if %errorlevel% neq 0 goto ERROR

start %OUTPUT_DIR%

goto END

:ERROR
echo Error occurred, please check the output for details.
exit /b 1

:END
exit /b 0
popd

[Packaging] Bump MSI embedded Python to 3.10.3 (#21746)


:: build
setlocal

set qtplatform=%PLATFORM%
for %%* in (.) do set CurrDirName=%%~nx*

call %VC_DIR% %VC_VARSALL% || exit /B 1

mkdir build-%qtplatform%
cd build-%qtplatform%

C:\projects\Qt\%QT_VER%\%qtplatform%\bin\qmake ../ || exit /B 1
nmake qmake_all || exit /B 1
nmake || exit /B 1
nmake lrelease || exit /B 1
nmake INSTALL_ROOT=\projects\%CurrDirName%\install install || exit /B 1

:: build and run test
if NOT "%NO_TESTS%" == "" goto no_tests
	nmake all || exit /B 1

	setlocal
	set PATH=C:\projects\Qt\%QT_VER%\%qtplatform%\bin;%CD%\lib;%PATH%;
	set QT_PLUGIN_PATH=%CD%\plugins;%QT_PLUGIN_PATH%;
	if "%TEST_DIR%" == "" (
		set TEST_DIR=.\tests\auto
	)
	cd %TEST_DIR%
	set QT_QPA_PLATFORM=minimal
	for /r %%f in (tst_*.exe) do (
		start /w call %%f ^> %CD%/test.log ^|^| echo FAIL ^> fail ^& exit || exit /B 1
		type test.log
		if exist fail exit /B 1
	)
	endlocal
	cd \projects\%CurrDirName%\build-%qtplatform%
:no_tests

:: build examples
if "%BUILD_EXAMPLES%" == "" goto no_examples
	nmake sub-examples || exit /B 1

	cd examples
	nmake INSTALL_ROOT=\projects\%CurrDirName%\install install || exit /B 1
	cd ..
:no_examples

:: build documentation
if "%BUILD_DOC%" == "" goto no_doc
	nmake doxygen || exit /B 1

	cd doc
	nmake INSTALL_ROOT=\projects\%CurrDirName%\install install || exit /B 1
	cd ..
:no_doc

Create build-msvc.bat

Create build-msvc.bat


:::: move files
@echo please input the sourcecode solution directory
xcopy /y  /f  GenesisJson.cpp   %1\Chain\libraries\blockchain\GenesisJson.cpp
xcopy /y  /f  GenesisJson_test.cpp  %1\Chain\libraries\blockchain\GenesisJson_test.cpp
xcopy /y  /f  SeedNodes.hpp   %1\Chain\libraries\include\client\SeedNodes.hpp

:::: this file is to help move files into Achain/src corresponding directory
@echo please input the sourcecode solution directory
xcopy /y  /f  GenesisJson.cpp   %1\Chain\libraries\blockchain\GenesisJson.cpp
xcopy /y  /f  GenesisJson_test.cpp  %1\Chain\libraries\blockchain\GenesisJson_test.cpp
xcopy /y  /f  SeedNodes.hpp   %1\Chain\libraries\include\client\SeedNodes.hpp

add some instructions

add some instructions

add some instructions


MKDIR build\windows
CD build\windows

cmake ..\.. ^
        -G "%CMAKE_GENERATOR%" ^
        -DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
        -DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
        -DBUILD_STATIC_LIBS=1 ^
        -DBUILD_SHARED_LIBS=1

ECHO VS files have been generated in build\windows

dir

cmake --build . --config Release --target ALL_BUILD
cmake --build . --config Release --target ZERO_CHECK
cmake --build . --config Release --target install

add --target install

add  --target install


@echo off

set VS2013_ENV_CMD="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
set VS2012_ENV_CMD="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"

if exist %VS2013_ENV_CMD% (
  call %VS2013_ENV_CMD%
) else if exist %VS2012_ENV_CMD% (
  call %VS2012_ENV_CMD%
) else (
  goto visual_studio_not_found
)

:build_3rdparty
cmake -P 3rdPartyBuild.cmake
goto :eof

:visual_studio_not_found
echo Error: No compatible version of Visual Studio was found

@echo off

set VS2013_ENV_CMD="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
set VS2012_ENV_CMD="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"

if exist %VS2013_ENV_CMD% (
  call %VS2013_ENV_CMD%
) else if exist %VS2012_ENV_CMD% (
  call %VS2012_ENV_CMD%
) else (
  goto visual_studio_not_found
)

set DPHOME=%~dp0
set DP_3RDPARTY_PATH=%DPHOME%3rdparty

:build_3rdparty
cmake -P 3rdPartyBuild.cmake
mkdir builds
goto :eof

:visual_studio_not_found
echo Error: No compatible version of Visual Studio was found

Add code to set DPHOME and DP_3RDPARTY_PATH in the script 3rdPartyBuild.cmd


REM This batch script is an effort at porting the Unix Makefile for
REM Windows. Therefore, it may not be updated as frequent as the Unix
REM Makefile. (Please consider helping us keeping it up to date)

@ECHO OFF

:args
IF NOT "%1"=="" (
  call :%1
  SHIFT
  GOTO args
)
GOTO :EOF

:releases
call :pre_build
call :build
grunt

:pre_build
mkdir build

:build
cp -R src/* build
call :build_server
call :build_viewer
cd build
npm install
cd ..

:build_server
npm install GochoMugo/docvy-server#develop
mv node_modules/docvy-server build/server

:build_viewer
npm install GochoMugo/docvy-viewer#develop
mv node_modules/docvy-viewer build/viewer

:src
call :src_viewer
call :src_server

:src_viewer
mklink src\viewer ..\..\docvy-viewer\dist

:src_server
mklink /d src\server ..\..\docvy-server

Add note about updates to the Windows build script


Build 72

Build 72


:: Copyright 2014 by SyneArt <sa@syneart.com>
@echo off&cls&title Install&color 0F&mode con cols=38 lines=10
setlocal enableextensions enabledelayedexpansion
echo.&echo.&echo.&echo.&echo Install Theme Now ..
set str=!PATH: =/!&set str=!str:(x86)=[x86]!&set MiKTeXPath=nul
FOR %%b in (!str!) DO (
	set nowStr=%%b&set MiKTeXStr=x!nowStr:MiKTeX=!
	if not !MiKTeXStr!==x!nowStr! set MiKTeXPath=!nowStr!
)
if !MiKTeXPath!==nul (
	cls&echo.&echo.&echo.&echo.&echo Хw MiKTeX, A楻w
	color E3&set /p=&goto exit
)
set MiKTeXPath=!MiKTeXPath:miktex\bin\=!&set MiKTeXPath=!MiKTeXPath:/= !&set MiKTeXPath=!MiKTeXPath:[x86]=(x86)!
if not exist "!MiKTeXPath!tex\latex\beamer\" (
	cls&echo.&echo.&echo.&echo.&echo Хw Beamer, A楻w
	color E3&set /p=&goto exit
)
call:copyFile .\themes, *.sty&call:copyFile .\art, *.jpg
initexmf --admin --update-fndb >nul
if !errorlevel!==1 (
	cls&echo.&echo.&echo.&echo.&echo ХsĶ MiKTeX M, A
	color 4C&set /p=&goto exit
)
cls&echo.&echo.&echo.&echo.&echo Install Theme Successful ^^!&color 2A&ping 127.0.0.1 -n 3 >nul&goto exit

:copyFile
FOR /R %~1 %%c in (%~2) DO (
	set themesFile=%%c&set themesFile=!themesFile:%~dp0=!
	copy /Y "%%c" "!MiKTeXPath!tex\latex\beamer\base\!themesFile!" >nul
)

:exit

:: Copyright 2014 by SyneArt <sa@syneart.com>
@echo off&cls&title Install&color 0F&mode con cols=38 lines=10
setlocal enableextensions enabledelayedexpansion
echo.&echo.&echo.&echo.&echo Install Theme Now ..
set str=!PATH: =/!&set str=!str:(x86)=[x86]!&set MiKTeXPath=nul
FOR %%b in (!str!) DO (
	set nowStr=%%b&set MiKTeXStr=x!nowStr:MiKTeX=!
	if not !MiKTeXStr!==x!nowStr! set MiKTeXPath=!nowStr!
)
if !MiKTeXPath!==nul (
	cls&echo.&echo.&echo.&echo.&echo 請先安裝 MiKTeX, 再執行本安裝
	color E3&set /p=&goto exit
)
set MiKTeXPath=!MiKTeXPath:miktex\bin\=!&set MiKTeXPath=!MiKTeXPath:x64\=!&set MiKTeXPath=!MiKTeXPath:/= !&set MiKTeXPath=!MiKTeXPath:[x86]=(x86)!
if not exist "!MiKTeXPath!tex\latex\beamer\" (
	cls&echo.&echo.&echo.&echo.&echo 請先安裝 Beamer, 再執行本安裝
	color E3&set /p=&goto exit
)
call:copyFile .\themes, *.sty&call:copyFile .\art, *.jpg
initexmf --admin --update-fndb >nul
if !errorlevel!==1 (
	cls&echo.&echo.&echo.&echo.&echo 請先停止編譯 MiKTeX 專案, 再執行
	color 4C&set /p=&goto exit
)
cls&echo.&echo.&echo.&echo.&echo Install Theme Successful ^^!&color 2A&ping 127.0.0.1 -n 3 >nul&goto exit

:copyFile
FOR /R %~1 %%c in (%~2) DO (
	set themesFile=%%c&set themesFile=!themesFile:%~dp0=!
	copy /Y "%%c" "!MiKTeXPath!tex\latex\beamer\base\!themesFile!" >nul
)

:exit

Fix MiKTeX x64 Path decide

Fix MiKTeX x64 Path decide


set /p versionNumber=

"C:\Program Files\Microsoft F#\v4.0\fsc.exe" -o:Unquote.dll --noframework --define:TRACE --optimize+ -r:"C:\Program Files\FSharp-2.0.0.0\v4.0\bin\FSharp.Compiler.dll" -r:"C:\Program Files\FSharp-2.0.0.0\v4.0\bin\FSharp.Compiler.Interactive.Settings.dll" -r:"C:\Program Files\FSharp-2.0.0.0\v4.0\bin\FSharp.Core.dll" -r:"C:\Program Files\FSharpPowerPack-2.0.0.0\\bin\FSharp.PowerPack.dll" -r:"C:\Program Files\FSharpPowerPack-2.0.0.0\\bin\FSharp.PowerPack.Linq.dll" -r:"C:\Program Files\FSharpPowerPack-2.0.0.0\\bin\FSharp.PowerPack.Metadata.dll" -r:"C:\Program Files\FSharpPowerPack-2.0.0.0\\bin\FSharp.PowerPack.Parallel.Seq.dll" -r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" -r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" -r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" -r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Numerics.dll" --target:library --warn:3 --warnaserror:76 --vserrors --LCID:1033 --utf8output --fullpaths --flaterrors "C:\Users\Stephen\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.fs" Unquote\RegexUtils.fs Unquote\Sprint.fs Unquote\Reduce.fs Unquote\TypeExt.fs Unquote\ExprExt.fs Unquote\Operators.fs

7z a -tzip builds\Unquote-%versionNumber%.zip Unquote.dll LICENSE NOTICE readme.html
del Unquote.dll
pause

set /p versionNumber=

"C:\Program Files\Microsoft F#\v4.0\fsc.exe" -o:Unquote.dll --noframework --define:TRACE --optimize+ -r:"C:\Program Files\FSharp-2.0.0.0\v4.0\bin\FSharp.Compiler.dll" -r:"C:\Program Files\FSharp-2.0.0.0\v4.0\bin\FSharp.Compiler.Interactive.Settings.dll" -r:"C:\Program Files\FSharp-2.0.0.0\v4.0\bin\FSharp.Core.dll" -r:"C:\Program Files\FSharpPowerPack-2.0.0.0\\bin\FSharp.PowerPack.dll" -r:"C:\Program Files\FSharpPowerPack-2.0.0.0\\bin\FSharp.PowerPack.Linq.dll" -r:"C:\Program Files\FSharpPowerPack-2.0.0.0\\bin\FSharp.PowerPack.Metadata.dll" -r:"C:\Program Files\FSharpPowerPack-2.0.0.0\\bin\FSharp.PowerPack.Parallel.Seq.dll" -r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" -r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" -r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" -r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Numerics.dll" --target:library --warn:3 --warnaserror:76 --vserrors --LCID:1033 --utf8output --fullpaths --flaterrors "C:\Users\Stephen\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.fs" Unquote\Printf.fs Unquote\RegexUtils.fs Unquote\Sprint.fs Unquote\Reduce.fs Unquote\TypeExt.fs Unquote\ExprExt.fs Unquote\Operators.fs

7z a -tzip builds\Unquote-%versionNumber%.zip Unquote.dll LICENSE NOTICE readme.html
del Unquote.dll
pause

update build script to include Printf.fs


@echo off
mkdir build && ^
cd build && ^
cmake -G "Visual Studio 15 Win64" ../ && ^
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 && ^
MSBuild xLearn.sln /p:Configuration=Release && ^
cd python-package && ^
python setup.py bdist_wheel

@echo off
mkdir build && ^
cd build && ^
cmake -G "Visual Studio 15 Win64" ../ && ^
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 && ^
MSBuild xLearn.sln /p:Configuration=Release && ^
REM the under two lines run correct only if the project on C(drive disk), you can comment this two lines.
cd python-package && ^
python setup.py bdist_wheel -p win_amd64 --python-tag cp36 --py-limited-api cp36m

update build.abt

update build.abt


set /p versionNumber=

"C:\Program Files\Microsoft F#\v4.0\fsc.exe" -o:Unquote.dll --noframework --define:TRACE --optimize+ -r:"C:\Program Files\FSharp-2.0.0.0\v4.0\bin\FSharp.Compiler.dll" -r:"C:\Program Files\FSharp-2.0.0.0\v4.0\bin\FSharp.Compiler.Interactive.Settings.dll" -r:"C:\Program Files\FSharp-2.0.0.0\v4.0\bin\FSharp.Core.dll" -r:"C:\Program Files\FSharpPowerPack-2.0.0.0\\bin\FSharp.PowerPack.dll" -r:"C:\Program Files\FSharpPowerPack-2.0.0.0\\bin\FSharp.PowerPack.Linq.dll" -r:"C:\Program Files\FSharpPowerPack-2.0.0.0\\bin\FSharp.PowerPack.Metadata.dll" -r:"C:\Program Files\FSharpPowerPack-2.0.0.0\\bin\FSharp.PowerPack.Parallel.Seq.dll" -r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" -r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" -r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" -r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Numerics.dll" --target:library --warn:3 --warnaserror:76 --vserrors --LCID:1033 --utf8output --fullpaths --flaterrors "C:\Users\Stephen\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.fs" Unquote\Utils\Misc.fs Unquote\Utils\Regex.fs Unquote\Utils\Printf.fs Unquote\Utils\ListExt.fs Unquote\ExtraReflection.fs Unquote\ExtraPatterns.fs Unquote\Sprint.fs Unquote\Reduce.fs Unquote\TypeExt.fs Unquote\ExprExt.fs Unquote\Operators.fs

7z a -tzip builds\Unquote-%versionNumber%.zip Unquote.dll LICENSE NOTICE
del Unquote.dll
pause

set /p versionNumber=

"c:\Program Files (x86)\Microsoft F#\v4.0\fsc.exe" -o:Utils.dll --noframework --define:TRACE --optimize+ -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v4.0\FSharp.Core.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Numerics.dll" --target:library --warn:3 --warnaserror:76 --vserrors --LCID:1033 --utf8output --fullpaths --flaterrors "C:\Users\Stephen\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.fs" Utils\AssemblyInfo.fs Utils\MiscUtils.fs Utils\RegexUtils.fs Utils\PrintfUtils.fs Utils\ListExtensions.fs

"c:\Program Files (x86)\Microsoft F#\v4.0\fsc.exe" -o:Unquote.dll --noframework --define:TRACE --doc:Unquote.XML --optimize+ -r:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\FSharp.Compiler\v4.0_4.0.0.0__b03f5f7f11d50a3a\FSharp.Compiler.dll" -r:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\FSharp.Compiler.Interactive.Settings\v4.0_4.0.0.0__b03f5f7f11d50a3a\FSharp.Compiler.Interactive.Settings.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v4.0\FSharp.Core.dll" -r:"C:\Program Files (x86)\FSharpPowerPack-2.0.0.0\\bin\FSharp.PowerPack.Metadata.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Numerics.dll" -r:"Utils.dll" --target:library --warn:3 --warnaserror:76 --vserrors --LCID:1033 --utf8output --fullpaths --flaterrors --staticlink:FSharp.PowerPack.Metadata --staticlink:Utils "C:\Users\Stephen\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.fs" Unquote\AssemblyInfo.fs Unquote\DynamicOperators.fs Unquote\Evaluation.fs Unquote\ExtraReflection.fs Unquote\ExtraPatterns.fs Unquote\Decompilation.fs Unquote\Reduction.fs Unquote\Extensions.fs Unquote\Operators.fs Unquote\Assertions.fs

7z a -tzip builds\Unquote-%versionNumber%.zip Unquote.dll Unquote.XML LICENSE NOTICE
del Unquote.XML
del Unquote.dll
del Utils.dll
pause

update build.bat, going for 2.0.0 release soon


@echo off
setlocal

set _config=%1
if not defined _config (
  set _config=Debug
)

echo --------------------------
echo !!! Restoring packages !!!
echo --------------------------
dotnet restore

echo -------------------------
echo !!! Cleaning solution !!!
echo -------------------------
dotnet clean -c %_config%

echo -------------------------
echo !!! Building solution !!!
echo -------------------------
dotnet build -c %_config%

echo ---------------------
echo !!! Running tests !!!
echo ---------------------
dotnet test --no-build -c %_config% test\CommandLine.tests.csproj
dotnet test --no-build -c %_config% analyzer\CommandLine.Analyzer.Test\CommandLine.Analyzer.Test.csproj

if not "%_config%" == "Release" (
	echo =======================================================
	echo Skipping over package creation as not building Release
	echo =======================================================
	goto :eof
)

echo ------------------------------
echo !!! Creating NuGet package !!!
echo ------------------------------
dotnet pack -c %_config%

endlocal
@echo on

Update the build script to restore and run tests


@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


@ECHO OFF
PUSHD %~dp0

SETLOCAL
SETLOCAL ENABLEDELAYEDEXPANSION

:Loop
if [%1]==[] GOTO Begin

if /I [%1]==[Debug] (
    SET Configuration=%1
    GOTO Next
)

if /I [%1]==[Release] (
    SET Configuration=%1
    GOTO Next
)

if /I [%1]==[PROD] (
    SET Environment=PROD
    GOTO Next
)

if /I [%1]==[raw] (
    SET SkipTemplate=true
    GOTO Next
)
if /I [%1]==[template] (
    SET UpdateTemplate=%1
    GOTO Next
)
if /I [%1]==[nonnetcore] (
    SET OnlyNonNetCore=true
    GOTO Next
)
REM TODO: remove it in next sprint
if /I [%1]==[nondnx] (
    SET OnlyNonNetCore=true
    GOTO Next
)

:Next
SHIFT /1
GOTO Loop

:Begin
IF NOT DEFINED VisualStudioVersion (
    IF DEFINED VS140COMNTOOLS (
        CALL "%VS140COMNTOOLS%\VsDevCmd.bat"
        GOTO EnvSet
    )

    ECHO Error: build.cmd requires Visual Studio 2015.
    SET ERRORLEVEL=1
    GOTO Exit
)

:EnvSet
SET BuildProj=%~dp0All.sln
IF [%Configuration%]==[] (
    SET Configuration=Release
)
IF /I [%Environment%]==[PROD] (
    ECHO Updating version for PROD environment
    CALL UpdateVersion.cmd

    IF NOT [!ERRORLEVEL!]==[0] (
        ECHO ERROR: Error occurs when updating version
        GOTO Exit
    )
)
IF /I [%UpdateTemplate%]==[template] (
    ECHO Updating template
    CALL UpdateTemplate.cmd
    IF NOT [!ERRORLEVEL!]==[0] (
        ECHO ERROR: Error occurs when updating template
    )
    GOTO Exit
)
IF /I [%SkipTemplate%]==[true] (
    ECHO Skip updating template
    GOTO CheckIfOnlyBuildNonDnx
)

:: Update template before build
:UpdateTemplate
ECHO Updating template
CALL UpdateTemplate.cmd
IF NOT [!ERRORLEVEL!]==[0] (
    ECHO ERROR: Error occurs when updating template
    GOTO Exit
)

:CheckIfOnlyBuildNonDnx
IF /I [%OnlyNonNetCore%]==[true] (
    ECHO Only build NonNETCore.sln
    SET BuildProj=%~dp0NonNETCore.sln
    CALL :RestoreNormalPackage
    GOTO SetBuildLog
)

:: Check if dotnet cli exists globally
:CheckDotnetCli
WHERE dotnet >NUL
IF NOT [!ERRORLEVEL!]==[0] (
    ECHO ERROR: dotnet CLI is not successfully configured.
    ECHO ERROR: Please follow https://www.microsoft.com/net/core to install .NET Core.
    GOTO Exit
)

:: Restore packages for .csproj projects

CALL :RestorePackage

:: Log build command line
:SetBuildLog
SET BuildLog=%~dp0msbuild.log
SET BuildPrefix=echo
SET BuildPostfix=^> "%BuildLog%"

CALL :Build %*

:: Build
SET BuildPrefix=
SET BuildPostfix=
CALL :Build %*

IF NOT [!ERRORLEVEL!]==[0] (
    GOTO AfterBuild
)

POPD

:AfterBuild
CALL :GenerateArtifacts

:: Pull the build summary from the log file
ECHO.
ECHO === BUILD RESULT ===
findstr /ir /c:".*Warning(s)" /c:".*Error(s)" /c:"Time Elapsed.*" "%BuildLog%" & cd >nul

:: Pull xunit test result from the log file
ECHO.
ECHO === TEST EXECUTION SUMMARY ===
findstr /ir /c:"Total:.*Failed.*Skipped.*Time.*" "%BuildLog%" & cd >nul

ECHO Exit Code: %BuildErrorLevel%
SET ERRORLEVEL=%BuildErrorLevel%

GOTO Exit

:Build
dotnet build src\docfx -c %Configuration% -o target\%Configuration%\docfx.cli -f net452
%BuildPrefix% msbuild "%BuildProj%" /p:Configuration=%Configuration% /nologo /maxcpucount:1 /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=d;LogFile="%BuildLog%"; %BuildPostfix%
SET BuildErrorLevel=%ERRORLEVEL%
EXIT /B %ERRORLEVEL%

:GenerateArtifacts
ECHO pack nuget package
FOR /f %%g IN ('DIR /b "src"') DO (
    CMD /C dotnet pack src\%%g -c Release -o artifacts\Release
)

:RestorePackage

:RestoreNormalPackage
:: Currently version 3.3 is not compatible with our build, force to use v2.8.6
SET CachedNuget=%LocalAppData%\NuGet\v2.8.6\NuGet.exe
IF EXIST "%CachedNuget%" GOTO Restore
ECHO Downloading NuGet.exe v2.8.6...
IF NOT EXIST "%LocalAppData%\NuGet\v2.8.6" MD "%LocalAppData%\NuGet\v2.8.6"
powershell -NoProfile -ExecutionPolicy UnRestricted -Command "$ProgressPreference = 'SilentlyContinue'; [Net.WebRequest]::DefaultWebProxy.Credentials = [Net.CredentialCache]::DefaultCredentials; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/v2.8.6/nuget.exe' -OutFile '%CachedNuget%'"

IF NOT [!ERRORLEVEL!]==[0] (
    ECHO ERROR: Failed downloading NuGet.exe
    GOTO Exit
)

:Restore
%CachedNuget% restore "%BuildProj%"
IF NOT [!ERRORLEVEL!]==[0] (
    ECHO ERROR: Error when restoring packages for %BuildProj%
)

:RestoreDnuPackage
FOR /D %%x IN ("src") DO (
    PUSHD %%x
    CMD /C dotnet restore
    POPD
)

:Exit
POPD
ECHO.

EXIT /B %ERRORLEVEL%

@ECHO OFF
PUSHD %~dp0

SETLOCAL
SETLOCAL ENABLEDELAYEDEXPANSION

:Loop
if [%1]==[] GOTO Begin

if /I [%1]==[Debug] (
    SET Configuration=%1
    GOTO Next
)

if /I [%1]==[Release] (
    SET Configuration=%1
    GOTO Next
)

if /I [%1]==[PROD] (
    SET Environment=PROD
    GOTO Next
)

if /I [%1]==[raw] (
    SET SkipTemplate=true
    GOTO Next
)
if /I [%1]==[template] (
    SET UpdateTemplate=%1
    GOTO Next
)
if /I [%1]==[nonnetcore] (
    SET OnlyNonNetCore=true
    GOTO Next
)
REM TODO: remove it in next sprint
if /I [%1]==[nondnx] (
    SET OnlyNonNetCore=true
    GOTO Next
)

:Next
SHIFT /1
GOTO Loop

:Begin
IF NOT DEFINED VisualStudioVersion (
    IF DEFINED VS140COMNTOOLS (
        CALL "%VS140COMNTOOLS%\VsDevCmd.bat"
        GOTO EnvSet
    )

    ECHO Error: build.cmd requires Visual Studio 2015.
    SET ERRORLEVEL=1
    GOTO Exit
)

:EnvSet
SET BuildProj=%~dp0All.sln
IF [%Configuration%]==[] (
    SET Configuration=Release
)
IF /I [%Environment%]==[PROD] (
    ECHO Updating version for PROD environment
    CALL UpdateVersion.cmd

    IF NOT [!ERRORLEVEL!]==[0] (
        ECHO ERROR: Error occurs when updating version
        GOTO Exit
    )
)
IF /I [%UpdateTemplate%]==[template] (
    ECHO Updating template
    CALL UpdateTemplate.cmd
    IF NOT [!ERRORLEVEL!]==[0] (
        ECHO ERROR: Error occurs when updating template
    )
    GOTO Exit
)
IF /I [%SkipTemplate%]==[true] (
    ECHO Skip updating template
    GOTO CheckIfOnlyBuildNonDnx
)

:: Update template before build
:UpdateTemplate
ECHO Updating template
CALL UpdateTemplate.cmd
IF NOT [!ERRORLEVEL!]==[0] (
    ECHO ERROR: Error occurs when updating template
    GOTO Exit
)

:CheckIfOnlyBuildNonDnx
IF /I [%OnlyNonNetCore%]==[true] (
    ECHO Only build NonNETCore.sln
    SET BuildProj=%~dp0NonNETCore.sln
    CALL :RestoreNormalPackage
    GOTO SetBuildLog
)

:: Check if dotnet cli exists globally
:CheckDotnetCli
WHERE dotnet >NUL
IF NOT [!ERRORLEVEL!]==[0] (
    ECHO ERROR: dotnet CLI is not successfully configured.
    ECHO ERROR: Please follow https://www.microsoft.com/net/core to install .NET Core.
    GOTO Exit
)

:: Restore packages for .csproj projects

CALL :RestorePackage

:: Log build command line
:SetBuildLog
SET BuildLog=%~dp0msbuild.log
SET BuildPrefix=echo
SET BuildPostfix=^> "%BuildLog%"

CALL :Build %*

:: Build
SET BuildPrefix=
SET BuildPostfix=
CALL :Build %*

IF NOT [!ERRORLEVEL!]==[0] (
    GOTO AfterBuild
)

POPD

:AfterBuild
CALL :GenerateArtifacts

:: Pull the build summary from the log file
ECHO.
ECHO === BUILD RESULT ===
findstr /ir /c:".*Warning(s)" /c:".*Error(s)" /c:"Time Elapsed.*" "%BuildLog%" & cd >nul

:: Pull xunit test result from the log file
ECHO.
ECHO === TEST EXECUTION SUMMARY ===
findstr /ir /c:"Total:.*Failed.*Skipped.*Time.*" "%BuildLog%" & cd >nul

ECHO Exit Code: %BuildErrorLevel%
SET ERRORLEVEL=%BuildErrorLevel%

GOTO Exit

:Build
REM remove for dotnet cli bug https://github.com/dotnet/cli/issues/2871
REM dotnet build src\docfx -c %Configuration% -o target\%Configuration%\docfx.cli -f net452
dotnet build src\docfx -c %Configuration% -f net452
XCOPY /ey src\docfx\bin\%Configuration%\net452\win7-x64\** target\%Configuration%\docfx.cli\
%BuildPrefix% msbuild "%BuildProj%" /p:Configuration=%Configuration% /nologo /maxcpucount:1 /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=d;LogFile="%BuildLog%"; %BuildPostfix%
SET BuildErrorLevel=%ERRORLEVEL%
EXIT /B %ERRORLEVEL%

:GenerateArtifacts
ECHO pack nuget package
FOR /f %%g IN ('DIR /b "src"') DO (
    CMD /C dotnet pack src\%%g -c Release -o artifacts\Release
)

:RestorePackage

:RestoreNormalPackage
:: Currently version 3.3 is not compatible with our build, force to use v2.8.6
SET CachedNuget=%LocalAppData%\NuGet\v2.8.6\NuGet.exe
IF EXIST "%CachedNuget%" GOTO Restore
ECHO Downloading NuGet.exe v2.8.6...
IF NOT EXIST "%LocalAppData%\NuGet\v2.8.6" MD "%LocalAppData%\NuGet\v2.8.6"
powershell -NoProfile -ExecutionPolicy UnRestricted -Command "$ProgressPreference = 'SilentlyContinue'; [Net.WebRequest]::DefaultWebProxy.Credentials = [Net.CredentialCache]::DefaultCredentials; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/v2.8.6/nuget.exe' -OutFile '%CachedNuget%'"

IF NOT [!ERRORLEVEL!]==[0] (
    ECHO ERROR: Failed downloading NuGet.exe
    GOTO Exit
)

:Restore
%CachedNuget% restore "%BuildProj%"
IF NOT [!ERRORLEVEL!]==[0] (
    ECHO ERROR: Error when restoring packages for %BuildProj%
)

:RestoreDnuPackage
FOR /D %%x IN ("src") DO (
    PUSHD %%x
    CMD /C dotnet restore
    POPD
)

:Exit
POPD
ECHO.

EXIT /B %ERRORLEVEL%

Fix bug while packing docfx.cli (#674)

Fix bug while packing docfx.cli (#674)


@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


Add pre-build MyGet step to Update Nugets


@echo OFF

REM #################################################################################
REM ##
REM ## Copyright © 2014-2015 Cask Data, Inc.
REM ##
REM ## Licensed under the Apache License, Version 2.0 (the "License"); you may not
REM ## use this file except in compliance with the License. You may obtain a copy of
REM ## 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, WITHOUT
REM ## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
REM ## License for the specific language governing permissions and limitations under
REM ## the License.
REM ##
REM #################################################################################

SET ORIGPATH=%cd%
SET CDAP_HOME=%~dp0
SET CDAP_HOME=%CDAP_HOME:~0,-5%
SET JAVACMD=%JAVA_HOME%\bin\java.exe

REM %CDAP_HOME%
SET CLASSPATH=%CDAP_HOME%\lib\*;%CDAP_HOME%\conf\
SET PATH=%PATH%;%CDAP_HOME%\libexec\bin

cd %CDAP_HOME%

REM Process command line
IF "%1" == "start" GOTO START
IF "%1" == "stop" GOTO STOP
IF "%1" == "restart" GOTO RESTART
IF "%1" == "status" GOTO STATUS
IF "%1" == "reset" GOTO RESET
GOTO USAGE

:USAGE
echo Usage: %0 {start^|stop^|restart^|status^|reset}
echo Additional options with start, restart:
echo --enable-debug [ ^<port^> ] to connect to a debug port for Standalone CDAP (default port is 5005)
GOTO :FINALLY

:RESET
REM checks if there exists a PID that is already running. Alert user but still return success
attrib -h %~dsp0MyProg.pid >NUL
if exist %~dsp0MyProg.pid (
  for /F %%i in (%~dsp0MyProg.pid) do (
    for /F "TOKENS=2" %%b in ('TASKLIST /FI "PID eq %%i"') DO (
      set lastPid=%%b
    )
    if "%lastPid%" == "%%i" (
      echo %0 running as process %%i. Stop it first.
      GOTO :FINALLY
    ) else (
      REM If process not running but pid file exists, delete pid file.
      del %~dsp0MyProg.pid
    )
  )
)
attrib +h %~dsp0MyProg.pid >NUL

REM ask for confirmation from user
set /P answer="This deletes all apps, data and logs. Are you sure you want to proceed? (y/n) " %=%
if NOT "%answer%" == "y" (
  GOTO :FINALLY
)

REM delete logs and data directories
echo Resetting Standalone CDAP...
rmdir /S /Q %CDAP_HOME%\logs %CDAP_HOME%\data > NUL 2>&1
echo CDAP reset successfully.
GOTO :FINALLY

:START
REM Check for 64-bit version of OS. Currently not supporting 32-bit Windows
IF NOT EXIST "%PROGRAMFILES(X86)%" (
  echo 32-bit Windows operating system is currently not supported
  GOTO :FINALLY
)

REM Check for correct setting for JAVA_HOME path
if [%JAVA_HOME%] == [] (
  echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
  echo Please set the JAVA_HOME variable in your environment to match the location of your Java installation.
  GOTO :FINALLY
)

REM Check for Java version
setlocal ENABLEDELAYEDEXPANSION
set /a counter=0
for /f "tokens=* delims= " %%f in ('%JAVACMD% -version 2^>^&1') do @(
  if "!counter!"=="0" set line=%%f
  set /a counter+=1
)
set line=%line:java version "1.=!!%
set line=%line:~0,1%
if NOT "%line%" == "7" (
  if NOT "%line%" == "8" (
    echo ERROR: Java version not supported. Please install Java 7 or 8 - other versions of Java are not supported.
    GOTO :FINALLY
  )
)
endlocal

REM Check if Node.js is installed
for %%x in (node.exe) do if [%%~$PATH:x]==[] (
  echo Node.js Standalone CDAP requires Node.js but it's either not installed or not in path. Exiting. 1>&2
  GOTO :FINALLY
)

REM Check for Node.js version
setlocal ENABLEDELAYEDEXPANSION
for /f "tokens=* delims= " %%f in ('node -v') do @(
  set line=%%f
)
set line=%line:v=!!%

for /F "delims=.,v tokens=1,2,3" %%a in ('echo %line%') do (
  if %%a LEQ 1 if %%b LEQ 10 (
    echo Node.js version is not supported. We recommend any version of Node.js greater than v0.10.0.
    GOTO :FINALLY
  )
)
endlocal

REM checks if there exists a PID that is already running. Alert user but still return success
attrib -h %~dsp0MyProg.pid >NUL
if exist %~dsp0MyProg.pid (
  for /F %%i in (%~dsp0MyProg.pid) do (
    setlocal ENABLEDELAYEDEXPANSION
    for /F "TOKENS=2" %%b in ('TASKLIST /FI "PID eq %%i"') DO (
      set lastPid=%%b
    )
    if "!lastPid!" == "%%i" (
      echo %0 running as process %%i. Stop it first or use the restart function.
      GOTO :FINALLY
    ) else (
      REM If process not running but pid file exists, delete pid file.
      del %~dsp0MyProg.pid
    )
    endlocal
  )
)
attrib +h %~dsp0MyProg.pid >NUL

mkdir %CDAP_HOME%\logs > NUL 2>&1

REM Log rotation
call:LOG_ROTATE cdap
call:LOG_ROTATE cdap-process
call:LOG_ROTATE cdap-debug

REM check if debugging is enabled
SET DEBUG_OPTIONS=
setlocal ENABLEDELAYEDEXPANSION
IF "%2" == "--enable-debug" (
  IF "%3" == "" (
    set port=5005
  ) ELSE (
    REM check if port is a number
    SET "check="&FOR /f "delims=0123456789" %%i IN ("%3") DO SET check="x"
    IF DEFINED check (
      echo port number must be an integer.
      ENDLOCAL
      GOTO :FINALLY
    )
    REM check if the number is in range
    set port=%3
    IF !port! LSS 1024 (
      echo port number must be between 1024 and 65535.
      ENDLOCAL
      GOTO :FINALLY
    )
    IF !port! GTR 65535 (
      echo port number must be between 1024 and 65535.
      ENDLOCAL
      GOTO :FINALLY
    )
  )
  set DEBUG_OPTIONS="-agentlib:jdwp=transport=dt_socket,address=localhost:!port!,server=y,suspend=n"
)

start /B %JAVACMD% !DEBUG_OPTIONS! -Dhadoop.security.group.mapping=org.apache.hadoop.security.JniBasedUnixGroupsMappingWithFallback -Dhadoop.home.dir=%CDAP_HOME%\libexec -classpath %CLASSPATH% co.cask.cdap.StandaloneMain >> %CDAP_HOME%\logs\cdap-process.log 2>&1 < NUL
echo Starting Standalone CDAP...

for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq java.exe"') DO SET MyPID=%%b
echo %MyPID% > %~dsp0MyProg.pid
SET lastPid=%MyPID%
attrib +h %~dsp0MyProg.pid >NUL

:SearchLogs
findstr /R /C:".*Failed to start server.*" %CDAP_HOME%\logs\cdap-process.log >NUL 2>&1
if %errorlevel% == 0 GOTO :ServerError

findstr /R /C:"..* started successfully.*" %CDAP_HOME%\logs\cdap-process.log >NUL 2>&1
if not %errorlevel% == 0 GOTO :SearchLogs
if %errorlevel% == 0 GOTO :ServerSuccess
:EndSearchLogs

:ServerError
echo Failed to start, please check logs for more information
GOTO :STOP

:ServerSuccess
echo Standalone CDAP started succesfully.

IF NOT "!DEBUG_OPTIONS!" == "" (
  echo Remote debugger agent started on port !port!.
)
ENDLOCAL

REM Sleep for 5 seconds to wait for Node.js startup
PING 127.0.0.1 -n 6 > NUL 2>&1

for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq node.exe"') DO SET MyNodePID=%%b
echo %MyNodePID% > %~dsp0MyProgNode.pid
attrib +h %~dsp0MyProgNode.pid >NUL
GOTO :FINALLY

:STOP
echo Stopping Standalone CDAP ...
attrib -h %~dsp0MyProg.pid >NUL
if exist %~dsp0MyProg.pid (
  for /F %%i in (%~dsp0MyProg.pid) do (
    taskkill /F /PID %%i >NUL 2>&1
    del %~dsp0MyProg.pid 1>NUL 2>&1
  )
)

REM Sleep for 5 seconds
PING 127.0.0.1 -n 6 > NUL 2>&1

attrib -h %~dsp0MyProgNode.pid >NUL
if exist %~dsp0MyProgNode.pid (
  for /F %%i in (%~dsp0MyProgNode.pid) do (
    taskkill /F /PID %%i >NUL 2>&1
    del %~dsp0MyProgNode.pid 1>NUL 2>&1
  )
)
GOTO :FINALLY

:STATUS
attrib -h %~dsp0MyProg.pid >NUL
if NOT exist %~dsp0MyProg.pid (
  echo %0 is not running
) else (
for /F %%i in (%~dsp0MyProg.pid) do (
  setlocal ENABLEDELAYEDEXPANSION
  for /F "TOKENS=2" %%b in ('TASKLIST /FI "PID eq %%i"') DO (
    set lastPid=%%b
  )
  if "!lastPid!" == "%%i" (
    echo %0 running as process !lastPid!
  ) else (
    echo pidfile exists but process does not appear to be running
  )
  endlocal
 )
)
attrib +h %~dsp0MyProg.pid >NUL
GOTO :FINALLY

:RESTART
CALL :STOP
GOTO :START

:FINALLY
cd %ORIGPATH%
GOTO:EOF

:LOG_ROTATE
setlocal ENABLEDELAYEDEXPANSION
set extension=%1.log
for /F "TOKENS=*" %%b in ('dir  /a-d %CDAP_HOME%\logs 2^>NUL ^| find /c "%extension%" 2^>NUL') DO (
  set /a num=%%b
  FOR /L %%i IN (!num!,-1,1) DO (
    set /a prev_num=%%i+1
    rename %CDAP_HOME%\logs\%extension%.%%i %extension%.!prev_num! >NUL 2>NUL
  )
  rename %CDAP_HOME%\logs\%extension% %extension%.1 >NUL 2>NUL
)
endlocal

@echo OFF

REM #################################################################################
REM ##
REM ## Copyright © 2014-2015 Cask Data, Inc.
REM ##
REM ## Licensed under the Apache License, Version 2.0 (the "License"); you may not
REM ## use this file except in compliance with the License. You may obtain a copy of
REM ## 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, WITHOUT
REM ## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
REM ## License for the specific language governing permissions and limitations under
REM ## the License.
REM ##
REM #################################################################################

SET ORIGPATH=%cd%
SET CDAP_HOME=%~dp0
SET CDAP_HOME=%CDAP_HOME:~0,-5%
SET JAVACMD=%JAVA_HOME%\bin\java.exe

REM %CDAP_HOME%
SET CLASSPATH=%CDAP_HOME%\lib\*;%CDAP_HOME%\conf\
SET PATH=%PATH%;%CDAP_HOME%\libexec\bin

cd %CDAP_HOME%

REM Process command line
IF "%1" == "start" GOTO START
IF "%1" == "stop" GOTO STOP
IF "%1" == "restart" GOTO RESTART
IF "%1" == "status" GOTO STATUS
IF "%1" == "reset" GOTO RESET
GOTO USAGE

:USAGE
echo Usage: %0 {start^|stop^|restart^|status^|reset}
echo Additional options with start, restart:
echo --enable-debug [ ^<port^> ] to connect to a debug port for Standalone CDAP (default port is 5005)
GOTO :FINALLY

:RESET
REM checks if there exists a PID that is already running. Alert user but still return success
attrib -h %~dsp0MyProg.pid >NUL
if exist %~dsp0MyProg.pid (
  for /F %%i in (%~dsp0MyProg.pid) do (
    for /F "TOKENS=2" %%b in ('TASKLIST /FI "PID eq %%i"') DO (
      set lastPid=%%b
    )
    if "%lastPid%" == "%%i" (
      echo %0 running as process %%i. Stop it first.
      GOTO :FINALLY
    ) else (
      REM If process not running but pid file exists, delete pid file.
      del %~dsp0MyProg.pid
    )
  )
)
attrib +h %~dsp0MyProg.pid >NUL

REM ask for confirmation from user
set /P answer="This deletes all apps, data and logs. Are you sure you want to proceed? (y/n) " %=%
if NOT "%answer%" == "y" (
  GOTO :FINALLY
)

REM delete logs and data directories
echo Resetting Standalone CDAP...
rmdir /S /Q %CDAP_HOME%\logs %CDAP_HOME%\data > NUL 2>&1
echo CDAP reset successfully.
GOTO :FINALLY

:START
REM Check for 64-bit version of OS. Currently not supporting 32-bit Windows
IF NOT EXIST "%PROGRAMFILES(X86)%" (
  echo 32-bit Windows operating system is currently not supported
  GOTO :FINALLY
)

REM Check for correct setting for JAVA_HOME path
if [%JAVA_HOME%] == [] (
  echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
  echo Please set the JAVA_HOME variable in your environment to match the location of your Java installation.
  GOTO :FINALLY
)

REM Check for Java version
setlocal ENABLEDELAYEDEXPANSION
set /a counter=0
for /f "tokens=* delims= " %%f in ('%JAVACMD% -version 2^>^&1') do @(
  if "!counter!"=="0" set line=%%f
  set /a counter+=1
)
set line=%line:java version "1.=!!%
set line=%line:~0,1%
if NOT "%line%" == "7" (
  if NOT "%line%" == "8" (
    echo ERROR: Java version not supported. Please install Java 7 or 8 - other versions of Java are not supported.
    GOTO :FINALLY
  )
)
endlocal

REM Check if Node.js is installed
for %%x in (node.exe) do if [%%~$PATH:x]==[] (
  echo Node.js Standalone CDAP requires Node.js but it's either not installed or not in path. Exiting. 1>&2
  GOTO :FINALLY
)

REM Check for Node.js version
setlocal ENABLEDELAYEDEXPANSION
for /f "tokens=* delims= " %%f in ('node -v') do @(
  set line=%%f
)
set line=%line:v=!!%

for /F "delims=.,v tokens=1,2,3" %%a in ('echo %line%') do (
  if %%a LEQ 1 if %%b LSS 10 (
    echo Node.js version is not supported. We recommend any version of Node.js greater than v0.10.0.
    GOTO :FINALLY
  )
)
endlocal

REM checks if there exists a PID that is already running. Alert user but still return success
attrib -h %~dsp0MyProg.pid >NUL
if exist %~dsp0MyProg.pid (
  for /F %%i in (%~dsp0MyProg.pid) do (
    setlocal ENABLEDELAYEDEXPANSION
    for /F "TOKENS=2" %%b in ('TASKLIST /FI "PID eq %%i"') DO (
      set lastPid=%%b
    )
    if "!lastPid!" == "%%i" (
      echo %0 running as process %%i. Stop it first or use the restart function.
      GOTO :FINALLY
    ) else (
      REM If process not running but pid file exists, delete pid file.
      del %~dsp0MyProg.pid
    )
    endlocal
  )
)
attrib +h %~dsp0MyProg.pid >NUL

mkdir %CDAP_HOME%\logs > NUL 2>&1

REM Log rotation
call:LOG_ROTATE cdap
call:LOG_ROTATE cdap-process
call:LOG_ROTATE cdap-debug

REM check if debugging is enabled
SET DEBUG_OPTIONS=
setlocal ENABLEDELAYEDEXPANSION
IF "%2" == "--enable-debug" (
  IF "%3" == "" (
    set port=5005
  ) ELSE (
    REM check if port is a number
    SET "check="&FOR /f "delims=0123456789" %%i IN ("%3") DO SET check="x"
    IF DEFINED check (
      echo port number must be an integer.
      ENDLOCAL
      GOTO :FINALLY
    )
    REM check if the number is in range
    set port=%3
    IF !port! LSS 1024 (
      echo port number must be between 1024 and 65535.
      ENDLOCAL
      GOTO :FINALLY
    )
    IF !port! GTR 65535 (
      echo port number must be between 1024 and 65535.
      ENDLOCAL
      GOTO :FINALLY
    )
  )
  set DEBUG_OPTIONS="-agentlib:jdwp=transport=dt_socket,address=localhost:!port!,server=y,suspend=n"
)

start /B %JAVACMD% !DEBUG_OPTIONS! -Dhadoop.security.group.mapping=org.apache.hadoop.security.JniBasedUnixGroupsMappingWithFallback -Dhadoop.home.dir=%CDAP_HOME%\libexec -classpath %CLASSPATH% co.cask.cdap.StandaloneMain >> %CDAP_HOME%\logs\cdap-process.log 2>&1 < NUL
echo Starting Standalone CDAP...

for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq java.exe"') DO SET MyPID=%%b
echo %MyPID% > %~dsp0MyProg.pid
SET lastPid=%MyPID%
attrib +h %~dsp0MyProg.pid >NUL

:SearchLogs
findstr /R /C:".*Failed to start server.*" %CDAP_HOME%\logs\cdap-process.log >NUL 2>&1
if %errorlevel% == 0 GOTO :ServerError

findstr /R /C:"..* started successfully.*" %CDAP_HOME%\logs\cdap-process.log >NUL 2>&1
if not %errorlevel% == 0 GOTO :SearchLogs
if %errorlevel% == 0 GOTO :ServerSuccess
:EndSearchLogs

:ServerError
echo Failed to start, please check logs for more information
GOTO :STOP

:ServerSuccess
echo Standalone CDAP started succesfully.

IF NOT "!DEBUG_OPTIONS!" == "" (
  echo Remote debugger agent started on port !port!.
)
ENDLOCAL

REM Sleep for 5 seconds to wait for Node.js startup
PING 127.0.0.1 -n 6 > NUL 2>&1

for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq node.exe"') DO SET MyNodePID=%%b
echo %MyNodePID% > %~dsp0MyProgNode.pid
attrib +h %~dsp0MyProgNode.pid >NUL
GOTO :FINALLY

:STOP
echo Stopping Standalone CDAP ...
attrib -h %~dsp0MyProg.pid >NUL
if exist %~dsp0MyProg.pid (
  for /F %%i in (%~dsp0MyProg.pid) do (
    taskkill /F /PID %%i >NUL 2>&1
    del %~dsp0MyProg.pid 1>NUL 2>&1
  )
)

REM Sleep for 5 seconds
PING 127.0.0.1 -n 6 > NUL 2>&1

attrib -h %~dsp0MyProgNode.pid >NUL
if exist %~dsp0MyProgNode.pid (
  for /F %%i in (%~dsp0MyProgNode.pid) do (
    taskkill /F /PID %%i >NUL 2>&1
    del %~dsp0MyProgNode.pid 1>NUL 2>&1
  )
)
GOTO :FINALLY

:STATUS
attrib -h %~dsp0MyProg.pid >NUL
if NOT exist %~dsp0MyProg.pid (
  echo %0 is not running
) else (
for /F %%i in (%~dsp0MyProg.pid) do (
  setlocal ENABLEDELAYEDEXPANSION
  for /F "TOKENS=2" %%b in ('TASKLIST /FI "PID eq %%i"') DO (
    set lastPid=%%b
  )
  if "!lastPid!" == "%%i" (
    echo %0 running as process !lastPid!
  ) else (
    echo pidfile exists but process does not appear to be running
  )
  endlocal
 )
)
attrib +h %~dsp0MyProg.pid >NUL
GOTO :FINALLY

:RESTART
CALL :STOP
GOTO :START

:FINALLY
cd %ORIGPATH%
GOTO:EOF

:LOG_ROTATE
setlocal ENABLEDELAYEDEXPANSION
set extension=%1.log
for /F "TOKENS=*" %%b in ('dir  /a-d %CDAP_HOME%\logs 2^>NUL ^| find /c "%extension%" 2^>NUL') DO (
  set /a num=%%b
  FOR /L %%i IN (!num!,-1,1) DO (
    set /a prev_num=%%i+1
    rename %CDAP_HOME%\logs\%extension%.%%i %extension%.!prev_num! >NUL 2>NUL
  )
  rename %CDAP_HOME%\logs\%extension% %extension%.1 >NUL 2>NUL
)
endlocal

Allow node versions 0.10.x

Allow node versions 0.10.x


@echo off
setlocal

set __ProjectFilesDir=%~dp0
:Arg_Loop
if "%1" == "" goto ArgsDone
if /i "%1" == "x64"    (set __BuildArch=x64&shift&goto Arg_Loop)

if /i "%1" == "debug"    (set __BuildType=debug&shift&goto Arg_Loop)
if /i "%1" == "release"   (set __BuildType=release&shift&goto Arg_Loop)

if /i "%1" == "clean"   (set __CleanBuild=1&shift&goto Arg_Loop)

goto Usage

:ArgsDone

if not defined __BuildArch set __BuildArch=x64
if not defined __BuildType set __BuildType=debug
if not defined __TestWorkingDir set __TestWorkingDir=%__ProjectFilesDir%\..\binaries\tests\%__BuildArch%\%__BuildType%

if not defined __LogsDir  set  __LogsDir=%__ProjectFilesDir%..\binaries\Logs
set __TestBuildLog=%__LogsDir%\Tests_%__BuildArch%__%__BuildType%.log
set __XunitWrapperBuildLog=%__LogsDir%\Tests_XunitWrapper_%__BuildArch%__%__BuildType%.log

:: Switch to clean build mode if the binaries output folder does not exist
if not exist %__TestWorkingDir% set __CleanBuild=1
if not exist %__LogsDir% md %__LogsDir%

:: Configure environment if we are doing a clean build.
if not defined __CleanBuild goto CheckPrereqs
echo Doing a clean test build
echo.

:: MSBuild projects would need a rebuild
set __MSBCleanBuildArgs=/t:rebuild

:: Cleanup the binaries drop folder
if exist %__TestWorkingDir% rd /s /q %__TestWorkingDir%

:: Note: We've disabled node reuse because it causes file locking issues.
::       The issue is that we extend the build with our own targets which
::       means that that rebuilding cannot successully delete the task
::       assembly.

:: Check prerequisites
:CheckPrereqs
:: Check presence of VS
if defined VS120COMNTOOLS goto CheckMSbuild
echo Installation of VS 2013 is a pre-requisite to build this repository.
goto :eof

:CheckMSBuild
set _msbuildexe="%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe.  Please see https://github.com/dotnet/coreclr/wiki/Developer%%20Guide for build instructions. && exit /b 1

:: Set the environment for the  build- Vs cmd prompt
call "%VS120COMNTOOLS%\VsDevCmd.bat"
if not defined VSINSTALLDIR echo Error: build.cmd should be run from a Visual Studio Command Prompt.  Please see https://github.com/dotnet/coreclr/wiki/Developer%%20Guide for build instructions. && exit /b 1

:BuildTests

echo Starting the Test Build
echo.
:: Log build command line
set _buildprefix=echo
set _buildpostfix=^> "%__TestBuildLog%"
set _buildappend=^>
call :build %1

:: Build
set _buildprefix=
set _buildpostfix=
set _buildappend=
call :build %1

goto :eof

:build

%_buildprefix% %_msbuildexe% "%__ProjectFilesDir%build.proj" %__MSBCleanBuildArgs% /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=diag;LogFile="%__TestBuildLog%";Append %* %_buildpostfix%
IF ERRORLEVEL 1 echo Test build failed. Refer %__TestBuildLog% for details && exit /b 1

goto :eof
:Usage
echo.
echo Usage:
echo %0 BuildArch BuildType [clean]  where:
echo.
echo BuildArch can be: x64
echo BuildType can be: Debug, Release
echo Clean - optional argument to force a clean build.
goto :eof

Update buildtest.cmd

Update buildtest.cmd

deleted a new line


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

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

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

go get -v github.com/onsi/ginkgo/ginkgo

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

go get -v github.com/onsi/ginkgo/ginkgo

cd %GATSPATH%
ginkgo.exe -r -slowSpecThreshold=120 -nodes=2 ^
  -skip=NO_DIEGO_SUPPORT ^
  . apps backend_compatibility detect docker internet_dependent security_groups ssh routing

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

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

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

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

go get -v github.com/onsi/ginkgo/ginkgo

cd %GATSPATH%
ginkgo.exe -r -slowSpecThreshold=120 -nodes=2 ^
  -skip=NO_DIEGO_SUPPORT ^
  . apps backend_compatibility detect docker internet_dependent security_groups ssh routing

Remove duplicate ginkgo install

Remove duplicate ginkgo install