@if "%_echo%"=="" echo off

setlocal
if EXIST build.ok DEL /f /q build.ok

if '%flavor%' == '' (
    set flavor=release
)

echo PERMUTATIONS='%permutations%'
call %~d0%~p0..\config.bat

if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" (
  goto Skip
)

set source1=
if exist test.ml (set source1=test.ml)
if exist test.fs (set source1=test.fs)

set sources=
if exist testlib.fsi (set sources=%sources% testlib.fsi)
if exist testlib.fs (set sources=%sources% testlib.fs)
if exist test.mli (set sources=%sources% test.mli)
if exist test.ml (set sources=%sources% test.ml)
if exist test.fsi (set sources=%sources% test.fsi)
if exist test.fs (set sources=%sources% test.fs)
if exist test2.mli (set sources=%sources% test2.mli)
if exist test2.ml (set sources=%sources% test2.ml)
if exist test2.fsi (set sources=%sources% test2.fsi)
if exist test2.fs (set sources=%sources% test2.fs)
if exist test.fsx (set sources=%sources% test.fsx)
if exist test2.fsx (set sources=%sources% test2.fsx)

set sourceshw=
if exist test-hw.mli (set sourceshw=%sourceshw% test-hw.mli)
if exist test-hw.ml (set sourceshw=%sourceshw% test-hw.ml)
if exist test-hw.fsx (set sourceshw=%sourceshw% test-hw.fsx)
if exist test2-hw.mli (set sourceshw=%sourceshw% test2-hw.mli)
if exist test2-hw.ml (set sourceshw=%sourceshw% test2-hw.ml)
if exist test2-hw.fsx (set sourceshw=%sourceshw% test2-hw.fsx)

rem to run the 64 bit version of the code set FSC_BASIC_64=FSC_BASIC_64
set PERMUTATIONS_LIST=FSI_FILE FSI_STDIN FSI_STDIN_OPT FSI_STDIN_GUI FSC_BASIC %FSC_BASIC_64% FSC_HW FSC_O3 GENERATED_SIGNATURE EMPTY_SIGNATURE EMPTY_SIGNATURE_OPT FSC_OPT_MINUS_DEBUG FSC_OPT_PLUS_DEBUG FRENCH SPANISH AS_DLL WRAPPER_NAMESPACE WRAPPER_NAMESPACE_OPT

if "%REDUCED_RUNTIME%"=="1" (
    echo REDUCED_RUNTIME set

    if not defined PERMUTATIONS (
        powershell.exe %PSH_FLAGS% -command "&{& '%~d0%~p0\PickPermutations.ps1' '%cd%' '%FSC%' '%PERMUTATIONS_LIST%'}" > _perm.txt
        if errorlevel 1 (
            set ERRORMSG=%ERRORMSG% PickPermutations.ps1 failed;
            goto :ERROR
        )
        set /p PERMUTATIONS=<_perm.txt
    )

    powershell.exe %PSH_FLAGS% -command "&{& '%~d0%~p0\DecidePEVerify.ps1' '%cd%' '%FSC%'}"
    if errorlevel 1 (
        set ERRORMSG=%ERRORMSG% DecidePEVerify.ps1 failed;
        goto :ERROR
    )
)

if not defined PERMUTATIONS (
    echo "PERMUTATIONS not defined. Building everything."
    set PERMUTATIONS=%PERMUTATIONS_LIST%
)

for %%A in (%PERMUTATIONS%) do (
    call :%%A
    IF ERRORLEVEL 1 EXIT /B 1
)

:Ok
echo Built fsharp %~f0 ok.
echo. > build.ok
endlocal
exit /b 0

:Skip
echo Skipped %~f0
endlocal
exit /b 0

:Error
echo Test Script Failed (perhaps test did not emit test.ok signal file?)
endlocal
exit /b %ERRORLEVEL%

:SETERROR
set NonexistentErrorLevel 2> nul
goto Error

:FSI_FILE
@echo do :FSI_FILE
goto :DO_NOOP

:FSI_STDIN
@echo do :FSI_STDIN
goto :DO_NOOP

:FSI_STDIN_OPT
@echo do :FSI_STDIN_OPT
goto :DO_NOOP

:FSI_STDIN_GUI
@echo do :FSI_STDIN_GUI
goto :DO_NOOP

:DO_NOOP
@echo No build action to take for this permutation
goto :EOF

:FRENCH
@echo do :FRENCH
goto :DOBASIC

:SPANISH
@echo do :SPANISH
goto :DOBASIC

:FSC_CORECLR
@Echo do :CORECLR
rem Build references currently hard coded need a better long term solution
set platform=win7-x64
For %%A in ("%cd%") do (Set TestCaseName=%%~nxA)
set command_line_args=
set command_line_args=%command_line_args% --exec %~d0%~p0..\fsharpqa\testenv\src\deployProj\CompileProj.fsx
set command_line_args=%command_line_args% --targetPlatformName:DNXCore,Version=v5.0/%platform%
set command_line_args=%command_line_args% --source:"%~d0%~p0coreclr_utilities.fs" --source:"%sources%"
set command_line_args=%command_line_args% --packagesDir:%~d0%~p0..\..\packages
set command_line_args=%command_line_args% --projectJsonLock:%~d0%~p0project.lock.json
set command_line_args=%command_line_args% --fsharpCore:%~d0%~p0..\testbin\%flavor%\coreclr\fsc\%platform%\fsharp.core.dll
set command_line_args=%command_line_args% --define:CoreClr --define:NetCore
set command_line_args=%command_line_args% --compilerPath:%~d0%~p0..\testbin\%flavor%\coreclr\fsc\%platform%
set command_line_args=%command_line_args% --copyCompiler:yes
set command_line_args=%command_line_args% --verbose:verbose
if not "%test_keyfile%" == "" (
    set command_line_args=%command_line_args% --keyfile:%test_keyfile%
)
if not "%test_delaysign%" == "" (
    set command_line_args=%command_line_args% --delaysign:yes
)
if not "%test_publicsign%" == "" (
    set command_line_args=%command_line_args% --publicsign:yes
)
if not "%extra_defines%" == "" (
    set command_line_args=%command_line_args% %extra_defines%
)
if "%test_outfile%" == "" (
    set command_line_args=%command_line_args% --output:%~d0%~p0..\testbin\%flavor%\coreclr\fsharp\core\%TestCaseName%\output\test.exe
)
if not "%test_outfile%" == "" (
    set command_line_args=%command_line_args% --output:%~d0%~p0..\testbin\%flavor%\coreclr\fsharp\core\%TestCaseName%\output\test-%test_outfile%.exe
)

echo fsi %command_line_args%
fsi %command_line_args%
echo Errorlevel: %errorlevel%
if ERRORLEVEL 1 goto Error
goto :EOF

:FSC_BASIC
@echo do :FSC_BASIC
:DOBASIC
"%FSC%" %fsc_flags% --define:BASIC_TEST -o:test.exe -g %sources%
if ERRORLEVEL 1 goto Error

if NOT EXIST dont.run.peverify (
    "%PEVERIFY%" test.exe
    @if ERRORLEVEL 1 goto Error
)
goto :EOF

:FSC_BASIC_64
@echo do :FSC_BASIC_64
"%FSC%" %fsc_flags% --define:BASIC_TEST --platform:x64 -o:testX64.exe -g %sources%
if ERRORLEVEL 1 goto Error

if NOT EXIST dont.run.peverify (
    "%PEVERIFY%" testX64.exe
    @if ERRORLEVEL 1 goto Error
)
goto :EOF

:FSC_HW
@echo do :FSC_HW
if exist test-hw.* (
  "%FSC%" %fsc_flags% -o:test-hw.exe -g %sourceshw%
  if ERRORLEVEL 1 goto Error

  if NOT EXIST dont.run.peverify (
    "%PEVERIFY%" test-hw.exe
    @if ERRORLEVEL 1 goto Error
  )
)
goto :EOF

:FSC_O3
@echo do :FSC_O3
"%FSC%" %fsc_flags% --optimize --define:PERF -o:test--optimize.exe -g %sources%
if ERRORLEVEL 1 goto Error

if NOT EXIST dont.run.peverify (
    "%PEVERIFY%" test--optimize.exe
    @if ERRORLEVEL 1 goto Error
)
goto :EOF

:GENERATED_SIGNATURE
@echo do :GENERATED_SIGNATURE
if NOT EXIST dont.use.generated.signature (
 if exist test.ml (

  echo Generating interface file...
  copy /y %source1% tmptest.ml
  REM NOTE: use --generate-interface-file since results may be in Unicode
  "%FSC%" %fsc_flags% --sig:tmptest.mli tmptest.ml
  if ERRORLEVEL 1 goto Error

  echo Compiling against generated interface file...
  "%FSC%" %fsc_flags% -o:tmptest1.exe tmptest.mli tmptest.ml
  if ERRORLEVEL 1 goto Error

  if NOT EXIST dont.run.peverify (
    "%PEVERIFY%" tmptest1.exe
    @if ERRORLEVEL 1 goto Error
  )
 )
)
goto :EOF

:EMPTY_SIGNATURE
@echo do :EMPTY_SIGNATURE
if NOT EXIST dont.use.empty.signature (
    if exist test.ml (
        echo Compiling against empty interface file...
        echo // empty file  > tmptest2.mli

        copy /y %source1% tmptest2.ml
        "%FSC%" %fsc_flags% --define:COMPILING_WITH_EMPTY_SIGNATURE -o:tmptest2.exe tmptest2.mli tmptest2.ml
        if ERRORLEVEL 1 goto Error

        if NOT EXIST dont.run.peverify (
            "%PEVERIFY%" tmptest2.exe
            @if ERRORLEVEL 1 goto Error
        )
    )
)
goto :EOF

:EMPTY_SIGNATURE_OPT
@echo do :EMPTY_SIGNATURE_OPT
if NOT EXIST dont.use.empty.signature (
    if exist test.ml (
        echo Compiling against empty interface file...
        echo // empty file  > tmptest2.mli

        copy /y %source1% tmptest2.ml
        "%FSC%" %fsc_flags% --define:COMPILING_WITH_EMPTY_SIGNATURE --optimize -o:tmptest2--optimize.exe tmptest2.mli tmptest2.ml
        if ERRORLEVEL 1 goto Error

        if NOT EXIST dont.run.peverify (
            "%PEVERIFY%" tmptest2--optimize.exe
            @if ERRORLEVEL 1 goto Error
        )
    )
)
goto :EOF

:FSC_OPT_MINUS_DEBUG
@echo do :FSC_OPT_MINUS_DEBUG
    "%FSC%" %fsc_flags% --optimize- --debug -o:test--optminus--debug.exe -g %sources%
    if ERRORLEVEL 1 goto Error

    if NOT EXIST dont.run.peverify (
        "%PEVERIFY%" test--optminus--debug.exe
        @if ERRORLEVEL 1 goto Error
    )
goto :EOF

:FSC_OPT_PLUS_DEBUG
@echo do :FSC_OPT_PLUS_DEBUG
    "%FSC%" %fsc_flags% --optimize+ --debug -o:test--optplus--debug.exe -g %sources%
    if ERRORLEVEL 1 goto Error

    if NOT EXIST dont.run.peverify (
        "%PEVERIFY%" test--optplus--debug.exe
        @if ERRORLEVEL 1 goto Error
    )
)
goto :EOF

REM Compile as a DLL to exercise pickling of interface data, then recompile the original source file referencing this DLL
REM THe second compilation will not utilize the information from the first in any meaningful way, but the
REM compiler will unpickle the interface and optimization data, so we test unpickling as well.

:AS_DLL
@echo do :AS_DLL
if NOT EXIST dont.compile.test.as.dll (
    "%FSC%" %fsc_flags% --optimize -a -o:test--optimize-lib.dll -g %sources%
    if ERRORLEVEL 1 goto Error
    "%FSC%" %fsc_flags% --optimize -r:test--optimize-lib.dll -o:test--optimize-client-of-lib.exe -g %sources%
    if ERRORLEVEL 1 goto Error

    if NOT EXIST dont.run.peverify (
        "%PEVERIFY%" test--optimize-lib.dll
        @if ERRORLEVEL 1 goto Error
    )

    if NOT EXIST dont.run.peverify (
        "%PEVERIFY%" test--optimize-client-of-lib.exe
    )
    @if ERRORLEVEL 1 goto Error
)
goto :EOF

:WRAPPER_NAMESPACE
@echo do :WRAPPER_NAMESPACE
if NOT EXIST dont.use.wrapper.namespace (
    if exist test.ml (
        echo Compiling when wrapped in a namespace declaration...

        echo module TestNamespace.TestModule > tmptest3.ml
        type %source1%  >> tmptest3.ml

        "%FSC%" %fsc_flags% -o:tmptest3.exe tmptest3.ml
        if ERRORLEVEL 1 goto Error

        if NOT EXIST dont.run.peverify (
            "%PEVERIFY%" tmptest3.exe
            @if ERRORLEVEL 1 goto Error
        )
    )
)
goto :EOF

:WRAPPER_NAMESPACE_OPT
@echo do :WRAPPER_NAMESPACE
if NOT EXIST dont.use.wrapper.namespace (
    if exist test.ml (
        echo Compiling when wrapped in a namespace declaration...

        echo module TestNamespace.TestModule > tmptest3.ml
        type %source1%  >> tmptest3.ml

        "%FSC%" %fsc_flags% --optimize -o:tmptest3--optimize.exe tmptest3.ml
        if ERRORLEVEL 1 goto Error

        if NOT EXIST dont.run.peverify (
            "%PEVERIFY%" tmptest3--optimize.exe
            @if ERRORLEVEL 1 goto Error
        )
    )
)
goto :EOF

