rmdir /S /Q Api
mkdir Api
"C:\Program Files\doxygen\bin\doxygen.exe" Doxyfile
robocopy Api ..\..\RunLooper.Doc /E /TEE /R:0

Change the doc build to output to secondary repo.


:: To build extensions for 64 bit Python 3, we need to configure environment
:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1)
::
:: To build extensions for 64 bit Python 2, we need to configure environment
:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0)
::
:: 32 bit builds do not require specific environment configurations.
::
:: Note: this script needs to be run with the /E:ON and /V:ON flags for the
:: cmd interpreter, at least for (SDK v7.0)
::
:: More details at:
:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows
:: http://stackoverflow.com/a/13751649/163740
::
:: Author: Olivier Grisel
:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
@ECHO OFF

SET COMMAND_TO_RUN=%*
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows
ECHO SDK: %WINDOWS_SDK_VERSION% ARCH: %PYTHON_ARCH%

IF "%PYTHON_VERSION%"=="3.5" GOTO main

IF "%PYTHON_ARCH%"=="32" GOTO main

SET DISTUTILS_USE_SDK=1
SET MSSdk=1
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release

:main

ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1

:: To build extensions for 64 bit Python 3, we need to configure environment
:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1)
::
:: To build extensions for 64 bit Python 2, we need to configure environment
:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0)
::
:: 32 bit builds do not require specific environment configurations.
::
:: Note: this script needs to be run with the /E:ON and /V:ON flags for the
:: cmd interpreter, at least for (SDK v7.0)
::
:: More details at:
:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows
:: http://stackoverflow.com/a/13751649/163740
::
:: Author: Olivier Grisel
:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
SET COMMAND_TO_RUN=%*
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows
SET WIN_WDK="c:\Program Files (x86)\Windows Kits\10\Include\wdf"
ECHO SDK: %WINDOWS_SDK_VERSION% ARCH: %PYTHON_ARCH%

IF "%PYTHON_VERSION%"=="3.5" (
    IF EXIST %WIN_WDK% (
        REM See: https://connect.microsoft.com/VisualStudio/feedback/details/1610302/
        REN %WIN_WDK% 0wdf
    )
    GOTO main
)

IF "%PYTHON_ARCH%"=="32" (
    GOTO main
)

SET DISTUTILS_USE_SDK=1
SET MSSdk=1
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%
CALL "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release

:main

ECHO Executing: %COMMAND_TO_RUN%
CALL %COMMAND_TO_RUN% || EXIT 1

Update from template.

Update from template.


msbuild /p:Configuration=Release NSISInfoWriter.sln
ilrepack /targetplatform:v4 ^
    /out:target\nsisiw.exe ^
    /parallel ^
    "%~dp0\NSISInfoWriter\bin\Release\nsisiw.exe" ^
    "%~dp0\NSISInfoWriter\bin\Release\CommandLine.dll"

msbuild /p:Configuration=Release NSISInfoWriter.sln
ilrepack /targetplatform:v4 ^
    /out:target\nsisiw.exe ^
    /parallel ^
    /ndebug ^
    "%~dp0\NSISInfoWriter\bin\Release\nsisiw.exe" ^
    "%~dp0\NSISInfoWriter\bin\Release\CommandLine.dll"

Disable debug information generation when using ilrepack


md build
cd build
cmake -DLIBWS_WITH_AUTOBAHN=ON ..
cmake --build .
ctest
bin\Debug\autobahntest.exe --config ..\test\autobahn\libws.cfg

cd deps
cd libevent
md build
cd build
cmake -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_REGRESS=ON -DEVENT__DISABLE_BENCHMARK=ON ..
cd ..
cd ..
cd ..

md build
cd build
cmake -DLibevent_DIR=deps/libevent/build/  -DLIBWS_WITH_AUTOBAHN=ON ..
cmake --build .
ctest
bin\Debug\autobahntest.exe --config ..\test\autobahn\libws.cfg

Update the jenkins build to build Libevent.


@if not defined __echo @echo off
setlocal

set __ThisScriptShort=%0
set __ThisScriptFull=%~f0
set __ThisScriptPath=%~dp0

REM =========================================================================================
REM ===
REM === Parse arguments
REM ===
REM =========================================================================================

set __OutputDir=
set __Arch=

: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" == "/arch"             (set __Arch=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "/outputdir"        (set __OutputDir=%2&shift&shift&goto Arg_Loop)

echo Invalid command-line argument: %1
goto Usage

:ArgsDone

if not defined __OutputDir goto Usage
if not defined __Arch goto Usage

REM =========================================================================================
REM ===
REM === Check if dotnet CLI and necessary directories exist
REM ===
REM =========================================================================================

set __DotNetToolDir=%__ThisScriptPath%..\Tools
set __DotNetCmd=%__DotNetToolDir%\dotnetcli\dotnet.exe
set __PackageDir=%__ThisScriptPath%..\Packages
set __TmpDir=%Temp%\coreclr_gcstress_%RANDOM%

REM Check if donet cli exists
if not exist "%__DotNetToolDir%" (
    echo Directory containing dotnet CLI does not exist: %__DotNetToolDir%
    goto Fail
)
if not exist "%__DotNetCmd%" (
    echo dotnet.exe does not exist: %__DotNetCmd%
    goto Fail
)

REM Create directories needed
if not exist "%__PackageDir%" md "%__PackageDir%"
if not exist "%__OutputDir%" md "%__OutputDir%"

REM Check and create a temp directory
if exist "%__TmpDir%" (
    rmdir /S /Q %__TmpDir%
)
mkdir %__TmpDir%

REM Project.json path
set __JasonFilePath=%__TmpDir%\project.json

REM =========================================================================================
REM ===
REM === Download packages
REM ===
REM =========================================================================================

REM Write dependency information to project.json
echo { ^
    "dependencies": { ^
    "runtime.win7-%__Arch%.Microsoft.NETCore.CoreDisTools": "1.0.1-prerelease-*" ^
    }, ^
    "frameworks": { "dnxcore50": { } } ^
    } > "%__JasonFilePath%"

echo Jason file: %__JasonFilePath%
type "%__JasonFilePath%"

REM Download the package
echo Downloading CoreDisTools package
set DOTNETCMD="%__DotNetCmd%" restore "%__JasonFilePath%" --source https://dotnet.myget.org/F/dotnet-core/ --packages "%__PackageDir%"
echo %DOTNETCMD%
call %DOTNETCMD%
if errorlevel 1 goto Fail

REM Get downloaded dll path
echo Locating coredistools.dll
FOR /F "delims=" %%i IN ('dir %__PackageDir%\coredistools.dll /b/s ^| findstr /R "runtime.win[0-9]*-%__Arch%"') DO set __LibPath=%%i
echo CoreDisTools library path: %__LibPath%
if not exist "%__LibPath%" (
    echo Failed to locate the downloaded library: %__LibPath%
    goto Fail
)

REM Copy library to output directory
echo Copy library: %__LibPath% to %__OutputDir%
copy /y "%__LibPath%" "%__OutputDir%"
if errorlevel 1 (
    echo Failed to copy %__LibPath% to %__OutputDir%
    goto Fail
)

REM Delete temporary files
if exist "%__TmpDir%" (
    rmdir /S /Q "%__TmpDir%"
)

exit /b 0

:Fail
if exist "%__TmpDir%" (
    rmdir /S /Q "%__TmpDir%"
)
exit /b 1

REM =========================================================================================
REM ===
REM === Helper routines
REM ===
REM =========================================================================================

:Usage
echo.
echo Download coredistool for GC stress testing
echo.
echo Usage:
echo     %__ThisScriptShort% /arch ^<TargetArch^> /outputdir ^<coredistools_lib_install_path^>
echo.
exit /b 1

@if not defined __echo @echo off
setlocal

set __ThisScriptShort=%0
set __ThisScriptFull=%~f0
set __ThisScriptPath=%~dp0

REM =========================================================================================
REM ===
REM === Parse arguments
REM ===
REM =========================================================================================

set __OutputDir=
set __Arch=

: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" == "/arch"             (set __Arch=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "/outputdir"        (set __OutputDir=%2&shift&shift&goto Arg_Loop)

echo Invalid command-line argument: %1
goto Usage

:ArgsDone

if not defined __OutputDir goto Usage
if not defined __Arch goto Usage

REM =========================================================================================
REM ===
REM === Check if dotnet CLI and necessary directories exist
REM ===
REM =========================================================================================

set __DotNetToolDir=%__ThisScriptPath%..\Tools
set __DotNetCmd=%__DotNetToolDir%\dotnetcli\dotnet.exe
set __PackageDir=%__ThisScriptPath%..\Packages
set __TmpDir=%Temp%\coreclr_gcstress_%RANDOM%

REM Check if dotnet cli exists
if not exist "%__DotNetToolDir%" (
    echo Directory containing dotnet CLI does not exist: %__DotNetToolDir%
    goto Fail
)
if not exist "%__DotNetCmd%" (
    echo dotnet.exe does not exist: %__DotNetCmd%
    goto Fail
)

REM Create directories needed
if not exist "%__PackageDir%" md "%__PackageDir%"
if not exist "%__OutputDir%" md "%__OutputDir%"

REM Check and create a temp directory
if exist "%__TmpDir%" (
    rmdir /S /Q %__TmpDir%
)
mkdir %__TmpDir%

REM Project.json path
set __JsonFilePath=%__TmpDir%\project.json

REM =========================================================================================
REM ===
REM === Download packages
REM ===
REM =========================================================================================

REM Write dependency information to project.json
echo { ^
    "dependencies": { ^
    "runtime.win7-%__Arch%.Microsoft.NETCore.CoreDisTools": "1.0.1-prerelease-*" ^
    }, ^
    "frameworks": { "dnxcore50": { } } ^
    } > "%__JsonFilePath%"

echo JSON file: %__JsonFilePath%
type "%__JsonFilePath%"

REM Download the package
echo Downloading CoreDisTools package
set DOTNETCMD="%__DotNetCmd%" restore "%__JsonFilePath%" --source https://dotnet.myget.org/F/dotnet-core/ --packages "%__PackageDir%"
echo %DOTNETCMD%
call %DOTNETCMD%
if errorlevel 1 goto Fail

REM Get downloaded dll path
echo Locating coredistools.dll
FOR /F "delims=" %%i IN ('dir %__PackageDir%\coredistools.dll /b/s ^| findstr /R "runtime.win[0-9]*-%__Arch%"') DO set __LibPath=%%i
echo CoreDisTools library path: %__LibPath%
if not exist "%__LibPath%" (
    echo Failed to locate the downloaded library: %__LibPath%
    goto Fail
)

REM Copy library to output directory
echo Copy library: %__LibPath% to %__OutputDir%
copy /y "%__LibPath%" "%__OutputDir%"
if errorlevel 1 (
    echo Failed to copy %__LibPath% to %__OutputDir%
    goto Fail
)

REM Delete temporary files
if exist "%__TmpDir%" (
    rmdir /S /Q "%__TmpDir%"
)

exit /b 0

:Fail
if exist "%__TmpDir%" (
    rmdir /S /Q "%__TmpDir%"
)
exit /b 1

REM =========================================================================================
REM ===
REM === Helper routines
REM ===
REM =========================================================================================

:Usage
echo.
echo Download coredistools for GC stress testing
echo.
echo Usage:
echo     %__ThisScriptShort% /arch ^<TargetArch^> /outputdir ^<coredistools_lib_install_path^>
echo.
exit /b 1

Fix some typos in setup-runtime-dependencies.cmd


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

@echo "Starting Windows build"

cd /d %~dp0
cd ..

@rem The image we're currently running has a broken version of Node.js enabled
@rem by nvm (v10.15.3), which has no npm bin. This hack uses the functional
@rem Node v8.9.1 to install npm@latest, it then uses this version of npm to
@rem install npm for v10.15.3.
call nvm use v8.9.1 || goto :error
call node C:\Users\kbuilder\AppData\Roaming\nvm-ps\versions\v8.9.1\node_modules\npm-bootstrap\bin\npm-cli.js i npm -g || goto :error
call nvm use v10.15.3 || goto :error
call node C:\Users\kbuilder\AppData\Roaming\nvm-ps\versions\v8.9.1\node_modules\npm\bin\npm-cli.js i npm -g || goto :error

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

goto :EOF

:error
exit /b 1

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

@echo "Starting Windows build"

cd /d %~dp0
cd ..

@rem npm path is not currently set in our image, we should fix this next time
@rem we upgrade Node.js in the image:
SET PATH=%PATH%;/cygdrive/c/Program Files/nodejs/npm

call nvm use v12.14.1
call which node

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

goto :EOF

:error
exit /b 1

build: update windows configuration to match new vm


mkdir build
cd build

set BUILD_CONFIG=Release