@if "%_echo%"=="" echo off

setlocal
if EXIST build.ok DEL /f /q build.ok

if '%flavor%' == '' (
    set flavor=release
)

echo PERMUTATIONS='%permutations%'
call %~d0%~p0..\config.bat

if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" (
  goto Skip
)

set source1=
if exist test.ml (set source1=test.ml)
if exist test.fs (set source1=test.fs)

set sources=
if exist testlib.fsi (set sources=%sources% testlib.fsi)
if exist testlib.fs (set sources=%sources% testlib.fs)
if exist test.mli (set sources=%sources% test.mli)
if exist test.ml (set sources=%sources% test.ml)
if exist test.fsi (set sources=%sources% test.fsi)
if exist test.fs (set sources=%sources% test.fs)
if exist test2.mli (set sources=%sources% test2.mli)
if exist test2.ml (set sources=%sources% test2.ml)
if exist test2.fsi (set sources=%sources% test2.fsi)
if exist test2.fs (set sources=%sources% test2.fs)
if exist test.fsx (set sources=%sources% test.fsx)
if exist test2.fsx (set sources=%sources% test2.fsx)

set sourceshw=
if exist test-hw.mli (set sourceshw=%sourceshw% test-hw.mli)
if exist test-hw.ml (set sourceshw=%sourceshw% test-hw.ml)
if exist test-hw.fsx (set sourceshw=%sourceshw% test-hw.fsx)
if exist test2-hw.mli (set sourceshw=%sourceshw% test2-hw.mli)
if exist test2-hw.ml (set sourceshw=%sourceshw% test2-hw.ml)
if exist test2-hw.fsx (set sourceshw=%sourceshw% test2-hw.fsx)

rem to run the 64 bit version of the code set FSC_BASIC_64=FSC_BASIC_64
set PERMUTATIONS_LIST=FSI_FILE FSI_STDIN FSI_STDIN_OPT FSI_STDIN_GUI FSC_BASIC %FSC_BASIC_64% FSC_HW FSC_O3 GENERATED_SIGNATURE EMPTY_SIGNATURE EMPTY_SIGNATURE_OPT FSC_OPT_MINUS_DEBUG FSC_OPT_PLUS_DEBUG FRENCH SPANISH AS_DLL WRAPPER_NAMESPACE WRAPPER_NAMESPACE_OPT

if "%REDUCED_RUNTIME%"=="1" (
    echo REDUCED_RUNTIME set

    if not defined PERMUTATIONS (
        powershell.exe %PSH_FLAGS% -command "&{& '%~d0%~p0\PickPermutations.ps1' '%cd%' '%FSC%' '%PERMUTATIONS_LIST%'}" > _perm.txt
        if errorlevel 1 (
            set ERRORMSG=%ERRORMSG% PickPermutations.ps1 failed;
            goto :ERROR
        )
        set /p PERMUTATIONS=<_perm.txt
    )

    powershell.exe %PSH_FLAGS% -command "&{& '%~d0%~p0\DecidePEVerify.ps1' '%cd%' '%FSC%'}"
    if errorlevel 1 (
        set ERRORMSG=%ERRORMSG% DecidePEVerify.ps1 failed;
        goto :ERROR
    )
)

if not defined PERMUTATIONS (
    echo "PERMUTATIONS not defined. Building everything."
    set PERMUTATIONS=%PERMUTATIONS_LIST%
)

for %%A in (%PERMUTATIONS%) do (
    call :%%A
    IF ERRORLEVEL 1 EXIT /B 1
)

:Ok
echo Built fsharp %~f0 ok.
echo. > build.ok
endlocal
exit /b 0

:Skip
echo Skipped %~f0
endlocal
exit /b 0

:Error
echo Test Script Failed (perhaps test did not emit test.ok signal file?)
endlocal
exit /b %ERRORLEVEL%

:SETERROR
set NonexistentErrorLevel 2> nul
goto Error

:FSI_FILE
@echo do :FSI_FILE
goto :DO_NOOP

:FSI_STDIN
@echo do :FSI_STDIN
goto :DO_NOOP

:FSI_STDIN_OPT
@echo do :FSI_STDIN_OPT
goto :DO_NOOP

:FSI_STDIN_GUI
@echo do :FSI_STDIN_GUI
goto :DO_NOOP

:DO_NOOP
@echo No build action to take for this permutation
goto :EOF

:FRENCH
@echo do :FRENCH
goto :DOBASIC

:SPANISH
@echo do :SPANISH
goto :DOBASIC

:FSC_CORECLR
@Echo do :CORECLR
rem Build references currently hard coded need a better long term solution
set platform=win7-x64
For %%A in ("%cd%") do (Set TestCaseName=%%~nxA)
set command_line_args=
set command_line_args=%command_line_args% --exec %~d0%~p0..\fsharpqa\testenv\src\deployProj\CompileProj.fsx
set command_line_args=%command_line_args% --targetPlatformName:DNXCore,Version=v5.0/%platform%
set command_line_args=%command_line_args% --source:"%~d0%~p0coreclr_utilities.fs" --source:"%sources%"
set command_line_args=%command_line_args% --packagesDir:%~d0%~p0..\..\packages
set command_line_args=%command_line_args% --projectJsonLock:%~d0%~p0project.lock.json
set command_line_args=%command_line_args% --fsharpCore:%~d0%~p0..\testbin\%flavor%\coreclr\fsc\%platform%\fsharp.core.dll
set command_line_args=%command_line_args% --define:CoreClr --define:NetCore
set command_line_args=%command_line_args% --compilerPath:%~d0%~p0..\testbin\%flavor%\coreclr\fsc\%platform%
set command_line_args=%command_line_args% --copyCompiler:yes
set command_line_args=%command_line_args% --verbose:verbose
if not "%test_keyfile%" == "" (
    set command_line_args=%command_line_args% --keyfile:%test_keyfile%
)
if not "%test_delaysign%" == "" (
    set command_line_args=%command_line_args% --delaysign:yes
)
if not "%test_publicsign%" == "" (
    set command_line_args=%command_line_args% --publicsign:yes
)
if not "%extra_defines%" == "" (
    set command_line_args=%command_line_args% %extra_defines%
)
if "%test_outfile%" == "" (
    set command_line_args=%command_line_args% --output:%~d0%~p0..\testbin\%flavor%\coreclr\fsharp\core\%TestCaseName%\output\test.exe
)
if not "%test_outfile%" == "" (
    set command_line_args=%command_line_args% --output:%~d0%~p0..\testbin\%flavor%\coreclr\fsharp\core\%TestCaseName%\output\test-%test_outfile%.exe
)

echo %fsi% %command_line_args%
%fsi% %command_line_args%
echo Errorlevel: %errorlevel%
if ERRORLEVEL 1 goto Error
goto :EOF

:FSC_BASIC
@echo do :FSC_BASIC
:DOBASIC
"%FSC%" %fsc_flags% --define:BASIC_TEST -o:test.exe -g %sources%
if ERRORLEVEL 1 goto Error

if NOT EXIST dont.run.peverify (
    "%PEVERIFY%" test.exe
    @if ERRORLEVEL 1 goto Error
)
goto :EOF

:FSC_BASIC_64
@echo do :FSC_BASIC_64
"%FSC%" %fsc_flags% --define:BASIC_TEST --platform:x64 -o:testX64.exe -g %sources%
if ERRORLEVEL 1 goto Error

if NOT EXIST dont.run.peverify (
    "%PEVERIFY%" testX64.exe
    @if ERRORLEVEL 1 goto Error
)
goto :EOF

:FSC_HW
@echo do :FSC_HW
if exist test-hw.* (
  "%FSC%" %fsc_flags% -o:test-hw.exe -g %sourceshw%
  if ERRORLEVEL 1 goto Error

  if NOT EXIST dont.run.peverify (
    "%PEVERIFY%" test-hw.exe
    @if ERRORLEVEL 1 goto Error
  )
)
goto :EOF

:FSC_O3
@echo do :FSC_O3
"%FSC%" %fsc_flags% --optimize --define:PERF -o:test--optimize.exe -g %sources%
if ERRORLEVEL 1 goto Error

if NOT EXIST dont.run.peverify (
    "%PEVERIFY%" test--optimize.exe
    @if ERRORLEVEL 1 goto Error
)
goto :EOF

:GENERATED_SIGNATURE
@echo do :GENERATED_SIGNATURE
if NOT EXIST dont.use.generated.signature (
 if exist test.ml (

  echo Generating interface file...
  copy /y %source1% tmptest.ml
  REM NOTE: use --generate-interface-file since results may be in Unicode
  "%FSC%" %fsc_flags% --sig:tmptest.mli tmptest.ml
  if ERRORLEVEL 1 goto Error

  echo Compiling against generated interface file...
  "%FSC%" %fsc_flags% -o:tmptest1.exe tmptest.mli tmptest.ml
  if ERRORLEVEL 1 goto Error

  if NOT EXIST dont.run.peverify (
    "%PEVERIFY%" tmptest1.exe
    @if ERRORLEVEL 1 goto Error
  )
 )
)
goto :EOF

:EMPTY_SIGNATURE
@echo do :EMPTY_SIGNATURE
if NOT EXIST dont.use.empty.signature (
    if exist test.ml (
        echo Compiling against empty interface file...
        echo // empty file  > tmptest2.mli

        copy /y %source1% tmptest2.ml
        "%FSC%" %fsc_flags% --define:COMPILING_WITH_EMPTY_SIGNATURE -o:tmptest2.exe tmptest2.mli tmptest2.ml
        if ERRORLEVEL 1 goto Error

        if NOT EXIST dont.run.peverify (
            "%PEVERIFY%" tmptest2.exe
            @if ERRORLEVEL 1 goto Error
        )
    )
)
goto :EOF

:EMPTY_SIGNATURE_OPT
@echo do :EMPTY_SIGNATURE_OPT
if NOT EXIST dont.use.empty.signature (
    if exist test.ml (
        echo Compiling against empty interface file...
        echo // empty file  > tmptest2.mli

        copy /y %source1% tmptest2.ml
        "%FSC%" %fsc_flags% --define:COMPILING_WITH_EMPTY_SIGNATURE --optimize -o:tmptest2--optimize.exe tmptest2.mli tmptest2.ml
        if ERRORLEVEL 1 goto Error

        if NOT EXIST dont.run.peverify (
            "%PEVERIFY%" tmptest2--optimize.exe
            @if ERRORLEVEL 1 goto Error
        )
    )
)
goto :EOF

:FSC_OPT_MINUS_DEBUG
@echo do :FSC_OPT_MINUS_DEBUG
    "%FSC%" %fsc_flags% --optimize- --debug -o:test--optminus--debug.exe -g %sources%
    if ERRORLEVEL 1 goto Error

    if NOT EXIST dont.run.peverify (
        "%PEVERIFY%" test--optminus--debug.exe
        @if ERRORLEVEL 1 goto Error
    )
goto :EOF

:FSC_OPT_PLUS_DEBUG
@echo do :FSC_OPT_PLUS_DEBUG
    "%FSC%" %fsc_flags% --optimize+ --debug -o:test--optplus--debug.exe -g %sources%
    if ERRORLEVEL 1 goto Error

    if NOT EXIST dont.run.peverify (
        "%PEVERIFY%" test--optplus--debug.exe
        @if ERRORLEVEL 1 goto Error
    )
)
goto :EOF

REM Compile as a DLL to exercise pickling of interface data, then recompile the original source file referencing this DLL
REM THe second compilation will not utilize the information from the first in any meaningful way, but the
REM compiler will unpickle the interface and optimization data, so we test unpickling as well.

:AS_DLL
@echo do :AS_DLL
if NOT EXIST dont.compile.test.as.dll (
    "%FSC%" %fsc_flags% --optimize -a -o:test--optimize-lib.dll -g %sources%
    if ERRORLEVEL 1 goto Error
    "%FSC%" %fsc_flags% --optimize -r:test--optimize-lib.dll -o:test--optimize-client-of-lib.exe -g %sources%
    if ERRORLEVEL 1 goto Error

    if NOT EXIST dont.run.peverify (
        "%PEVERIFY%" test--optimize-lib.dll
        @if ERRORLEVEL 1 goto Error
    )

    if NOT EXIST dont.run.peverify (
        "%PEVERIFY%" test--optimize-client-of-lib.exe
    )
    @if ERRORLEVEL 1 goto Error
)
goto :EOF

:WRAPPER_NAMESPACE
@echo do :WRAPPER_NAMESPACE
if NOT EXIST dont.use.wrapper.namespace (
    if exist test.ml (
        echo Compiling when wrapped in a namespace declaration...

        echo module TestNamespace.TestModule > tmptest3.ml
        type %source1%  >> tmptest3.ml

        "%FSC%" %fsc_flags% -o:tmptest3.exe tmptest3.ml
        if ERRORLEVEL 1 goto Error

        if NOT EXIST dont.run.peverify (
            "%PEVERIFY%" tmptest3.exe
            @if ERRORLEVEL 1 goto Error
        )
    )
)
goto :EOF

:WRAPPER_NAMESPACE_OPT
@echo do :WRAPPER_NAMESPACE
if NOT EXIST dont.use.wrapper.namespace (
    if exist test.ml (
        echo Compiling when wrapped in a namespace declaration...

        echo module TestNamespace.TestModule > tmptest3.ml
        type %source1%  >> tmptest3.ml

        "%FSC%" %fsc_flags% --optimize -o:tmptest3--optimize.exe tmptest3.ml
        if ERRORLEVEL 1 goto Error

        if NOT EXIST dont.run.peverify (
            "%PEVERIFY%" tmptest3--optimize.exe
            @if ERRORLEVEL 1 goto Error
        )
    )
)
goto :EOF

Use full path to FSI instead of relying on ambient fsi


@echo off

REM This is a script that will set environment information about where to find
REM NuGet.exe, it's version and ensure that it's present on the enlistment.
set NuGetExeFolder=%~dp0..\..
set NuGetExe=%NuGetExeFolder%\NuGet.exe
set NuGetAdditionalCommandLineArgs=-verbosity quiet -configfile "%NuGetExeFolder%\nuget.config" -Project2ProjectTimeOut 1200

REM Download NuGet.exe if we haven't already
powershell -noprofile -executionPolicy Bypass -file "%~dp0download-nuget.ps1"

@echo off

REM This is a script that will set environment information about where to find
REM NuGet.exe, it's version and ensure that it's present on the enlistment.
set NuGetExeFolder=%~dp0..\..\Binaries\Tools
set NuGetExe=%NuGetExeFolder%\NuGet.exe
set NuGetAdditionalCommandLineArgs=-verbosity quiet -configfile "%NuGetExeFolder%\nuget.config" -Project2ProjectTimeOut 1200

Fix the packing issue

Fix the packing issue


@echo off

setlocal enabledelayedexpansion

set directory=%~f1
if [%directory%] == [] set directory=%CD%

if exist %directory%\NUL (
    set directory=%directory%
) else (
    set directory=%~dp1
)

pushd %directory%

for /f "delims=" %%i in ('git rev-parse --show-toplevel') do set directory=%%i
git rev-parse --show-toplevel 1> nul 2> nul

if %errorlevel% EQU 0 (
    start "" "C:\Program Files (x86)\Atlassian\SourceTree\SourceTree.exe" -f %directory%
)

popd
endlocal

@echo off

setlocal enabledelayedexpansion

set directory=%~f1
if [%directory%] == [] set directory=%CD%

if exist %directory%\NUL (
    set directory=%directory%
) else (
    set directory=%~dp1
)

pushd %directory%

for /f "delims=" %%i in ('git rev-parse --show-toplevel') do set directory=%%i
git rev-parse --show-toplevel 1> nul 2> nul

if %errorlevel% EQU 0 (
    start "" "C:\Program Files (x86)\Atlassian\SourceTree\SourceTree.exe" -f %directory:/=\%
)

popd
endlocal

Replace forward slashes with back slashes


set PATH=%PATH%;"%WIX%\bin"
cd build
md output
copy *.exe output
copy "c:\vcpkg\installed\x64-windows\bin\sqlite3.dll" output
copy "C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\bin\libgcc_s_seh-1.dll" output
copy "C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\bin\libstdc++-6.dll" output
copy "C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\bin\libwinpthread-1.dll" output
cd output
windeployqt codequery.exe
dir/b/a/s
candle.exe -ext WixUIExtension -ext WixUtilExtension "..\..\windows-install\win64\codequery64.wxs"
light.exe -ext WixUIExtension -ext WixUtilExtension codequery64.wixobj

set PATH=%PATH%;"%WIX%\bin"
cd build
md output
copy *.exe output
copy "c:\vcpkg\installed\x64-windows\bin\sqlite3.dll" output
copy "C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\bin\libgcc_s_seh-1.dll" output
copy "C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\bin\libstdc++-6.dll" output
copy "C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\bin\libwinpthread-1.dll" output
cd output
windeployqt codequery.exe
dir /b/a/s
candle.exe -ext WixUIExtension -ext WixUtilExtension "..\..\windows-install\win64\codequery64.wxs"
light.exe -ext WixUIExtension -ext WixUtilExtension codequery64.wixobj
dir /a/s *.msi

print MSI

print MSI


@echo off
md \php-gtk-dist
cd \php-gtk-dist
md php4
md winnt
md winnt\system32
md test
copy \php4\php.exe php4
copy \php4\php_win.exe php4
copy \php4\php4ts.dll php4
copy \php4\php4isapi.dll php4
copy \php4\php_gtk.dll php4
copy \php4\php_gtk_libglade.dll php4
copy \php4\php_gtk_sqpane.dll php4
copy \php\php4\php.ini-dist winnt\php.ini
type \php\php-gtk\win32\php.ini >>winnt\php.ini
copy %SystemRoot%\system32\gtk-1.3.dll winnt\system32
copy %SystemRoot%\system32\gdk-1.3.dll winnt\system32
copy %SystemRoot%\system32\gmodule-1.3.dll winnt\system32
copy %SystemRoot%\system32\glib-1.3.dll winnt\system32
copy %SystemRoot%\system32\iconv-1.3.dll winnt\system32
copy %SystemRoot%\system32\gnu-intl.dll winnt\system32
copy %SystemRoot%\system32\libglade-0.14.dll winnt\system32
copy %SystemRoot%\system32\libxml.dll winnt\system32
copy \php\php-gtk\test\fileselection.php test
copy \php\php-gtk\test\gtk.php test
copy \php\php-gtk\test\hello.php test
copy \php\php-gtk\test\list.php test
copy \php\php-gtk\test\scribble.php test
copy \php\php-gtk\test\testgtkrc test
copy \php\php-gtk\test\testgtkrc2 test
copy \php\php-gtk\win32\README.txt
"c:\Program Files\WinZip\WZZip" -ampr php-gtk-0.5.0-win32.zip
cd \php\php-gtk\win32

@echo off
SET zip_file=php-gtk-0.5.0-win32.zip
md \php-gtk-dist
cd \php-gtk-dist
md php4
md winnt
md winnt\system32
md test
copy \php4\php.exe php4
copy \php4\php_win.exe php4
copy \php4\php4ts.dll php4
copy \php4\php4isapi.dll php4
copy \php4\php_gtk.dll php4
copy \php4\php_gtk_libglade.dll php4
copy \php4\php_gtk_sqpane.dll php4
copy \php\php4\php.ini-dist winnt\php.ini
type \php\php-gtk\win32\php.ini >>winnt\php.ini
copy %SystemRoot%\system32\gtk-1.3.dll winnt\system32
copy %SystemRoot%\system32\gdk-1.3.dll winnt\system32
copy %SystemRoot%\system32\gmodule-1.3.dll winnt\system32
copy %SystemRoot%\system32\glib-1.3.dll winnt\system32
copy %SystemRoot%\system32\iconv-1.3.dll winnt\system32
copy %SystemRoot%\system32\gnu-intl.dll winnt\system32
copy %SystemRoot%\system32\libglade-0.14.dll winnt\system32
copy %SystemRoot%\system32\libxml.dll winnt\system32
copy \php\php-gtk\test\fileselection.php test
copy \php\php-gtk\test\gtk.php test
copy \php\php-gtk\test\hello.php test
copy \php\php-gtk\test\list.php test
copy \php\php-gtk\test\scribble.php test
copy \php\php-gtk\test\testgtkrc test
copy \php\php-gtk\test\testgtkrc2 test
copy \php\php-gtk\win32\README.txt
copy \php\php-gtk\NEWS
"c:\Program Files\WinZip\WZZip" -ampr %zip_file%
copy %zip_file% \php\php-gtk-web\distributions
del %zip_file%
cd \php\php-gtk\win32

Make sure the dist. file is copied to the web directory


@echo off
SET "VERSION=1.0.0"

SET "SBT_OPTS=-Xmx8G -Denable-tika=0 -Denable-javacv=0" && sbt desktopApp/universal:packageBin desktopApp/jdkPackager:packageBin && move /y "%~dp0desktop-app\target\universal\shadowcloud-desktop-%VERSION%.zip" "%~dp0desktop-app\target\universal\shadowcloud-%VERSION%-light.zip" && move /y "%~dp0desktop-app\target\universal\jdkpackager\bundles\shadowcloud-%VERSION%.exe" "%~dp0desktop-app\target\universal\jdkpackager\bundles\shadowcloud-%VERSION%-light.exe" && SET "SBT_OPTS=-Xmx8G -Denable-tika=1 -Denable-javacv=1" && sbt desktopApp/universal:packageBin desktopApp/jdkPackager:packageBin && move /y "%~dp0desktop-app\target\universal\shadowcloud-desktop-%VERSION%.zip" "%~dp0desktop-app\target\universal\shadowcloud-%VERSION%-full.zip" && move /y "%~dp0desktop-app\target\universal\jdkpackager\bundles\shadowcloud-%VERSION%.exe" "%~dp0desktop-app\target\universal\jdkpackager\bundles\shadowcloud-%VERSION%-full.exe"

@echo off
SET "VERSION=1.0.0"

SET "SBT_OPTS=-Xmx8G -Denable-tika=0 -Denable-javacv=0" && sbt desktopApp/universal:packageBin desktopApp/jdkPackager:packageBin && move /y "%~dp0desktop-app\target\universal\shadowcloud-desktop-%VERSION%.zip" "%~dp0desktop-app\target\universal\shadowcloud-%VERSION%-light.zip" && move /y "%~dp0desktop-app\target\universal\jdkpackager\bundles\shadowcloud-%VERSION%.exe" "%~dp0desktop-app\target\universal\jdkpackager\bundles\shadowcloud-%VERSION%-light.exe" && SET "SBT_OPTS=-Xmx8G -Denable-tika=1 -Denable-javacv=1" && sbt desktopApp/jdkPackager:packageBin && SET "SBT_OPTS=-Xmx8G -Denable-tika=1 -Denable-javacv-all=1" && sbt desktopApp/universal:packageBin && move /y "%~dp0desktop-app\target\universal\shadowcloud-desktop-%VERSION%.zip" "%~dp0desktop-app\target\universal\shadowcloud-%VERSION%-full.zip" && move /y "%~dp0desktop-app\target\universal\jdkpackager\bundles\shadowcloud-%VERSION%.exe" "%~dp0desktop-app\target\universal\jdkpackager\bundles\shadowcloud-%VERSION%-full.exe"

Build fixes

Build fixes


cd ..\src
call msvcbuild.bat static

cd ..\ext\re
call msvcbuild.bat

cd ..\..\ext\tsx
call msvcbuild.bat

cd ..\..\sample
@setlocal
@set SCHEME_H_DIR=..\src
@set MSCOMPILE=cl /nologo /O2 /W3 /c /D_CRT_SECURE_NO_WARNINGS /I%SCHEME_H_DIR%
@set MSLINK=link /nologo
@set EXT_LIBS=..\ext\re\lib\re.lib ..\ext\tsx\lib\tsx.lib

@if not exist bin\ (
  mkdir bin
)

%MSCOMPILE% /MT repl.c
%MSLINK% /out:bin\repl.exe repl.obj ..\src\lib\miniscm.lib %EXT_LIBS%

del repl.obj

cd ..\src
call msvcbuild.bat static

cd ..\ext\re
call msvcbuild.bat

cd ..\..\ext\tsx
call msvcbuild.bat

cd ..\..\example
@setlocal
@set SCHEME_H_DIR=..\src
@set MSCOMPILE=cl /nologo /O2 /W3 /c /D_CRT_SECURE_NO_WARNINGS /I%SCHEME_H_DIR%
@set MSLINK=link /nologo
@set EXT_LIBS=..\ext\re\lib\re.lib ..\ext\tsx\lib\tsx.lib

@if not exist bin\ (
  mkdir bin
)

%MSCOMPILE% /MT repl.c
%MSLINK% /out:bin\repl.exe repl.obj ..\src\lib\miniscm.lib %EXT_LIBS%

del repl.obj

Fix typo in example's bat

Fix typo in example's bat


@echo off
rem
rem Install or update Cygwin.
rem

setlocal

set _PACKAGES=cron,diffutils,inetutils,ncurses,netcat,openssh,p7zip,procps,python,rsync,screen,unzip,vim,zip,genisoimage,w3m,wodim
set _ROOTDIR=C:\cygwin
set _SITE=http://mirrors.xmission.com/cygwin
set _PREFIX=CYGWIN_SETUP:

goto :main

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

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

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

:start_service
    echo %_PREFIX% Starting %1
    %_ROOTDIR%\bin\cygrunsrv --start %1
goto :eof

:start_services
    rem Start syslogd first.
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do (
        if "%%s" == "syslogd" call :start_service %%s
    )
    rem Start rest of services.
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do (
        if not "%%s" == "syslogd" call :start_service %%s
    )
goto :eof

:get_setup_exe
    if not exist %_ROOTDIR% (
        echo %_PREFIX% Creating %_ROOTDIR%
        mkdir %_ROOTDIR%
    )
    echo %_PREFIX% Fetching latest setup.exe from cygwin.com
    wget --quiet -O %_ROOTDIR%\setup.exe http://cygwin.com/setup.exe
goto :eof