REM Configure step
REM Using VS2019 generator but using the VS2017 toolset (v141)
REM reference https://gitlab.kitware.com/cmake/cmake/issues/19157
set CMAKE_GENERATOR=Visual Studio 16 2019
if "%ARCH%"=="32" (
    set CMAKE_GENERATOR_ARCH=""
) else (
    set CMAKE_GENERATOR_ARCH=Win64
)
set CMAKE_GENERATOR_TOOLSET=v141

REM llvm 8 needs the 64bit linker
set PreferredToolArchitecture=x64

REM Reduce build times and package size by removing unused stuff
REM BENCHMARKS (new for llvm8) don't build under Visual Studio 14 2015
set CMAKE_CUSTOM=-DLLVM_TARGETS_TO_BUILD="host;AMDGPU;NVPTX" ^
    -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_UTILS=ON -DLLVM_INCLUDE_DOCS=OFF ^
    -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_ASSERTIONS=ON ^
    -DLLVM_USE_INTEL_JITEVENTS=ON ^
    -DLLVM_INCLUDE_BENCHMARKS=OFF ^
    -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly

REM the platform toolset host arch is set to x64 so as to use the 64bit linker,
REM the 32bit linker heap is too small for llvm8 so it tries and falls over to
REM the 64bit linker anyway
cmake -G "%CMAKE_GENERATOR%" -A "%CMAKE_GENERATOR_ARCH%" -T "%CMAKE_GENERATOR_TOOLSET%" ^
    -DCMAKE_BUILD_TYPE="%BUILD_CONFIG%" -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
    -DCMAKE_INSTALL_PREFIX:PATH=%LIBRARY_PREFIX% %CMAKE_CUSTOM% %SRC_DIR% ^
    -DCMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE=x64
if errorlevel 1 exit 1

REM Build step
cmake --build . --config "%BUILD_CONFIG%"
if errorlevel 1 exit 1

REM Install step
cmake --build . --config "%BUILD_CONFIG%" --target install
if errorlevel 1 exit 1

REM From: https://github.com/conda-forge/llvmdev-feedstock/pull/53
%BUILD_CONFIG%\bin\opt -S -vector-library=SVML -mcpu=haswell -O3 %RECIPE_DIR%\numba-3016.ll | %BUILD_CONFIG%\bin\FileCheck %RECIPE_DIR%\numba-3016.ll
if errorlevel 1 exit 1

REM This is technically how to run the suite, but it will only run in an
REM enhanced unix-like shell which has functions like `grep` available.
REM cd ..\test
REM %PYTHON% ..\build\%BUILD_CONFIG%\bin\llvm-lit.py -vv Transforms ExecutionEngine Analysis CodeGen/X86
REM if errorlevel 1 exit 1

mkdir build
cd build

set BUILD_CONFIG=Release

REM Configure step
REM Using VS2019 generator but using the VS2017 toolset (v141)
REM reference https://gitlab.kitware.com/cmake/cmake/issues/19157
set CMAKE_GENERATOR=Visual Studio 16 2019
if "%ARCH%"=="32" (
    set CMAKE_GENERATOR_ARCH=Win32
) else (
    set CMAKE_GENERATOR_ARCH=x64
)
set CMAKE_GENERATOR_TOOLSET=v141

REM llvm 8 needs the 64bit linker
set PreferredToolArchitecture=x64

REM Reduce build times and package size by removing unused stuff
REM BENCHMARKS (new for llvm8) don't build under Visual Studio 14 2015
set CMAKE_CUSTOM=-DLLVM_TARGETS_TO_BUILD="host;AMDGPU;NVPTX" ^
    -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_UTILS=ON -DLLVM_INCLUDE_DOCS=OFF ^
    -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_ASSERTIONS=ON ^
    -DLLVM_USE_INTEL_JITEVENTS=ON ^
    -DLLVM_INCLUDE_BENCHMARKS=OFF ^
    -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly

REM the platform toolset host arch is set to x64 so as to use the 64bit linker,
REM the 32bit linker heap is too small for llvm8 so it tries and falls over to
REM the 64bit linker anyway
cmake -G "%CMAKE_GENERATOR%" -A "%CMAKE_GENERATOR_ARCH%" -T "%CMAKE_GENERATOR_TOOLSET%" ^
    -DCMAKE_BUILD_TYPE="%BUILD_CONFIG%" -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
    -DCMAKE_INSTALL_PREFIX:PATH=%LIBRARY_PREFIX% %CMAKE_CUSTOM% %SRC_DIR% ^
    -DCMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE=x64
if errorlevel 1 exit 1

REM Build step
cmake --build . --config "%BUILD_CONFIG%"
if errorlevel 1 exit 1

REM Install step
cmake --build . --config "%BUILD_CONFIG%" --target install
if errorlevel 1 exit 1

REM From: https://github.com/conda-forge/llvmdev-feedstock/pull/53
%BUILD_CONFIG%\bin\opt -S -vector-library=SVML -mcpu=haswell -O3 %RECIPE_DIR%\numba-3016.ll | %BUILD_CONFIG%\bin\FileCheck %RECIPE_DIR%\numba-3016.ll
if errorlevel 1 exit 1

REM This is technically how to run the suite, but it will only run in an
REM enhanced unix-like shell which has functions like `grep` available.
REM cd ..\test
REM %PYTHON% ..\build\%BUILD_CONFIG%\bin\llvm-lit.py -vv Transforms ExecutionEngine Analysis CodeGen/X86
REM if errorlevel 1 exit 1

Fix the option

Fix the option


java -jar "C:\Windows\System32\Soup.jar" %1 %2

java -jar "C:\Windows\System32\Soup Production.jar" %1 %2

Update Soup.bat

Update Soup.bat


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

if not defined SDELETE_URL set SDELETE_URL=http://live.sysinternals.com/sdelete.exe

for %%i in ("%SDELETE_URL%") do set SDELETE_EXE=%%~nxi
set SDELETE_DIR=%TEMP%\sdelete
set SDELETE_PATH=%SDELETE_DIR%\%SDELETE_EXE%

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

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

reg add HKCU\Software\Sysinternals\SDelete /v EulaAccepted /t REG_DWORD /d 1 /f

echo ==^> Running SDelete on %SystemDrive%
start /b /wait "%SDELETE_PATH%" -z %SystemDrive%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: "%SDELETE_PATH%" -z %SystemDrive%
ver>nul

popd

echo ==^> Removing "%SDELETE_DIR%"
rmdir /q /s "%SDELETE_DIR%"

:exit0

ver>nul

goto :exit

:exit1

verify other 2>nul

:exit

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

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

if not defined SDELETE_URL set SDELETE_URL=http://live.sysinternals.com/sdelete.exe

for %%i in ("%SDELETE_URL%") do set SDELETE_EXE=%%~nxi
set SDELETE_DIR=%TEMP%\sdelete
set SDELETE_PATH=%SDELETE_DIR%\%SDELETE_EXE%

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

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

reg add HKCU\Software\Sysinternals\SDelete /v EulaAccepted /t REG_DWORD /d 1 /f

echo ==^> Running SDelete on %SystemDrive%
"%SDELETE_PATH%" -z %SystemDrive%

@if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: "%SDELETE_PATH%" -z %SystemDrive%
ver>nul

popd

echo ==^> Removing "%SDELETE_DIR%"
rmdir /q /s "%SDELETE_DIR%"

:exit0

ver>nul

goto :exit

:exit1

verify other 2>nul

:exit

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

fix sdelete fail due to start prefix

fix sdelete fail due to start prefix


@ECHO off
REM This suite requires https://github.com/inkarkat/runVimTests to run
../../runVimTests/bin/runVimTests.cmd --pure vimgrep.suite

@ECHO off
REM This suite requires https://github.com/inkarkat/runVimTests to run

if %1.==clean. goto Clean
if %1.==run. goto Run

echo "usage: runall.bat clean|run"
goto End

:Clean
echo Cleaning
del /Q *.out 2> nul
del /Q *.msgout 2> nul
goto End

:Run
echo Running
../../runVimTests/bin/runVimTests.cmd --pure vimgrep.suite
goto End

:End

Add an option to clean the test directory


@rem Reset PATH and current folder after LLVM build.
@set PATH=%oldpath%
@cd %mesa%

@rem Check environment
@IF %flexstate%==0 (
@echo winflexbison is required to build Mesa3D.
GOTO skipmesa
)
@if NOT EXIST mesa if %gitstate%==0 (
@echo Fatal: Both Mesa3D code and Git are missing. At least one is required. Execution halted.
@GOTO skipmesa
)

@rem Hide Meson support behind a parametter as it doesn't work yet.
@IF %enablemeson%==0 if %pythonver% GEQ 3 echo Mesa3D build: Unimplemented code path.
@IF %enablemeson%==0 if %pythonver% GEQ 3 GOTO skipmesa

@IF %pythonver% GEQ 3 IF %pkgconfigstate%==0 echo pkg-config is required to build Mesa3D with Meson. You can either use mingw-w64 or pkgconfiglite distribution, but mingw-w64 is the only up-to-date distribution.
@IF %pythonver% GEQ 3 IF %pkgconfigstate%==0 GOTO skipmesa

@REM Aquire Mesa3D source code if missing and enable S3TC texture cache automatically if possible.
@set buildmesa=n
@if %gitstate%==0 echo Error: Git not found. Auto-patching disabled. If you try to build with GLES support and use quick configuration or try to build osmesa expect a build failure per https://bugs.freedesktop.org/show_bug.cgi?id=106843
@if %gitstate%==0 echo.
@if NOT EXIST mesa echo Warning: Mesa3D source code not found.
@if NOT EXIST mesa echo.
@if NOT EXIST mesa set /p buildmesa=Download mesa code and build (y/n):
@if NOT EXIST mesa if /i "%buildmesa%"=="y" echo.
@if NOT EXIST mesa if /i NOT "%buildmesa%"=="y" GOTO skipmesa
@if NOT EXIST mesa set branch=master
@if NOT EXIST mesa IF %pythonver%==2 set /p branch=Enter Mesa source code branch name - defaults to master:
@if NOT EXIST mesa IF %pythonver%==2 echo.
@if NOT EXIST mesa IF %pythonver%==2 set mesarepo=https://gitlab.freedesktop.org/mesa/mesa.git
@if NOT EXIST mesa IF %pythonver% GEQ 3 set mesarepo=https://gitlab.freedesktop.org/dbaker/mesa.git
@if NOT EXIST mesa IF %pythonver% GEQ 3 set branch=meson-windows
@if NOT EXIST mesa git clone --recurse-submodules --depth=1 --branch=%branch% %mesarepo% mesa
@if NOT EXIST mesa echo.

@REM Collect information about Mesa3D code. Apply patches
@if EXIST mesa if /i NOT "%buildmesa%"=="y" set /p buildmesa=Begin mesa build. Proceed (y/n):
@if EXIST mesa if /i "%buildmesa%"=="y" echo.
@if /i NOT "%buildmesa%"=="y" GOTO skipmesa
@cd mesa
@set LLVM=%mesa%\llvm\%abi%-%llvmlink%
@set /p mesaver=<VERSION
@if "%mesaver:~-7%"=="0-devel" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%00
@if "%mesaver:~5,4%"=="0-rc" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%00+%mesaver:~9%
@if NOT "%mesaver:~5,2%"=="0-" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%50+%mesaver:~5%
@if EXIST mesapatched.ini GOTO configmesabuild
@if %gitstate%==0 GOTO configmesabuild

@rem Enable S3TC texture cache
@git apply -v ..\mesa-dist-win\patches\s3tc.patch
@echo 1 > mesapatched.ini
@echo.

@rem Disable osmesa when building GLES when using Scons build.
@rem GLES linking with osmesa is disabled due to build failure - https://bugs.freedesktop.org/show_bug.cgi?id=106843
@rem We'll do a 2-pass build in this case. Build everything requested without GLES, then build everything again
@rem with GLES.
@IF %pythonver%==2 IF %intmesaver% LSS 18300 git apply -v ..\mesa-dist-win\patches\osmesa.patch
@IF %pythonver%==2 IF %intmesaver% LSS 18300 echo.

@rem Fix swr build with LLVM 7.0 (patch v3) - https://lists.freedesktop.org/archives/mesa-dev/2018-October/207017.html
@git apply -v ..\mesa-dist-win\patches\swr-llvm7.patch
@echo.

@rem Add MSVC_USE_SCRIPT support so that Scons can use 64-bit compiler when doing a 32-bit build.
@IF %intmesaver% LSS 18300 git appy -v ..\mesa-dist-win\patches\msvc_use_script.patch
@IF %intmesaver% LSS 18300 echo.

@rem RIP texture_float build option that remained present in a zombie state for Scons build.
@git apply -v ..\mesa-dist-win\patches\upstream\texture_float-zombie-RIP.patch
@echo.

:configmesabuild
@rem Configure Mesa build.