:setup
    echo %_PREFIX% Running setup.exe for updates
    %_ROOTDIR%\setup.exe --site %_SITE% --quiet-mode --no-shortcuts --root %_ROOTDIR% --local-package-dir %_ROOTDIR%\LocalPackageDir
    echo %_PREFIX% Running setup.exe to install standard package set
    %_ROOTDIR%\setup.exe --site %_SITE% --quiet-mode --no-shortcuts --root %_ROOTDIR% --local-package-dir %_ROOTDIR%\LocalPackageDir --packages %_PACKAGES%
goto :eof

:create_passwd
    if not exist %_ROOTDIR%\etc\passwd (
        echo %_PREFIX% Creating /etc/passwd
        %_ROOTDIR%\bin\bash --login -i -c '/usr/bin/mkpasswd --local > /etc/passwd'
    )
    if not exist %_ROOTDIR%\etc\group (
        echo %_PREFIX% Creating /etc/group
        %_ROOTDIR%\bin\bash --login -i -c '/usr/bin/mkgroup --local > /etc/group'
    )
goto :eof

:config_syslogd
    sc query syslogd | findstr "service does not exist" > NUL:
    if %ERRORLEVEL% NEQ 0 goto :eof

    echo %_PREFIX% Configuring syslogd
    if not exist %_ROOTDIR%\bin\syslogd-config (
        echo %_PREFIX% ERROR: inetutils not installed
        goto :eof
    )
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/syslogd-config"
goto :eof

:config_sshd
    sc query sshd | findstr "service does not exist" > NUL:
    if %ERRORLEVEL% NEQ 0 goto :eof

    echo %_PREFIX% Configuring sshd
    if not exist %_ROOTDIR%\bin\ssh-host-config (
        echo %_PREFIX% ERROR: opensshd not installed
        goto :eof
    )
    findstr /r "^sshd:" %_ROOTDIR%\etc\passwd
    if %ERRORLEVEL% EQU 0 (
        echo %_PREFIX% ERROR: sshd account found in /etc/passwd
        goto :eof
    )
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/ssh-host-config"
    echo %_PREFIX% Disabling reverse DNS lookup by sshd
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/sed -i -e 's/#UseDNS yes/UseDNS no/' /etc/sshd_config"
goto :eof

:config_lsa
    reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages" | findstr cyglsa > NUL:
    if %ERRORLEVEL% EQU 0 goto :eof

    echo %_PREFIX% Configuring cyglsa
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/cyglsa-config"
goto :eof

:main
    call :check_admin ||exit /b 1
    call :get_setup_exe
    call :stop_services
    call :setup
    call :create_passwd
    call :config_syslogd
    call :config_sshd
    call :start_services
    rem Do config_lsa last so that reboot message is last
    call :config_lsa
:exit

@echo off
rem
rem Install or update Cygwin.
rem

setlocal

set _PACKAGES=cron,diffutils,inetutils,ncurses,netcat,openssh,p7zip,procps,python,rsync,screen,unzip,vim,zip,genisoimage,w3m,wodim
set _ROOTDIR=C:\cygwin
set _SITE=http://mirrors.xmission.com/cygwin
set _PREFIX=CYGWIN_SETUP:

goto :main

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

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

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

:start_service
    rem Start a single Cygwin service.
    echo %_PREFIX% Starting %1
    %_ROOTDIR%\bin\cygrunsrv --start %1
goto :eof

:start_services
    rem Start all Cygwin services.

    rem Start syslogd first.
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do (
        if "%%s" == "syslogd" call :start_service %%s
    )
    rem Start rest of services.
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do (
        if not "%%s" == "syslogd" call :start_service %%s
    )
goto :eof

:get_setup_exe
    rem Download latest setup.exe.
    if not exist %_ROOTDIR% (
        echo %_PREFIX% Creating %_ROOTDIR%
        mkdir %_ROOTDIR%
    )
    echo %_PREFIX% Fetching latest setup.exe from cygwin.com
    wget --quiet -O %_ROOTDIR%\setup.exe http://cygwin.com/setup.exe
goto :eof

:check_for_cygwin_proc
    rem Check for any Cygwin processes.
    echo %_PREFIX% Checking for running Cygwin processes
    set _TEMPFILE=%TEMP%\cygwin_setup.txt
    :retry
        %_ROOTDIR%\bin\ps -l | findstr /v /c:"/usr/bin/ps" > %_TEMPFILE%
        findstr /v /r /c:"PID.*COMMAND" %_TEMPFILE% | findstr /r /c:"^..*" > NUL:
        if ERRORLEVEL 1 goto :ignore
        echo %_PREFIX% Found running Cygwin processes
        type %_TEMPFILE%
        del %_TEMPFILE%
        :ask_abort_retry_ignore
            set /p _ANSWER=Abort, Retry, or Ignore?
            set _ANSWER=%_ANSWER:~0,1%
            if "%_ANSWER%" == "a" exit /b 1
            if "%_ANSWER%" == "A" exit /b 1
            if "%_ANSWER%" == "r" goto :retry
            if "%_ANSWER%" == "R" goto :retry
            if "%_ANSWER%" == "i" goto :ignore
            if "%_ANSWER%" == "I" goto :ignore
        goto :ask_abort_retry_ignore
    :ignore
exit /b 0

:setup
    rem Run setup.exe.
    echo %_PREFIX% Running setup.exe for updates
    %_ROOTDIR%\setup.exe --site %_SITE% --quiet-mode --no-shortcuts --root %_ROOTDIR% --local-package-dir %_ROOTDIR%\LocalPackageDir
    echo %_PREFIX% Running setup.exe to install standard package set
    %_ROOTDIR%\setup.exe --site %_SITE% --quiet-mode --no-shortcuts --root %_ROOTDIR% --local-package-dir %_ROOTDIR%\LocalPackageDir --packages %_PACKAGES%
goto :eof

:create_passwd
    rem Create local passwd and group files.
    if not exist %_ROOTDIR%\etc\passwd (
        echo %_PREFIX% Creating /etc/passwd
        %_ROOTDIR%\bin\bash --login -i -c '/usr/bin/mkpasswd --local > /etc/passwd'
    )
    if not exist %_ROOTDIR%\etc\group (
        echo %_PREFIX% Creating /etc/group
        %_ROOTDIR%\bin\bash --login -i -c '/usr/bin/mkgroup --local > /etc/group'
    )
goto :eof

:config_syslogd
    sc query syslogd | findstr "service does not exist" > NUL:
    if %ERRORLEVEL% NEQ 0 goto :eof

    echo %_PREFIX% Configuring syslogd
    if not exist %_ROOTDIR%\bin\syslogd-config (
        echo %_PREFIX% ERROR: inetutils not installed
        goto :eof
    )
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/syslogd-config"
goto :eof

:config_sshd
    sc query sshd | findstr "service does not exist" > NUL:
    if %ERRORLEVEL% NEQ 0 goto :eof

    echo %_PREFIX% Configuring sshd
    if not exist %_ROOTDIR%\bin\ssh-host-config (
        echo %_PREFIX% ERROR: opensshd not installed
        goto :eof
    )
    findstr /r "^sshd:" %_ROOTDIR%\etc\passwd
    if %ERRORLEVEL% EQU 0 (
        echo %_PREFIX% ERROR: sshd account found in /etc/passwd
        goto :eof
    )
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/ssh-host-config"
    echo %_PREFIX% Disabling reverse DNS lookup by sshd
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/sed -i -e 's/#UseDNS yes/UseDNS no/' /etc/sshd_config"
goto :eof

:config_lsa
    reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages" | findstr cyglsa > NUL:
    if %ERRORLEVEL% EQU 0 goto :eof

    echo %_PREFIX% Configuring cyglsa
    %_ROOTDIR%\bin\bash --login -i -c "/usr/bin/cyglsa-config"
goto :eof

:main
    call :check_admin ||exit /b 1
    call :get_setup_exe
    call :stop_services
    call :check_for_cygwin_proc ||exit /b 1
    call :setup
    call :create_passwd
    call :config_syslogd
    call :config_sshd
    call :start_services
    rem Do config_lsa last so that reboot message is last
    call :config_lsa
:exit

check for running Cygwin processes

cygwin_setup.bat: check for running Cygwin processes


:: Save source for C code and remove compiled libraries
copy "%SRC_DIR%\goodvibes\share\symmetry.c" symmetry.c
copy "%SRC_DIR%\goodvibes\share\LICENSE.txt" symmetry.LICENSE.txt
rd /S /Q "%SRC_DIR%\goodvibes\share\"

:: Install Python
"%PYTHON%" -m pip install . -vv

:: Compile C code and move to expected destination
md %SP_DIR%\goodvibes\share\
"%CC%" /LD symmetry.c /OUT:"%SP_DIR%\goodvibes\share\symmetry_win.dll"

@echo on

:: Save source for C code and remove compiled libraries
copy "%SRC_DIR%\goodvibes\share\symmetry.c" symmetry.c || goto :error
copy "%SRC_DIR%\goodvibes\share\LICENSE.txt" symmetry.LICENSE.txt || goto :error
rd /S /Q "%SRC_DIR%\goodvibes\share\" || goto :error

:: Install Python
"%PYTHON%" -m pip install . -vv || goto :error

:: Compile C code and move to expected destination
md %SP_DIR%\goodvibes\share\ || goto :error
"%CC%" /LD symmetry.c /OUT:"%SP_DIR%\goodvibes\share\symmetry_win.dll" || goto :error

goto :EOF

:error
echo Failed with error #%errorlevel%.
exit /b %errorlevel%

Make sure bld.bat reports errors

Make sure bld.bat reports errors


REM Shell script to migrate an instance of the 3D City Database from v2.x to v3.0
REM on PostgreSQL/PostGIS

REM Provide your database details here
set PGPORT=5432
set PGHOST=localhost
set PGUSER=vcs_user
set CITYDB=dresden
set PGBIN=C:\PostgreSQL\9.3\bin

REM cd to path of the shell script
cd /d %~dp0

REM Run MIGRATE_DB.sql to migrate the 3D City Database instance from v2.x to v3.0
"%PGBIN%\psql" -d "%CITYDB%" -f "MIGRATE_DB.sql"

pause

REM Shell script to migrate an instance of the 3D City Database from v2.x to v3.0
REM on PostgreSQL/PostGIS

REM Provide your database details here
set PGPORT=5432
set PGHOST=your_host_address
set PGUSER=your_username
set CITYDB=your_database
set PGBIN=path_to_psql

REM cd to path of the shell script
cd /d %~dp0

REM Run MIGRATE_DB.sql to migrate the 3D City Database instance from v2.x to v3.0
"%PGBIN%\psql" -d "%CITYDB%" -f "MIGRATE_DB.sql"

pause

[postgresql] set credentials in MIGRATE_DB.bat back to default


echo ON

git config --system alias.co checkout
if errorlevel 1 exit 1
git config --system alias.br branch
if errorlevel 1 exit 1
git config --system alias.ci commit
if errorlevel 1 exit 1
git config --system alias.st status
if errorlevel 1 exit 1
git config --system alias.unstage 'reset HEAD --'
if errorlevel 1 exit 1
git config --system alias.last 'log -1 HEAD'
if errorlevel 1 exit 1
git config --system credential.helper 'cache --timeout=3600'
if errorlevel 1 exit 1

echo OFF

echo ON

git config --system alias.co checkout
if errorlevel 1 exit 1
git config --system alias.br branch
if errorlevel 1 exit 1
git config --system alias.ci commit
if errorlevel 1 exit 1
git config --system alias.st status
if errorlevel 1 exit 1
git config --system alias.unstage reset HEAD --
if errorlevel 1 exit 1
git config --system alias.last log -1 HEAD
if errorlevel 1 exit 1
git config --system credential.helper cache --timeout=3600
if errorlevel 1 exit 1

echo OFF

Update bld.bat

Update bld.bat


echo off

echo Set install parameter
set HTMLDIR=
set WIKIDIR=
set DBUSER=
set DBPASS=
set DBSERVER=
set DBNAME=
set WIKIUSER=
set WIKIPWD=
set WIKINAME=

echo Download Mediawiki
set MEDIAWIKIVERSION=1.33
set MEDIAWIKIMINORVERSION=0
set MEDIAWIKIURL=https://releases.wikimedia.org/mediawiki/%MEDIAWIKIVERSION%/mediawiki-%MEDIAWIKIVERSION%.%MEDIAWIKIMINORVERSION%.tar.gz
set MEDIAWIKIDIR=mediawiki-%MEDIAWIKIVERSION%.%MEDIAWIKIMINORVERSION%
cd %htmldir%

curl %MEDIAWIKIURL% --output wikijournals.tar.gz

echo Uncompress Mediawiki into wikijournals directory
tar -xvzf wikijournals.tar.gz
ren %MEDIAWIKIDIR% %WIKIDIR%
del wikijournals.tar.gz

echo Install Mediawiki
echo %HTMLDIR%\%WIKIDIR%\maintenance
cd %HTMLDIR%\%WIKIDIR%\maintenance
call php install.php --dbuser=%DBUSER% --dbpass=%DBPASS% --dbserver=%DBSERVER% --dbname=%DBNAME% --dbtype=mysql --installdbpass=%DBPASS% --installdbuser=%DBUSER% --lang=de --pass=%WIKIPWD% --scriptpath=/%WIKIDIR% %WIKINAME% %WIKIUSER%
cd ..

echo off

echo Set install parameter
set HTMLDIR=
set WIKIDIR=
set DBUSER=
set DBPASS=
set DBSERVER=
set DBNAME=
set WIKIUSER=
set WIKIPWD=
set WIKINAME=

echo Download Mediawiki
set MEDIAWIKIVERSION=1.33
set MEDIAWIKIMINORVERSION=0
set MEDIAWIKIURL=https://releases.wikimedia.org/mediawiki/%MEDIAWIKIVERSION%/mediawiki-%MEDIAWIKIVERSION%.%MEDIAWIKIMINORVERSION%.tar.gz
set MEDIAWIKIDIR=mediawiki-%MEDIAWIKIVERSION%.%MEDIAWIKIMINORVERSION%
cd %HTMLDIR%

curl %MEDIAWIKIURL% --output wikijournals.tar.gz

echo Uncompress Mediawiki into wikijournals directory
tar -xvzf wikijournals.tar.gz
ren %MEDIAWIKIDIR% %WIKIDIR%
del wikijournals.tar.gz

echo Install Mediawiki
echo %HTMLDIR%\%WIKIDIR%\maintenance
cd %HTMLDIR%\%WIKIDIR%\maintenance
call php install.php --dbuser=%DBUSER% --dbpass=%DBPASS% --dbserver=%DBSERVER% --dbname=%DBNAME% --dbtype=mysql --installdbpass=%DBPASS% --installdbuser=%DBUSER% --lang=de --pass=%WIKIPWD% --scriptpath=/%WIKIDIR% %WIKINAME% %WIKIUSER%
cd ..

Update install_mediawiki.cmd

Update install_mediawiki.cmd

Minor change