@if %pythonver%==2 set buildcmd=%pythonloc% %pythonloc:~0,-10%Scripts\scons.py -j%throttle% build=release platform=windows machine=%longabi% MSVC_USE_SCRIPT=%vsenv%
@if %pythonver%==2 if %intmesaver% LSS 18201 set buildcmd=%buildcmd% texture_float=1
@if %pythonver% GEQ 3 set buildconf=%mesonloc% build/%abi% --backend=vs2017 --buildtype=plain
@if %pythonver% GEQ 3 IF %mesonver:~2,-2% LSS 48 if %llvmlink%==MT set buildconf=%buildconf% -Dc_args="/MT /O2" -Dcpp_args="/MT /O2"
@if %pythonver% GEQ 3 IF %mesonver:~2,-2% GEQ 48 set buildconf=%buildconf% --optimization=2
@if %pythonver% GEQ 3 IF %mesonver:~2,-2% GEQ 48 if %llvmlink%==MT set buildconf=%buildconf% -Db_vscrt=mt
@IF %pythonver% GEQ 3 set platformabi=Win32
@IF %pythonver% GEQ 3 IF %abi%==x64 set platformabi=%abi%
@if %pythonver% GEQ 3 set buildcmd=msbuild /p^:Configuration=plain,Platform=%platformabi% mesa.sln /m^:%throttle%

@set ninja=n
@if %pythonver% GEQ 3 if NOT %ninjastate%==0 set /p ninja=Use Ninja build system instead of MsBuild (y/n); less storage device strain and maybe faster build:
@if %pythonver% GEQ 3 if NOT %ninjastate%==0 echo.
@if /I "%ninja%"=="y" if %ninjastate%==1 set PATH=%mesa%\ninja\;%PATH%
@if /I "%ninja%"=="y" set buildconf=%buildconf:vs2017=ninja%
@if %pythonver% GEQ 3 if /I "%ninja%"=="y" set buildcmd=ninja -j %throttle%

@set llvmless=n
@if EXIST %LLVM% set /p llvmless=Build Mesa without LLVM (y/n). llvmpipe and swr drivers and high performance JIT won't be available for other drivers and libraries:
@if EXIST %LLVM% echo.
@if NOT EXIST %LLVM% set /p llvmless=Build Mesa without LLVM (y=yes/q=quit). llvmpipe and swr drivers and high performance JIT won't be available for other drivers and libraries:
@if NOT EXIST %LLVM% echo.
@if /I NOT "%llvmless%"=="y" if NOT EXIST %LLVM% echo User refused to build Mesa without LLVM.
@if /I NOT "%llvmless%"=="y" if NOT EXIST %LLVM% GOTO skipmesa
@if %pythonver%==2 if /I "%llvmless%"=="y" set buildcmd=%buildcmd% llvm=no
@if %pythonver% GEQ 3 if /I NOT "%llvmless%"=="y" set buildconf=%buildconf% -Dllvm-wrap=llvm
@if %pythonver% GEQ 3 if /I NOT "%llvmless%"=="y" call %mesa%\mesa-dist-win\buildscript\modules\llvmwrapgen.cmd

@if %pythonver%==2 set /p openmp=Build Mesa3D with OpenMP. Faster build and smaller binaries (y/n):
@if %pythonver%==2 echo.
@if %pythonver%==2 if /I "%openmp%"=="y" set buildcmd=%buildcmd% openmp=1

@set swrdrv=n
@if /I NOT "%llvmless%"=="y" if %abi%==x64 if EXIST %LLVM% set /p swrdrv=Do you want to build swr drivers? (y=yes):
@if /I NOT "%llvmless%"=="y" if %abi%==x64 if EXIST %LLVM% echo.
@if %pythonver%==2 if /I "%swrdrv%"=="y" set buildcmd=%buildcmd% swr=1
@if %pythonver% GEQ 3 if /I "%swrdrv%"=="y" set buildconf=%buildconf% -Dgallium-drivers=swrast,swr

@set disableosmesa=0
@IF %pythonver%==2 IF %intmesaver% LSS 18300 set /p gles=Do you want to build GLAPI as a shared library and standalone GLES libraries (y/n):
@IF %pythonver%==2 IF %intmesaver% LSS 18300 echo.
@IF %pythonver% GEQ 3 set /p gles=Do you want to build GLAPI as a shared library and standalone GLES libraries (y/n):
@IF %pythonver% GEQ 3 echo.
@if %pythonver%==2 if /I "%gles%"=="y" set gles=y
@if %pythonver%==2 if /I "%gles%"=="y" set disableosmesa=1
@if %pythonver%==2 if /I NOT "%gles%"=="y" set gles=0
@if %pythonver% GEQ 3 if /I NOT "%gles%"=="y" set buildconf=%buildconf% -Dgles1=false -Dgles2=false
@if %pythonver% GEQ 3 if /I "%gles%"=="y" set buildconf=%buildconf% -Dgles1=true -Dgles2=true

@set expressmesabuild=n
@if %pythonver%==2 set /p expressmesabuild=Do you want to build Mesa with quick configuration - includes libgl-gdi, graw-gdi, graw-null, tests, osmesa and GLAPI + OpenGL ES if GLES enabled:
@if %pythonver%==2 echo.
@if %pythonver%==2 IF /I "%expressmesabuild%"=="y" set mesatargets=.
@if %pythonver%==2 IF /I NOT "%expressmesabuild%"=="y" set mesatargets=libgl-gdi

@set osmesa=n
@IF /I NOT "%expressmesabuild%"=="y" set /p osmesa=Do you want to build off-screen rendering drivers (y/n):
@IF /I NOT "%expressmesabuild%"=="y" echo.
@if %pythonver%==2 IF /I NOT "%expressmesabuild%"=="y" IF /I "%osmesa%"=="y" set mesatargets=%mesatargets% osmesa
@if %pythonver% GEQ 3 IF /I "%osmesa%"=="y" set buildconf=%buildconf% -Dosmesa=gallium
@IF /I "%expressmesabuild%"=="y" set osmesa=y

@set graw=n
@IF /I NOT "%expressmesabuild%"=="y" set /p graw=Do you want to build graw library (y/n):
@IF /I NOT "%expressmesabuild%"=="y" echo.
@if %pythonver%==2 if /I "%graw%"=="y" IF /I NOT "%expressmesabuild%"=="y" set mesatargets=%mesatargets% graw-gdi
@IF /I "%expressmesabuild%"=="y" set graw=y
@if %pythonver% GEQ 3 if /I "%graw%"=="y" set buildconf=%buildconf% -Dbuild-tests=true

@set cleanbuild=n
@IF %pythonver%==2 if EXIST build\windows-%longabi% set /p cleanbuild=Do you want to clean build (y/n):
@IF %pythonver%==2 if EXIST build\windows-%longabi% echo.
@IF %pythonver% GEQ 3 if EXIST build\%abi% set /p cleanbuild=Do you want to clean build (y/n):
@IF %pythonver% GEQ 3 if EXIST build\%abi% echo.
@IF %pythonver%==2 if /I "%cleanbuild%"=="y" RD /S /Q build\windows-%longabi%
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" RD /S /Q build\%abi%
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" for /d %%q in ("%mesa%\mesa\subprojects\zlib-*") do @RD /S /Q "%%~q"
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" for /d %%r in ("%mesa%\mesa\subprojects\expat-*") do @RD /S /Q "%%~r"

@IF %flexstate%==1 set PATH=%mesa%\flexbison\;%PATH%
@if %pythonver%==2 GOTO build_mesa
@if %pythonver% GEQ 3 IF %pkgconfigstate%==2 GOTO build_mesa
@set PATH=%PKG_CONFIG_PATH%\;%PATH%

:build_mesa
@if NOT EXIST build md build
@IF %pythonver%==2 if NOT EXIST build\windows-%longabi% md build\windows-%longabi%
@IF %pythonver% GEQ 3 if NOT EXIST build\%abi% md build\%abi%
@IF %pythonver%==2 if NOT EXIST build\windows-%longabi%\git_sha1.h echo 0 > build\windows-%longabi%\git_sha1.h
@IF %pythonver% GEQ 3 if NOT EXIST build\%abi%\src md build\%abi%\src
@IF %pythonver% GEQ 3 if NOT EXIST build\%abi%\src\git_sha1.h echo 0 > build\%abi%\src\git_sha1.h
@echo.
@if %pythonver% GEQ 3 call %vsenv% %vsabi%
@if %pythonver% GEQ 3 echo.
@if %pythonver% GEQ 3 echo Build configuration command stored in buildconf variable.
@if %pythonver% GEQ 3 echo.
@if %pythonver% GEQ 3 cmd
@if %pythonver%==2 IF /I "%osmesa%"=="y" IF %disableosmesa%==1 (
@echo Build command: %buildcmd% gles=0 %mesatargets%
@echo.
@%buildcmd% gles=0 %mesatargets%
@echo.
@pause
@echo Beginning 2nd build pass
@echo.
)
@if %pythonver%==2 (
@echo Build command: %buildcmd% gles=%gles% %mesatargets%
@echo.
@%buildcmd% gles=%gles% %mesatargets%
@echo.
)

:skipmesa
@echo.

@rem Reset PATH and current folder after LLVM build.
@set PATH=%oldpath%
@cd %mesa%

@rem Check environment
@IF %flexstate%==0 (
@echo winflexbison is required to build Mesa3D.
GOTO skipmesa
)
@if NOT EXIST mesa if %gitstate%==0 (
@echo Fatal: Both Mesa3D code and Git are missing. At least one is required. Execution halted.
@GOTO skipmesa
)

@rem Hide Meson support behind a parametter as it doesn't work yet.
@IF %enablemeson%==0 if %pythonver% GEQ 3 echo Mesa3D build: Unimplemented code path.
@IF %enablemeson%==0 if %pythonver% GEQ 3 GOTO skipmesa

@IF %pythonver% GEQ 3 IF %pkgconfigstate%==0 echo pkg-config is required to build Mesa3D with Meson. You can either use mingw-w64 or pkgconfiglite distribution, but mingw-w64 is the only up-to-date distribution.
@IF %pythonver% GEQ 3 IF %pkgconfigstate%==0 GOTO skipmesa

@REM Aquire Mesa3D source code if missing and enable S3TC texture cache automatically if possible.
@set buildmesa=n
@if %gitstate%==0 echo Error: Git not found. Auto-patching disabled. If you try to build with GLES support and use quick configuration or try to build osmesa expect a build failure per https://bugs.freedesktop.org/show_bug.cgi?id=106843
@if %gitstate%==0 echo.
@if NOT EXIST mesa echo Warning: Mesa3D source code not found.
@if NOT EXIST mesa echo.
@if NOT EXIST mesa set /p buildmesa=Download mesa code and build (y/n):
@if NOT EXIST mesa if /i "%buildmesa%"=="y" echo.
@if NOT EXIST mesa if /i NOT "%buildmesa%"=="y" GOTO skipmesa
@if NOT EXIST mesa set branch=master
@if NOT EXIST mesa IF %pythonver%==2 set /p branch=Enter Mesa source code branch name - defaults to master:
@if NOT EXIST mesa IF %pythonver%==2 echo.
@if NOT EXIST mesa IF %pythonver%==2 set mesarepo=https://gitlab.freedesktop.org/mesa/mesa.git
@if NOT EXIST mesa IF %pythonver% GEQ 3 set mesarepo=https://gitlab.freedesktop.org/dbaker/mesa.git
@if NOT EXIST mesa IF %pythonver% GEQ 3 set branch=meson-windows
@if NOT EXIST mesa git clone --recurse-submodules --depth=1 --branch=%branch% %mesarepo% mesa
@if NOT EXIST mesa echo.

@REM Collect information about Mesa3D code. Apply patches
@if EXIST mesa if /i NOT "%buildmesa%"=="y" set /p buildmesa=Begin mesa build. Proceed (y/n):
@if EXIST mesa if /i "%buildmesa%"=="y" echo.
@if /i NOT "%buildmesa%"=="y" GOTO skipmesa
@cd mesa
@set LLVM=%mesa%\llvm\%abi%-%llvmlink%
@set /p mesaver=<VERSION
@if "%mesaver:~-7%"=="0-devel" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%00
@if "%mesaver:~5,4%"=="0-rc" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%00+%mesaver:~9%
@if NOT "%mesaver:~5,2%"=="0-" set /a intmesaver=%mesaver:~0,2%%mesaver:~3,1%50+%mesaver:~5%
@if EXIST mesapatched.ini GOTO configmesabuild
@if %gitstate%==0 GOTO configmesabuild

@rem Enable S3TC texture cache
@git apply -v ..\mesa-dist-win\patches\s3tc.patch
@echo 1 > mesapatched.ini
@echo.

@rem Disable osmesa when building GLES when using Scons build.
@rem GLES linking with osmesa is disabled due to build failure - https://bugs.freedesktop.org/show_bug.cgi?id=106843
@rem We'll do a 2-pass build in this case. Build everything requested without GLES, then build everything again
@rem with GLES.
@IF %pythonver%==2 IF %intmesaver% LSS 18300 git apply -v ..\mesa-dist-win\patches\osmesa.patch
@IF %pythonver%==2 IF %intmesaver% LSS 18300 echo.