@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 (#114)

chore: use latest npm on Windows (#114)


@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 tmp
@cd tmp
cmake -Wno-dev -G "Visual Studio 12" -DwxWidgets_PREFIX_DIRECTORY=%WXWIN% -DOpenCVRoot=%OPENCV_DIR% ..
@cd ..

@mkdir tmp
@cd tmp
cmake -Wno-dev -G "Visual Studio 12" "-DwxWidgets_PREFIX_DIRECTORY=%WXWIN%" "-DOpenCVRoot=%OPENCV_DIR%" ..
@cd ..

allow spaces in WXWIN path

allow spaces in WXWIN path


test script

test script


@ECHO OFF

cd ..\picklesdoc.github.com
rmdir Output /s /q
echo D | xcopy ..\pickles\Output Output /e
powershell -Command "(gc index_template.md) -replace 'VERSION_PLACEHOLDER', '%1' | Out-File -encoding ASCII index.md"
cd ..\pickles

Add script for deploying documentation

Add script for deploying documentation


set PATH=%PATH%;"%WIX%\bin"
cd build
md output
copy *.exe output
copy "c:\vcpkg\installed\x64-windows\bin\sqlite3.dll" output
cd output
windeployqt codequery.exe
dir/b/a/s
candle.exe -ext WixUIExtension -ext WixUtilExtension "..\..\windows-install\win64\codequery64.wxs"
light.exe -ext WixUIExtension -ext WixUtilExtension codequery64.wixobj

Add Wix to env GHA

Add Wix to env GHA


:: Copyright by SyneArt <sa@syneart.com>
@echo off&cls&title InstallTheme&color 0F&mode con cols=38 lines=10
setlocal enableextensions enabledelayedexpansion
set texPath=nul

REM For TeXLive
call:pushProgress 1 & call tlmgr --version 1>nul 2>&1 && (
	for /f "tokens=1* delims=:" %%a in ('tlmgr --version') do (
		if "%%a"=="tlmgr using installation" (
			set texPath=#%%b&set texPath=!texPath:# =!\texmf-dist\tex\latex\beamer\
		)
	)
	call:copyFile .\themes, *.sty&call:copyFile .\art, *.jpg
	if !errorlevel!==1 (call:pushCopyError&goto exit)
	call:pushProgress 2 & texhash >nul 2>&1
	if !errorlevel!==1 (call:pushCompileError&goto exit)
)

REM For MiKTeX
call:pushProgress 3 & call initexmf --version 1>nul 2>&1 && (
	for /f "tokens=1* delims=: " %%a in ('initexmf --report') do (
		if exist %%b\tex\latex\beamer\base\ set texPath=%%b\tex\latex\beamer\base\
	)
	if !texPath!==nul (call:pushBeamerError&goto exit)
	call:copyFile .\themes, *.sty&call:copyFile .\art, *.jpg
	if !errorlevel!==1 (call:pushCopyError&goto exit)
	call:pushProgress 4 & initexmf --admin --update-fndb >nul 2>&1
	if !errorlevel!==1 (call:pushCompileError&goto exit)
)

if !texPath!==nul (
	cls&echo.&echo.&echo.&echo.&echo Please install LaTeX first.
	color E3&set /p=&goto exit
)

cls&echo.&echo.&echo.&echo.&echo Install Theme Successful ^^! :-P&color 2A&ping 127.0.0.1 -n 3 >nul&goto exit

:pushBeamerError
cls&echo.&echo.&echo.&echo.&echo Please install Beamer on MiKTeX first.
color E3&set /p=&goto exit

:pushCopyError
cls&echo.&echo.&echo.&echo.&echo Not Found Path, please feedback.
color 4C&set /p=&goto exit

:pushCompileError
cls&echo.&echo.&echo.&echo.&echo Please stop LaTeX Compile first.
color 4C&set /p=&goto exit

:pushProgress
cls&echo.&echo.&echo.&echo.&echo Installing Theme , Wait .. [ %~1 of 4 ]
goto exit

:copyFile
FOR /R %~1 %%c in (%~2) DO (
	set themesFile=%%c&set themesFile=!themesFile:%~dp0=!
	copy /Y "%%c" "!texPath!!themesFile!" 1>nul 2>&1
)

:exit

:: Copyright by SyneArt <sa@syneart.com>
@echo off&cls&title InstallTheme&color 0F&mode con cols=38 lines=10
setlocal enableextensions enabledelayedexpansion
set texPath=nul

REM For TeXLive
call:pushProgress 1 & call tlmgr --version 1>nul 2>&1 && (
	for /f "tokens=1* delims=:" %%a in ('tlmgr --version') do (
		if "%%a"=="tlmgr using installation" (
			set texPath=#%%b&set texPath=!texPath:# =!\texmf-dist\tex\latex\beamer\
		)
	)
	call:copyFile .\themes, *.sty&call:copyFile .\art, *.jpg
	if !errorlevel!==1 (call:pushCopyError&goto exit)
	call:pushProgress 2 & texhash >nul 2>&1
	if !errorlevel!==1 (call:pushCompileError&goto exit)
)

REM For MiKTeX
call:pushProgress 3 & call initexmf --version 1>nul 2>&1 && (
	for /f "tokens=1* delims=: " %%a in ('initexmf --report') do (
		if exist %%b\tex\latex\beamer\base\ set texPath=%%b\tex\latex\beamer\base\
	)
	if !texPath!==nul (call:pushBeamerError&goto exit)
	call:copyFile .\themes, *.sty&call:copyFile .\art, *.jpg
	if !errorlevel!==1 (call:pushCopyError&goto exit)
	call:pushProgress 4 & initexmf --admin --update-fndb >nul 2>&1
	if !errorlevel!==1 (call:pushCompileError&goto exit)
)

if !texPath!==nul (
	call:echo "Please install LaTeX first."
	color E3&set /p=&goto exit
)

call:echo "Install Theme Successful (^^)"&color 2A&ping 127.0.0.1 -n 3 >nul&goto exit

:pushBeamerError
call:echo "Please install Beamer on MiKTeX first."
color E3&set /p=&goto exit

:pushCopyError
call:echo "Not Found Path, please feedback."
color 4C&set /p=&goto exit

:pushCompileError
call:echo "Please stop LaTeX Compile first."
color 4C&set /p=&goto exit

:pushProgress
call:echo "Installing Theme , Wait .. [ %~1 of 4 ]"
goto exit

:echo
cls&echo.&echo.&echo.&echo.&echo %~1
goto exit

:copyFile
FOR /R %~1 %%c in (%~2) DO (
	set themesFile=%%c&set themesFile=!themesFile:%~dp0=!
	copy /Y "%%c" "!texPath!!themesFile!" 1>nul 2>&1
)

:exit

Sort out echo

Sort out echo


@REM NOTE: This script must be run from a Visual Studio command prompt window

@ECHO off

SET CMDHOME=%~dp0.
if "%FrameworkDir%" == "" set FrameworkDir=%WINDIR%\Microsoft.NET\Framework
if "%FrameworkVersion%" == "" set FrameworkVersion=v4.0.30319

SET MSBUILDEXEDIR=%FrameworkDir%\%FrameworkVersion%
SET MSBUILDEXE=%MSBUILDEXEDIR%\MSBuild.exe

@echo Build Debug ==============================
SET CONFIGURATION=Debug
SET OutDir=%CMDHOME%\..\Binaries\%CONFIGURATION%

"%MSBUILDEXE%" %CMDHOME%\Orleans.sln
@if ERRORLEVEL 1 GOTO :ErrorStop

@REM Install Visual Studio SDK and uncomment the following lines
@REM to build Visual Studio project templates.
@REM
@REM %MSBUILDEXE% %CMDHOME%\OrleansVSTools\OrleansVSTools.sln
@REM xcopy /s /y %CMDHOME%\SDK\VSIX %OutDir%\VSIX\
@REM @if ERRORLEVEL 1 GOTO :ErrorStop

"%MSBUILDEXE%" /p:Configuration=%CONFIGURATION% /p:OutputPath=. %CMDHOME%\Build\OrleansSetup.wixproj
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo BUILD succeeded for %CONFIGURATION%

@echo Build Release ============================
SET CONFIGURATION=Release
SET OutDir=%CMDHOME%\..\Binaries\%CONFIGURATION%

"%MSBUILDEXE%" %CMDHOME%\Orleans.sln
@if ERRORLEVEL 1 GOTO :ErrorStop

@REM Install Visual Studio SDK and uncomment the following lines
@REM to build Visual Studio project templates.
@REM
@REM %MSBUILDEXE% %CMDHOME%\OrleansVSTools\OrleansVSTools.sln
@REM xcopy /s /y %CMDHOME%\SDK\VSIX %OutDir%\VSIX\
@REM @if ERRORLEVEL 1 GOTO :ErrorStop

"%MSBUILDEXE%" /p:Configuration=%CONFIGURATION% /p:OutputPath=. %CMDHOME%\Build\OrleansSetup.wixproj
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo BUILD succeeded for %CONFIGURATION%
@GOTO :EOF

:ErrorStop
@echo BUILD FAILED for %CONFIGURATION% with error %ERRORLEVEL% - CANNOT CONTINUE

:EOF

@REM NOTE: This script must be run from a Visual Studio command prompt window

@ECHO off

SET CMDHOME=%~dp0.
if "%FrameworkDir%" == "" set FrameworkDir=%WINDIR%\Microsoft.NET\Framework
if "%FrameworkVersion%" == "" set FrameworkVersion=v4.0.30319

SET MSBUILDEXEDIR=%FrameworkDir%\%FrameworkVersion%
SET MSBUILDEXE=%MSBUILDEXEDIR%\MSBuild.exe

set PROJ=%CMDHOME%\Orleans.sln

@echo ===== Building %PROJ% =====

@echo Build Debug ==============================

SET CONFIGURATION=Debug
SET OutDir=%CMDHOME%\..\Binaries\%CONFIGURATION%

"%MSBUILDEXE%" /p:Configuration=%CONFIGURATION% "%PROJ%"
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo BUILD ok for %CONFIGURATION% %PROJ%

@echo Build Release ============================

SET CONFIGURATION=Release
SET OutDir=%CMDHOME%\..\Binaries\%CONFIGURATION%

"%MSBUILDEXE%" /p:Configuration=%CONFIGURATION% "%PROJ%"
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo BUILD ok for %CONFIGURATION% %PROJ%

@echo Build Release Installers =================

SET CONFIGURATION=Release

set STEP=VSIX
@REM
@REM Install Visual Studio SDK and uncomment the following lines
@REM to build Visual Studio project templates.
@REM
@REM "%MSBUILDEXE%" /p:Configuration=%CONFIGURATION% "%CMDHOME%\OrleansVSTools\OrleansVSTools.sln"
@REM xcopy /s /y %CMDHOME%\SDK\VSIX %OutDir%\VSIX\
@REM @if ERRORLEVEL 1 GOTO :ErrorStop
@REM @echo BUILD ok for VSIX package for %PROJ%

set STEP=WIX
"%MSBUILDEXE%" /p:Configuration=%CONFIGURATION% /p:OutputPath=. "%CMDHOME%\Build\OrleansSetup.wixproj"
@if ERRORLEVEL 1 GOTO :ErrorStop
@echo BUILD ok for WIX package for %PROJ%

@echo ===== Build succeeded for %PROJ% =====
@GOTO :EOF

:ErrorStop
if "%STEP%" == "" set STEP=%CONFIGURATION%
@echo ===== Build FAILED for %PROJ% -- %STEP% with error %ERRORLEVEL% - CANNOT CONTINUE =====

:EOF

Clean up Build.cmd script - Specify main solution file in one place. - Fix some quoting and param insonsistencies in Build.cmd - Only build VSIX and WIX packages from Release bits.


call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
hg pull -u --rebase
msbuild "Palaso VS2010.sln" /verbosity:quiet /maxcpucount

Add GetAndBuildThis.bat

Add GetAndBuildThis.bat


Update the version of Python and our code signing cert for Windows.

This updates the Windows installer to bundle Python 2.7.17 (the latest
2.7.x release), and to use our latest code signing cert, in preparation
for the release.

In the future, we'll want to upgrade to Python 3.x, but we're aiming not
to break anything for RBTools 1.0.x.


@echo off
setlocal enableextensions

goto entry

:usage
  echo usage: jsc dev      [-c^|--config CONFIG_JS] [BOOTSTRAP_TARGET]
  echo     or jsc compile  [-c^|--config CONFIG_JS] MODULE_FILE ... COMPILE_TARGET
  echo     or jsc identify MODULE_FILE
  echo     or jsc inline   [-c^|--config CONFIG_JS] [-n^|--invoke-main MAIN_MODULE] [-r^|--register] COMPILE_FILE ... LINK_TARGET
  echo     or jsc link     [-c^|--config CONFIG_JS] COMPILE_FILE ... LINK_TARGET
  echo     or jsc help
  echo.
  echo arguments:
  echo   BOOTSTRAP_TARGET file to generate for running in dev mode, this defaults
  echo                    to a file called bootstrap.js in the same directory as
  echo                    the config file
  echo   MODULE_FILE      file containing an uncompiled module
  echo   COMPILE_TARGET   file to generate when compiling, will contain the set of
  echo                    modules and their dependencies
  echo   COMPILE_FILE     file produced by compilation to use as input to linking,
  echo                    COMPILE_FILE must have corresponding 'COMPILE_TARGET.meta'
  echo   LINK_TARGET      file to generate when linking, will contain bootstrap
  echo                    information: bolt, install and configuration
  echo.
  echo options:
  echo   -c^|--config CONFIG_JS          override bolt configuration file
  echo                                    default: config/bolt/prod.js
  echo   -o^|--output OUTPUT_DIR         override compilation output directory
  echo                                    default: scratch/main/js/compile
  echo   -n^|--invoke-main MAIN_MODULE   specify main module of inline scripts
  echo   -r^|--register                  register modules in global namespace
  echo.

  exit /b 0

:fail_usage
  echo.
  call :usage
  exit /b 1

:fail
  exit /b 1

:entry

set base=%~dp0

if "%~1"=="" echo error: must specify mode. && goto fail_usage

set mode=%~1
shift

if "%mode%"=="dev" goto done_mode_validation
if "%mode%"=="compile" goto done_mode_validation
if "%mode%"=="identify" goto done_mode_validation
if "%mode%"=="inline" goto done_mode_validation
if "%mode%"=="link" goto done_mode_validation
if "%mode%"=="help" goto done_mode_validation

echo invalid mode [%mode%], must be one of dev^|compile^|identify^|inline^|link^|help
goto fail_usage

:done_mode_validation

if "%mode%"=="help" call :usage && exit /b 0

:parse_flags
  set flag=%~1
  if not "%flag:~0,1%"=="-" goto done_parse_flags
  shift

  if "%flag%"=="-c" goto parse_config
  if "%flag%"=="--config" goto parse_config
  if "%flag%"=="-o" goto parse_output
  if "%flag%"=="--output" goto parse_output
  if "%flag%"=="-n" goto parse_invoke
  if "%flag%"=="--invoke-main" goto parse_invoke
  if "%flag%"=="-r" goto parse_register
  if "%flag%"=="--register" goto parse_register
  if "%flag%"=="--" goto done_parse_flags
  echo invalid flag [%flag%] && goto fail_usage

  goto parse_flags

  :parse_config
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set config_js=%~1
    shift
  goto parse_flags

  :parse_output
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set output_dir=%~1
    shift
  goto parse_flags

  :parse_invoke
    if "%~1"=="" echo %flag% requires an argument to be specified && goto fail_usage
    set invoke_main=true
    set main=%~1
    shift
  goto parse_flags

  :parse_register
    set register_modules=true
  goto parse_flags

:done_parse_flags

if "%config_js%"=="" set config_js=config/bolt/prod.js
if "%output_dir%"=="" set output_dir=scratch/main/js/compile
if "%register_modules%"=="" set register_modules=false
if "%invoke_main%"=="" set invoke_main=false

if not exist "%config_js%" echo %config_js% does not exist or is not a file && goto fail
for %%i in ("%config_js%") do if exist %%~si\NUL echo %config_js% does not exist or is not a file && goto fail

for %%i in (node.exe) do set node=%%~$PATH:i
if "%node%"=="" echo error: node.js is not on the system path && goto fail

if "%mode%"=="dev" goto jsc_dev
if "%mode%"=="compile" goto jsc_compile
if "%mode%"=="identify" goto jsc_identify
if "%mode%"=="inline" goto jsc_inline
if "%mode%"=="link" goto jsc_link
exit /b 0

:jsc_dev
  if "%~1"=="" for %%F in ("%config_js%") do (set bootstrap=%%~dpFbootstrap.js) && goto exec_jsc_dev
  if "%~2"=="" set bootstrap=%~1 && goto exec_jsc_dev
  echo invalid number of arguments for jsc %mode%
  goto fail_usage

  :exec_jsc_dev
    "%node%" "%base%jsc.js" "%mode%" "%bootstrap%" "%config_js%"
exit /b 0

:jsc_compile
  goto jsc_x

:jsc_identify
  if "%~1"=="" echo invalid number of arguments for jsc %mode% && goto fail_usage
  if not "%~2"=="" echo invalid number of arguments for jsc %mode% && goto fail_usage
  "%node%" "%base%jsc.js" "%mode%" "%~1"
exit /b 0

:jsc_inline
  if "%~1"=="" echo invalid number of arguments for jsc %mode% && goto fail_usage
  if "%~2"=="" echo invalid number of arguments for jsc %mode% && goto fail_usage

  :jsc_inline_remaining
  if "%~1"=="" goto end_jsc_inline_remaining
  set remaining=%remaining% "%~1"
  shift
  goto :jsc_inline_remaining
  :end_jsc_inline_remaining

  "%node%" "%base%jsc.js" "%mode%" "%config_js%" "%invoke_main%" "%main%" "%register_modules%" %remaining%
exit /b 0

:jsc_link
  goto jsc_x

:jsc_x
  if "%~1"=="" echo invalid number of arguments for jsc %mode% && goto fail_usage
  if "%~2"=="" echo invalid number of arguments for jsc %mode% && goto fail_usage

  :jsc_x_remaining
  if "%~1"=="" goto end_jsc_x_remaining
  set remaining=%remaining% "%~1"
  shift
  goto :jsc_x_remaining
  :end_jsc_x_remaining

  "%node%" "%base%jsc.js" "%mode%" "%config_js%" %remaining%
exit /b 0

Add batch file implementation of jsc

Add batch file implementation of jsc


@cl /Ox pagent.c User32.lib
@del /Q *.obj

util: delete intermediate files when building pagent util


Update generate_solution.bat

Update generate_solution.bat


:: Copyright (c) 2011 The Native Client Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file.

echo on

setlocal
set MODE=%1
set BITS=%2
set TOOLCHAIN=%3

:: Picking out drive letter on which the build is happening so we can use it
:: for the temp directory.
set BUILD_DRIVE=%PATH:~0,1%

call buildbot\msvs_env.bat %BITS%

set RETCODE=0

if "%MODE%" equ "dbg" (set GYPMODE=Debug) else (set GYPMODE=Release)
if %BITS% equ 32 (set VCBITS=x86) else (set VCBITS=x64)
if %BITS% equ 32 (set SEL_LDR=sel_ldr.exe) else (set SEL_LDR=sel_ldr64.exe)
if "%TOOLCHAIN%" equ "glibc" (set GLIBCOPTS=--nacl_glibc) else (set GLIBCOPTS=)

echo @@@BUILD_STEP clobber@@@
rd /s /q scons-out ^
 & rd /s /q build\Debug build\Release ^
 & rd /s /q build\Debug-Win32 build\Release-Win32 ^
 & rd /s /q build\Debug-x64 build\Release-x64

:: Skip over hooks and partial_sdk when run inside the toolchain
:: build as the toolchain takes care or the clobber, hooks aren't needed, and
:: partial_sdk really shouldn't be needed.
if "%INSIDE_TOOLCHAIN%" equ "" goto NonToolchain
:: GYP_DEFINES tells GYP whether we need x86-32 or x86-64 binaries to
:: generate in the gyp_compile stage.  On toolchain bot we can not just
:: use gclient runhooks --force because it'll clobber freshly created
:: toolchain.
echo @@@BUILD_STEP gyp_generate_only@@@
cd ..
python.bat native_client/build/gyp_nacl native_client/build/all.gyp
cd native_client
goto SkipSync

:NonToolchain
echo @@@BUILD_STEP cleanup_temp@@@
:: Selecting a temp directory on the same drive as the build.
:: Many of our bots have tightly packed C: drives, but plentiful E: drives.
set OLD_TEMP=%TEMP%
set TEMP=%BUILD_DRIVE%:\temp
set TMP=%TEMP%
mkdir %TEMP%
:: Safety check.
if "%OLD_TEMP%" equ "" goto SkipClean
:: Cleaning old temp directory to clear up all the nearly full bots out there.
del /S /Q "%OLD_TEMP%\*"
for /D %%I in ("%OLD_TEMP%\*") do rmdir /S /Q %%I
:: Cleaning new temp directory so we don't overflow in the future.
del /S /Q "%TEMP%\*"
for /D %%I in ("%TEMP%\*") do rmdir /S /Q %%I
:SkipClean

echo @@@BUILD_STEP gclient_runhooks@@@
cmd /c gclient runhooks
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

echo @@@BUILD_STEP partial_sdk@@@
if "%TOOLCHAIN%" equ "glibc" (
  call scons.bat --verbose --mode=nacl_extra_sdk platform=x86-%BITS% ^
    --download --nacl_glibc extra_sdk_update_header extra_sdk_update
  if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

  if %BITS% equ 32 goto SkipSync
  echo @@@BUILD_STEP partial_sdk_32@@@
  setlocal
  call vcvarsall.bat x86 && call scons.bat --verbose --mode=nacl_extra_sdk -j 8 ^
    %GLIBCOPTS% platform=x86-32 extra_sdk_update_header extra_sdk_update
  if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
  endlocal
) else (
  call scons.bat --verbose --mode=nacl_extra_sdk platform=x86-%BITS% ^
    --download extra_sdk_update_header install_libpthread extra_sdk_update
  if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

  if %BITS% equ 32 goto SkipSync
  echo @@@BUILD_STEP partial_sdk_32@@@
  setlocal
  call vcvarsall.bat x86 && call scons.bat --verbose --mode=nacl_extra_sdk -j 8 ^
    platform=x86-32 extra_sdk_update_header install_libpthread extra_sdk_update
  if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
  endlocal
)
:SkipSync

echo @@@BUILD_STEP gyp_compile@@@
setlocal
call vcvarsall.bat x86 && call devenv.com build\all.sln /build %GYPMODE%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
endlocal

echo @@@BUILD_STEP gyp_tests@@@
python_slave.exe trusted_test.py --config %GYPMODE%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

echo on
echo @@@BUILD_STEP scons_compile@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat -j 8 ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc platform=x86-%BITS%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
endlocal

if "%TOOLCHAIN%" equ "glibc" goto NoNeedForPlugin
echo @@@BUILD_STEP plugin_compile@@@
setlocal
call vcvarsall.bat x86 && call scons.bat -j 8 ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc platform=x86-%BITS% plugin
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
endlocal
:NoNeedForPlugin

echo @@@BUILD_STEP small_tests@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc small_tests ^
 platform=x86-%BITS%
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal

if "%TOOLCHAIN%" neq "glibc" goto AfterDynamicLibraryBrowserTests
:: TODO(bradchen): fix this test for 64-bit Windows. Current failure seems to
:: be some sort of race.
if %BITS% equ 64 goto AfterDynamicLibraryBrowserTests
echo @@@BUILD_STEP dynamic_library_browser_tests@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc ^
 dynamic_library_browser_tests platform=x86-%BITS%
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal
:AfterDynamicLibraryBrowserTests

if "%TOOLCHAIN%" equ "glibc" goto AfterTests
echo @@@BUILD_STEP medium_tests@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc medium_tests ^
 platform=x86-%BITS%
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal

echo @@@BUILD_STEP large_tests@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc large_tests ^
 platform=x86-%BITS%
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal

if "%INSIDE_TOOLCHAIN%" neq "" goto AfterTests

echo @@@BUILD_STEP chrome_browser_tests@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc ^
 SILENT=1 platform=x86-%BITS% ^
 chrome_browser_tests
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal

echo @@@BUILD_STEP chrome_browser_tests using GYP@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc ^
 SILENT=1 platform=x86-%BITS% ^
 force_ppapi_plugin=build\%GYPMODE%\ppGoogleNaClPlugin.dll ^
 force_sel_ldr=build\%GYPMODE%\%SEL_LDR% ^
 chrome_browser_tests
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal

# TODO(mcgrathr): Drop support for non-IRT builds and remove this entirely.
# See http://code.google.com/p/nativeclient/issues/detail?id=1691
echo @@@BUILD_STEP chrome_browser_tests without IRT@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc ^
 SILENT=1 platform=x86-%BITS% ^
 chrome_browser_tests irt=0
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal

echo @@@BUILD_STEP pyauto_tests@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc ^
 SILENT=1 platform=x86-%BITS% ^
 pyauto_tests
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal

:AfterTests

if %RETCODE% neq 0 (
  echo @@@BUILD_STEP summary@@@
  echo There were failed stages.
  exit /b %RETCODE%
)

:: Copyright (c) 2011 The Native Client Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file.

echo on

setlocal
set MODE=%1
set BITS=%2
set TOOLCHAIN=%3

:: Picking out drive letter on which the build is happening so we can use it
:: for the temp directory.
set BUILD_DRIVE=%PATH:~0,1%

call buildbot\msvs_env.bat %BITS%

set RETCODE=0

if "%MODE%" equ "dbg" (set GYPMODE=Debug) else (set GYPMODE=Release)
if %BITS% equ 32 (set VCBITS=x86) else (set VCBITS=x64)
if %BITS% equ 32 (set SEL_LDR=sel_ldr.exe) else (set SEL_LDR=sel_ldr64.exe)
if "%TOOLCHAIN%" equ "glibc" (set GLIBCOPTS=--nacl_glibc) else (set GLIBCOPTS=)

echo @@@BUILD_STEP clobber@@@
rd /s /q scons-out ^
 & rd /s /q build\Debug build\Release ^
 & rd /s /q build\Debug-Win32 build\Release-Win32 ^
 & rd /s /q build\Debug-x64 build\Release-x64

:: Skip over hooks and partial_sdk when run inside the toolchain
:: build as the toolchain takes care or the clobber, hooks aren't needed, and
:: partial_sdk really shouldn't be needed.
if "%INSIDE_TOOLCHAIN%" equ "" goto NonToolchain
:: GYP_DEFINES tells GYP whether we need x86-32 or x86-64 binaries to
:: generate in the gyp_compile stage.  On toolchain bot we can not just
:: use gclient runhooks --force because it'll clobber freshly created
:: toolchain.
echo @@@BUILD_STEP gyp_generate_only@@@
cd ..
python.bat native_client/build/gyp_nacl native_client/build/all.gyp
cd native_client
goto SkipSync

:NonToolchain
echo @@@BUILD_STEP cleanup_temp@@@
:: Selecting a temp directory on the same drive as the build.
:: Many of our bots have tightly packed C: drives, but plentiful E: drives.
set OLD_TEMP=%TEMP%
set TEMP=%BUILD_DRIVE%:\temp
set TMP=%TEMP%
mkdir %TEMP%
:: Safety check.
if "%OLD_TEMP%" equ "" goto SkipClean
:: Cleaning old temp directory to clear up all the nearly full bots out there.
del /S /Q "%OLD_TEMP%\*"
for /D %%I in ("%OLD_TEMP%\*") do rmdir /S /Q %%I
:: Cleaning new temp directory so we don't overflow in the future.
del /S /Q "%TEMP%\*"
for /D %%I in ("%TEMP%\*") do rmdir /S /Q %%I
:SkipClean

echo @@@BUILD_STEP gclient_runhooks@@@
cmd /c gclient runhooks
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

echo @@@BUILD_STEP partial_sdk@@@
if "%TOOLCHAIN%" equ "glibc" (
  call scons.bat --verbose --mode=nacl_extra_sdk platform=x86-%BITS% ^
    --download --nacl_glibc extra_sdk_update_header extra_sdk_update
  if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

  if %BITS% equ 32 goto SkipSync
  echo @@@BUILD_STEP partial_sdk_32@@@
  setlocal
  call vcvarsall.bat x86 && call scons.bat --verbose --mode=nacl_extra_sdk -j 8 ^
    %GLIBCOPTS% platform=x86-32 extra_sdk_update_header extra_sdk_update
  if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
  endlocal
) else (
  call scons.bat --verbose --mode=nacl_extra_sdk platform=x86-%BITS% ^
    --download extra_sdk_update_header install_libpthread extra_sdk_update
  if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

  if %BITS% equ 32 goto SkipSync
  echo @@@BUILD_STEP partial_sdk_32@@@
  setlocal
  call vcvarsall.bat x86 && call scons.bat --verbose --mode=nacl_extra_sdk -j 8 ^
    platform=x86-32 extra_sdk_update_header install_libpthread extra_sdk_update
  if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
  endlocal
)
:SkipSync

echo @@@BUILD_STEP gyp_compile@@@
setlocal
call vcvarsall.bat x86 && call devenv.com build\all.sln /build %GYPMODE%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
endlocal

echo @@@BUILD_STEP gyp_tests@@@
python_slave.exe trusted_test.py --config %GYPMODE%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

echo on
echo @@@BUILD_STEP scons_compile@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat -j 8 ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc platform=x86-%BITS%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
endlocal

if "%TOOLCHAIN%" equ "glibc" goto NoNeedForPlugin
echo @@@BUILD_STEP plugin_compile@@@
setlocal
call vcvarsall.bat x86 && call scons.bat -j 8 ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc platform=x86-32 plugin
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
endlocal
:NoNeedForPlugin

echo @@@BUILD_STEP small_tests@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc small_tests ^
 platform=x86-%BITS%
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal

:: TODO(bradchen): add dynamic_library_browser_tests
::  when DSOs are added to Windows toolchain build

if "%TOOLCHAIN%" equ "glibc" goto AfterTests
echo @@@BUILD_STEP medium_tests@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc medium_tests ^
 platform=x86-%BITS%
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal

echo @@@BUILD_STEP large_tests@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc large_tests ^
 platform=x86-%BITS%
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal

if "%INSIDE_TOOLCHAIN%" neq "" goto AfterTests

echo @@@BUILD_STEP chrome_browser_tests@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc ^
 SILENT=1 platform=x86-%BITS% ^
 chrome_browser_tests
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal

echo @@@BUILD_STEP chrome_browser_tests using GYP@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc ^
 SILENT=1 platform=x86-%BITS% ^
 force_ppapi_plugin=build\%GYPMODE%\ppGoogleNaClPlugin.dll ^
 force_sel_ldr=build\%GYPMODE%\%SEL_LDR% ^
 chrome_browser_tests
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal

# TODO(mcgrathr): Drop support for non-IRT builds and remove this entirely.
# See http://code.google.com/p/nativeclient/issues/detail?id=1691
echo @@@BUILD_STEP chrome_browser_tests without IRT@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc ^
 SILENT=1 platform=x86-%BITS% ^
 chrome_browser_tests irt=0
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal

echo @@@BUILD_STEP pyauto_tests@@@
setlocal
call vcvarsall.bat %VCBITS% && call scons.bat ^
 DOXYGEN=..\third_party\doxygen\win\doxygen ^
 %GLIBCOPTS% -k --verbose --mode=%MODE%-win,nacl,doc ^
 SILENT=1 platform=x86-%BITS% ^
 pyauto_tests
if %ERRORLEVEL% neq 0 (set RETCODE=%ERRORLEVEL% & echo @@@STEP_FAILURE@@@)
endlocal

:AfterTests

if %RETCODE% neq 0 (
  echo @@@BUILD_STEP summary@@@
  echo There were failed stages.
  exit /b %RETCODE%
)

Fix bot redness. This change reverts r5419 changes to
buildbot/buildbot_win.bat to 5366.
Review URL: http://codereview.chromium.org/7063028

git-svn-id: 721b910a23eff8a86f00c8fd261a7587cddf18f8@5423 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2


@echo off

set MAPNIK_VERSION=v2.2.0
set MAPNIK_PREFIX=c:\\mapnik-%MAPNIK_VERSION%
set MAPNIK_LIBS=%MAPNIK_PREFIX%\lib
set MAPNIK_INCLUDES=%MAPNIK_PREFIX%\include
set MAPNIK_INPUT_PLUGINS_DIRECTORY=%MAPNIK_PREFIX%\input
set MAPNIK_FONTS_DIRECTORY=%MAPNIK_PREFIX%\fonts

if /i "%1"=="" goto help
if /i "%1"=="help" goto help
if /i "%1"=="--help" goto help
if /i "%1"=="-help" goto help
if /i "%1"=="/help" goto help
if /i "%1"=="?" goto help
if /i "%1"=="-?" goto help
if /i "%1"=="--?" goto help
if /i "%1"=="/?" goto help
if /i "%1"=="--prefix" echo %MAPNIK_PREFIX%
if /i "%1"=="--libs" echo mapnik.lib
@rem TODO - figure out how to avoid hardcoding these library names
if /i "%1"=="--dep-libs" echo icuuc.lib icuin.lib libboost_system-vc100-mt-s-1_49.lib
if /i "%1"=="--ldflags" echo %MAPNIK_LIBS%
if /i "%1"=="--defines" echo _WINDOWS HAVE_JPEG HAVE_PNG HAVE_TIFF MAPNIK_USE_PROJ4 BOOST_REGEX_HAS_ICU MAPNIK_THREADSAFE BIGINT HAVE_LIBXML2 HAVE_CAIRO
@rem /MD is multithreaded dynamic linking - http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
@rem /EHsc is to support c++ exceptions - http://msdn.microsoft.com/en-us/library/1deeycx5(v=vs.80).aspx
@rem /GR is to support rtti (runtime type detection) - http://msdn.microsoft.com/en-us/library/we6hfdy0.aspx
if /i "%1"=="--cxxflags" echo /MD /EHsc /GR
if /i "%1"=="--includes" echo %MAPNIK_INCLUDES%
if /i "%1"=="--input-plugins" echo %MAPNIK_INPUT_PLUGINS_DIRECTORY%
if /i "%1"=="--fonts" echo %MAPNIK_FONTS_DIRECTORY%
goto exit

:help
echo mapnik-config.bat
echo Examples:
echo   --libs            : provide lib name for mapnik.dll
echo   --defines         : provide compiler defines needed for this mapnik build
echo   --dep-libs        : provide lib names of depedencies
echo   --ldflags         : provide lib paths to depedencies
echo   --cxxflags        : provide compiler flags
echo   --includes        : provide header paths for mapnik
echo   --dep-includes    : provide header paths for dependencies
echo   --input-plugins   : provide path to input plugins directory
echo   --fonts           : provide path to fonts directory
goto exit

:exit
goto :EOF

add static version of mapnik-config.bat for windows


PATH=C:\python26;C:\progra~1\7-zip;C:\progra~2\7-zip;%PATH%
rmdir /q /s dist\*.*
del /s /q dist\*.*
python setup.py py2exe
cd dist
#7z d namebench.zip jinja2\* dns\* 'graphy\*
7z d namebench.zip tcl\*.*
rmdir /s /q tcl\tcl8.5\tzdata tcl\tk8.5\demos
del tcl\tk8.5\images\*.eps
copy ..\README.txt .
7z a namebench_for_Windows.zip -r * >nul
namebench -x -O 8.8.8.8 -t5 -o test.html
start test.html

cd ..

rem Tool to assemble Windows builds
rem Requirements are 7-zip, py2exe, and FreeExtractor

PATH=C:\python27;C:\python26;C:\progra~1\7-zip;C:\progra~2\7-zip;%PATH%

rem ****** Clean out the old junk
rmdir /q /s dist\*.*
del /s /q dist\*.*

rem ****** Compile our executable and core zipfile
python setup.py py2exe

rem ****** Remove extras from core zipfile
cd dist
7z d namebench.zip tcl\*.*
rmdir /s /q tcl\tcl8.5\tzdata tcl\tk8.5\demos
del tcl\tk8.5\images\*.eps

rem ****** Final assembly of zipfile
copy ..\README.txt .
7z a namebench_for_Windows.zip -r * >nul

rem ****** Test assembled zipfile
namebench -x -O 8.8.8.8 -q5 -o test.html
start test.html

cd ..

Add comments to release_win.bat

Add comments to release_win.bat


@echo off
setlocal EnableDelayedExpansion

echo Waiting for the firmware flasher to exit.
:waitForExitLoop
tasklist /FI "IMAGENAME eq QMK Firmware Flasher.exe" 2>NUL | find /I /N "QMK Firmware Flasher.exe">NUL
if errorlevel 1 (
  goto continue
) else (
  sleep 1
  goto waitForExitLoop
)

:continue
cd %~dp0\resources

if exist app.asar.update (
  move /y app.asar app.asar.backup
  move /y app.asar.update app.asar
) else (
    echo Nothing to update.
)

cd ..
"QMK Firmware Flasher.exe"

add updater.bat

add updater.bat


@echo off
:: Copyright (c) 2012 - 2014, Andres Gomez Casanova (AngocA)
:: All rights reserved.
::
:: Redistribution and use in source and binary forms, with or without
:: modification, are permitted provided that the following conditions are met:
::
:: 1. Redistributions of source code must retain the above copyright notice,
::    this list of conditions and the following disclaimer.
:: 2. Redistributions in binary form must reproduce the above copyright notice,
::    this list of conditions and the following disclaimer in the documentation
::    and/or other materials provided with the distribution.
::
:: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
:: AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
:: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
:: ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
:: LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
:: CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
:: SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
:: INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
:: CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
:: ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
:: POSSIBILITY OF SUCH DAMAGE.

:: Checks if there is already a connection established
db2 connect > NUL
if %ERRORLEVEL% EQU 0 (
 goto version
) else (
 echo Please connect to a database before the execution of the installation.
 goto exit
)

:version
:: Sets the path.
if EXIST init.bat (
 call init.bat
)

:: Checks in which DB2 version the utility will be installed.
:: DB2 v10.1 is the default version.
if "%1" EQU "" (
 goto v10.1
)
if /I "%1" EQU "-v10.1" (
 goto v10.1
)
if /I "%1" EQU "-v9.7" (
 goto v9.7
)

:: DB2 v10.1.
:v10.1
echo Installing application for v10.1
db2 -tf %SRC_MAIN_CODE_PATH%\Tables.sql
db2 -tf %SRC_MAIN_CODE_PATH%\Objects.sql
db2 -td@ -f %SRC_MAIN_CODE_PATH%\Tools.sql
db2 -td@ -f %SRC_MAIN_CODE_PATH%\AdminHeader.sql
db2 -td@ -f %SRC_MAIN_CODE_PATH%\AdminBody.sql
db2 -td@ -f %SRC_MAIN_CODE_PATH%\LOG.sql
db2 -td@ -f %SRC_MAIN_CODE_PATH%\GET_LOGGER.sql
db2 -td@ -f %SRC_MAIN_CODE_PATH%\Trigger.sql

:: Temporal capabilities for tables.
if "%2" EQU "t" (
 echo Create table for Time Travel
 db2 -tf %SRC_MAIN_CODE_PATH%\Create_Tables_Time_Travel.sql
)
if "%1" EQU "t" (
 echo Create table for Time Travel
 db2 -tf %SRC_MAIN_CODE_PATH%\Create_Tables_Time_Travel.sql
)

goto exit

:: DB2 v9.7
:v9.7
echo Installing application for DB2 v9.7
db2 -tf %SRC_MAIN_CODE_PATH%\Tables_v9_7.sql
db2 -tf %SRC_MAIN_CODE_PATH%\Objects.sql
db2 -td@ -f %SRC_MAIN_CODE_PATH%\Tools.sql
db2 -td@ -f %SRC_MAIN_CODE_PATH%\AdminHeader.sql
db2 -td@ -f %SRC_MAIN_CODE_PATH%\AdminBody.sql
db2 -td@ -f %SRC_MAIN_CODE_PATH%\LOG.sql
db2 -td@ -f %SRC_MAIN_CODE_PATH%\GET_LOGGER_v9_7.sql
db2 -td@ -f %SRC_MAIN_CODE_PATH%\Trigger.sql

goto exit

:exit

@echo off
:: Copyright (c) 2012 - 2014, Andres Gomez Casanova (AngocA)
:: All rights reserved.
::
:: Redistribution and use in source and binary forms, with or without
:: modification, are permitted provided that the following conditions are met:
::
:: 1. Redistributions of source code must retain the above copyright notice,
::    this list of conditions and the following disclaimer.
:: 2. Redistributions in binary form must reproduce the above copyright notice,
::    this list of conditions and the following disclaimer in the documentation
::    and/or other materials provided with the distribution.
::
:: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
:: AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
:: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
:: ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
:: LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
:: CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
:: SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
:: INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
:: CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
:: ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
:: POSSIBILITY OF SUCH DAMAGE.

:: Checks if there is already a connection established
db2 connect > NUL
if %ERRORLEVEL% EQU 0 (
 goto version
) else (
 echo Please connect to a database before the execution of the installation.
 goto exit
)

:version
:: Sets the path.
if EXIST init.bat (
 call init.bat
)

:: Checks in which DB2 version the utility will be installed.
:: DB2 v10.1 is the default version.
if "%1" EQU "" (
 goto v10.1
)
if /I "%1" EQU "-v10.1" (
 goto v10.1
)
if /I "%1" EQU "-v9.7" (
 goto v9.7
)

:: DB2 v10.1.
:v10.1
echo Installing application for v10.1
db2 -tsC_MAIN_CODE_PATH%\Tables.sql
db2 -tsf %SRC_MAIN_CODE_PATH%\Objects.sql
db2 -td@ -sf %SRC_MAIN_CODE_PATH%\Tools.sql
db2 -td@ -sf %SRC_MAIN_CODE_PATH%\AdminHeader.sql
db2 -td@ -sf %SRC_MAIN_CODE_PATH%\AdminBody.sql
db2 -td@ -sf %SRC_MAIN_CODE_PATH%\LOG.sql
db2 -td@ -sf %SRC_MAIN_CODE_PATH%\GET_LOGGER.sql
db2 -td@ -sf %SRC_MAIN_CODE_PATH%\Trigger.sql

:: Temporal capabilities for tables.
if "%2" EQU "t" (
 echo Create table for Time Travel
 db2 -tf %SRC_MAIN_CODE_PATH%\Create_Tables_Time_Travel.sql
)
if "%1" EQU "t" (
 echo Create table for Time Travel
 db2 -tf %SRC_MAIN_CODE_PATH%\Create_Tables_Time_Travel.sql
)

goto exit

:: DB2 v9.7
:v9.7
echo Installing application for DB2 v9.7
db2 -tsf %SRC_MAIN_CODE_PATH%\Tables_v9_7.sql
db2 -tsf %SRC_MAIN_CODE_PATH%\Objects.sql
db2 -td@ -sf %SRC_MAIN_CODE_PATH%\Tools.sql
db2 -td@ -sf %SRC_MAIN_CODE_PATH%\AdminHeader.sql
db2 -td@ -sf %SRC_MAIN_CODE_PATH%\AdminBody.sql
db2 -td@ -sf %SRC_MAIN_CODE_PATH%\LOG.sql
db2 -td@ -sf %SRC_MAIN_CODE_PATH%\GET_LOGGER_v9_7.sql
db2 -td@ -sf %SRC_MAIN_CODE_PATH%\Trigger.sql

goto exit

:exit

Stop when error

Stop when error


@ECHO OFF
ECHO.
ECHO Downloading Libbitcoin Explorer dependencies from NuGet
CALL nuget.exe install ..\vs2013\bitcoin-explorer\packages.config
CALL nuget.exe install ..\vs2013\libbitcoin-explorer\packages.config
CALL nuget.exe install ..\vs2013\libbitcoin-explorer-test\packages.config
ECHO.
CALL buildbase.bat ..\vs2013\libbitcoin-explorer.sln 12
ECHO.
PAUSE

@ECHO OFF
ECHO.
ECHO Downloading Libbitcoin Explorer dependencies from NuGet
CALL nuget.exe install ..\vs2013\bx\packages.config
CALL nuget.exe install ..\vs2013\libbitcoin-explorer\packages.config
CALL nuget.exe install ..\vs2013\libbitcoin-explorer-test\packages.config
ECHO.
CALL buildbase.bat ..\vs2013\libbitcoin-explorer.sln 12
ECHO.
PAUSE

Update bx path for nuget refresh.

Update bx path for nuget refresh.


@echo off

@rem Modified version of vcbuild.bat from Node

@rem Ensure environment properly setup
if not defined SHIELDBATTERY_PATH goto env-error

@rem Process arguments.
set config=Release
set target=Build
set nobuild=
set noprojgen=

:next-arg
if "%1"=="" goto args-done
if /i "%1"=="debug"         set config=Debug&goto arg-ok
if /i "%1"=="release"       set config=Release&goto arg-ok
if /i "%1"=="noprojgen"     set noprojgen=1&goto arg-ok
if /i "%1"=="nobuild"       set nobuild=1&goto arg-ok

echo Warning: ignoring invalid command line option `%1`.

:arg-ok
:arg-ok
shift
goto next-arg

:args-done

:project-gen
@rem Skip project generation if requested.
if defined noprojgen goto msbuild

@rem Generate the VS project.
SETLOCAL
  if defined VS110COMNTOOLS call "%VS110COMNTOOLS%\VCVarsQueryRegistry.bat"
  call "%~dp0\deps\node\vcbuild.bat" ia32 noetw noperfctr nobuild nosign
  if not exist "%~dp0\deps\node\config.gypi" goto create-msvs-files-failed
  cd "%~dp0"
  python "deps\node\tools\gyp\gyp" --depth=. -f msvs --generator-output=. -G msvs_version=auto -Ideps\node\common.gypi -Ideps\node\config.gypi -Dlibrary=static_library -Dtarget_arch=ia32 -Dcomponent=static_library shieldbattery.gyp
  if errorlevel 1 goto create-msvs-files-failed
  if not exist shieldbattery.sln goto create-msvs-files-failed
  echo Shieldbattery project files generated.
ENDLOCAL

:msbuild
@rem Skip build if requested.
if defined nobuild goto exit

@rem Look for Visual Studio 2012
if not defined VS110COMNTOOLS goto msbuild-not-found
if not exist "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-not-found
call "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat"
if not defined VCINSTALLDIR goto msbuild-not-found
set GYP_MSVS_VERSION=2012
goto msbuild-found

:msbuild-not-found
echo Build skipped. To build, this file needs to run from VS cmd prompt.
goto exit

:msbuild-found
@rem Build the sln with msbuild.
msbuild shieldbattery.sln /m /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
if errorlevel 1 goto exit
goto link-modules

:create-msvs-files-failed
echo Failed to create vc project files for shieldbattery.
goto exit

:link-modules
@rem Link up the native modules inside the js directory
cd "%~dp0\node-psi"
call npm link
if errorlevel 1 goto linking-failed
cd "%~dp0\node-bw"
call npm link
if errorlevel 1 goto linking-failed
cd "%~dp0\js"
call npm link psi
if errorlevel 1 goto linking-failed
call npm link bw
if errorlevel 1 goto linking-failed
call npm install
if errorlevel 1 goto linking-failed
rmdir "%SHIELDBATTERY_PATH%\js"
mklink /D "%SHIELDBATTERY_PATH%\js" "%~dp0\js"
echo JS modules linked.
goto exit

:linking-failed
echo Linking JS modules failed, please check command output and ensure node.js is installed and setup on your PATH.
goto exit

:env-error
echo Necessary environment variables not set! Please set SHIELDBATTERY_PATH and re-run this script.
goto exit

:help
echo vcbuild.bat [debug/release] [noprojgen] [nobuild]
echo Examples:
echo   vcbuild.bat                : builds release build
echo   vcbuild.bat debug          : builds debug build
goto exit

:exit
cd "%~dp0"
goto :EOF

@echo off

@rem Modified version of vcbuild.bat from Node

@rem Ensure environment properly setup
if not defined SHIELDBATTERY_PATH goto env-error

@rem Process arguments.
set config=Release
set target=Build
set nobuild=
set noprojgen=

:next-arg
if "%1"=="" goto args-done
if /i "%1"=="debug"         set config=Debug&goto arg-ok
if /i "%1"=="release"       set config=Release&goto arg-ok
if /i "%1"=="noprojgen"     set noprojgen=1&goto arg-ok
if /i "%1"=="nobuild"       set nobuild=1&goto arg-ok

echo Warning: ignoring invalid command line option `%1`.

:arg-ok
:arg-ok
shift
goto next-arg

:args-done

:project-gen
@rem Skip project generation if requested.
if defined noprojgen goto msbuild

@rem Look for Visual Studio 2012
if not defined VS110COMNTOOLS goto msbuild-not-found
if not exist "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-not-found
call "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat"
if not defined VCINSTALLDIR goto msbuild-not-found
set GYP_MSVS_VERSION=2012

@rem Generate the VS project.
SETLOCAL
  if defined VS110COMNTOOLS call "%VS110COMNTOOLS%\VCVarsQueryRegistry.bat"
  call "%~dp0\deps\node\vcbuild.bat" ia32 noetw noperfctr nobuild nosign
  if not exist "%~dp0\deps\node\config.gypi" goto create-msvs-files-failed
  cd "%~dp0"
  python "deps\node\tools\gyp\gyp" --depth=. -f msvs --generator-output=. -G msvs_version=auto -Ideps\node\common.gypi -Ideps\node\config.gypi -Dlibrary=static_library -Dtarget_arch=ia32 -Dcomponent=static_library shieldbattery.gyp
  if errorlevel 1 goto create-msvs-files-failed
  if not exist shieldbattery.sln goto create-msvs-files-failed
  echo Shieldbattery project files generated.
ENDLOCAL
goto do-build

:msbuild
@rem Skip build if requested.
if defined nobuild goto exit

:msbuild-not-found
echo Build skipped. To build, this file needs to run from VS cmd prompt.
goto exit

:do-build
@rem Build the sln with msbuild.
msbuild shieldbattery.sln /m /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
if errorlevel 1 goto exit
goto link-modules

:create-msvs-files-failed
echo Failed to create vc project files for shieldbattery.
goto exit

:link-modules
@rem Link up the native modules inside the js directory
cd "%~dp0\node-psi"
call npm link
if errorlevel 1 goto linking-failed
cd "%~dp0\node-bw"
call npm link
if errorlevel 1 goto linking-failed
cd "%~dp0\js"
call npm link psi
if errorlevel 1 goto linking-failed
call npm link bw
if errorlevel 1 goto linking-failed
call npm install
if errorlevel 1 goto linking-failed
rmdir "%SHIELDBATTERY_PATH%\js"
mklink /D "%SHIELDBATTERY_PATH%\js" "%~dp0\js"
echo JS modules linked.
goto exit

:linking-failed
echo Linking JS modules failed, please check command output and ensure node.js is installed and setup on your PATH.
goto exit

:env-error
echo Necessary environment variables not set! Please set SHIELDBATTERY_PATH and re-run this script.
goto exit

:help
echo vcbuild.bat [debug/release] [noprojgen] [nobuild]
echo Examples:
echo   vcbuild.bat                : builds release build
echo   vcbuild.bat debug          : builds debug build
goto exit

:exit
cd "%~dp0"
goto :EOF

Change vcbuild to determine VS version before gyping.