@rem Fix swr build with LLVM 7.0 (patch v3) - https://lists.freedesktop.org/archives/mesa-dev/2018-October/207017.html
@git apply -v ..\mesa-dist-win\patches\swr-llvm7.patch
@echo.

@rem Add MSVC_USE_SCRIPT support so that Scons can use 64-bit compiler when doing a 32-bit build.
@IF %intmesaver% LSS 18300 git appy -v ..\mesa-dist-win\patches\msvc_use_script.patch
@IF %intmesaver% LSS 18300 echo.

@rem RIP texture_float build option that remained present in a zombie state for Scons build.
@git apply -v ..\mesa-dist-win\patches\upstream\texture_float-zombie-RIP.patch
@echo.

:configmesabuild
@rem Configure Mesa build.

@if %pythonver%==2 set buildcmd=%pythonloc% %pythonloc:~0,-10%Scripts\scons.py -j%throttle% build=release platform=windows machine=%longabi% MSVC_USE_SCRIPT=%vsenv%
@if %pythonver%==2 if %intmesaver% LSS 18201 set buildcmd=%buildcmd% texture_float=1
@if %pythonver% GEQ 3 set buildconf=%mesonloc% build/%abi% --backend=vs2017 --buildtype=plain
@if %pythonver% GEQ 3 IF %mesonver:~2,-2% LSS 48 if %llvmlink%==MT set buildconf=%buildconf% -Dc_args="/MT /O2" -Dcpp_args="/MT /O2"
@if %pythonver% GEQ 3 IF %mesonver:~2,-2% GEQ 48 set buildconf=%buildconf% --optimization=2
@if %pythonver% GEQ 3 IF %mesonver:~2,-2% GEQ 48 if %llvmlink%==MT set buildconf=%buildconf% -Db_vscrt=mt
@IF %pythonver% GEQ 3 set platformabi=Win32
@IF %pythonver% GEQ 3 IF %abi%==x64 set platformabi=%abi%
@if %pythonver% GEQ 3 set buildcmd=msbuild /p^:Configuration=plain,Platform=%platformabi% mesa.sln /m^:%throttle%

@set ninja=n
@if %pythonver% GEQ 3 if NOT %ninjastate%==0 set /p ninja=Use Ninja build system instead of MsBuild (y/n); less storage device strain and maybe faster build:
@if %pythonver% GEQ 3 if NOT %ninjastate%==0 echo.
@if /I "%ninja%"=="y" if %ninjastate%==1 set PATH=%mesa%\ninja\;%PATH%
@if /I "%ninja%"=="y" set buildconf=%buildconf:vs2017=ninja%
@if %pythonver% GEQ 3 if /I "%ninja%"=="y" set buildcmd=ninja -j %throttle%

@set llvmless=n
@if EXIST %LLVM% set /p llvmless=Build Mesa without LLVM (y/n). llvmpipe and swr drivers and high performance JIT won't be available for other drivers and libraries:
@if EXIST %LLVM% echo.
@if NOT EXIST %LLVM% set /p llvmless=Build Mesa without LLVM (y=yes/q=quit). llvmpipe and swr drivers and high performance JIT won't be available for other drivers and libraries:
@if NOT EXIST %LLVM% echo.
@if /I NOT "%llvmless%"=="y" if NOT EXIST %LLVM% echo User refused to build Mesa without LLVM.
@if /I NOT "%llvmless%"=="y" if NOT EXIST %LLVM% GOTO skipmesa
@if %pythonver%==2 if /I "%llvmless%"=="y" set buildcmd=%buildcmd% llvm=no
@if %pythonver% GEQ 3 if /I NOT "%llvmless%"=="y" set buildconf=%buildconf% -Dllvm-wrap=llvm
@if %pythonver% GEQ 3 if /I NOT "%llvmless%"=="y" call %mesa%\mesa-dist-win\buildscript\modules\llvmwrapgen.cmd

@if %pythonver%==2 set /p openmp=Build Mesa3D with OpenMP. Faster build and smaller binaries (y/n):
@if %pythonver%==2 echo.
@if %pythonver%==2 if /I "%openmp%"=="y" set buildcmd=%buildcmd% openmp=1

@set swrdrv=n
@if /I NOT "%llvmless%"=="y" if %abi%==x64 if EXIST %LLVM% set /p swrdrv=Do you want to build swr drivers? (y=yes):
@if /I NOT "%llvmless%"=="y" if %abi%==x64 if EXIST %LLVM% echo.
@if %pythonver%==2 if /I "%swrdrv%"=="y" set buildcmd=%buildcmd% swr=1
@if %pythonver% GEQ 3 if /I "%swrdrv%"=="y" set buildconf=%buildconf% -Dgallium-drivers=swrast,swr

@set disableosmesa=0
@IF %pythonver%==2 IF %intmesaver% LSS 18300 set /p gles=Do you want to build GLAPI as a shared library and standalone GLES libraries (y/n):
@IF %pythonver%==2 IF %intmesaver% LSS 18300 echo.
@IF %pythonver% GEQ 3 set /p gles=Do you want to build GLAPI as a shared library and standalone GLES libraries (y/n):
@IF %pythonver% GEQ 3 echo.
@if %pythonver%==2 if /I "%gles%"=="y" set gles=y
@if %pythonver%==2 if /I "%gles%"=="y" set disableosmesa=1
@if %pythonver%==2 if /I NOT "%gles%"=="y" set gles=0
@if %pythonver% GEQ 3 if /I NOT "%gles%"=="y" set buildconf=%buildconf% -Dgles1=false -Dgles2=false
@if %pythonver% GEQ 3 if /I "%gles%"=="y" set buildconf=%buildconf% -Dgles1=true -Dgles2=true

@set expressmesabuild=n
@if %pythonver%==2 set /p expressmesabuild=Do you want to build Mesa with quick configuration - includes libgl-gdi, graw-gdi, graw-null, tests, osmesa and GLAPI + OpenGL ES if GLES enabled:
@if %pythonver%==2 echo.
@if %pythonver%==2 IF /I "%expressmesabuild%"=="y" set mesatargets=.
@if %pythonver%==2 IF /I NOT "%expressmesabuild%"=="y" set mesatargets=libgl-gdi

@set osmesa=n
@IF /I NOT "%expressmesabuild%"=="y" set /p osmesa=Do you want to build off-screen rendering drivers (y/n):
@IF /I NOT "%expressmesabuild%"=="y" echo.
@if %pythonver%==2 IF /I NOT "%expressmesabuild%"=="y" IF /I "%osmesa%"=="y" set mesatargets=%mesatargets% osmesa
@if %pythonver% GEQ 3 IF /I "%osmesa%"=="y" set buildconf=%buildconf% -Dosmesa=gallium
@IF /I "%expressmesabuild%"=="y" set osmesa=y

@set graw=n
@IF /I NOT "%expressmesabuild%"=="y" set /p graw=Do you want to build graw library (y/n):
@IF /I NOT "%expressmesabuild%"=="y" echo.
@if %pythonver%==2 if /I "%graw%"=="y" IF /I NOT "%expressmesabuild%"=="y" set mesatargets=%mesatargets% graw-gdi
@IF /I "%expressmesabuild%"=="y" set graw=y
@if %pythonver% GEQ 3 if /I "%graw%"=="y" set buildconf=%buildconf% -Dbuild-tests=true

@set cleanbuild=n
@IF %pythonver%==2 if EXIST build\windows-%longabi% set /p cleanbuild=Do you want to clean build (y/n):
@IF %pythonver%==2 if EXIST build\windows-%longabi% echo.
@IF %pythonver% GEQ 3 if EXIST build\%abi% set /p cleanbuild=Do you want to clean build (y/n):
@IF %pythonver% GEQ 3 if EXIST build\%abi% echo.
@IF %pythonver%==2 if /I "%cleanbuild%"=="y" RD /S /Q build\windows-%longabi%
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" RD /S /Q build\%abi%
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" for /d %%q in ("%mesa%\mesa\subprojects\zlib-*") do @RD /S /Q "%%~q"
@IF %pythonver% GEQ 3 if /I "%cleanbuild%"=="y" for /d %%r in ("%mesa%\mesa\subprojects\expat-*") do @RD /S /Q "%%~r"

@IF %flexstate%==1 set PATH=%mesa%\flexbison\;%PATH%
@if %pythonver%==2 GOTO build_mesa
@if %pythonver% GEQ 3 IF %pkgconfigstate%==2 GOTO build_mesa
@set PATH=%PKG_CONFIG_PATH%\;%PATH%

:build_mesa
@if NOT EXIST build md build
@IF %pythonver%==2 if NOT EXIST build\windows-%longabi% md build\windows-%longabi%
@IF %pythonver% GEQ 3 if NOT EXIST build\%abi% md build\%abi%
@IF %pythonver%==2 if NOT EXIST build\windows-%longabi%\git_sha1.h echo 0 > build\windows-%longabi%\git_sha1.h
@IF %pythonver% GEQ 3 if NOT EXIST build\%abi%\src md build\%abi%\src
@IF %pythonver% GEQ 3 if NOT EXIST build\%abi%\src\git_sha1.h echo 0 > build\%abi%\src\git_sha1.h
@echo.
@call %vsenv% %vsabi%
@echo.
@if %pythonver% GEQ 3 echo Build configuration command stored in buildconf variable.
@if %pythonver% GEQ 3 echo.
@if %pythonver% GEQ 3 cmd
@if %pythonver%==2 IF /I "%osmesa%"=="y" IF %disableosmesa%==1 (
@echo Build command: %buildcmd% gles=0 %mesatargets%
@echo.
@%buildcmd% gles=0 %mesatargets%
@echo.
@pause
@echo Beginning 2nd build pass
@echo.
)
@if %pythonver%==2 (
@echo Build command: %buildcmd% gles=%gles% %mesatargets%
@echo.
@%buildcmd% gles=%gles% %mesatargets%
@echo.
)

:skipmesa
@echo.

Fix one More MSVC_USE_SCRIPT odditiy. It should work now.


REM
REM Copyright (C) 2011-13, DyND Developers
REM BSD 2-Clause License, see LICENSE.txt
REM
REM This is the master windows build + test script for building
REM the dynd python bindings on jenkins.
REM
REM Jenkins Requirements:
REM   - Anaconda should be installed in C:\Anaconda.
REM   - Use a jenkins build matrix for multiple
REM     platforms/python versions
REM   - Use the XShell plugin to launch this script
REM   - Call the script from the root workspace
REM     directory as buildscripts/jenkins-build
REM   - Use a user-defined axis to select python versions with PYTHON_VERSION
REM

REM If no MSVC version is selected, choose 2010
if "%MSVC_VERSION%" == "" set MSVC_VERSION=10.0
REM Require a version of Python to be selected
if "%PYTHON_VERSION%" == "" exit /b 1

REM Jenkins has '/' in its workspace. Fix it to '\' to simplify the DOS commands.
set WORKSPACE=%WORKSPACE:/=\%

REM Remove the build subdirectory from last time
rd /q /s build

REM Get libdynd into the libraries subdirectory
REM TODO: Build libdynd in a separate jenkins project,
REM       and use its build artifact here.
call .\buildscripts\checkout_libdynd.bat
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Use conda to create a conda environment of the required
REM python version and containing the dependencies.
SET PYENV_PREFIX=%WORKSPACE%\build\pyenv
call .\buildscripts\create_conda_pyenv.bat %PYTHON_VERSION% %PYENV_PREFIX%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on
set PYTHON_EXECUTABLE=%PYENV_PREFIX%\Python.exe
set PATH=%PYENV_PREFIX%;%PYENV_PREFIX%\Scripts;%PATH%

REM Select the correct compiler, by first getting whether
REM the Python is 32-bit or 64-bit.
FOR /F "delims=" %%i IN ('%PYTHON_EXECUTABLE% -c "import ctypes;print(8*ctypes.sizeof(ctypes.c_void_p))"') DO set PYTHON_BITS=%%i
if "%PYTHON_BITS%" == "64" goto :python64
 set MSVC_VCVARS_PLATFORM=x86
 set MSVC_BUILD_PLATFORM=Win32
 if "%MSVC_VERSION%" == "9.0" set CMAKE_BUILD_TARGET="Visual Studio 9 2008"
 if "%MSVC_VERSION%" == "10.0" set CMAKE_BUILD_TARGET="Visual Studio 10"
 if "%MSVC_VERSION%" == "11.0" set CMAKE_BUILD_TARGET="Visual Studio 11"
goto :python32
:python64
 set MSVC_VCVARS_PLATFORM=amd64
 set MSVC_BUILD_PLATFORM=x64
 if "%MSVC_VERSION%" == "9.0" set CMAKE_BUILD_TARGET="Visual Studio 9 2008 Win64"
 if "%MSVC_VERSION%" == "10.0" set CMAKE_BUILD_TARGET="Visual Studio 10 Win64"
 if "%MSVC_VERSION%" == "11.0" set CMAKE_BUILD_TARGET="Visual Studio 11 Win64"
:python32

REM Configure the appropriate visual studio command line environment
if "%PROGRAMFILES(X86)%" == "" set VCDIR=%PROGRAMFILES%\Microsoft Visual Studio %MSVC_VERSION%\VC
if NOT "%PROGRAMFILES(X86)%" == "" set VCDIR=%PROGRAMFILES(X86)%\Microsoft Visual Studio %MSVC_VERSION%\VC
call "%VCDIR%\vcvarsall.bat" %MSVC_VCVARS_PLATFORM%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on

REM Create a fresh visual studio solution with cmake, and do the build/install
cd build
cmake -DCMAKE_INSTALL_PREFIX=install -G %CMAKE_BUILD_TARGET% -DPYTHON_EXECUTABLE=%PYTHON_EXECUTABLE% ..
IF %ERRORLEVEL% NEQ 0 exit /b 1
devenv dynd-python.sln /Build "RelWithDebInfo|%MSVC_BUILD_PLATFORM%"
IF %ERRORLEVEL% NEQ 0 exit /b 1
devenv dynd-python.sln /Build "RelWithDebInfo|%MSVC_BUILD_PLATFORM%" /Project INSTALL
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Run the tests and generate xml results
%PYTHON_EXECUTABLE% -c "import dynd;dynd.test(xunitfile='../test_results.xml', exit=1)"
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Get the version number and process it into a suitable form
FOR /F "delims=" %%i IN ('%PYTHON_EXECUTABLE% -c "import dynd;print(dynd.__version__)"') DO set PYDYND_VERSION=%%i
if "%PYDYND_VERSION%" == "" exit /b 1
set PYDYND_VERSION=%PYDYND_VERSION:-=_%

REM Put the conda package by itself in the directory pkgs/<anaconda-arch>
cd ..
rd /q /s pkgs
mkdir pkgs
cd pkgs
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" mkdir win-64
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" cd win-64
if NOT "%PROCESSOR_ARCHITECTURE%" == "AMD64" mkdir win-32
if NOT "%PROCESSOR_ARCHITECTURE%" == "AMD64" cd win-32

REM Create a conda package from the build
call C:\Anaconda\Scripts\conda package -p %PYENV_PREFIX% --pkg-name=dynd-python --pkg-version=%PYDYND_VERSION%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on

cd ..

exit /b 0

REM
REM Copyright (C) 2011-13, DyND Developers
REM BSD 2-Clause License, see LICENSE.txt
REM
REM This is the master windows build + test script for building
REM the dynd python bindings on jenkins.
REM
REM Jenkins Requirements:
REM   - Anaconda should be installed in C:\Anaconda.
REM   - Use a jenkins build matrix for multiple
REM     platforms/python versions
REM   - Use the XShell plugin to launch this script
REM   - Call the script from the root workspace
REM     directory as buildscripts/jenkins-build
REM   - Use a user-defined axis to select python versions with PYTHON_VERSION
REM

REM If no MSVC version is selected, choose 2010
if "%MSVC_VERSION%" == "" set MSVC_VERSION=10.0
REM Require a version of Python to be selected
if "%PYTHON_VERSION%" == "" exit /b 1

REM Jenkins has '/' in its workspace. Fix it to '\' to simplify the DOS commands.
set WORKSPACE=%WORKSPACE:/=\%

REM Remove the build subdirectory from last time
rd /q /s build

REM Get libdynd into the libraries subdirectory
REM TODO: Build libdynd in a separate jenkins project,
REM       and use its build artifact here.
call .\buildscripts\checkout_libdynd.bat
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Use conda to create a conda environment of the required
REM python version and containing the dependencies.
SET PYENV_PREFIX=%WORKSPACE%\build\pyenv
call .\buildscripts\create_conda_pyenv.bat %PYTHON_VERSION% %PYENV_PREFIX%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on
set PYTHON_EXECUTABLE=%PYENV_PREFIX%\Python.exe
set PATH=%PYENV_PREFIX%;%PYENV_PREFIX%\Scripts;%PATH%

REM Select the correct compiler, by first getting whether
REM the Python is 32-bit or 64-bit.
FOR /F "delims=" %%i IN ('%PYTHON_EXECUTABLE% -c "import ctypes;print(8*ctypes.sizeof(ctypes.c_void_p))"') DO set PYTHON_BITS=%%i
if "%PYTHON_BITS%" == "64" goto :python64
 set MSVC_VCVARS_PLATFORM=x86
 set MSVC_BUILD_PLATFORM=Win32
 if "%MSVC_VERSION%" == "9.0" set CMAKE_BUILD_TARGET="Visual Studio 9 2008"
 if "%MSVC_VERSION%" == "10.0" set CMAKE_BUILD_TARGET="Visual Studio 10"
 if "%MSVC_VERSION%" == "11.0" set CMAKE_BUILD_TARGET="Visual Studio 11"
goto :python32
:python64
 set MSVC_VCVARS_PLATFORM=amd64
 set MSVC_BUILD_PLATFORM=x64
 if "%MSVC_VERSION%" == "9.0" set CMAKE_BUILD_TARGET="Visual Studio 9 2008 Win64"
 if "%MSVC_VERSION%" == "10.0" set CMAKE_BUILD_TARGET="Visual Studio 10 Win64"
 if "%MSVC_VERSION%" == "11.0" set CMAKE_BUILD_TARGET="Visual Studio 11 Win64"
:python32

REM Configure the appropriate visual studio command line environment
if "%PROGRAMFILES(X86)%" == "" set VCDIR=%PROGRAMFILES%\Microsoft Visual Studio %MSVC_VERSION%\VC
if NOT "%PROGRAMFILES(X86)%" == "" set VCDIR=%PROGRAMFILES(X86)%\Microsoft Visual Studio %MSVC_VERSION%\VC
call "%VCDIR%\vcvarsall.bat" %MSVC_VCVARS_PLATFORM%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on

REM Create a fresh visual studio solution with cmake, and do the build/install
cd build
cmake -DCMAKE_INSTALL_PREFIX=install -G %CMAKE_BUILD_TARGET% -DPYTHON_EXECUTABLE=%PYTHON_EXECUTABLE% ..
IF %ERRORLEVEL% NEQ 0 exit /b 1
devenv dynd-python.sln /Build "RelWithDebInfo|%MSVC_BUILD_PLATFORM%"
IF %ERRORLEVEL% NEQ 0 exit /b 1
devenv dynd-python.sln /Build "RelWithDebInfo|%MSVC_BUILD_PLATFORM%" /Project INSTALL
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Run the tests and generate xml results
%PYTHON_EXECUTABLE% -c "import dynd;dynd.test(xunitfile='../test_results.xml', verbosity=2, exit=1)"
IF %ERRORLEVEL% NEQ 0 exit /b 1

REM Get the version number and process it into a suitable form
FOR /F "delims=" %%i IN ('%PYTHON_EXECUTABLE% -c "import dynd;print(dynd.__version__)"') DO set PYDYND_VERSION=%%i
if "%PYDYND_VERSION%" == "" exit /b 1
set PYDYND_VERSION=%PYDYND_VERSION:-=_%

REM Put the conda package by itself in the directory pkgs/<anaconda-arch>
cd ..
rd /q /s pkgs
mkdir pkgs
cd pkgs
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" mkdir win-64
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" cd win-64
if NOT "%PROCESSOR_ARCHITECTURE%" == "AMD64" mkdir win-32
if NOT "%PROCESSOR_ARCHITECTURE%" == "AMD64" cd win-32

REM Create a conda package from the build
call C:\Anaconda\Scripts\conda package -p %PYENV_PREFIX% --pkg-name=dynd-python --pkg-version=%PYDYND_VERSION%
IF %ERRORLEVEL% NEQ 0 exit /b 1
echo on

cd ..

exit /b 0

Make the jenkins test run use verbosity=2


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

@echo off
SET iserr=0
SET SCRIPTDIR=%~dp0
SET DARTROOTDIR=%~dp0..\..\
SET DOWNLOADSDIR="%SCRIPTDIR%downloads\ "
SET REQUIREMENTSFILE="%~dp0..\..\requirements.txt "

REM DART Offline Installation
REM Copyright 2017 Lockheed Martin Corporation
REM Created: 2015-06-26
REM Version: 3.0 (2016-12-01)

echo DART Offline Installer (Windows 7)
echo Created by the Lockheed Martin Red Team
echo.
echo.

echo This will install the dependencies for DART.
echo.
pause

echo
echo [-] Checking for Admin privileges

REM UAC check/prompt from techgainer.com/create-batch-file-automatically-run-adminstrator

:: BatchGotAdmin (Run as Admin code starts)
REM Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM If error flag set, we do not have admin

if '%errorlevel%' NEQ '0' (
echo [!] Not running as admin
echo     This script requires administrative rights to run in order to:
echo         - Add Python to the system path
echo [-] Requesting admin privileges ^(will restart script as admin^)
pause
goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B

:gotAdmin
echo [-] Check passed - running as admin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
REM CD /D "%~dp0"

:: BatchGotAdmin (Run as Admin code ends)

echo [-] Beginning installation of vcpython27
msiexec /i %DOWNLOADSDIR%vcpython27.msi -qb
echo [-] vcpython27 installed

echo [-] Beginning installation of Python 2.7
msiexec /i %DOWNLOADSDIR%python-installer.msi /qb!
echo [-] Python 2.7 installed

echo [-] Adding Python to PATH
>nul 2>&1 SETX /M path "%PATH%;C:\Python27;C:\Python27\Scripts"
if '%errorlevel%' NEQ '0' (
echo [!] ERROR adding Python to path. Please manually add
echo     C:\Python27 and C:\Python27\Scripts
echo     to your system path, then reboot.
SET iserr=1
) else (
echo [-] Added C:\Python27 and C:\Python27\Scripts to PATH
)

echo [-] Installing required components
C:\Python27\Scripts\pip.exe install --no-index --find-links=%DOWNLOADSDIR% -r %REQUIREMENTSFILE%
echo [-] Components installed.

echo.
echo.

if '%iserr%' NEQ '0' (
echo [!] SCRIPT ENCOUNTERED ERRORS
echo [!] Please review the output and take appropriate action.
echo.
echo.
)

echo [!] You should probably reboot this computer.
echo [!] You may encounter problems
echo     if you do not reboot before running DART.

echo.
echo.
pause

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

@echo off
SET iserr=0
SET SCRIPTDIR=%~dp0
SET DARTROOTDIR=%~dp0..\..\
SET DOWNLOADSDIR=%SCRIPTDIR%downloads\
SET REQUIREMENTSFILE=%~dp0..\..\requirements.txt

REM DART Offline Installation
REM Copyright 2017 Lockheed Martin Corporation
REM Created: 2015-06-26
REM Version: 3.0 (2016-12-01)

echo DART Offline Installer (Windows 7)
echo Created by the Lockheed Martin Red Team
echo.
echo.

echo This will install the dependencies for DART.
echo.
pause

echo
echo [-] Checking for Admin privileges

REM UAC check/prompt from techgainer.com/create-batch-file-automatically-run-adminstrator

:: BatchGotAdmin (Run as Admin code starts)
REM Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM If error flag set, we do not have admin

if '%errorlevel%' NEQ '0' (
echo [!] Not running as admin
echo     This script requires administrative rights to run in order to:
echo         - Add Python to the system path
echo [-] Requesting admin privileges ^(will restart script as admin^)
pause
goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B

:gotAdmin
echo [-] Check passed - running as admin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
REM CD /D "%~dp0"

:: BatchGotAdmin (Run as Admin code ends)

echo [-] Beginning installation of vcpython27
msiexec /i %DOWNLOADSDIR%vcpython27.msi -qb
echo [-] vcpython27 installed

echo [-] Beginning installation of Python 2.7
msiexec /i %DOWNLOADSDIR%python-installer.msi /qb!
echo [-] Python 2.7 installed

echo [-] Adding Python to PATH
>nul 2>&1 SETX /M path "%PATH%;C:\Python27;C:\Python27\Scripts"
if '%errorlevel%' NEQ '0' (
echo [!] ERROR adding Python to path. Please manually add
echo     C:\Python27 and C:\Python27\Scripts
echo     to your system path, then reboot.
SET iserr=1
) else (
echo [-] Added C:\Python27 and C:\Python27\Scripts to PATH
)

echo [-] Installing required components
C:\Python27\Scripts\pip.exe install --no-index --find-links=%DOWNLOADSDIR% -r %REQUIREMENTSFILE%
echo [-] Components installed.

echo.
echo.

if '%iserr%' NEQ '0' (
echo [!] SCRIPT ENCOUNTERED ERRORS
echo [!] Please review the output and take appropriate action.
echo.
echo.
)

echo [!] You should probably reboot this computer.
echo [!] You may encounter problems
echo     if you do not reboot before running DART.

echo.
echo.
pause

Remove quotes and adjust spacing in offline install script path definitions. Believe this'll resolve the bug reported in #1.


mkdir build
cd build

set BUILD_CONFIG=Release

REM === Configure step ===

REM allow setting the targets to build as an environment variable
if "%LLVM_TARGETS_TO_BUILD%"=="" (
    set "LLVM_TARGETS_TO_BUILD=host;AMDGPU;NVPTX"
)
set CMAKE_GENERATOR="Visual Studio 16 2019"
set CMAKE_GENERATOR_TOOLSET="v141"

REM Reduce build times and package size by removing unused stuff
set CMAKE_CUSTOM=-DLLVM_TARGETS_TO_BUILD="%LLVM_TARGETS_TO_BUILD%" ^
    -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_UTILS=ON -DLLVM_INCLUDE_DOCS=OFF ^
    -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_ASSERTIONS=ON ^
    -DLLVM_USE_INTEL_JITEVENTS=ON ^
    -DLLVM_INCLUDE_BENCHMARKS=OFF ^
    -DLLVM_ENABLE_DIA_SDK=OFF ^
    -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly

cmake -G "%CMAKE_GENERATOR%" -T "%CMAKE_GENERATOR_TOOLSET%" ^
    -DCMAKE_BUILD_TYPE="%BUILD_CONFIG%" -DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
    -DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" %CMAKE_CUSTOM% "%SRC_DIR%"

REM === Build step ===
cmake --build . --config "%BUILD_CONFIG%"
if errorlevel 1 exit 1

REM === Install step ===
cmake --build . --config "%BUILD_CONFIG%" --target install
if errorlevel 1 exit 1

REM From: https://github.com/conda-forge/llvmdev-feedstock/pull/53
"%BUILD_CONFIG%\bin\opt" -S -vector-library=SVML -mcpu=haswell -O3 "%RECIPE_DIR%\numba-3016.ll" | "%BUILD_CONFIG%\bin\FileCheck" "%RECIPE_DIR%\numba-3016.ll"
if errorlevel 1 exit 1

REM This is technically how to run the suite, but it will only run in an
REM enhanced unix-like shell which has functions like `grep` available.
REM cd ..\test
REM "%PYTHON%" "..\build\%BUILD_CONFIG%\bin\llvm-lit.py" -vv Transforms ExecutionEngine Analysis CodeGen/X86
REM if errorlevel 1 exit 1

mkdir build
cd build

set BUILD_CONFIG=Release

REM === Configure step ===

REM allow setting the targets to build as an environment variable
if "%LLVM_TARGETS_TO_BUILD%"=="" (
    set "LLVM_TARGETS_TO_BUILD=host;AMDGPU;NVPTX"
)
if "%ARCH%"=="32" (
    set "ARCH_POSTFIX="
) else (
    set "ARCH_POSTFIX= Win64"
)
set "CMAKE_GENERATOR[0]=Visual Studio 14 2015%ARCH_POSTFIX%"
set "CMAKE_GENERATOR[1]=Visual Studio 15 2017%ARCH_POSTFIX%"
set "CMAKE_GENERATOR[2]=Visual Studio 16 2019"
set MAX_INDEX_CMAKE_GENERATOR=2
set CMAKE_GENERATOR_TOOLSET=v141

REM the platform toolset host arch is set to x64 so as to use the 64bit linker,
REM the 32bit linker heap is too small for llvm8 so it tries and falls over to
REM the 64bit linker anyway
set PreferredToolArchitecture=x64

REM Reduce build times and package size by removing unused stuff
REM BENCHMARKS (new for llvm8) don't build under Visual Studio 14 2015
set CMAKE_CUSTOM=-DLLVM_TARGETS_TO_BUILD="%LLVM_TARGETS_TO_BUILD%" ^
    -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_UTILS=ON -DLLVM_INCLUDE_DOCS=OFF ^
    -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_ASSERTIONS=ON ^
    -DLLVM_USE_INTEL_JITEVENTS=ON ^
    -DLLVM_INCLUDE_BENCHMARKS=OFF ^
    -DLLVM_ENABLE_DIA_SDK=OFF ^
    -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly

REM try all compatible visual studio toolsets to find one that is installed
setlocal enabledelayedexpansion
for /l %%n in (0,1,%MAX_INDEX_CMAKE_GENERATOR%) do (
    cmake -G "!CMAKE_GENERATOR[%%n]!" -T "%CMAKE_GENERATOR_TOOLSET%" ^
        -DCMAKE_BUILD_TYPE="%BUILD_CONFIG%" -DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
        -DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" %CMAKE_CUSTOM% "%SRC_DIR%"
    if not errorlevel 1 goto configuration_successful
    del CMakeCache.txt
)

REM no compatible visual studio toolset was found

:configuration_successful
endlocal
REM === Build step ===
cmake --build . --config "%BUILD_CONFIG%"
if errorlevel 1 exit 1

REM === Install step ===
cmake --build . --config "%BUILD_CONFIG%" --target install
if errorlevel 1 exit 1

REM From: https://github.com/conda-forge/llvmdev-feedstock/pull/53
"%BUILD_CONFIG%\bin\opt" -S -vector-library=SVML -mcpu=haswell -O3 "%RECIPE_DIR%\numba-3016.ll" | "%BUILD_CONFIG%\bin\FileCheck" "%RECIPE_DIR%\numba-3016.ll"
if errorlevel 1 exit 1

REM This is technically how to run the suite, but it will only run in an
REM enhanced unix-like shell which has functions like `grep` available.
REM cd ..\test
REM "%PYTHON%" "..\build\%BUILD_CONFIG%\bin\llvm-lit.py" -vv Transforms ExecutionEngine Analysis CodeGen/X86
REM if errorlevel 1 exit 1

Revert "experimental: simplify script to use only Visual Studio 16 2019"

This reverts commit 6594546243dd7c0fcc2e0686b2723090e7b9011b.


@echo off

echo.
echo James Build System
echo -------------------

set ANT_HOME=tools
set CLASSPATH=lib\xerces.jar

%ANT_HOME%\bin\ant.bat -emacs %1 %2 %3 %4 %5 %6 %7 %8
goto cleanup

:cleanup
set ANT_HOME=

@echo off

echo.
echo James Build System
echo -------------------

set ANT_HOME=tools
set CLASSPATH=lib\xerces-1.4.3.jar;tools\lib\velocity-1.3-dev.jar;tools\lib\jdom-b7.jar

%ANT_HOME%\bin\ant.bat -emacs %1 %2 %3 %4 %5 %6 %7 %8
goto cleanup

:cleanup
set ANT_HOME=

Use velocity and jdom that was copied from jakarta-site2

git-svn-id: 88158f914d5603334254b4adf21dfd50ec107162@107714 13f79535-47bb-0310-9956-ffa450edef68


@echo off
setlocal enableextensions
setlocal enabledelayedexpansion

::set CFLAGS=/Od /D_DEBUG
::set CFLAGS=/Od /Zi /D_DEBUG
set CFLAGS=/O2 /fp:fast

set CC=..\compiler\cl.exe
set HLSLC=..\compiler\dxc.exe /Ges /O3 /WX /nologo

set NAME=test01
set SHADER_BEGIN=0
set SHADER_END=0

for /L %%G in (%SHADER_BEGIN%,1,%SHADER_END%) do (
    if exist data\%%G.vs.cso del data\%%G.vs.cso
    if exist data\%%G.ps.cso del data\%%G.ps.cso
    %HLSLC% /D VS_%%G /E VertexMain /Fo data\%%G.vs.cso /T vs_6_0 %NAME%.hlsl & if !ERRORLEVEL! neq 0 (goto :end)
    %HLSLC% /D PS_%%G /E PixelMain /Fo data\%%G.ps.cso /T ps_6_0 %NAME%.hlsl & if !ERRORLEVEL! neq 0 (goto :end)
)

if exist %NAME%.exe del %NAME%.exe

%CC% %CFLAGS% /Gm- /nologo /GS- /Gs999999 /Gy /Gw /EHa- /Bt /WX /Wall /wd4710 /wd4711 /wd5045 /wd4820 /wd4201 /wd4221 /wd4152 /wd4204 %NAME%.c ^
     /link ..\compiler\kernel32.lib /OPT:REF /INCREMENTAL:NO /SUBSYSTEM:WINDOWS /ENTRY:Start /NODEFAULTLIB

if exist *.obj del *.obj

if "%1" == "run" if exist %NAME%.exe (.\%NAME%.exe)

:end

@echo off
setlocal enableextensions
setlocal enabledelayedexpansion

set CFLAGS=/Od /D_DEBUG
::set CFLAGS=/Od /Zi /D_DEBUG
::set CFLAGS=/O2 /fp:fast

set CC=..\compiler\cl.exe
set HLSLC=..\compiler\dxc.exe /Ges /O3 /WX /nologo

set NAME=test01
set SHADER_BEGIN=0
set SHADER_END=0

for /L %%G in (%SHADER_BEGIN%,1,%SHADER_END%) do (
    if exist data\%%G.vs.cso del data\%%G.vs.cso
    if exist data\%%G.ps.cso del data\%%G.ps.cso
    %HLSLC% /D VS_%%G /E VertexMain /Fo data\%%G.vs.cso /T vs_6_0 %NAME%.hlsl & if !ERRORLEVEL! neq 0 (goto :end)
    %HLSLC% /D PS_%%G /E PixelMain /Fo data\%%G.ps.cso /T ps_6_0 %NAME%.hlsl & if !ERRORLEVEL! neq 0 (goto :end)
)

if exist %NAME%.exe del %NAME%.exe

%CC% %CFLAGS% /Gm- /nologo /GS- /Gs999999 /Gy /Gw /EHa- /Bt /WX /Wall /wd4710 /wd4711 /wd5045 /wd4820 /wd4201 /wd4221 /wd4152 /wd4204 %NAME%.c ^
     /link ..\compiler\kernel32.lib /OPT:REF /INCREMENTAL:NO /SUBSYSTEM:WINDOWS /ENTRY:Start /NODEFAULTLIB

if exist *.obj del *.obj

if "%1" == "run" if exist %NAME%.exe (.\%NAME%.exe)

:end

Update make.bat

Update make.bat


if "%VSCMD_TEST%" NEQ "" goto :test
if "%VSCMD_ARG_CLEAN_ENV%" NEQ "" goto :clean_env

set FSHARPINSTALLDIR=%VSINSTALLDIR%Common7\IDE\CommonExtensions\Microsoft\FSharp\
set "PATH=%FSHARPINSTALLDIR%;%PATH%"

goto :end

:test

set __VSCMD_TEST_FSHARP_STATUS=pass

@REM ******************************************************************
@REM basic environment validation cases go here
@REM ******************************************************************

where fsc.exe
if "%ERRORLEVEL%" NEQ "0" (
    @echo [ERROR:%~nx0] Unable to find F# compiler via 'where fsc.exe'.
    set __VSCMD_TEST_FSHARP_STATUS=fail
)

where fsi.exe
if "%ERRORLEVEL%" NEQ "0" (
    @echo [ERROR:%~nx0] Unable to find F# Interactive via 'where fsi.exe'.
    set __VSCMD_TEST_FSHARP_STATUS=fail
)

@REM return value other than 0 if tests failed.
if "%__VSCMD_TEST_FSHARP_STATUS%" NEQ "pass" (
    set __VSCMD_TEST_FSHARP_STATUS=
    exit /B 1
)

set __VSCMD_TEST_FSHARP_STATUS=
exit /B 0

:clean_env

@REM Script only adds to PATH, no custom action required for -clean_env
@REM vsdevcmd.bat will clean-up this variable.

goto :end
:end

exit /B 0

if "%VSCMD_TEST%" NEQ "" goto :test
if "%VSCMD_ARG_CLEAN_ENV%" NEQ "" goto :clean_env

set FSHARPINSTALLDIR=%VSINSTALLDIR%Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools
set "PATH=%FSHARPINSTALLDIR%;%PATH%"

goto :end

:test

set __VSCMD_TEST_FSHARP_STATUS=pass

@REM ******************************************************************
@REM basic environment validation cases go here
@REM ******************************************************************

where fsc.exe
if "%ERRORLEVEL%" NEQ "0" (
    @echo [ERROR:%~nx0] Unable to find F# compiler via 'where fsc.exe'.
    set __VSCMD_TEST_FSHARP_STATUS=fail
)

where fsi.exe
if "%ERRORLEVEL%" NEQ "0" (
    @echo [ERROR:%~nx0] Unable to find F# Interactive via 'where fsi.exe'.
    set __VSCMD_TEST_FSHARP_STATUS=fail
)

@REM return value other than 0 if tests failed.
if "%__VSCMD_TEST_FSHARP_STATUS%" NEQ "pass" (
    set __VSCMD_TEST_FSHARP_STATUS=
    exit /B 1
)

set __VSCMD_TEST_FSHARP_STATUS=
exit /B 0

:clean_env

@REM Script only adds to PATH, no custom action required for -clean_env
@REM vsdevcmd.bat will clean-up this variable.

goto :end
:end

exit /B 0

fix tools path

fix tools path


@echo off
pushd ..\tonyu2-compiler\
node index.js ..\Tonyu2\www\Kernel\
popd

add build.bat

add build.bat


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

set targetPath=C:\projects\nfluent\
set initialPath=%cd%

git clone -q %initialPath% %targetPath%

cd %targetPath%

REM msbuild .\.build\Build.proj /p:Configuration="%config%" /t:RunAll /v:M /fl /flp:LogFile=msbuild.log;Verbosity=Diagnostic /nr:false
msbuild .\.build\Build.proj /p:Configuration="%config%" /t:Package /v:M /fl /flp:LogFile=msbuild.log;Verbosity=Diagnostic /nr:false

cd %initialPath%

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

set targetPath=C:\projects\nfluent\
set initialPath=%cd%

git clone %initialPath% %targetPath%

cd %targetPath%

REM msbuild .\.build\Build.proj /p:Configuration="%config%" /t:RunAll /v:M /fl /flp:LogFile=msbuild.log;Verbosity=Diagnostic /nr:false
msbuild .\.build\Build.proj /p:Configuration="%config%" /t:Package /v:M /fl /flp:LogFile=msbuild.log;Verbosity=Diagnostic /nr:false

cd %initialPath%

Remove the quiet mode for git clone within the 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
%BuildPrefix% msbuild "%BuildProj%" /p:Configuration=%Configuration% /nologo /maxcpucount:1 /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=d;LogFile="%BuildLog%"; %BuildPostfix%
SET BuildErrorLevel=%ERRORLEVEL%
dotnet build src\docfx -c %Configuration% -o target\%Configuration%\docfx.cli -f net452
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
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%

Build docfx.cli first (#673)

Build docfx.cli first (#673)


@echo off

pushd %~dp0

SET PACKAGEPATH=.\packages\
SET NUGET=.\tools\nuget\NuGet.exe
SET NUGETOPTIONS=-ConfigFile .\tools\nuget\NuGet.Config -OutputDirectory %PACKAGEPATH% -ExcludeVersion

IF NOT EXIST %PACKAGEPATH%FAKE\Ver_4.23.0 (
  RD /S/Q %PACKAGEPATH%FAKE
  %NUGET% install FAKE -Version 4.23.0 %NUGETOPTIONS%
  COPY NUL %PACKAGEPATH%FAKE\Ver_4.23.0
)

IF NOT EXIST %PACKAGEPATH%FAKE.BuildLib\Ver_0.2.6 (
  RD /S/Q %PACKAGEPATH%FAKE.BuildLib
  %NUGET% install FAKE.BuildLib -Version 0.2.6 %NUGETOPTIONS%
  COPY NUL %PACKAGEPATH%FAKE.BuildLib\Ver_0.2.6
)

set encoding=utf-8
"%PACKAGEPATH%FAKE\tools\FAKE.exe" build.fsx %*

popd

@echo off

pushd %~dp0

SET PACKAGEPATH=.\packages\
SET NUGET=.\tools\nuget\NuGet.exe
SET NUGETOPTIONS=-ConfigFile .\tools\nuget\NuGet.Config -OutputDirectory %PACKAGEPATH% -ExcludeVersion

IF NOT EXIST %PACKAGEPATH%FAKE\Ver_4.25.4 (
  RD /S/Q %PACKAGEPATH%FAKE
  %NUGET% install FAKE -Version 4.25.4 %NUGETOPTIONS%
  COPY NUL %PACKAGEPATH%FAKE\Ver_4.25.4
)

IF NOT EXIST %PACKAGEPATH%FAKE.BuildLib\Ver_0.2.7 (
  RD /S/Q %PACKAGEPATH%FAKE.BuildLib
  %NUGET% install FAKE.BuildLib -Version 0.2.7 %NUGETOPTIONS%
  COPY NUL %PACKAGEPATH%FAKE.BuildLib\Ver_0.2.7
)

set encoding=utf-8
"%PACKAGEPATH%FAKE\tools\FAKE.exe" build.fsx %*

popd

Update BuildLib 0.2.7

Update BuildLib 0.2.7


::..............................................................................
::
::  This file is part of the AXL library.
::
::  AXL is distributed under the MIT license.
::  For details see accompanying license.txt file,
::  the public copy of which is also available at:
::  http://tibbo.com/downloads/archive/axl/license.txt
::
::..............................................................................

@echo off

set DOWNLOAD_DIR=c:\downloads
set DOWNLOAD_DIR_CMAKE=%DOWNLOAD_DIR:\=/%

:: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

:: Ragel

mkdir %DOWNLOAD_DIR%\ragel
appveyor DownloadFile %RAGEL_DOWNLOAD_URL% -FileName %DOWNLOAD_DIR%\ragel.exe

echo set (RAGEL_EXE %DOWNLOAD_DIR_CMAKE%/ragel.exe) >> paths.cmake

:: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

:: Lua

mkdir %DOWNLOAD_DIR%\lua
appveyor DownloadFile %LUA_DOWNLOAD_URL% -FileName %DOWNLOAD_DIR%\lua\lua.zip
7z x -y %DOWNLOAD_DIR%\lua\lua.zip -o%DOWNLOAD_DIR%\lua

echo set (LUA_INC_DIR %DOWNLOAD_DIR_CMAKE%/lua/include) >> paths.cmake
echo set (LUA_LIB_DIR %DOWNLOAD_DIR_CMAKE%/lua) >> paths.cmake
echo set (LUA_DLL_DIR %DOWNLOAD_DIR_CMAKE%/lua) >> paths.cmake
echo set (LUA_LIB_NAME %LUA_LIB_NAME%) >> paths.cmake

:: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

:: OpenSSL

set OPENSSL_DIR_CMAKE=%OPENSSL_DIR:\=/%

echo set (OPENSSL_INC_DIR %OPENSSL_DIR_CMAKE%/include) >> paths.cmake
echo set (OPENSSL_LIB_DIR %OPENSSL_DIR_CMAKE%/lib) >> paths.cmake

:: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

:: Get rid of Xamarin annoying build warnings

del "c:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
del "c:\Program Files (x86)\MSBuild\4.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"

::..............................................................................
::
::  This file is part of the AXL library.
::
::  AXL is distributed under the MIT license.
::  For details see accompanying license.txt file,
::  the public copy of which is also available at:
::  http://tibbo.com/downloads/archive/axl/license.txt
::
::..............................................................................

@echo off

set DOWNLOAD_DIR=c:\downloads
set DOWNLOAD_DIR_CMAKE=%DOWNLOAD_DIR:\=/%

:: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

:: Ragel

mkdir %DOWNLOAD_DIR%\ragel
appveyor DownloadFile %RAGEL_DOWNLOAD_URL% -FileName %DOWNLOAD_DIR%\ragel.exe

echo set (RAGEL_EXE %DOWNLOAD_DIR_CMAKE%/ragel.exe) >> paths.cmake

:: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

:: Lua

mkdir %DOWNLOAD_DIR%\lua
appveyor DownloadFile %LUA_DOWNLOAD_URL% -FileName %DOWNLOAD_DIR%\lua\lua.zip
7z x -y %DOWNLOAD_DIR%\lua\lua.zip -o%DOWNLOAD_DIR%\lua

echo set (LUA_INC_DIR %DOWNLOAD_DIR_CMAKE%/lua/include) >> paths.cmake
echo set (LUA_LIB_DIR %DOWNLOAD_DIR_CMAKE%/lua) >> paths.cmake
echo set (LUA_DLL_DIR %DOWNLOAD_DIR_CMAKE%/lua) >> paths.cmake
echo set (LUA_LIB_NAME %LUA_LIB_NAME%) >> paths.cmake

:: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

:: OpenSSL

set OPENSSL_DIR_CMAKE=%OPENSSL_DIR:\=/%

echo set (OPENSSL_INC_DIR %OPENSSL_DIR_CMAKE%/include) >> paths.cmake
echo set (OPENSSL_LIB_DIR %OPENSSL_DIR_CMAKE%/lib) >> paths.cmake

:: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

:: Get rid of annoying Xamarin build warnings

if exist "c:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets" (
	del "c:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
)

if exist "c:\Program Files (x86)\MSBuild\4.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets" (
	del "c:\Program Files (x86)\MSBuild\4.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
)

delete xamarin targets conditionally

[ci] delete xamarin targets conditionally


cl /O2 /W3 /WX /I "\Program Files\Java\jdk1.5.0_11\include" /I "\Program Files\Java\jdk1.5.0_11\include\win32"  NucleotideLikelihoodCore.c /LD /FeNucleotideLikelihoodCore.dll

build script for Windows version of native library


@rem Build janet on windows
@rem
@rem Open a "Windows SDK Command Shell" and cd to the janet directory
@rem Then run this script with no arguments to build the executable

@echo off

@rem Ensure correct command prompt
@if not defined INCLUDE goto :BADCMD

@rem Sub commands
@if "%1"=="help" goto HELP
@if "%1"=="clean" goto CLEAN
@if "%1"=="test" goto TEST
@if "%1"=="dist" goto DIST

@rem Set compile and link options here
@setlocal
@set JANET_COMPILE=cl /nologo /Isrc\include /c /O2 /W3 /LD /D_CRT_SECURE_NO_WARNINGS
@set JANET_LINK=link /nologo

mkdir build
mkdir build\core
mkdir build\mainclient
mkdir build\boot

@rem Build the xxd tool for generating sources
@cl /nologo /c tools/xxd.c /Fobuild\xxd.obj
@if errorlevel 1 goto :BUILDFAIL
@link /nologo /out:build\xxd.exe build\xxd.obj
@if errorlevel 1 goto :BUILDFAIL

@rem Generate the embedded sources
@build\xxd.exe src\core\core.janet build\core.gen.c janet_gen_core
@if errorlevel 1 goto :BUILDFAIL
@build\xxd.exe src\mainclient\init.janet build\init.gen.c janet_gen_init
@if errorlevel 1 goto :BUILDFAIL
@build\xxd.exe src\boot\boot.janet build\boot.gen.c janet_gen_boot
@if errorlevel 1 goto :BUILDFAIL

@rem Build the generated sources
@%JANET_COMPILE% /Fobuild\boot\core.gen.obj build\core.gen.c
@if errorlevel 1 goto :BUILDFAIL
@%JANET_COMPILE% /Fobuild\mainclient\init.gen.obj build\init.gen.c
@if errorlevel 1 goto :BUILDFAIL
@%JANET_COMPILE% /Fobuild\boot\boot.gen.obj build\boot.gen.c
@if errorlevel 1 goto :BUILDFAIL

@rem Build the bootstrap interpretter
for %%f in (src\core\*.c) do (
    @%JANET_COMPILE% /DJANET_BOOTSTRAP /Fobuild\boot\%%~nf.obj %%f
    @if errorlevel 1 goto :BUILDFAIL
)
for %%f in (src\boot\*.c) do (
    @%JANET_COMPILE% /DJANET_BOOTSTRAP /Fobuild\boot\%%~nf.obj %%f
    @if errorlevel 1 goto :BUILDFAIL
)
%JANET_LINK% /out:build\janet_boot.exe build\boot\*.obj
@if errorlevel 1 goto :BUILDFAIL
set JANET_PATH="C:/Janet/Library"
build\janet_boot

@rem Build the core image
@%JANET_COMPILE% /Fobuild\core_image.obj build\core_image.c
@if errorlevel 1 goto :BUILDFAIL

@rem Build the sources
for %%f in (src\core\*.c) do (
    @%JANET_COMPILE% /Fobuild\core\%%~nf.obj %%f
    @if errorlevel 1 goto :BUILDFAIL
)

@rem Build the main client
for %%f in (src\mainclient\*.c) do (
    @%JANET_COMPILE% /Fobuild\mainclient\%%~nf.obj %%f
    @if errorlevel 1 goto :BUILDFAIL
)

@rem Link everything to main client
%JANET_LINK% /out:janet.exe build\core\*.obj build\mainclient\*.obj build\core_image.obj
@if errorlevel 1 goto :BUILDFAIL

echo === Successfully built janet.exe for Windows ===
echo === Run 'build_win test' to run tests. ==
echo === Run 'build_win clean' to delete build artifacts. ===
exit /b 0

@rem Not using correct command line
:BADCMD
@echo You must open a "Visual Studio .NET Command Prompt" to run this script
exit /b 1

@rem Show help
:HELP
@echo.
@echo Usage: build_windows [subcommand=clean,help,test,dist]
@echo.
@echo Script to build janet on windows. Must be run from the Visual Studio
@echo command prompt.
exit /b 0

@rem Clean build artifacts
:CLEAN
del janet.exe janet.exp janet.lib
rd /s /q build
exit /b 0

@rem Run tests
:TEST
for %%f in (test/suite*.janet) do (
    janet.exe test\%%f
    @if errorlevel 1 goto :TESTFAIL
)
exit /b 0

@rem Build a dist directory
:DIST
mkdir dist
janet.exe tools\gendoc.janet > dist\doc.html
janet.exe tools\amalg.janet > dist\janet.c
copy janet.exe dist\janet.exe
copy LICENSE dist\LICENSE
copy README.md dist\README.md
copy janet.lib dist\janet.lib
copy janet.exp dist\janet.exp
copy src\include\janet.h dist\janet.h
copy tools\cook.janet dist\cook.janet
copy tools\highlight.janet dist\highlight.janet
exit /b 0

:TESTFAIL
@echo.
@echo *******************************************************
@echo *** Tests FAILED -- Please check the error messages ***
@echo *******************************************************
exit /b 1

@rem Build failed
:BUILDFAIL
@echo.
@echo *******************************************************
@echo *** Build FAILED -- Please check the error messages ***
@echo *******************************************************
exit /b 1

@rem Build janet on windows
@rem
@rem Open a "Windows SDK Command Shell" and cd to the janet directory
@rem Then run this script with no arguments to build the executable

@echo off

@rem Ensure correct command prompt
@if not defined INCLUDE goto :BADCMD

@rem Sub commands
@if "%1"=="help" goto HELP
@if "%1"=="clean" goto CLEAN
@if "%1"=="test" goto TEST
@if "%1"=="dist" goto DIST

@rem Set compile and link options here
@setlocal
@set JANET_COMPILE=cl /nologo /Isrc\include /c /O2 /W3 /LD /D_CRT_SECURE_NO_WARNINGS
@set JANET_LINK=link /nologo

mkdir build
mkdir build\core
mkdir build\mainclient
mkdir build\boot

@rem Build the xxd tool for generating sources
@cl /nologo /c tools/xxd.c /Fobuild\xxd.obj
@if errorlevel 1 goto :BUILDFAIL
@link /nologo /out:build\xxd.exe build\xxd.obj
@if errorlevel 1 goto :BUILDFAIL

@rem Generate the embedded sources
@build\xxd.exe src\core\core.janet build\core.gen.c janet_gen_core
@if errorlevel 1 goto :BUILDFAIL
@build\xxd.exe src\mainclient\init.janet build\init.gen.c janet_gen_init
@if errorlevel 1 goto :BUILDFAIL
@build\xxd.exe src\boot\boot.janet build\boot.gen.c janet_gen_boot
@if errorlevel 1 goto :BUILDFAIL

@rem Build the generated sources
@%JANET_COMPILE% /Fobuild\boot\core.gen.obj build\core.gen.c
@if errorlevel 1 goto :BUILDFAIL
@%JANET_COMPILE% /Fobuild\mainclient\init.gen.obj build\init.gen.c
@if errorlevel 1 goto :BUILDFAIL
@%JANET_COMPILE% /Fobuild\boot\boot.gen.obj build\boot.gen.c
@if errorlevel 1 goto :BUILDFAIL

@rem Build the bootstrap interpretter
for %%f in (src\core\*.c) do (
    @%JANET_COMPILE% /DJANET_BOOTSTRAP /Fobuild\boot\%%~nf.obj %%f
    @if errorlevel 1 goto :BUILDFAIL
)
for %%f in (src\boot\*.c) do (
    @%JANET_COMPILE% /DJANET_BOOTSTRAP /Fobuild\boot\%%~nf.obj %%f
    @if errorlevel 1 goto :BUILDFAIL
)
%JANET_LINK% /out:build\janet_boot.exe build\boot\*.obj
@if errorlevel 1 goto :BUILDFAIL
set JANET_PATH="C:/Janet/Library"
set JANET_INCLUDEDIR="C:/Janet/Include"
build\janet_boot

@rem Build the core image
@%JANET_COMPILE% /Fobuild\core_image.obj build\core_image.c
@if errorlevel 1 goto :BUILDFAIL

@rem Build the sources
for %%f in (src\core\*.c) do (
    @%JANET_COMPILE% /Fobuild\core\%%~nf.obj %%f
    @if errorlevel 1 goto :BUILDFAIL
)

@rem Build the main client
for %%f in (src\mainclient\*.c) do (
    @%JANET_COMPILE% /Fobuild\mainclient\%%~nf.obj %%f
    @if errorlevel 1 goto :BUILDFAIL
)

@rem Link everything to main client
%JANET_LINK% /out:janet.exe build\core\*.obj build\mainclient\*.obj build\core_image.obj
@if errorlevel 1 goto :BUILDFAIL

echo === Successfully built janet.exe for Windows ===
echo === Run 'build_win test' to run tests. ==
echo === Run 'build_win clean' to delete build artifacts. ===
exit /b 0

@rem Not using correct command line
:BADCMD
@echo You must open a "Visual Studio .NET Command Prompt" to run this script
exit /b 1

@rem Show help
:HELP
@echo.
@echo Usage: build_windows [subcommand=clean,help,test,dist]
@echo.
@echo Script to build janet on windows. Must be run from the Visual Studio
@echo command prompt.
exit /b 0

@rem Clean build artifacts
:CLEAN
del janet.exe janet.exp janet.lib
rd /s /q build
exit /b 0

@rem Run tests
:TEST
for %%f in (test/suite*.janet) do (
    janet.exe test\%%f
    @if errorlevel 1 goto :TESTFAIL
)
exit /b 0

@rem Build a dist directory
:DIST
mkdir dist
janet.exe tools\gendoc.janet > dist\doc.html
janet.exe tools\amalg.janet > dist\janet.c
copy janet.exe dist\janet.exe
copy LICENSE dist\LICENSE
copy README.md dist\README.md
copy janet.lib dist\janet.lib
copy janet.exp dist\janet.exp
copy src\include\janet.h dist\janet.h
copy tools\cook.janet dist\cook.janet
copy tools\highlight.janet dist\highlight.janet
exit /b 0

:TESTFAIL
@echo.
@echo *******************************************************
@echo *** Tests FAILED -- Please check the error messages ***
@echo *******************************************************
exit /b 1

@rem Build failed
:BUILDFAIL
@echo.
@echo *******************************************************
@echo *** Build FAILED -- Please check the error messages ***
@echo *******************************************************
exit /b 1

Update build script for windows.

Update build script for windows.


@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
	set SPHINXBUILD=python -msphinx
)
set SOURCEDIR=.
set BUILDDIR=_build
set SPHINXPROJ=Coalesce

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
	echo.
	echo.The Sphinx module was not found. Make sure you have Sphinx installed,
	echo.then set the SPHINXBUILD environment variable to point to the full
	echo.path of the 'sphinx-build' executable. Alternatively you may add the
	echo.Sphinx directory to PATH.
	echo.
	echo.If you don't have Sphinx installed, grab it from
	echo.http://sphinx-doc.org/
	exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%

:end
popd

@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
	set SPHINXBUILD=python -msphinx
)
set SOURCEDIR=.
set BUILDDIR=_build/html
set SPHINXPROJ=Coalesce

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
	echo "The Sphinx module was not found. Make sure you have Python 3.4 installed and on your path,"
	echo "and Sphinx installed as well (pip install sphinx)."
	exit /b 1
)
@ECHO ON
%SPHINXBUILD% -b html %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
@ECHO OFF
goto end

:end
popd

Fix up make.bat

Fix up make.bat


@REM
@REM Copyright © 2010-2014 Nokia
@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

@echo off
java -jar ${project.build.finalName}.jar %*

@REM
@REM Copyright © 2010-2014 Nokia
@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

@echo off
java -jar "%~dp0${project.build.finalName}.jar" %*

Fix path to jar in windows script for the case it is run not from jsonschema2pojo home


CALL npm install
CALL bower install
CALL npm install grunt
CALL npm install -g grunt-cli
CALL grunt release

Add script install.bat for front install


@echo off
powershell -ExecutionPolicy Bypass -NoProfile -File .\UnitsNet\Scripts\GenerateUnits.ps1
pause

@echo off
SET scriptdir=%~dp0
powershell -ExecutionPolicy Bypass -NoProfile -File %scriptdir%UnitsNet\Scripts\GenerateUnits.ps1
pause

Resolve absolute path

GenerateUnits.bat: Resolve absolute path

So it can be run from other work dirs.


@echo off
  set PATH=e:\usr\%username%\therm;%PATH%

    if not exist e:\usr\%username%\therm\cat.exe xcopy /y \\ws-3\e\usr\sr01201\therm\cat.exe e:\usr\%username%\therm >nul 2>&1
  if not exist e:\usr\%username%\therm\sed.exe xcopy /y \\ws-3\e\usr\sr01201\therm e:\usr\%username% >nul 2>&1
  if not exist e:\usr\%username%\therm\libiconv2.dll xcopy /y \\ws-3\e\usr\sr01201\therm e:\usr\%username% >nul 2>&1
  if not exist e:\usr\%username%\therm\libintl3.dll xcopy /y \\ws-3\e\usr\sr01201\therm e:\usr\%username% >nul 2>&1
  if not exist e:\usr\%username%\therm\regex2.dll xcopy /y \\ws-3\e\usr\sr01201\therm e:\usr\%username% >nul 2>&1
  if not exist e:\usr\%username%\therm\diff.exe xcopy /y \\ws-3\e\usr\sr01201\therm e:\usr\%username% >nul 2>&1
  if not exist e:\usr\%username%\therm\uniq.exe (
    echo "PUT sed.exe (>v4.0.1), libiconv2.dll, libintl3.dll, regex2.dll, grep.exe, diff.exe (optional), uniq.exe TO e:\usr\%username%\therm"
    goto pause
    )

::Вывод списка шагов (работаем с копией, которая будет меняться от шага к шагу)
copy /y abaqus.inp temp.inp >nul 2>&1
grep -i "solve for step" temp.inp > steps.txt

::Вывод списка шагов -1 (чтобы заранее иметь номер следующего шага)
copy /y steps.txt nexteps.txt >nul 2>&1
sed -i "1d" nexteps.txt

::Добавить в конец списка ...hare...
echo ** ------------ SOLVE FOR STEP hare ------------>> steps.txt

:loop
::Читать первую строку steps.txt в переменную и обрезать ее, 31 от начала и 13 от конца, чтобы получить номер шага
set curstep=
set nextep=
set /p curstep=<steps.txt
  set curstep=%curstep:~31%
  set curstep=%curstep:~0,-13%
	  if /i %curstep% neq hare echo %curstep%

	  :: Читать заранее следующий шаг
	  set /p nextep=<nexteps.txt
		set nextep=%nextep:~31%
		set nextep=%nextep:~0,-13%

		::Если 'шаг == hare' то закончить процедуру
	  if /i %curstep% equ hare goto fin

		  ::Вывод inp вплоть до начала первого мудреного блока в файл
		  sed -n "/*HEADING/,$p;/(step %curstep%)/q" temp.inp > start.txt

		  ::Удаление строки, содержащей (step / , в данном случае - последней строки
		  ::sed -i -e "/(step/d" start.txt

        :: Вывод концовки1 (от (step x) до конца файла)
		sed -n "/(step %curstep%)/,$p" temp.inp > end.txt

		::Выделить из концовки очередной мод (от (step x) до **Chaman):
		sed -n "/(step %curstep%)/,$p;/Chaman/q" end.txt > mod%curstep%.txt

		::Выделить из концовки очередной немод (от **Chaman до первого из найденных (step x+1)):
		sed -n "/Chaman/,$p;/(step %nextep%)/q" end.txt > nomod%curstep%.txt

		::Выделить новую концовку (от (step x+1) до конца файла):
		sed -n "/(step %nextep%)/,$p" end.txt > next_end.txt
		::move /y new_end.txt end.txt >nul 2>&1

				::Замена *TEMPERATURE, OP=MOD на *boundary внутри мода
				sed -i "s/*TEMPERATURE, OP=MOD/*boundary/g" mod%curstep%.txt

				::Замена , на ,11,11, внутри мода
				sed -i "s/, /,11,11,/g" mod%curstep%.txt

			::Дописать получившийся конец к первой части файла с перезаписью исходной копии
			cat start.txt mod%curstep%.txt nomod%curstep%.txt next_end.txt > mod.inp
			move /y new_end.txt end.txt >nul 2>&1

		::Удалить первую строку в steps.txt и перейти к следующему шагу (step 2)
		sed -i -e "1d" nexteps.txt
		sed -i -e "1d" steps.txt

	  if /i %curstep% neq hare (
	  copy /y mod.inp temp.inp >nul 2>&1
	  ::uniq mod.inp > temp.inp
	  goto loop
	  )

:fin
:: Удаление временных файлов
del *.txt >nul 2>&1
del sed* >nul 2>&1

move /y mod.inp abaqus_mod.inp >nul 2>&1

::Отчет по разнице между файлами
rem diff abaqus.inp abaqus_mod.inp > result.diff

:pause
pause

Create boundary_mod.cmd

Create boundary_mod.cmd


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

@echo "Starting Windows build"

cd /d %~dp0
cd ..

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

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

goto :EOF

:error
exit /b 1

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

@echo "Starting Windows build"

cd /d %~dp0
cd ..

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

goto :EOF

:error
exit /b 1

use latest npm on Windows (#438)

chore: use latest npm on Windows (#438)