@ECHO OFF

REM GIT Tag and Build nuget package

IF "%1" == "" GOTO SyntaxError
IF "%2" == "" GOTO SyntaxError

REM main code
git tag -a %1 -m "%2"
cd GFDN.ThaiBahtText
nuget pack GFDN.ThaiBahtText.csproj ^
   -Version %1 ^
	 -Prop Configuration=Release ^
	 -OutputDirectory "Nuget Packages"
cd ..
@ECHO.
@ECHO Push to GitHub
git push origin --tags
@ECHO.
@ECHO Push to NuGet
nuget push "GFDN.ThaiBahtText\NuGet Packages\ThaiBahtText.%1.nupkg"
GOTO End

:SyntaxError
@ECHO Usage syntax:
@ECHO.
@ECHO nugetpack tag_number tag_name
@ECHO.
@ECHO Sample:
@ECHO   nugetpack 0.1 baby-peter
GOTO End

:End
@ECHO ON

@ECHO OFF

REM GIT Tag and Build nuget package

IF "%1" == "" GOTO SyntaxError
IF "%2" == "" GOTO SyntaxError

REM main code
git tag -a %1 -m "%2"
cd GFDN.ThaiBahtText
nuget pack GFDN.ThaiBahtText.csproj ^
   -Version %1 ^
	 -Prop Configuration=Release ^
	 -OutputDirectory "Nuget Packages"
cd ..
@ECHO.
@ECHO Push to GitHub
git push origin master
git push origin --tags
@ECHO.
@ECHO Push to NuGet
nuget push "GFDN.ThaiBahtText\NuGet Packages\ThaiBahtText.%1.nupkg"
GOTO End

:SyntaxError
@ECHO Usage syntax:
@ECHO.
@ECHO nugetpack tag_number tag_name
@ECHO.
@ECHO Sample:
@ECHO   nugetpack 0.1 baby-peter
GOTO End

:End
@ECHO ON

Make sure that push all updates before tagging them


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

SETLOCAL ENABLEEXTENSIONS
SET me=%~n0
SET parent_dir=%~dp0

SET /A ERROR_INSTALLER=1
SET /A ERROR_RECOVERY=2
SET /A ERROR_INSTALLER_MISMATCH=4
SET /A ERROR_UNLOCK=8

ECHO.
ECHO Welcome to the Maru installer!
ECHO.
ECHO In order to install Maru you will need to:
ECHO.
ECHO 1. Connect your device to your computer over USB
ECHO.
ECHO 2. Enable USB Debugging on your device:
ECHO.
ECHO    1.  Go to the Settings app and scroll down to
ECHO        the System section
ECHO.
ECHO        NOTE: If you already have "Developer options"
ECHO        under System then go directly to #5
ECHO.
ECHO    2.  Tap on "About phone"
ECHO    3.  Tap "Build number" 7 times until you get a message
ECHO        that says you are now a developer
ECHO    4.  Go back to the main Settings app
ECHO    5.  Tap on "Developer options"
ECHO    6.  Ensure that "USB debugging" is enabled
ECHO    7.  Tap "OK" if you see a dialog asking you to allow
ECHO        USB Debugging for your computer's RSA key fingerprint
ECHO.
ECHO WARNING: Installing Maru will wipe all your personal data
ECHO so make sure you first back-up anything important!
ECHO.

SET /P confirm="Are you ready to install Maru? (yes/no): "
ECHO.
IF NOT "%confirm%"=="yes" (
    ECHO Aborting installation.
    CALL :mexit 0
)

ECHO Excellent, let's get Maru up and running on your device.
ECHO.

PUSHD %parent_dir%

ECHO Checking for a complete installation zip...
CALL :check_zip
IF /I "%ERRORLEVEL%" NEQ "0" (
    ECHO.
    ECHO Hmm, looks like your installer is missing a few things.
    ECHO.
    ECHO Are you running this install script outside the directory
    ECHO you unzipped Maru in?
    ECHO.
    ECHO If that isn't it, please try downloading the installer again.
    ECHO.
    CALL :mexit %ERROR_INSTALLER%
)

CALL :check_recovery
IF /I "%ERRORLEVEL%" EQU "0" (
    GOTO :bootloader
)

:recovery_adb
ECHO Rebooting your device into recovery mode...
adb reboot bootloader > NUL 2>&1
IF /I "%ERRORLEVEL%" NEQ "0" (
    CALL :echo_device_not_found
    CALL :mexit %ERROR_RECOVERY%
)
PING.EXE -n 7 127.0.0.1 > NUL

CALL :check_recovery
IF /I "%ERRORLEVEL%" NEQ "0" (
    CALL :echo_device_not_found
    CALL :mexit %ERROR_RECOVERY%
)

:bootloader
ECHO Checking that this is the correct installer for your device...
(SET product=)
CALL :fastboot_get_product product
ECHO   Your device reports itself as "%product%"
FINDSTR "%product%" android-info.txt > NUL
IF /I "%ERRORLEVEL%" NEQ "0" (
    CALL :echo_installer_mismatch
    CALL :mexit %ERROR_INSTALLER_MISMATCH%
)

ECHO Checking bootloader lock state...
CALL :check_unlocked %product%
IF /I "%ERRORLEVEL%" EQU "0" (
    GOTO :flash
)

ECHO Unlocking bootloader, you will need to confirm this on your device...
fastboot oem unlock > NUL 2>&1
CALL :check_unlocked %product%
IF /I "%ERRORLEVEL%" EQU "0" (
    CALL :echo_unlock_reboot
    fastboot reboot > NUL 2>&1
    CALL :mexit 0
) ELSE (
    ECHO Failed to unlock bootloader!
    CALL :fatal
    CALL :mexit %ERROR_UNLOCK%
)

:flash
:: ECHO BAIL!
:: PAUSE
:: EXIT /B 0

ECHO.
ECHO Installing Maru, please keep your device connected...
fastboot format cache
fastboot flash boot boot.img
fastboot flash system system.img
fastboot format userdata

ECHO.
ECHO Installation complete!
ECHO.
ECHO The first boot will take 2-3 mins as Maru sets up
ECHO your device so please be patient.
ECHO.
ECHO Rebooting into Maru...
fastboot reboot > NUL 2>&1
CALL :mexit 0

:: functions

:check_zip
IF NOT EXIST "android-info.txt" EXIT /B 1
IF NOT EXIST "boot.img" EXIT /B 1
IF NOT EXIST "system.img" EXIT /B 1
EXIT /B 0

:check_recovery
FOR /F "tokens=* USEBACKQ" %%F IN (`fastboot devices`) DO (
    SET recovery_check=fastboot devices
)
IF "%recovery_check%"=="" (EXIT /B 1)
EXIT /B 0

:fastboot_get_product
FOR /F "tokens=2 delims= " %%G IN (
    'fastboot getvar product 2^>^&1 ^| FINDSTR "product"'
) DO (
    SET %1=%%G
)
EXIT /B 0

:check_unlocked
SET _device=%1
IF "%_device%"=="flo" (
    REM flo shows incorrect lock state in oem device-info, so use this workaround
    fastboot getvar lock_state 2>&1 | FINDSTR "lock_state" | FINDSTR "unlocked"
) ELSE (
    REM this should work for most devices
    fastboot oem device-info 2>&1 | FINDSTR "unlocked" | FINDSTR "true"
)
IF /I "%ERRORLEVEL%" NEQ "0" (EXIT /B 1)
EXIT /B 0

:echo_device_not_found
ECHO.
ECHO Hmm, your device can't be found.
ECHO.
ECHO Please ensure that:
ECHO.
ECHO 1. Your device is connected to your computer over USB
ECHO 2. You have USB Debugging enabled, see above for instructions
ECHO 3. You unlock your device and tap "OK" if you see a dialog asking you
ECHO    to allow USB Debugging for your computer's RSA key fingerprint
ECHO 4. You have the Google USB Driver properly installed for your device
ECHO    as described in HELP.txt (this is the main source of problems on Windows!)
ECHO.
ECHO Go ahead and re-run the installer when you're ready.
ECHO.
EXIT /B 0

:echo_installer_mismatch
ECHO.
ECHO Woops, looks like you are using the wrong installer for your device!
ECHO.
ECHO Please download the correct installer, making sure that your device codename
ECHO is listed in the zip file name.
ECHO.
EXIT /B 0

:echo_unlock_reboot
ECHO.
ECHO Successfully unlocked bootloader!
ECHO.
ECHO Your device will need to reboot before continuing. It will factory
ECHO reset, so this reboot can take a few minutes longer than usual.
ECHO.
ECHO Please re-run this script after your device completely boots up
ECHO and you have re-enabled USB Debugging.
ECHO.
EXIT /B 0

:fatal
ECHO.
ECHO Yikes, something went wrong with the installation. We're sorry.
ECHO.
ECHO Please contact us at hello@maruos.com with the issue you are facing
ECHO and we'll personally walk you through the install process.
ECHO.
EXIT /B 0

:mexit
ECHO.
ECHO Press any key to exit...
PAUSE > NUL
POPD
EXIT %1

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

SETLOCAL ENABLEEXTENSIONS
SET me=%~n0
SET parent_dir=%~dp0

SET /A ERROR_INSTALLER=1
SET /A ERROR_BOOTLOADER=2
SET /A ERROR_INSTALLER_MISMATCH=4
SET /A ERROR_UNLOCK=8

ECHO.
ECHO Welcome to the Maru installer!
ECHO.
ECHO In order to install Maru you will need to:
ECHO.
ECHO 1. Connect your device to your computer over USB
ECHO.
ECHO 2. Enable USB Debugging on your device:
ECHO.
ECHO    1.  Go to the Settings app and scroll down to
ECHO        the System section
ECHO.
ECHO        NOTE: If you already have "Developer options"
ECHO        under System then go directly to #5
ECHO.
ECHO    2.  Tap on "About phone"
ECHO    3.  Tap "Build number" 7 times until you get a message
ECHO        that says you are now a developer
ECHO    4.  Go back to the main Settings app
ECHO    5.  Tap on "Developer options"
ECHO    6.  Ensure that "USB debugging" is enabled
ECHO    7.  Tap "OK" if you see a dialog asking you to allow
ECHO        USB Debugging for your computer's RSA key fingerprint
ECHO.
ECHO WARNING: Installing Maru will wipe all your personal data
ECHO so make sure you first back-up anything important!
ECHO.

SET /P confirm="Are you ready to install Maru? (yes/no): "
ECHO.
IF NOT "%confirm%"=="yes" (
    ECHO Aborting installation.
    CALL :mexit 0
)

ECHO Excellent, let's get Maru up and running on your device.
ECHO.

PUSHD %parent_dir%

ECHO Checking for a complete installation zip...
CALL :check_zip
IF /I "%ERRORLEVEL%" NEQ "0" (
    ECHO.
    ECHO Hmm, looks like your installer is missing a few things.
    ECHO.
    ECHO Are you running this install script outside the directory
    ECHO you unzipped Maru in?
    ECHO.
    ECHO If that isn't it, please try downloading the installer again.
    ECHO.
    CALL :mexit %ERROR_INSTALLER%
)

CALL :check_bootloader
IF /I "%ERRORLEVEL%" EQU "0" (
    GOTO :bootloader
)

:bootloader_adb
ECHO Rebooting your device into bootloader...
adb reboot bootloader > NUL 2>&1
IF /I "%ERRORLEVEL%" NEQ "0" (
    CALL :echo_device_not_found
    CALL :mexit %ERROR_BOOTLOADER%
)
PING.EXE -n 7 127.0.0.1 > NUL

CALL :check_bootloader
IF /I "%ERRORLEVEL%" NEQ "0" (
    CALL :echo_device_not_found
    CALL :mexit %ERROR_BOOTLOADER%
)

:bootloader
ECHO Checking that this is the correct installer for your device...
(SET product=)
CALL :fastboot_get_product product
ECHO   Your device reports itself as "%product%"
FINDSTR "%product%" android-info.txt > NUL
IF /I "%ERRORLEVEL%" NEQ "0" (
    CALL :echo_installer_mismatch
    CALL :mexit %ERROR_INSTALLER_MISMATCH%
)

ECHO Checking bootloader lock state...
CALL :check_unlocked %product%
IF /I "%ERRORLEVEL%" EQU "0" (
    GOTO :flash
)

ECHO Unlocking bootloader, you will need to confirm this on your device...
fastboot oem unlock > NUL 2>&1
CALL :check_unlocked %product%
IF /I "%ERRORLEVEL%" EQU "0" (
    CALL :echo_unlock_reboot
    fastboot reboot > NUL 2>&1
    CALL :mexit 0
) ELSE (
    ECHO Failed to unlock bootloader!
    CALL :fatal
    CALL :mexit %ERROR_UNLOCK%
)

:flash
:: ECHO BAIL!
:: PAUSE
:: EXIT /B 0

ECHO.
ECHO Installing Maru, please keep your device connected...
fastboot format cache
fastboot flash boot boot.img
fastboot flash system system.img
fastboot format userdata

ECHO.
ECHO Installation complete!
ECHO.
ECHO The first boot will take 2-3 mins as Maru sets up
ECHO your device so please be patient.
ECHO.
ECHO Rebooting into Maru...
fastboot reboot > NUL 2>&1
CALL :mexit 0

:: functions

:check_zip
IF NOT EXIST "android-info.txt" EXIT /B 1
IF NOT EXIST "boot.img" EXIT /B 1
IF NOT EXIST "system.img" EXIT /B 1
EXIT /B 0

:check_bootloader
FOR /F "tokens=*" %%G IN ('fastboot devices') DO (
    SET bootloader_check=true
)
IF "%bootloader_check%"=="" (EXIT /B 1)
EXIT /B 0

:fastboot_get_product
FOR /F "tokens=2 delims= " %%G IN (
    'fastboot getvar product 2^>^&1 ^| FINDSTR "product"'
) DO (
    SET %1=%%G
)
EXIT /B 0

:check_unlocked
SET _device=%1
IF "%_device%"=="flo" (
    REM flo shows incorrect lock state in oem device-info, so use this workaround
    fastboot getvar lock_state 2>&1 | FINDSTR "lock_state" | FINDSTR "unlocked"
) ELSE (
    REM this should work for most devices
    fastboot oem device-info 2>&1 | FINDSTR "unlocked" | FINDSTR "true"
)
IF /I "%ERRORLEVEL%" NEQ "0" (EXIT /B 1)
EXIT /B 0

:echo_device_not_found
ECHO.
ECHO Hmm, your device can't be found.
ECHO.
ECHO Please ensure that:
ECHO.
ECHO 1. Your device is connected to your computer over USB
ECHO 2. You have USB Debugging enabled, see above for instructions
ECHO 3. You unlock your device and tap "OK" if you see a dialog asking you
ECHO    to allow USB Debugging for your computer's RSA key fingerprint
ECHO 4. You have the Google USB Driver properly installed for your device
ECHO    as described in HELP.txt (this is the main source of problems on Windows!)
ECHO.
ECHO Go ahead and re-run the installer when you're ready.
ECHO.
EXIT /B 0

:echo_installer_mismatch
ECHO.
ECHO Woops, looks like you are using the wrong installer for your device!
ECHO.
ECHO Please download the correct installer, making sure that your device codename
ECHO is listed in the zip file name.
ECHO.
EXIT /B 0

:echo_unlock_reboot
ECHO.
ECHO Successfully unlocked bootloader!
ECHO.
ECHO Your device will need to reboot before continuing. It will factory
ECHO reset, so this reboot can take a few minutes longer than usual.
ECHO.
ECHO Please re-run this script after your device completely boots up
ECHO and you have re-enabled USB Debugging.
ECHO.
EXIT /B 0

:fatal
ECHO.
ECHO Yikes, something went wrong with the installation. We're sorry.
ECHO.
ECHO Please contact us at hello@maruos.com with the issue you are facing
ECHO and we'll personally walk you through the install process.
ECHO.
EXIT /B 0

:mexit
ECHO.
ECHO Press any key to exit...
PAUSE > NUL
POPD
EXIT %1

windows: Swap recovery -> bootloader in user messages

Signed-off-by: Preetam D'Souza <217a41a8be005ac7f6a1c1c5a42b81b8928ed037@gmail.com>


:start

cls

call "C:\Program Files\Dart\dart-sdk\bin\dart.exe" C:\Users\derri\Documents\draw2\bin\server\server.dart --clientFiles "../build/web/"

pause
pause

goto start

:start

cls

call "C:\Program Files\Dart\dart-sdk\bin\dart.exe" C:\Users\derri\Desktop\draw2\bin\server\server.dart --clientFiles "../build/web/"

pause
pause

goto start

update build server path

update build server path


echo ON

set GITHUB_USERNAME=StatisKit
set GITHUB_REPOSITORY=Misc
set DEFAULT_ANACONDA_BUILD_RECIPES=libboost python-scons python-gitpython
set DEFAULT_ANACONDA_CHANNELS=statiskit conda-forge

if "%ANACONDA_CHANNELS%" == "" (
    set ANACONDA_CHANNELS=%DEFAULT_ANACONDA_CHANNELS%
) else (
    echo "Channels used: "%ANACONDA_CHANNELS%
)

set ANACONDA_CHANNEL_FLAGS=
for %%i in (%ANACONDA_CHANNELS%) do (
    set "!ANACONDA_CHANNEL_FLAGS=%ANACONDA_CHANNEL_FLAGS% -c %%i!"
)

if "%ANACONDA_BUILD_RECIPES%" == "" (
    set ANACONDA_BUILD_RECIPES=%DEFAULT_ANACONDA_BUILD_RECIPES%
) else (
    echo "Recipes to build: "%ANACONDA_BUILD_RECIPES%
)

echo ON

if not exist ..\..\%GITHUB_REPOSITORY% (
    if exist %GITHUB_REPOSITORY% (
        rmdir %GITHUB_REPOSITORY% /s /q
    )
    git clone https://github.com/%GITHUB_USERNAME%/%GITHUB_REPOSITORY%.git
    if %errorlevel% neq 0 (
        exit /b %errorlevel%
    )
    cd %GITHUB_REPOSITORY%/conda
)

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

for %%i in (%ANACONDA_BUILD_RECIPES%) do (
    conda build %%i %ANACONDA_CHANNEL_FLAGS% %ANACONDA_BUILD_FLAGS%
    if %errorlevel% neq 0 (
        if exist %GITHUB_REPOSITORY% (
            rmdir %GITHUB_REPOSITORY% /s /q
        )
        exit /b %errorlevel%
    )
)

if exist %GITHUB_REPOSITORY% (
    rmdir %GITHUB_REPOSITORY% /s /q
)

ECHO OFF

echo ON

set GITHUB_USERNAME=StatisKit
set GITHUB_REPOSITORY=Misc
set DEFAULT_ANACONDA_BUILD_RECIPES=libboost python-scons python-gitpython
set DEFAULT_ANACONDA_CHANNELS=statiskit conda-forge

if "%ANACONDA_CHANNELS%" == "" (
    set ANACONDA_CHANNELS=%DEFAULT_ANACONDA_CHANNELS%
) else (
    echo "Channels used: "%ANACONDA_CHANNELS%
)

set ANACONDA_CHANNEL_FLAGS=
for %%i in (%ANACONDA_CHANNELS%) do (
    set "!ANACONDA_CHANNEL_FLAGS!=!%ANACONDA_CHANNEL_FLAGS%! -c %%i"
)

if "%ANACONDA_BUILD_RECIPES%" == "" (
    set ANACONDA_BUILD_RECIPES=%DEFAULT_ANACONDA_BUILD_RECIPES%
) else (
    echo "Recipes to build: "%ANACONDA_BUILD_RECIPES%
)

echo ON

if not exist ..\..\%GITHUB_REPOSITORY% (
    if exist %GITHUB_REPOSITORY% (
        rmdir %GITHUB_REPOSITORY% /s /q
    )
    git clone https://github.com/%GITHUB_USERNAME%/%GITHUB_REPOSITORY%.git
    if %errorlevel% neq 0 (
        exit /b %errorlevel%
    )
    cd %GITHUB_REPOSITORY%/conda
)

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

for %%i in (%ANACONDA_BUILD_RECIPES%) do (
    conda build %%i %ANACONDA_CHANNEL_FLAGS% %ANACONDA_BUILD_FLAGS%
    if %errorlevel% neq 0 (
        if exist %GITHUB_REPOSITORY% (
            rmdir %GITHUB_REPOSITORY% /s /q
        )
        exit /b %errorlevel%
    )
)

if exist %GITHUB_REPOSITORY% (
    rmdir %GITHUB_REPOSITORY% /s /q
)

ECHO OFF

Test bld.bat

Test bld.bat


@echo off
REM This is an example script to run ExtractLinkData.py
REM Syntax:
REM 		python ExtractLinkData.py [KEY STRING] [PARAMETER] [PATH(S) TO *.rpt FILE(S)] [PATH TO OUTPUT FILE AS *.csv]
REM Allowed parameters are: 'flow', 'velocity', 'depth', or 'capacity'"

REM Activate conda environment (with necessary packages installed)
call activate

REM Example of running ExtractLinkData.py
REM '^' is used only to split long lines here
python "..\utils\run_ExtractLinkData.py" "<<< Link c96 >>>" "flow" ^
"..\demo_catchment\out\SWMM_out\demo_catchment_adap.rpt" ^
"..\demo_catchment\out\SWMM_out\demo_catchment_rect.rpt" ^
"..\demo_catchment\out\SWMM_results\flow_timeseries.csv"

REM Deactivate conda environment
call deactivate

REM Wait for user input before closing terminal
pause

@echo off
REM This is an example script to run ExtractLinkData.py
REM Syntax:
REM 		python ExtractLinkData.py [KEY STRING] [PARAMETER] [PATH(S) TO *.rpt FILE(S)] [PATH TO OUTPUT FILE AS *.csv]
REM Allowed parameters are: 'flow', 'velocity', 'depth', or 'capacity'"

REM Activate conda environment (with necessary packages installed)
call activate

REM Example of running ExtractLinkData.py
REM '^' is used only to split long lines here
python "..\utils\ExtractLinkData.py" "<<< Link c96 >>>" "flow"^
 "..\demo_catchment\out\SWMM_out\demo_catchment_adap.rpt"^
 "..\demo_catchment\out\SWMM_out\demo_catchment_rect.rpt"^
 "..\demo_catchment\out\SWMM_results\flow_timeseries.csv"

REM Deactivate conda environment
call deactivate

REM Wait for user input before closing terminal
pause

Replace run_ExtractLinkData.bat

Replace run_ExtractLinkData.bat


### test_app.bat - 2013 - Carr Adrien ###
echo "Copyright company - 2013"
echo "Build : 10:00"
echo "version 1.2"

add partner name

add partner name


mkdir build
cd build

cmake ^
    -G "Ninja" ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DQPOASES_AVOID_LA_NAMING_CONFLICTS:BOOL=ON \
    -DBUILD_SHARED_LIBS:BOOL=ON ^
    -DBUILD_TESTING:BOOL=ON ^
    %SRC_DIR%
if errorlevel 1 exit 1

:: Build.
cmake --build . --config Release
if errorlevel 1 exit 1

:: Install.
cmake --build . --config Release --target install
if errorlevel 1 exit 1

:: Test.
ctest --output-on-failure -C Release
if errorlevel 1 exit 1

mkdir build
cd build

cmake ^
    -G "Ninja" ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DQPOASES_AVOID_LA_NAMING_CONFLICTS:BOOL=ON ^
    -DBUILD_SHARED_LIBS:BOOL=ON ^
    -DBUILD_TESTING:BOOL=ON ^
    %SRC_DIR%
if errorlevel 1 exit 1

:: Build.
cmake --build . --config Release
if errorlevel 1 exit 1

:: Install.
cmake --build . --config Release --target install
if errorlevel 1 exit 1

:: Test.
ctest --output-on-failure -C Release
if errorlevel 1 exit 1

Update bld.bat

Update bld.bat


@setlocal
@set TSCOMPILE=cl /nologo /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DWIN32 /DUSE_DL=1
@set TSLINK=link /nologo
@set TSLIB=lib /nologo

@if "%1" == "static" goto STATIC
@if not exist bin\ (
  mkdir bin
)

%TSCOMPILE% /MT scheme.c dynload.c
%TSLINK% /out:bin\tinyscheme.exe scheme.obj dynload.obj

%TSCOMPILE% /MDd scheme.c dynload.c
%TSLINK% /out:bin\tinyscheme_d.exe scheme.obj dynload.obj

@goto END

:STATIC
@if not exist lib\ (
  mkdir lib
)

%TSCOMPILE% /DSTANDALONE=0 /MT scheme.c dynload.c
%TSLIB% /out:lib\tinyscheme.lib scheme.obj dynload.obj

%TSCOMPILE% /DSTANDALONE=0 /MDd scheme.c dynload.c
%TSLIB% /out:lib\tinyscheme_d.lib scheme.obj dynload.obj

:END
del scheme.obj dynload.obj

Add a batch file to build on Windows with MSVC.


@echo off

REM Copyright (C) 2017 The Qt Company Ltd.
REM Contact: https://www.qt.io/licensing/
REM
REM This file is part of Qbs.
REM
REM $QT_BEGIN_LICENSE:LGPL$
REM Commercial License Usage
REM Licensees holding valid commercial Qt licenses may use this file in
REM accordance with the commercial license agreement provided with the
REM Software or, alternatively, in accordance with the terms contained in
REM a written agreement between you and The Qt Company. For licensing terms
REM and conditions see https://www.qt.io/terms-conditions. For further
REM information use the contact form at https://www.qt.io/contact-us.
REM
REM GNU Lesser General Public License Usage
REM Alternatively, this file may be used under the terms of the GNU Lesser
REM General Public License version 3 as published by the Free Software
REM Foundation and appearing in the file LICENSE.LGPL3 included in the
REM packaging of this file. Please review the following information to
REM ensure the GNU Lesser General Public License version 3 requirements
REM will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
REM
REM GNU General Public License Usage
REM Alternatively, this file may be used under the terms of the GNU
REM General Public License version 2.0 or (at your option) the GNU General
REM Public license version 3 or any later version approved by the KDE Free
REM Qt Foundation. The licenses are as published by the Free Software
REM Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
REM included in the packaging of this file. Please review the following
REM information to ensure the GNU General Public License requirements will
REM be met: https://www.gnu.org/licenses/gpl-2.0.html and
REM https://www.gnu.org/licenses/gpl-3.0.html.
REM
REM $QT_END_LICENSE$

setlocal enabledelayedexpansion || exit /b
if not exist VERSION ( echo This script must be run from the qbs source directory 1>&2 && exit /b 1 )
for /f %%j in (VERSION) do ( set "version=!version!%%j," )
set "version=%version:~0,-1%"

set builddir=%TEMP%\qbs-release-%version%
if exist "%builddir%" ( del /s /q "%builddir%" || exit /b )

qbs setup-toolchains --settings-dir "%builddir%\.settings" --detect || exit /b

if exist "%QTDIR%" (
    qbs setup-qt --settings-dir "%builddir%\.settings"^
     "%QTDIR%\bin\qmake.exe" qt || exit /b
) else (
    echo QTDIR environment variable not set or does not exist: %QTDIR%
    exit /b 1
)
if exist "%QTDIR64%" (
    qbs setup-qt --settings-dir "%builddir%\.settings"^
     "%QTDIR64%\bin\qmake.exe" qt64 || exit /b
) else (
    echo QTDIR64 environment variable not set or does not exist: %QTDIR64%
    exit /b 1
)

REM Work around QBS-1142, where symlinks to UNC named paths aren't resolved
REM properly, for example if this command is being run in a Docker container
REM where the current directory is a symlink
(robocopy "%CD%" "%builddir%\source" /e /njh /njs /ndl /nc /ns /xd .git) ^& IF %ERRORLEVEL% GTR 1 exit %ERRORLEVEL%

qbs build --settings-dir "%builddir%\.settings"^
 -f "%builddir%\source" -d "%builddir%\build"^
 -p dist qbs.buildVariant:release dist.includeTopLevelDir:true^
 release "qbs.installRoot:%builddir%\qbs-windows-x86-%version%" profile:qt^
 release-64 "qbs.installRoot:%builddir%\qbs-windows-x86_64-%version%" profile:qt64 || exit /b

copy /y "%builddir%\build\release\qbs-windows-x86-%version%.zip" dist || exit /b
copy /y "%builddir%\build\release-64\qbs-windows-x86_64-%version%.zip" dist || exit /b

Add a script to create the release packages for Windows

This is a simple script which invokes a build of Qbs using the
specific configuration we intend to use for creating official
Windows release packages. It only requires an existing qbs.exe in
the PATH as well as the QTDIR and QTDIR64 environment variables set
to 32-bit and 64-bit installations of Qt, respectively. It does not
use or modify the current environment outside of temporary
directories.

The intent is to use this script in conjunction with a Docker
container although that is not required; instructions for using
which will follow in a subsequent patch.

Change-Id: I3f150d53c5b4afffdb4d5f5f7d64bf322b263a78
Reviewed-by: Christian Kandeler <3aa99dcdd3f0cac61fb81c2a11771c0cc2497607@qt.io>


:<<"::WINDOWS_ONLY"
@echo off
:: Copyright 2020 The Pigweed Authors
::
:: Licensed under the Apache License, Version 2.0 (the "License"); you may not
:: use this file except in compliance with the License. You may obtain a copy of
:: the License at
::
::     https://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
:: WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
:: License for the specific language governing permissions and limitations under
:: the License.
::WINDOWS_ONLY
:; echo "ERROR: Attempting to run Windows .bat from a Unix/POSIX shell!"
:; echo "Instead, run the following command."
:; echo ""
:; echo "    source ./bootstrap.sh"
:; echo ""
:<<"::WINDOWS_ONLY"

:: Pigweed Windows environment setup.

:: If PW_CHECKOUT_ROOT is set, use it. Users should not set this variable.
:: It's used because when one batch script invokes another the Powershell magic
:: below doesn't work. To reinforce that users should not be using
:: PW_CHECKOUT_ROOT, it is cleared here after it is used, and other pw tools
:: will complain if they see that variable set.
:: TODO(mohrr) find out a way to do this without PW_CHECKOUT_ROOT.
if "%PW_CHECKOUT_ROOT%"=="" (
  :: ~dp0 is the batchism for the directory in which a .bat file resides.
  set "PW_ROOT=%~dp0"
) else (
  set "PW_ROOT=%PW_CHECKOUT_ROOT%"
  set PW_CHECKOUT_ROOT=
)

:: Allow forcing a specific Python version through the environment variable
:: PW_BOOTSTRAP_PYTHON. Otherwise, use the system Python if one exists.
if not "%PW_BOOTSTRAP_PYTHON%" == "" (
  set "python=%PW_BOOTSTRAP_PYTHON%"
) else (
  where python >NUL 2>&1
  if %ERRORLEVEL% EQU 0 (
    set python=python
  ) else (
    echo.
    echo Error: no system Python present
    echo.
    echo   Pigweed's bootstrap process requires a local system Python.
    echo   Please install Python on your system, add it to your PATH
    echo   and re-try running bootstrap.
    goto finish
  )
)

:: PW_ENVIRONMENT_ROOT allows developers to specify where the environment should
:: be installed. _PW_ACTUAL_ENVIRONMENT_ROOT is where Pigweed keeps that
:: information. This separation allows Pigweed to assume PW_ENVIRONMENT_ROOT
:: came from the developer and not from a previous bootstrap possibly from
:: another workspace.
if "%PW_ENVIRONMENT_ROOT%"=="" (
   :: Not prefixing environment with "." since that doesn't hide it anyway.
   set "_PW_ACTUAL_ENVIRONMENT_ROOT=%PW_ROOT%\environment"
) else (
   set "_PW_ACTUAL_ENVIRONMENT_ROOT=%PW_ENVIRONMENT_ROOT%"
)
set "shell_file=%_PW_ACTUAL_ENVIRONMENT_ROOT%\activate.bat"

set "_pw_start_script=%PW_ROOT%\pw_env_setup\py\pw_env_setup\windows_env_start.py"

if "%PW_PROJECT_ROOT%"=="" (
   set "PW_PROJECT_ROOT=%PW_ROOT%"
)

:: If PW_SKIP_BOOTSTRAP is set, only run the activation stage instead of the
:: complete env_setup.
if "%PW_SKIP_BOOTSTRAP%" == "" (
  :: Without the trailing slash in %PW_ROOT%/, batch combines that token with
  :: the --shell-file argument.
  call "%python%" "%PW_ROOT%\pw_env_setup\py\pw_env_setup\env_setup.py" ^
      --pw-root "%PW_ROOT%/" ^
      --shell-file "%shell_file%" ^
      --install-dir "%_PW_ACTUAL_ENVIRONMENT_ROOT%" ^
      --use-pigweed-defaults
) else (
  if exist "%shell_file%" (
    call "%python%" "%_pw_start_script%"
  ) else (
    call "%python%" "%_pw_start_script%" --no-shell-file
    goto finish
  )
)

call "%shell_file%"

:finish
::WINDOWS_ONLY

:<<"::WINDOWS_ONLY"
@echo off
:: Copyright 2020 The Pigweed Authors
::
:: Licensed under the Apache License, Version 2.0 (the "License"); you may not
:: use this file except in compliance with the License. You may obtain a copy of
:: the License at
::
::     https://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
:: WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
:: License for the specific language governing permissions and limitations under
:: the License.
::WINDOWS_ONLY
:; echo "ERROR: Attempting to run Windows .bat from a Unix/POSIX shell!"
:; echo "Instead, run the following command."
:; echo ""
:; echo "    source ./bootstrap.sh"
:; echo ""
:<<"::WINDOWS_ONLY"

:: Pigweed Windows environment setup.

:: WARNING: Multi-line "if" statements can be dangerous!
::
:: Example:
::  call do_foo
::  if [expression] (
::    call cmd_a
::    set my_var = %ERRORLEVEL%
::    call final_script --flag %my_var%
::  )
:: Batch evaluates these expressions in a way that will produce unexpected
:: behavior. It appears that when each line is executed, it does not affect
:: local context until the entire expression is complete. In this example,
:: ERRORLEVEL does not reflect `call cmd_a`, but whatever residual state was
:: present from `do_foo`. Similarly, in the call to `final_script`, `my_var`
:: will NOT be valid as the variable `set` doesn't apply until the entire `if`
:: expression completes.
:: This script only uses multi-line if statements to `goto` after an operation.

:: If PW_CHECKOUT_ROOT is set, use it. Users should not set this variable.
:: It's used because when one batch script invokes another the Powershell magic
:: below doesn't work. To reinforce that users should not be using
:: PW_CHECKOUT_ROOT, it is cleared here after it is used, and other pw tools
:: will complain if they see that variable set.
:: TODO(mohrr) find out a way to do this without PW_CHECKOUT_ROOT.

:: ~dp0 is the batchism for the directory in which a .bat file resides.
if "%PW_CHECKOUT_ROOT%"=="" ^
set "PW_ROOT=%~dp0" &^
goto select_python

:: Since PW_CHECKOUT_ROOT is set, use it.
set "PW_ROOT=%PW_CHECKOUT_ROOT%"
set "PW_CHECKOUT_ROOT="

:select_python
:: Allow forcing a specific Python version through the environment variable
:: PW_BOOTSTRAP_PYTHON. Otherwise, use the system Python if one exists.
if not "%PW_BOOTSTRAP_PYTHON%" == "" (
  set "python=%PW_BOOTSTRAP_PYTHON%"
  goto find_environment_root
)

:: Detect python installation.
where python >NUL 2>&1
if %ERRORLEVEL% EQU 0 (
  set "python=python"
  goto find_environment_root
)

echo.
echo Error: no system Python present
echo.
echo   Pigweed's bootstrap process requires a local system Python.
echo   Please install Python on your system, add it to your PATH
echo   and re-try running bootstrap.
goto finish

:find_environment_root
:: PW_ENVIRONMENT_ROOT allows developers to specify where the environment should
:: be installed. _PW_ACTUAL_ENVIRONMENT_ROOT is where Pigweed keeps that
:: information. This separation allows Pigweed to assume PW_ENVIRONMENT_ROOT
:: came from the developer and not from a previous bootstrap possibly from
:: another workspace.

:: Not prefixing environment with "." since that doesn't hide it anyway.
if "%PW_ENVIRONMENT_ROOT%"=="" (
  set "_PW_ACTUAL_ENVIRONMENT_ROOT=%PW_ROOT%\environment"
) else (
  set "_PW_ACTUAL_ENVIRONMENT_ROOT=%PW_ENVIRONMENT_ROOT%"
)

set "shell_file=%_PW_ACTUAL_ENVIRONMENT_ROOT%\activate.bat"

set "_pw_start_script=%PW_ROOT%\pw_env_setup\py\pw_env_setup\windows_env_start.py"

if "%PW_PROJECT_ROOT%"=="" set "PW_PROJECT_ROOT=%PW_ROOT%"

:: If PW_SKIP_BOOTSTRAP is set, only run the activation stage instead of the
:: complete env_setup.
if not "%PW_SKIP_BOOTSTRAP%" == "" goto skip_bootstrap

:: Without the trailing slash in %PW_ROOT%/, batch combines that token with
:: the --shell-file argument.
call "%python%" "%PW_ROOT%\pw_env_setup\py\pw_env_setup\env_setup.py" ^
    --pw-root "%PW_ROOT%/" ^
    --shell-file "%shell_file%" ^
    --install-dir "%_PW_ACTUAL_ENVIRONMENT_ROOT%" ^
    --use-pigweed-defaults
goto activate_shell

:skip_bootstrap
if exist "%shell_file%" (
  call "%python%" "%_pw_start_script%"
) else (
  call "%python%" "%_pw_start_script%" --no-shell-file
  goto finish
)

:activate_shell
call "%shell_file%"

:finish
::WINDOWS_ONLY

Fix batch 'if' statements

pw_env_setup: Fix batch 'if' statements

Batch doesn't support multi-line "if" statements in the way basically
every other language does. This makes me sad.

On a positive note, it was funny to see how much of this script was
non-deterministic.

Change-Id: I81dfae126bba8ba48c636832a4e4c30456319e52
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/23840
Commit-Queue: Armando Montanez <97ef6fdb231c129ac8827d9f0c4106bfbf57f74f@google.com>
Reviewed-by: Rob Mohr <d07614a8a0b466db08f68224f87d738b0f9615cf@google.com>
Reviewed-by: Anthony DiGirolamo <4cc40125edc24ec5bc72df7917ea0b403ee8cebe@google.com>


echo start the node server

@cd ..
@node index.js

add bin folder

add bin folder

add a .bat file to start the node server


@echo off
rem
rem _dist/  xyzzy ̃oCiW߂ xyzzy.zip 쐬B
rem O build.bat  bytecompile.bat sărhĂƁB
rem

setlocal
cd /d %~dp0

if "%1"=="" (
  set VERSION=dev
) else (
  set VERSION=%1
)

set APPNAME=xyzzy
set BASEDIR=%~dp0
set DISTROOT=%BASEDIR%\_dist
set DISTDIR=%DISTROOT%\%APPNAME%
set DIST_ARCHIVE=%DISTROOT%\%APPNAME%-%VERSION%.zip

cd %BASEDIR%
rd /S /Q %DISTDIR% 2> nul
del /Q %DIST_ARCHIVE% 2> nul

mkdir %DISTROOT% 2> nul
mkdir %DISTDIR%
mkdir %DISTDIR%\lisp
mkdir %DISTDIR%\etc
mkdir %DISTDIR%\docs
mkdir %DISTDIR%\reference
mkdir %DISTDIR%\site-lisp

xcopy /F /G /H /R /K /Y *.exe %DISTDIR%
xcopy /F /G /H /R /K /Y LICENSE %DISTDIR%\docs\
xcopy /F /G /H /R /K /Y LEGAL.md %DISTDIR%\docs\
xcopy /F /G /H /R /K /Y /S /E lisp %DISTDIR%\lisp\
xcopy /F /G /H /R /K /Y /S /E etc %DISTDIR%\etc\
xcopy /F /G /H /R /K /Y /S /E docs %DISTDIR%\docs\
xcopy /F /G /H /R /K /Y /S /E reference %DISTDIR%\reference\

cd %DISTROOT%
7za a %DIST_ARCHIVE% %DISTDIR%

@echo off
rem
rem _dist/  xyzzy ̃oCiW߂ xyzzy.zip 쐬B
rem O build.bat  bytecompile.bat sărhĂƁB
rem

setlocal
cd /d %~dp0

if "%1"=="" (
  set VERSION=dev
) else (
  set VERSION=%1
)

set APPNAME=xyzzy
set BASEDIR=%~dp0
set DISTROOT=%BASEDIR%\_dist
set DISTDIR=%DISTROOT%\%APPNAME%
set DIST_ARCHIVE=%DISTROOT%\%APPNAME%-%VERSION%.zip

cd %BASEDIR%
rd /S /Q %DISTDIR% 2> nul
del /Q %DIST_ARCHIVE% 2> nul

mkdir %DISTROOT% 2> nul
mkdir %DISTDIR%
mkdir %DISTDIR%\lisp
mkdir %DISTDIR%\etc
mkdir %DISTDIR%\docs
mkdir %DISTDIR%\reference
mkdir %DISTDIR%\site-lisp

xcopy /F /G /H /R /K /Y *.exe %DISTDIR%
xcopy /F /G /H /R /K /Y LICENSE %DISTDIR%\docs\
xcopy /F /G /H /R /K /Y LEGAL.md %DISTDIR%\docs\
xcopy /F /G /H /R /K /Y /S /E lisp %DISTDIR%\lisp\
xcopy /F /G /H /R /K /Y /S /E etc %DISTDIR%\etc\
xcopy /F /G /H /R /K /Y /S /E docs %DISTDIR%\docs\
xcopy /F /G /H /R /K /Y /S /E reference %DISTDIR%\reference\

cd %DISTROOT%
rem 7za a %DIST_ARCHIVE% %DISTDIR%
zip -9 -r %DIST_ARCHIVE% %APPNAME%

use info-zip instead of 7zip

use info-zip instead of 7zip


@echo off

:: Set up Visual Studio command line environment variables given a
:: machine type, e.g., amd64 or x86.

:: Visual Studio 2017 Enterprise
set BATDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build
if exist "%BATDIR%\vcvarsall.bat" goto found

:: Visual Studio 2017 Professional
set BATDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build
if exist "%BATDIR%\vcvarsall.bat" goto found

:: Visual Studio 2017 Community
set BATDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
if exist "%BATDIR%\vcvarsall.bat" goto found

:: Visual Studio 2015
set BATDIR=%VS140COMNTOOLS%..\..\VC
if exist "%BATDIR%\vcvarsall.bat" goto found

echo Visual Studio 2017 or 2015 must be installed.
exit 1

:found

:: Clear environment variables that we might otherwise inherit
set INCLUDE=
set LIB=
set LIBPATH=

"%BATDIR%\vcvarsall.bat" %1

@echo off

:: Set up Visual Studio command line environment variables given a
:: machine type, e.g., amd64 or x86.

:: Visual Studio 2017 Enterprise
set BATDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build
if exist "%BATDIR%\vcvarsall.bat" goto found

:: Visual Studio 2017 Professional
set BATDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build
if exist "%BATDIR%\vcvarsall.bat" goto found

:: Visual Studio 2017 Community
set BATDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
if exist "%BATDIR%\vcvarsall.bat" goto found

:: Visual Studio 2015
set BATDIR=%VS140COMNTOOLS%..\..\VC
if exist "%BATDIR%\vcvarsall.bat" goto found

echo Visual Studio 2017 or 2015 must be installed.
exit 1

:found

:: Clear environment variables that we might otherwise inherit
set INCLUDE=
set LIB=
set LIBPATH=

:: Visual Studio 2017's vcvarsall.bat changes the directory to %USERPROFILE%\Source if the directory exists. See https://developercommunity.visualstudio.com/content/problem/26780/vsdevcmdbat-changes-the-current-working-directory.html
set VSCMD_START_DIR=%CD%
"%BATDIR%\vcvarsall.bat" %1

fix c/vs.bat for Visual Studio 2017 when %USERPROFILE%\Source exists


@ECHO OFF
setlocal enabledelayedexpansion
set msg=
call check.bat
set /p ask=Upload to S3 (y/n)?
if %ask% == y (
	call doPush.bat
)
set /p gitdo=Push to git (y/n)?
if %gitdo% == y (
	set /p msg=Git commit message :
	git add .
	git commit -m "!msg!"
	git push
)

@ECHO OFF
setlocal enabledelayedexpansion
set msg=
call check.bat
set /p ask=Upload to S3 (y/n)?
if %ask% == y (
	call doPush.bat
)
set /p gitdo=Push to git (y/n)?
if %gitdo% == y (
	set /p msg=Git commit message :
	git add .
	git commit -m "!msg!"
	git push
	echo yonguelink
)

Test user name

Test user name


@echo off
REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements.  See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License.  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.

set ZOOCFGDIR=%~dp0%..\conf
set ZOO_LOG_DIR=%~dp0%..\logs
set ZOO_LOG4J_PROP=INFO,CONSOLE

REM for sanity sake assume Java 1.6
REM see: http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html

REM add the zoocfg dir to classpath
set CLASSPATH=%ZOOCFGDIR%

REM make it work in the release
SET CLASSPATH=%~dp0..\*;%~dp0..\lib\*;%CLASSPATH%

REM make it work for developers
SET CLASSPATH=%~dp0..\build\classes;%~dp0..\build\lib\*;%CLASSPATH%

set ZOOCFG=%ZOOCFGDIR%\zoo.cfg

@REM setup java environment variables

if not defined JAVA_HOME (
  echo Error: JAVA_HOME is not set.
  goto :eof
)

set JAVA_HOME=%JAVA_HOME:"=%

if not exist "%JAVA_HOME%"\bin\java.exe (
  echo Error: JAVA_HOME is incorrectly set.
  goto :eof
)

set JAVA="%JAVA_HOME%"\bin\java

@echo off
REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements.  See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License.  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.

set ZOOCFGDIR=%~dp0%..\conf
set ZOO_LOG_DIR=%~dp0%..\logs
set ZOO_LOG4J_PROP=INFO,CONSOLE

REM for sanity sake assume Java 1.6
REM see: http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html

REM add the zoocfg dir to classpath
set CLASSPATH=%ZOOCFGDIR%

REM make it work in the release
SET CLASSPATH=%~dp0..\*;%~dp0..\lib\*;%CLASSPATH%

REM make it work for developers
SET CLASSPATH=%~dp0..\build\classes;%~dp0..\build\lib\*;%CLASSPATH%

set ZOOCFG=%ZOOCFGDIR%\zoo.cfg

@REM setup java environment variables

if not defined JAVA_HOME (
  echo Error: JAVA_HOME is not set.
  goto :eof
)

set JAVA_HOME=%JAVA_HOME:"=%

if not exist "%JAVA_HOME%"\bin\java.exe (
  echo Error: JAVA_HOME is incorrectly set.
  goto :eof
)

REM strip off trailing \ from JAVA_HOME or java does not start
if "%JAVA_HOME:~-1%" EQU "\" set "JAVA_HOME=%JAVA_HOME:~0,-1%"

set JAVA="%JAVA_HOME%"\bin\java

remove trailing \ from JAVA_HOME

ZOOKEEPER-2951: remove trailing \ from JAVA_HOME

 fixes ZOOKEEPER-2951

Author: Jorg Heymans <jorg.heymans@gmail.com>

Reviewers: 5b53a183ea2bd2d082534bd4ca654905d183733b@apache.org

Closes #431 from jorgheymans/master

Change-Id: Id47651ebdbb29574b47863640e928b6a99af6920
(cherry picked from commit dcfbe45241855f2caccf3848be2e66e7aa23aa96)
Signed-off-by: Patrick Hunt <5b53a183ea2bd2d082534bd4ca654905d183733b@apache.org>


:: build-windows.bat
::
:: This source file is part of the Swift.org open source project
::
:: Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
:: Licensed under Apache License v2.0 with Runtime Library Exception
::
:: See https://swift.org/LICENSE.txt for license information
:: See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

:: REQUIRED ENVIRONMENT VARIABLES
:: This script requires to be executed inside one Visual Studio command line,
:: in order for many of the tools and environment variables to be available.
:: Additionally, it needs the following variables:
:: - CMAKE_BUILD_TYPE: Kind of build: Release, RelWithDebInfo, Debug.
:: - PYTHON_HOME: The Python installation directory.

:: REQUIRED PERMISSIONS
:: Practically, it is easier to be in the Adminstrators group to run the
:: script, but it should be possible to execute as a normal user.
:: The user will need permission to write files into the Windows SDK and the
:: VisualC++ folder.

@echo off

setlocal enableextensions enabledelayedexpansion

set icu_version_major=64
set icu_version_minor=2
set icu_version=%icu_version_major%_%icu_version_minor%
set icu_version_dotted=%icu_version_major%.%icu_version_minor%

set "exitOnError=|| (exit /b)"
set current_directory=%~dp0
set current_directory=%current_directory:~0,-1%
set source_root=%current_directory%\..\..

:: Resetting source_root with %CD% removes the ..\.. from the paths, and makes
:: the output easier to read.
cd %source_root%
set source_root=%CD%

set full_build_root=%source_root%\build
set install_directory=%build_root%\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr

mkdir %full_build_root%
:: Use the shortest path we can for the build directory, to avoid Windows
:: path problems as much as we can.
subst S: /d
subst S: %full_build_root% %exitOnError%
set build_root=S:

call :clone_repositories %exitOnError%
call :download_icu %exitOnError%
:: TODO: Disabled until we need LLBuild/SwiftPM in this build script.
:: call :download_sqlite3

call :build_llvm %exitOnError%
path %PATH%;%install_directory%\bin

call :build_cmark %exitOnError%

call :prepare_platform_modules %exitOnError%
call :build_swift %exitOnError%

call :build_lldb %exitOnError%

path %source_root%\icu-%icu_version%\bin64;%install_directory%\bin;%build_root%\swift\libdispatch-prefix\bin;%PATH%;%ProgramFiles%\Git\usr\bin
call :test_swift %exitOnError%

goto :end
endlocal

:clone_repositories
:: Clones the repositories used by the Windows build.
:: It supposes that the swift repository is already cloned by CI.
:: It supposes the %CD% is the source root.
setlocal enableextensions enabledelayedexpansion

git config --global core.autocrlf false
git clone --depth 1 --single-branch https://github.com/apple/swift-cmark cmark %exitOnError%
git clone --depth 1 --single-branch --branch swift/master https://github.com/apple/llvm-project llvm-project %exitOnError%
mklink /D "%source_root%\clang" "%source_root%\llvm-project\clang"
mklink /D "%source_root%\llvm" "%source_root%\llvm-project\llvm"
mklink /D "%source_root%\lldb" "%source_root%\llvm-project\lldb"
mklink /D "%source_root%\compiler-rt" "%source_root%\llvm-project\compiler-rt"
mklink /D "%source_root%\libcxx" "%source_root%\llvm-project\libcxx"
mklink /D "%source_root%\clang-tools-extra" "%source_root%\llvm-project\clang-tools-extra"
git clone --depth 1 --single-branch https://github.com/apple/swift-corelibs-libdispatch %exitOnError%

goto :eof
endlocal

:download_icu
:: Downloads ICU, which will be used as a dependency for the Swift Standard
:: Library and Foundation.
setlocal enableextensions enabledelayedexpansion

set file_name=icu4c-%icu_version%-Win64-MSVC2017.zip
curl -L -O -z %file_name% "http://download.icu-project.org/files/icu4c/%icu_version_dotted%/%file_name%" %exitOnError%
:: unzip warns about the paths in the zip using slashes, which raises the
:: errorLevel to 1. We cannot use exitOnError, and have to ignore errors.
unzip -o %file_name% -d "%source_root%\icu-%icu_version%"
exit /b 0

goto :eof
endlocal

:download_sqlite3
:: Downloads SQLite3, which will be used as a dependency for llbuild and
:: Swift Package Manager.
setlocal enableextensions enabledelayedexpansion

set file_name=sqlite-amalgamation-3270200.zip
curl -L -O "https://www.sqlite.org/2019/%file_name%" %exitOnError%
unzip -o %file_name% %exitOnError%

goto :eof
endlocal

:prepare_platform_modules
:: Create files into the right places of the Windows SDK to the files in the
:: swift repository, in order to consider the headers of the Windows SDK a
:: module to compile Swift code against them.
setlocal enableextensions enabledelayedexpansion

copy /y "%source_root%\swift\stdlib\public\Platform\ucrt.modulemap" "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap" %exitOnError%
copy /y "%source_root%\swift\stdlib\public\Platform\winsdk.modulemap" "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap" %exitOnError%
copy /y "%source_root%\swift\stdlib\public\Platform\visualc.modulemap" "%VCToolsInstallDir%\include\module.modulemap" %exitOnError%
copy /y "%source_root%\swift\stdlib\public\Platform\visualc.apinotes" "%VCToolsInstallDir%\include\visualc.apinotes" %exitOnError%

goto :eof
endlocal

:build_llvm
:: Configures, builds, and installs LLVM
setlocal enableextensions enabledelayedexpansion

mkdir "%build_root%\llvm" %exitOnError%
pushd "%build_root%\llvm"

cmake "%source_root%\llvm"^
    -G Ninja^
    -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
    -DCMAKE_C_COMPILER=cl^
    -DCMAKE_CXX_COMPILER=cl^
    -DCMAKE_INSTALL_PREFIX:PATH=%install_directory%^
    -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-windows-msvc^
    -DLLVM_ENABLE_PDB:BOOL=YES^
    -DLLVM_ENABLE_ASSERTIONS:BOOL=YES^
    -DLLVM_ENABLE_PROJECTS:STRING=clang^
    -DLLVM_TARGETS_TO_BUILD:STRING="AArch64;ARM;X86"^
    -DLLVM_INCLUDE_BENCHMARKS:BOOL=NO^
    -DLLVM_INCLUDE_DOCS:BOOL=NO^
    -DLLVM_INCLUDE_EXAMPLES:BOOL=NO^
    -DLLVM_INCLUDE_GO_TESTS:BOOL=NO^
    -DLLVM_TOOL_GOLD_BUILD:BOOL=NO^
    -DLLVM_ENABLE_OCAMLDOC:BOOL=NO^
    -DLLVM_ENABLE_LIBXML2:BOOL=NO^
    -DLLVM_ENABLE_ZLIB:BOOL=NO^
    -DENABLE_X86_RELAX_RELOCATIONS:BOOL=YES^
    -DLLVM_INSTALL_BINUTILS_SYMLINKS:BOOL=YES^
    -DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=YES^
    -DLLVM_TOOLCHAIN_TOOLS:STRING="addr2line;ar;c++filt;dsymutil;dwp;llvm-ar;llvm-cov;llvm-cvtres;llvm-cxxfilt;llvm-dlltool;llvm-dwp;llvm-ranlib;llvm-lib;llvm-mt;llvm-nm;llvm-objdump;llvm-pdbutil;llvm-profdata;llvm-rc;llvm-readelf;llvm-readobj;llvm-size;llvm-strip;llvm-symbolizer;llvm-undname;nm;objcopy;objdump;ranlib;readelf;size;strings"^
    -DCLANG_TOOLS="clang;clang-format;clang-headers;clang-tidy"^
    -DCMAKE_CXX_FLAGS:STRING="/GS- /Oy"^
    -DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
    -DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO %exitOnError%

popd

cmake --build "%build_root%\llvm" %exitOnError%
cmake --build "%build_root%\llvm" --target install %exitOnError%

goto :eof
endlocal

:build_cmark
:: Configures and builds CMark
setlocal enableextensions enabledelayedexpansion

mkdir "%build_root%\cmark" %exitOnError%
pushd "%build_root%\cmark"

cmake "%source_root%\cmark"^
    -G Ninja^
    -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
    -DCMAKE_C_COMPILER=cl^
    -DCMAKE_CXX_COMPILER=cl^
    -DCMAKE_CXX_FLAGS:STRING="/GS- /Oy"^
    -DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
    -DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO %exitOnError%

popd

cmake --build "%build_root%\cmark" %exitOnError%

goto :eof
endlocal

:build_swift
:: Configures, builds, and installs Swift and the Swift Standard Library
setlocal enableextensions enabledelayedexpansion

mkdir "%build_root%\swift" %exitOnError%
pushd "%build_root%\swift"

:: SWIFT_PARALLEL_LINK_JOBS=8 allows the build machine to use as many CPU as
:: possible, while not exhausting the RAM.
cmake "%source_root%\swift"^
    -G Ninja^
    -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
    -DCMAKE_C_COMPILER=cl^
    -DCMAKE_CXX_COMPILER=cl^
    -DCMAKE_INSTALL_PREFIX:PATH=%install_directory%^
    -DClang_DIR:PATH=%build_root%\llvm\lib\cmake\clang^
    -DSWIFT_PATH_TO_CMARK_BUILD:PATH=%build_root%\cmark^
    -DSWIFT_PATH_TO_CMARK_SOURCE:PATH=%source_root%\cmark^
    -DSWIFT_PATH_TO_LIBDISPATCH_SOURCE:PATH=%source_root%\swift-corelibs-libdispatch^
    -DLLVM_DIR:PATH=%build_root%\llvm\lib\cmake\llvm^
    -DSWIFT_INCLUDE_DOCS:BOOL=NO^
    -DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE:PATH=%source_root%\icu-%icu_version%\include\unicode^
    -DSWIFT_WINDOWS_x86_64_ICU_UC:PATH=%source_root%\icu-%icu_version%\lib64\icuuc.lib^
    -DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE:PATH=%source_root%\icu-%icu_version%\include^
    -DSWIFT_WINDOWS_x86_64_ICU_I18N:PATH=%source_root%\icu-%icu_version%\lib64\icuin.lib^
    -DSWIFT_BUILD_DYNAMIC_STDLIB:BOOL=YES^
    -DSWIFT_BUILD_DYNAMIC_SDK_OVERLAY:BOOL=YES^
    -DSWIFT_BUILD_STATIC_STDLIB:BOOL=NO^
    -DSWIFT_BUILD_STATIC_SDK_OVERLAY:BOOL=NO^
    -DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=YES^
    -DSWIFT_BUILD_SOURCEKIT:BOOL=YES^
    -DSWIFT_ENABLE_SOURCEKIT_TESTS:BOOL=NO^
    -DSWIFT_INSTALL_COMPONENTS="autolink-driver;compiler;clang-resource-dir-symlink;stdlib;sdk-overlay;editor-integration;tools;sourcekit-inproc;swift-remote-mirror;swift-remote-mirror-headers"^
    -DSWIFT_PARALLEL_LINK_JOBS=8^
    -DPYTHON_EXECUTABLE:PATH=%PYTHON_HOME%\python.exe^
    -DCMAKE_CXX_FLAGS:STRING="/GS- /Oy"^
    -DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
    -DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO %exitOnError%

popd

cmake --build "%build_root%\swift" %exitOnError%
cmake --build "%build_root%\swift" --target install %exitOnError%

goto :eof
endlocal

:test_swift
:: Tests the Swift compiler and the Swift Standard Library
setlocal enableextensions enabledelayedexpansion

cmake --build "%build_root%\swift" --target check-swift %exitOnError%

goto :eof
endlocal

:build_lldb
:: Configures, builds, and installs LLDB
setlocal enableextensions enabledelayedexpansion

mkdir "%build_root%\lldb" %exitOnError%
pushd "%build_root%\lldb"

cmake "%source_root%\lldb"^
    -G Ninja^
    -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
    -DCMAKE_C_COMPILER=clang-cl^
    -DCMAKE_CXX_COMPILER=clang-cl^
    -DCMAKE_INSTALL_PREFIX:PATH=%install_directory%^
    -DLLVM_DIR:PATH=%build_root%\llvm\lib\cmake\llvm^
    -DClang_DIR:PATH=%build_root%\llvm\lib\cmake\clang^
    -DSwift_DIR:PATH=%build_root%\swift\lib\cmake\swift^
    -DLLVM_ENABLE_ASSERTIONS:BOOL=YES^
    -DLLDB_ALLOW_STATIC_BINDINGS:BOOL=YES^
    -DPYTHON_HOME:PATH=%PYTHON_HOME%^
    -DCMAKE_CXX_FLAGS:STRING="/GS- /Oy"^
    -DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
    -DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
    -DLLDB_INCLUDE_TESTS:BOOL=NO %exitOnError%

popd

cmake --build "%build_root%\lldb" %exitOnError%
cmake --build "%build_root%\lldb" --target install %exitOnError%

goto :eof
endlocal

:build_libdispatch
:: Configures, builds, and installs Dispatch
setlocal enableextensions enabledelayedexpansion

mkdir "%build_root%\swift-corelibs-libdispatch" %exitOnError%
pushd "%build_root%\swift-corelibs-libdispatch"

cmake "%source_root%\swift-corelibs-libdispatch"^
    -G Ninja^
    -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
    -DCMAKE_C_COMPILER=clang-cl^
    -DCMAKE_CXX_COMPILER=clang-cl^
    -DCMAKE_SWIFT_COMPILER:PATH=%install_directory%\bin\swiftc.exe^
    -DSwift_DIR:PATH=%build_root%\swift\lib\cmake\swift^
    -DCMAKE_INSTALL_PREFIX:PATH=%install_directory%^
    -DBUILD_SHARED_LIBS:BOOL=YES^
    -DENABLE_TESTING:BOOL=NO^
    -DCMAKE_C_COMPILER_TARGET=x86_64-unknown-windows-msvc^
    -DENABLE_SWIFT:BOOL=YES^
    -DCMAKE_CXX_FLAGS:STRING="/GS- /Oy"^
    -DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
    -DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO %exitOnError%

popd

cmake --build "%build_root%\swift-corelibs-libdispatch" %exitOnError%
cmake --build "%build_root%\swift-corelibs-libdispatch" --target install %exitOnError%

goto :eof
endlocal

:end

:: build-windows.bat
::
:: This source file is part of the Swift.org open source project
::
:: Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
:: Licensed under Apache License v2.0 with Runtime Library Exception
::
:: See https://swift.org/LICENSE.txt for license information
:: See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

:: REQUIRED ENVIRONMENT VARIABLES
:: This script requires to be executed inside one Visual Studio command line,
:: in order for many of the tools and environment variables to be available.
:: Additionally, it needs the following variables:
:: - CMAKE_BUILD_TYPE: Kind of build: Release, RelWithDebInfo, Debug.
:: - PYTHON_HOME: The Python installation directory.

:: REQUIRED PERMISSIONS
:: Practically, it is easier to be in the Adminstrators group to run the
:: script, but it should be possible to execute as a normal user.
:: The user will need permission to write files into the Windows SDK and the
:: VisualC++ folder.

@echo off

setlocal enableextensions enabledelayedexpansion

set icu_version_major=64
set icu_version_minor=2
set icu_version=%icu_version_major%_%icu_version_minor%
set icu_version_dotted=%icu_version_major%.%icu_version_minor%

set "exitOnError=|| (exit /b)"
set current_directory=%~dp0
set current_directory=%current_directory:~0,-1%
set source_root=%current_directory%\..\..

:: Resetting source_root with %CD% removes the ..\.. from the paths, and makes
:: the output easier to read.
cd %source_root%
set source_root=%CD%

set full_build_root=%source_root%\build
set install_directory=%build_root%\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr

mkdir %full_build_root%
:: Use the shortest path we can for the build directory, to avoid Windows
:: path problems as much as we can.
subst S: /d
subst S: %full_build_root% %exitOnError%
set build_root=S:

call :clone_repositories %exitOnError%
call :download_icu %exitOnError%
:: TODO: Disabled until we need LLBuild/SwiftPM in this build script.
:: call :download_sqlite3

call :build_llvm %exitOnError%
path %PATH%;%install_directory%\bin

call :build_cmark %exitOnError%

call :prepare_platform_modules %exitOnError%
call :build_swift %exitOnError%

call :build_lldb %exitOnError%

path %source_root%\icu-%icu_version%\bin64;%install_directory%\bin;%build_root%\swift\bin;%build_root%\swift\libdispatch-prefix\bin;%PATH%;%ProgramFiles%\Git\usr\bin
call :test_swift %exitOnError%

goto :end
endlocal

:clone_repositories
:: Clones the repositories used by the Windows build.
:: It supposes that the swift repository is already cloned by CI.
:: It supposes the %CD% is the source root.
setlocal enableextensions enabledelayedexpansion

git config --global core.autocrlf false
git clone --depth 1 --single-branch https://github.com/apple/swift-cmark cmark %exitOnError%
git clone --depth 1 --single-branch --branch swift/master https://github.com/apple/llvm-project llvm-project %exitOnError%
mklink /D "%source_root%\clang" "%source_root%\llvm-project\clang"
mklink /D "%source_root%\llvm" "%source_root%\llvm-project\llvm"
mklink /D "%source_root%\lldb" "%source_root%\llvm-project\lldb"
mklink /D "%source_root%\compiler-rt" "%source_root%\llvm-project\compiler-rt"
mklink /D "%source_root%\libcxx" "%source_root%\llvm-project\libcxx"
mklink /D "%source_root%\clang-tools-extra" "%source_root%\llvm-project\clang-tools-extra"
git clone --depth 1 --single-branch https://github.com/apple/swift-corelibs-libdispatch %exitOnError%

goto :eof
endlocal

:download_icu
:: Downloads ICU, which will be used as a dependency for the Swift Standard
:: Library and Foundation.
setlocal enableextensions enabledelayedexpansion

set file_name=icu4c-%icu_version%-Win64-MSVC2017.zip
curl -L -O -z %file_name% "http://download.icu-project.org/files/icu4c/%icu_version_dotted%/%file_name%" %exitOnError%
:: unzip warns about the paths in the zip using slashes, which raises the
:: errorLevel to 1. We cannot use exitOnError, and have to ignore errors.
unzip -o %file_name% -d "%source_root%\icu-%icu_version%"
exit /b 0

goto :eof
endlocal

:download_sqlite3
:: Downloads SQLite3, which will be used as a dependency for llbuild and
:: Swift Package Manager.
setlocal enableextensions enabledelayedexpansion

set file_name=sqlite-amalgamation-3270200.zip
curl -L -O "https://www.sqlite.org/2019/%file_name%" %exitOnError%
unzip -o %file_name% %exitOnError%

goto :eof
endlocal

:prepare_platform_modules
:: Create files into the right places of the Windows SDK to the files in the
:: swift repository, in order to consider the headers of the Windows SDK a
:: module to compile Swift code against them.
setlocal enableextensions enabledelayedexpansion

copy /y "%source_root%\swift\stdlib\public\Platform\ucrt.modulemap" "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap" %exitOnError%
copy /y "%source_root%\swift\stdlib\public\Platform\winsdk.modulemap" "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap" %exitOnError%
copy /y "%source_root%\swift\stdlib\public\Platform\visualc.modulemap" "%VCToolsInstallDir%\include\module.modulemap" %exitOnError%
copy /y "%source_root%\swift\stdlib\public\Platform\visualc.apinotes" "%VCToolsInstallDir%\include\visualc.apinotes" %exitOnError%

goto :eof
endlocal

:build_llvm
:: Configures, builds, and installs LLVM
setlocal enableextensions enabledelayedexpansion

mkdir "%build_root%\llvm" %exitOnError%
pushd "%build_root%\llvm"

cmake "%source_root%\llvm"^
    -G Ninja^
    -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
    -DCMAKE_C_COMPILER=cl^
    -DCMAKE_CXX_COMPILER=cl^
    -DCMAKE_INSTALL_PREFIX:PATH=%install_directory%^
    -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-windows-msvc^
    -DLLVM_ENABLE_PDB:BOOL=YES^
    -DLLVM_ENABLE_ASSERTIONS:BOOL=YES^
    -DLLVM_ENABLE_PROJECTS:STRING=clang^
    -DLLVM_TARGETS_TO_BUILD:STRING="AArch64;ARM;X86"^
    -DLLVM_INCLUDE_BENCHMARKS:BOOL=NO^
    -DLLVM_INCLUDE_DOCS:BOOL=NO^
    -DLLVM_INCLUDE_EXAMPLES:BOOL=NO^
    -DLLVM_INCLUDE_GO_TESTS:BOOL=NO^
    -DLLVM_TOOL_GOLD_BUILD:BOOL=NO^
    -DLLVM_ENABLE_OCAMLDOC:BOOL=NO^
    -DLLVM_ENABLE_LIBXML2:BOOL=NO^
    -DLLVM_ENABLE_ZLIB:BOOL=NO^
    -DENABLE_X86_RELAX_RELOCATIONS:BOOL=YES^
    -DLLVM_INSTALL_BINUTILS_SYMLINKS:BOOL=YES^
    -DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=YES^
    -DLLVM_TOOLCHAIN_TOOLS:STRING="addr2line;ar;c++filt;dsymutil;dwp;llvm-ar;llvm-cov;llvm-cvtres;llvm-cxxfilt;llvm-dlltool;llvm-dwp;llvm-ranlib;llvm-lib;llvm-mt;llvm-nm;llvm-objdump;llvm-pdbutil;llvm-profdata;llvm-rc;llvm-readelf;llvm-readobj;llvm-size;llvm-strip;llvm-symbolizer;llvm-undname;nm;objcopy;objdump;ranlib;readelf;size;strings"^
    -DCLANG_TOOLS="clang;clang-format;clang-headers;clang-tidy"^
    -DCMAKE_CXX_FLAGS:STRING="/GS- /Oy"^
    -DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
    -DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO %exitOnError%

popd

cmake --build "%build_root%\llvm" %exitOnError%
cmake --build "%build_root%\llvm" --target install %exitOnError%

goto :eof
endlocal

:build_cmark
:: Configures and builds CMark
setlocal enableextensions enabledelayedexpansion

mkdir "%build_root%\cmark" %exitOnError%
pushd "%build_root%\cmark"

cmake "%source_root%\cmark"^
    -G Ninja^
    -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
    -DCMAKE_C_COMPILER=cl^
    -DCMAKE_CXX_COMPILER=cl^
    -DCMAKE_CXX_FLAGS:STRING="/GS- /Oy"^
    -DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
    -DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO %exitOnError%

popd

cmake --build "%build_root%\cmark" %exitOnError%

goto :eof
endlocal

:build_swift
:: Configures, builds, and installs Swift and the Swift Standard Library
setlocal enableextensions enabledelayedexpansion

mkdir "%build_root%\swift" %exitOnError%
pushd "%build_root%\swift"

:: SWIFT_PARALLEL_LINK_JOBS=8 allows the build machine to use as many CPU as
:: possible, while not exhausting the RAM.
cmake "%source_root%\swift"^
    -G Ninja^
    -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
    -DCMAKE_C_COMPILER=cl^
    -DCMAKE_CXX_COMPILER=cl^
    -DCMAKE_INSTALL_PREFIX:PATH=%install_directory%^
    -DClang_DIR:PATH=%build_root%\llvm\lib\cmake\clang^
    -DSWIFT_PATH_TO_CMARK_BUILD:PATH=%build_root%\cmark^
    -DSWIFT_PATH_TO_CMARK_SOURCE:PATH=%source_root%\cmark^
    -DSWIFT_PATH_TO_LIBDISPATCH_SOURCE:PATH=%source_root%\swift-corelibs-libdispatch^
    -DLLVM_DIR:PATH=%build_root%\llvm\lib\cmake\llvm^
    -DSWIFT_INCLUDE_DOCS:BOOL=NO^
    -DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE:PATH=%source_root%\icu-%icu_version%\include\unicode^
    -DSWIFT_WINDOWS_x86_64_ICU_UC:PATH=%source_root%\icu-%icu_version%\lib64\icuuc.lib^
    -DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE:PATH=%source_root%\icu-%icu_version%\include^
    -DSWIFT_WINDOWS_x86_64_ICU_I18N:PATH=%source_root%\icu-%icu_version%\lib64\icuin.lib^
    -DSWIFT_BUILD_DYNAMIC_STDLIB:BOOL=YES^
    -DSWIFT_BUILD_DYNAMIC_SDK_OVERLAY:BOOL=YES^
    -DSWIFT_BUILD_STATIC_STDLIB:BOOL=NO^
    -DSWIFT_BUILD_STATIC_SDK_OVERLAY:BOOL=NO^
    -DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=YES^
    -DSWIFT_BUILD_SOURCEKIT:BOOL=YES^
    -DSWIFT_ENABLE_SOURCEKIT_TESTS:BOOL=NO^
    -DSWIFT_INSTALL_COMPONENTS="autolink-driver;compiler;clang-resource-dir-symlink;stdlib;sdk-overlay;editor-integration;tools;sourcekit-inproc;swift-remote-mirror;swift-remote-mirror-headers"^
    -DSWIFT_PARALLEL_LINK_JOBS=8^
    -DPYTHON_EXECUTABLE:PATH=%PYTHON_HOME%\python.exe^
    -DCMAKE_CXX_FLAGS:STRING="/GS- /Oy"^
    -DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
    -DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO %exitOnError%

popd

cmake --build "%build_root%\swift" %exitOnError%
cmake --build "%build_root%\swift" --target install %exitOnError%

goto :eof
endlocal

:test_swift
:: Tests the Swift compiler and the Swift Standard Library
setlocal enableextensions enabledelayedexpansion

cmake --build "%build_root%\swift" --target check-swift %exitOnError%

goto :eof
endlocal

:build_lldb
:: Configures, builds, and installs LLDB
setlocal enableextensions enabledelayedexpansion

mkdir "%build_root%\lldb" %exitOnError%
pushd "%build_root%\lldb"

cmake "%source_root%\lldb"^
    -G Ninja^
    -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
    -DCMAKE_C_COMPILER=clang-cl^
    -DCMAKE_CXX_COMPILER=clang-cl^
    -DCMAKE_INSTALL_PREFIX:PATH=%install_directory%^
    -DLLVM_DIR:PATH=%build_root%\llvm\lib\cmake\llvm^
    -DClang_DIR:PATH=%build_root%\llvm\lib\cmake\clang^
    -DSwift_DIR:PATH=%build_root%\swift\lib\cmake\swift^
    -DLLVM_ENABLE_ASSERTIONS:BOOL=YES^
    -DLLDB_ALLOW_STATIC_BINDINGS:BOOL=YES^
    -DPYTHON_HOME:PATH=%PYTHON_HOME%^
    -DCMAKE_CXX_FLAGS:STRING="/GS- /Oy"^
    -DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
    -DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
    -DLLDB_INCLUDE_TESTS:BOOL=NO %exitOnError%

popd

cmake --build "%build_root%\lldb" %exitOnError%
cmake --build "%build_root%\lldb" --target install %exitOnError%

goto :eof
endlocal

:build_libdispatch
:: Configures, builds, and installs Dispatch
setlocal enableextensions enabledelayedexpansion

mkdir "%build_root%\swift-corelibs-libdispatch" %exitOnError%
pushd "%build_root%\swift-corelibs-libdispatch"

cmake "%source_root%\swift-corelibs-libdispatch"^
    -G Ninja^
    -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%^
    -DCMAKE_C_COMPILER=clang-cl^
    -DCMAKE_CXX_COMPILER=clang-cl^
    -DCMAKE_SWIFT_COMPILER:PATH=%install_directory%\bin\swiftc.exe^
    -DSwift_DIR:PATH=%build_root%\swift\lib\cmake\swift^
    -DCMAKE_INSTALL_PREFIX:PATH=%install_directory%^
    -DBUILD_SHARED_LIBS:BOOL=YES^
    -DENABLE_TESTING:BOOL=NO^
    -DCMAKE_C_COMPILER_TARGET=x86_64-unknown-windows-msvc^
    -DENABLE_SWIFT:BOOL=YES^
    -DCMAKE_CXX_FLAGS:STRING="/GS- /Oy"^
    -DCMAKE_EXE_LINKER_FLAGS:STRING=/INCREMENTAL:NO^
    -DCMAKE_SHARED_LINKER_FLAGS:STRING=/INCREMENTAL:NO %exitOnError%

popd

cmake --build "%build_root%\swift-corelibs-libdispatch" %exitOnError%
cmake --build "%build_root%\swift-corelibs-libdispatch" --target install %exitOnError%

goto :eof
endlocal

:end

Add folder to path while testing.

[windows] Add folder to path while testing.

Some DLL are not installed, since they are only used for testing, but
they need to be in the PATH to allow some test binaries to execute
properly.


Add noVR launcher

Add noVR launcher


@echo off
if "%1"=="" (
    echo Please provide a video file name.
    goto:eof
  ) else (
    echo Processing, please wait.
    start /b /wait python-3.6.0\python.exe do_the_mosh.py %1
)

Create datamosh.bat

Create datamosh.bat


@ECHO ON

REM Install Hugo if it's not installed
pushd D:\home\site\deployments\tools
if not exist Hugo md Hugo
cd Hugo
if exist bin goto build
md bin
cd bin
:install
curl -o hugo0207.zip -L https://github.com/spf13/hugo/releases/download/v0.27.1/hugo_0.27.1_Windows-64bit.zip
echo Installing Hugo...
SetLocal DisableDelayedExpansion & d:\7zip\7za x hugo0207.zip

REM Generate Hugo static site from source on GitHub
:build
popd
call D:\home\site\deployments\tools\hugo\bin\hugo -d D:\home\site\wwwroot
echo Hugo build finished successfully.

@ECHO ON

REM Install Hugo if it's not installed
pushd D:\home\site\deployments\tools
if not exist Hugo md Hugo
cd Hugo
if exist bin goto build
md bin
cd bin
:install
curl -o hugo041.zip -L https://github.com/gohugoio/hugo/releases/download/v0.41/hugo_0.41_Windows-64bit.zip
echo Installing Hugo...
SetLocal DisableDelayedExpansion & d:\7zip\7za x hugo041.zip

REM Generate Hugo static site from source on GitHub
:build
popd
call D:\home\site\deployments\tools\hugo\bin\hugo -d D:\home\site\wwwroot
echo Hugo build finished successfully.

upgrade hugo

upgrade hugo


@echo off

set script=%~dp0%
set parent=%script: =,%
set parent=%parent:\= %
set parentdir=
set unixpath=
call :getparentdir %parent%
set parent=%parentdir:,= %
set unixpath=%unixpath%/b2d

rem echo script='%script%'
rem echo parentdir='%parentdir%'
rem echo parent='%parent%'
rem echo unixpath='%unixpath%'

if not exist ..\env.bat (
	echo Add %parent%\env.bat: (..\env.bat^)
	echo See env.bat.template in %script%
	echo In ..\env.bat, complete your %%PATH%% with Git, VirtualBox and Boot2Docker
	exit /B 1
)
call "%parent%\env.bat"
set PATH=%PATH%;%script%

rem http://stackoverflow.com/a/7218493/6309: test substring
echo.%PATH%| findstr /C:"Boot2Docker" 1>nul
if errorlevel 1 (
	echo "Boot2Docker is not found in PATH: check your ..\env.bat"
	exit /B 1
)
echo.%PATH%| findstr /C:"Git" 1>nul
if errorlevel 1 (
	echo "Git is not found in PATH: check your ..\env.bat"
	exit /B 1
)
echo.%PATH%| findstr /C:"VirtualBox" 1>nul
if errorlevel 1 (
	echo "VirtualBox is not found in PATH: check your ..\env.bat"
	exit /B 1
)

doskey vbm="VBoxManage.exe" $*
doskey vbmmt="VBoxManage.exe modifyvm \"boot2docker-vm\" natpf1 \"tcp-port$1,tcp,,$1,,$1\";"
doskey vbmmu="VBoxManage.exe modifyvm \"boot2docker-vm\" natpf1 \"udp-port$1,udp,,$1,,$1\";"
doskey vbmct="VBoxManage.exe controlvm \"boot2docker-vm\" natpf1 \"tcp-port$1,tcp,,$1,,$1\";"
doskey vbmcu="VBoxManage.exe controlvm \"boot2docker-vm\" natpf1 \"udp-port$1,udp,,$1,,$1\";"
doskey bd="boot2docker.exe" $*

rem -------------
rem Generate profile
rem --------------
rem sed -e "s;#unixpath#;%unixpath%;g" profile.template > profile

set scriptd=%script:\=\\%
git -C %script% config filter.dffilter.smudge %scriptd%dfsmudge.sh
git -C %script% config filter.dffilter.clean %scriptd%dfclean.sh
cp -f %script%dfsmudge.sh.template %script%dfsmudge.sh
echo.%HTTP_PROXY%| findstr /C:"http" 1>nul
if errorlevel 0 (
	sed -i -e "s/#hasproxy#/1/g" dfsmudge.sh
	sed -i -e "s;#http_proxy#;%HTTP_PROXY%;g" dfsmudge.sh
	sed -i -e "s;#https_proxy#;%HTTPS_PROXY%;g" dfsmudge.sh
	sed -i -e "s;#no_proxy#;%NO_PROXY%;g" dfsmudge.sh
)
goto :eof
goto :eof

rem http://www.dostips.com/DtTutoFunctions.php#FunctionTutorial.ReturningValuesClassic
:getparentdir
setlocal enabledelayedexpansion
set P=%~1
rem echo 1='%P%'
rem echo getparentdir parentdir='%parentdir%'
rem echo getparentdir unixpath='%unixpath%'
if "!P!" EQU "" goto :eof
if "!P!" EQU "b2d" (
	endlocal
	set "parentdir=%parentdir%"
	set "unixpath=%unixpath%"
	goto :EOF
)
if not "%parentdir%" == "" (
	set "parentdir=!parentdir!\!P!"
	set "unixpath=!unixpath!/!P!"
	rem echo notempty: parentdir='%parentdir%'
	rem echo notempty: unixpath='%unixpath%'
)
rem echo between: parentdir='%parentdir%'
rem echo between: unixpath='%unixpath%'
if "%parentdir%" == "" (
	set "parentdir=!P!"
	set "unixpath=/!P!"
	set "unixpath=!unixpath::=!"
	call :lowercase unixpath
	rem echo empty: parentdir='!parentdir!'
	rem echo empty: unixpath='!unixpath!'
)
shift
( endlocal & REM.-- RETURN VALUES
	set "parentdir=%parentdir%"
	set "unixpath=%unixpath%"
)
rem echo shiftt: parentdir='%parentdir%'
rem echo shiftt: unixpath='%unixpath%'
goto getparentdir

:lowercase
set %~1=!%1:C=c!
set %~1=!%1:D=d!
set %~1=!%1:E=e!
set %~1=!%1:F=f!
set %~1=!%1:G=g!
set %~1=!%1:H=h!
set %~1=!%1:I=i!
set %~1=!%1:J=j!
set %~1=!%1:K=k!
set %~1=!%1:L=l!
set %~1=!%1:M=m!
set %~1=!%1:N=n!
set %~1=!%1:O=o!
set %~1=!%1:P=p!
set %~1=!%1:Q=q!
set %~1=!%1:R=r!
set %~1=!%1:S=s!
set %~1=!%1:T=t!
set %~1=!%1:U=u!
set %~1=!%1:V=v!
set %~1=!%1:W=w!
set %~1=!%1:X=w!
set %~1=!%1:Y=y!
set %~1=!%1:Z=z!
goto :eof

@echo off

set script=%~dp0%
set parent=%script: =,%
set parent=%parent:\= %
set parentdir=
set unixpath=
call :getparentdir %parent%
set parent=%parentdir:,= %
set unixpath=%unixpath%/b2d

rem echo script='%script%'
rem echo parentdir='%parentdir%'
rem echo parent='%parent%'
rem echo.unixpath='%unixpath%'

if not exist ..\env.bat (
	echo Add %parent%\env.bat: (..\env.bat^)
	echo See env.bat.template in %script%
	echo In ..\env.bat, complete your %%PATH%% with Git, VirtualBox and Boot2Docker
	exit /B 1
)
call "%parent%\env.bat"
set PATH=%PATH%;%script%

rem http://stackoverflow.com/a/7218493/6309: test substring
echo.%PATH%| findstr /C:"Boot2Docker" 1>nul
if errorlevel 1 (
	echo "Boot2Docker is not found in PATH: check your ..\env.bat"
	exit /B 1
)
echo.%PATH%| findstr /C:"Git" 1>nul
if errorlevel 1 (
	echo "Git is not found in PATH: check your ..\env.bat"
	exit /B 1
)
echo.%PATH%| findstr /C:"VirtualBox" 1>nul
if errorlevel 1 (
	echo "VirtualBox is not found in PATH: check your ..\env.bat"
	exit /B 1
)

doskey vbm="VBoxManage.exe" $*
doskey vbmmt="VBoxManage.exe modifyvm \"boot2docker-vm\" natpf1 \"tcp-port$1,tcp,,$1,,$1\";"
doskey vbmmu="VBoxManage.exe modifyvm \"boot2docker-vm\" natpf1 \"udp-port$1,udp,,$1,,$1\";"
doskey vbmct="VBoxManage.exe controlvm \"boot2docker-vm\" natpf1 \"tcp-port$1,tcp,,$1,,$1\";"
doskey vbmcu="VBoxManage.exe controlvm \"boot2docker-vm\" natpf1 \"udp-port$1,udp,,$1,,$1\";"
doskey bd="boot2docker.exe" $*

rem -------------
rem Generate profile
rem --------------
rem sed -e "s;#unixpath#;%unixpath%;g" profile.template > profile

set scriptd=%script:\=\\%
git -C %script% config filter.dffilter.smudge %scriptd%dfsmudge.sh
git -C %script% config filter.dffilter.clean %scriptd%dfclean.sh
cp -f %script%dfsmudge.sh.template %script%dfsmudge.sh
echo.%HTTP_PROXY%| findstr /C:"http" 1>nul
if errorlevel 0 (
	sed -i -e "s/#hasproxy#/1/g" dfsmudge.sh
	sed -i -e "s;#http_proxy#;%HTTP_PROXY%;g" dfsmudge.sh
	sed -i -e "s;#https_proxy#;%HTTPS_PROXY%;g" dfsmudge.sh
	sed -i -e "s;#no_proxy#;%NO_PROXY%;g" dfsmudge.sh
)
goto :eof

rem http://www.dostips.com/DtTutoFunctions.php#FunctionTutorial.ReturningValuesClassic
:getparentdir
setlocal enabledelayedexpansion
set P=%~1
rem echo 1='%P%'
rem echo getparentdir parentdir='%parentdir%'
rem echo getparentdir unixpath='%unixpath%'
if "!P!" EQU "" goto :eof
if "!P!" EQU "b2d" (
	endlocal
	set "parentdir=%parentdir%"
	set "unixpath=%unixpath%"
	goto :EOF
)
if not "%parentdir%" == "" (
	set "parentdir=!parentdir!\!P!"
	set "unixpath=!unixpath!/!P!"
	rem echo notempty: parentdir='%parentdir%'
	rem echo notempty: unixpath='%unixpath%'
)
rem echo between: parentdir='%parentdir%'
rem echo between: unixpath='%unixpath%'
if "%parentdir%" == "" (
	set "parentdir=!P!"
	set "unixpath=/!P!"
	set "unixpath=!unixpath::=!"
	call :lowercase unixpath
	rem echo empty: parentdir='!parentdir!'
	rem echo empty: unixpath='!unixpath!'
)
shift
( endlocal & REM.-- RETURN VALUES
	set "parentdir=%parentdir%"
	set "unixpath=%unixpath%"
)
rem echo shiftt: parentdir='%parentdir%'
rem echo shiftt: unixpath='%unixpath%'
goto getparentdir

:lowercase
set %~1=!%1:C=c!
set %~1=!%1:D=d!
set %~1=!%1:E=e!
set %~1=!%1:F=f!
set %~1=!%1:G=g!
set %~1=!%1:H=h!
set %~1=!%1:I=i!
set %~1=!%1:J=j!
set %~1=!%1:K=k!
set %~1=!%1:L=l!
set %~1=!%1:M=m!
set %~1=!%1:N=n!
set %~1=!%1:O=o!
set %~1=!%1:P=p!
set %~1=!%1:Q=q!
set %~1=!%1:R=r!
set %~1=!%1:S=s!
set %~1=!%1:T=t!
set %~1=!%1:U=u!
set %~1=!%1:V=v!
set %~1=!%1:W=w!
set %~1=!%1:X=w!
set %~1=!%1:Y=y!
set %~1=!%1:Z=z!
goto :eof

senv.bat: fix getparentdir not found error message


@echo off

for /d %%d in (
	"%~dp0..\vendors\xsrv"
	"%~dp0..\vendors\VcXsrv*"
	"%~dp0..\vendors\Xming*"
) do if exist "%%~d" if exist "%~dp0..\etc\misc\xsrv\xsrv-multiwindow.xlaunch" (
	start "" "%%~d\XLaunch.exe" -run "%~dp0..\etc\misc\xsrv\xsrv-multiwindow.xlaunch"
	goto :EOF
)

@echo off

for /d %%d in (
	"%~dp0..\vendors\xsrv"
	"%~dp0..\vendors\VcXsrv*"
	"%~dp0..\vendors\Xming*"
) do if exist "%%~d" for %%n in (
	XLaunch
) do if exist "%%~d\%%~n.exe" (
	start "" "%%~d\XLaunch.exe" -run "%~dp0..\etc\misc\xsrv\xsrv-multiwindow.xlaunch"
	goto :EOF
)

simplify xlaunch.bat from the previous commit


@ECHO OFF
SETLOCAL

SET SCRIPT_DIR=%~dp0
IF NOT EXIST "%SCRIPT_DIR%\..\..\build\setup_vars_opencv3.cmd" (
  ECHO ERROR: OpenCV Winpack installation is required
  pause
  exit
)

:: Detect Python binary
python -V 2>nul
IF %ERRORLEVEL% EQU 0 (
  SET PYTHON=python
  GOTO :PYTHON_FOUND
)

CALL :QUERY_PYTHON 3.7
IF %ERRORLEVEL% EQU 0 GOTO :PYTHON_FOUND
CALL :QUERY_PYTHON 3.6
IF %ERRORLEVEL% EQU 0 GOTO :PYTHON_FOUND
CALL :QUERY_PYTHON 3.5
IF %ERRORLEVEL% EQU 0 GOTO :PYTHON_FOUND
CALL :QUERY_PYTHON 3.4
IF %ERRORLEVEL% EQU 0 GOTO :PYTHON_FOUND
CALL :QUERY_PYTHON 2.7
IF %ERRORLEVEL% EQU 0 GOTO :PYTHON_FOUND
GOTO :PYTHON_NOT_FOUND

:QUERY_PYTHON
SETLOCAL
SET PY_VERSION=%1
FOR /F "tokens=2*" %%A IN ('REG QUERY "HKCU\SOFTWARE\Python\PythonCore\%PY_VERSION%\InstallPath" /reg:64 /ve 2^>NUL ^| FIND "REG_SZ"') DO SET PYTHON_DIR=%%B
IF EXIST "%PYTHON_DIR%\python.exe" (
  SET "PYTHON=%PYTHON_DIR%\python.exe"
  GOTO :QUERY_PYTHON_FOUND
)
FOR /F "tokens=2*" %%A IN ('REG QUERY "HKLM\SOFTWARE\Python\PythonCore\%PY_VERSION%\InstallPath" /reg:64 /ve 2^>NUL ^| FIND "REG_SZ"') DO SET PYTHON_DIR=%%B
IF EXIST "%PYTHON_DIR%\python.exe" (
  SET "PYTHON=%PYTHON_DIR%\python.exe"
  GOTO :QUERY_PYTHON_FOUND
)

::echo Python %PY_VERSION% is not detected
ENDLOCAL
EXIT /B 1

:QUERY_PYTHON_FOUND
ECHO Found Python %PY_VERSION% from Windows Registry
ENDLOCAL & SET PYTHON=%PYTHON%
EXIT /B 0

IF exist C:\Python27-x64\python.exe (
  SET PYTHON=C:\Python27-x64\python.exe
  GOTO :PYTHON_FOUND
)
IF exist C:\Python27\python.exe (
  SET PYTHON=C:\Python27\python.exe
  GOTO :PYTHON_FOUND
)

:PYTHON_NOT_FOUND
ECHO ERROR: Python not found
IF NOT DEFINED OPENCV_BATCH_MODE ( pause )
EXIT /B

:PYTHON_FOUND
ECHO Using Python: %PYTHON%

:: Don't generate unnecessary .pyc cache files
SET PYTHONDONTWRITEBYTECODE=1

IF [%1]==[] goto rundemo

set SRC_FILENAME=%~dpnx1
echo SRC_FILENAME=%SRC_FILENAME%
call :dirname "%SRC_FILENAME%" SRC_DIR
call :dirname "%PYTHON%" PYTHON_DIR
PUSHD %SRC_DIR%
CALL "%SCRIPT_DIR%\..\..\build\setup_vars_opencv3.cmd"
ECHO Run: %*
%PYTHON% %*
SET result=%errorlevel%
IF %result% NEQ 0 (
  IF NOT DEFINED OPENCV_BATCH_MODE (
    SET "PATH=%PYTHON_DIR%;%PATH%"
    echo ================================================================================
    echo **  Type 'python sample_name.py' to run sample
    echo **  Type 'exit' to exit from interactive shell and open the build directory
    echo ================================================================================
    cmd /k echo Current directory: %CD%
  )
)
POPD
EXIT /B %result%

:rundemo
PUSHD "%SCRIPT_DIR%\python"
CALL "%SCRIPT_DIR%\..\..\build\setup_vars_opencv3.cmd"
%PYTHON% demo.py
SET result=%errorlevel%
IF %result% NEQ 0 (
  IF NOT DEFINED OPENCV_BATCH_MODE ( pause )
)
POPD
EXIT /B %result%

:dirname file resultVar
  setlocal
  set _dir=%~dp1
  set _dir=%_dir:~0,-1%
  endlocal & set %2=%_dir%
  EXIT /B 0

@ECHO OFF
SETLOCAL

SET SCRIPT_DIR=%~dp0
IF NOT EXIST "%SCRIPT_DIR%\..\..\build\setup_vars_opencv3.cmd" (
  ECHO ERROR: OpenCV Winpack installation is required
  pause
  exit
)

:: Detect Python binary
python -V 2>nul
IF %ERRORLEVEL% EQU 0 (
  SET PYTHON=python
  GOTO :PYTHON_FOUND
)

CALL :QUERY_PYTHON 3.7
IF %ERRORLEVEL% EQU 0 GOTO :PYTHON_FOUND
CALL :QUERY_PYTHON 3.6
IF %ERRORLEVEL% EQU 0 GOTO :PYTHON_FOUND
CALL :QUERY_PYTHON 3.5
IF %ERRORLEVEL% EQU 0 GOTO :PYTHON_FOUND
CALL :QUERY_PYTHON 3.4
IF %ERRORLEVEL% EQU 0 GOTO :PYTHON_FOUND
CALL :QUERY_PYTHON 2.7
IF %ERRORLEVEL% EQU 0 GOTO :PYTHON_FOUND
GOTO :PYTHON_NOT_FOUND

:QUERY_PYTHON
SETLOCAL
SET PY_VERSION=%1
SET PYTHON_DIR=
CALL :regquery "HKCU\SOFTWARE\Python\PythonCore\%PY_VERSION%\InstallPath" PYTHON_DIR
IF EXIST "%PYTHON_DIR%\python.exe" (
  SET "PYTHON=%PYTHON_DIR%\python.exe"
  GOTO :QUERY_PYTHON_FOUND
)
CALL :regquery "HKLM\SOFTWARE\Python\PythonCore\%PY_VERSION%\InstallPath" PYTHON_DIR
IF EXIST "%PYTHON_DIR%\python.exe" (
  SET "PYTHON=%PYTHON_DIR%\python.exe"
  GOTO :QUERY_PYTHON_FOUND
)

::echo Python %PY_VERSION% is not detected
ENDLOCAL
EXIT /B 1

:QUERY_PYTHON_FOUND
ECHO Found Python %PY_VERSION% from Windows Registry: %PYTHON%
ENDLOCAL & SET PYTHON=%PYTHON%
EXIT /B 0

IF exist C:\Python27-x64\python.exe (
  SET PYTHON=C:\Python27-x64\python.exe
  GOTO :PYTHON_FOUND
)
IF exist C:\Python27\python.exe (
  SET PYTHON=C:\Python27\python.exe
  GOTO :PYTHON_FOUND
)

:PYTHON_NOT_FOUND
ECHO ERROR: Python not found
IF NOT DEFINED OPENCV_BATCH_MODE ( pause )
EXIT /B

:PYTHON_FOUND
ECHO Using Python: %PYTHON%

:: Don't generate unnecessary .pyc cache files
SET PYTHONDONTWRITEBYTECODE=1

IF [%1]==[] goto rundemo

set SRC_FILENAME=%~dpnx1
echo SRC_FILENAME=%SRC_FILENAME%
call :dirname "%SRC_FILENAME%" SRC_DIR
call :dirname "%PYTHON%" PYTHON_DIR
PUSHD %SRC_DIR%
CALL "%SCRIPT_DIR%\..\..\build\setup_vars_opencv3.cmd"
ECHO Run: %*
%PYTHON% %*
SET result=%errorlevel%
IF %result% NEQ 0 (
  IF NOT DEFINED OPENCV_BATCH_MODE (
    SET "PATH=%PYTHON_DIR%;%PATH%"
    echo ================================================================================
    echo **  Type 'python sample_name.py' to run sample
    echo **  Type 'exit' to exit from interactive shell and open the build directory
    echo ================================================================================
    cmd /k echo Current directory: %CD%
  )
)
POPD
EXIT /B %result%

:rundemo
PUSHD "%SCRIPT_DIR%\python"
CALL "%SCRIPT_DIR%\..\..\build\setup_vars_opencv3.cmd"
%PYTHON% demo.py
SET result=%errorlevel%
IF %result% NEQ 0 (
  IF NOT DEFINED OPENCV_BATCH_MODE ( pause )
)
POPD
EXIT /B %result%

:dirname file resultVar
  setlocal
  set _dir=%~dp1
  set _dir=%_dir:~0,-1%
  endlocal & set %2=%_dir%
  EXIT /B 0

:regquery name resultVar
  SETLOCAL
  FOR /F "tokens=*" %%A IN ('REG QUERY "%1" /reg:64 /ve 2^>NUL ^| FIND "REG_SZ"') DO SET _val=%%A
  IF "x%_val%x"=="xx" EXIT /B 1
  SET _val=%_val:*REG_SZ=%
  FOR /F "tokens=*" %%A IN ("%_val%") DO SET _val=%%A
  ENDLOCAL & SET %2=%_val%
  EXIT /B 0

fix registry values querying

samples(run_python): fix registry values querying


@echo off

REM Copyright (c) 2013-2017, The PurpleI2P Project
REM This file is part of Purple i2pd project and licensed under BSD3
REM See full license text in LICENSE file at top of project tree

setlocal enableextensions

set CURL=%~dp0curl.exe
call :GET_LOCALE
call :GET_PROXY
call :GET_ARCH

if "%locale%"=="Russian" (
	echo ઠ I2Pd Browser Portable
	echo ⥬ : %locale%, ⥪: %xOS%
	echo.
	echo 㧪 ⠭騪 Firefox Portable ESR
) else (
	echo Building I2Pd Browser Portable
	echo System locale: %locale%, architecture: %xOS%
	echo.
	echo Downloading Firefox Portable ESR installer
)

"%CURL%" -L -f -# -O https://downloads.sourceforge.net/project/portableapps/Mozilla%%20Firefox%%2C%%20Portable%%20Ed./Mozilla%%20Firefox%%20ESR%%2C%%20Portable%%20Edition%%2045.8.0/FirefoxPortableESR_45.8.0_%locale%.paf.exe %$X%
if errorlevel 1 (
	echo ERROR:%ErrorLevel%
	pause
	exit
) else (echo OK!)

echo.
if "%locale%"=="Russian" (
	echo ᯠ ⠭騪  㤠  㦭 䠩
) else (
	echo Unpacking the installer and delete unnecessary files
)

7z x -y -o..\Firefox FirefoxPortableESR_45.8.0_%locale%.paf.exe > nul
del /Q FirefoxPortableESR_45.8.0_%locale%.paf.exe
rmdir /S /Q ..\Firefox\$PLUGINSDIR
rmdir /S /Q ..\Firefox\App\AppInfo
rmdir /S /Q ..\Firefox\App\Bin
rmdir /S /Q ..\Firefox\App\DefaultData\plugins
rmdir /S /Q ..\Firefox\App\DefaultData\settings
rmdir /S /Q ..\Firefox\Other
del /Q ..\Firefox\App\readme.txt
del /Q ..\Firefox\help.html
rem if "xOS"=="x86" (
rem	rmdir /S /Q ..\Firefox\App\Firefox64
	rmdir /S /Q ..\Firefox\App\Firefox\dictionaries
	rmdir /S /Q ..\Firefox\App\Firefox\uninstall
	del /Q ..\Firefox\App\Firefox\browser\blocklist.xml
	del /Q ..\Firefox\App\Firefox\crashreporter.*
	del /Q ..\Firefox\App\Firefox\maintenanceservice*.*
	del /Q ..\Firefox\App\Firefox\update*.*
rem ) else (
rem	rmdir /S /Q ..\Firefox\App\Firefox
	rmdir /S /Q ..\Firefox\App\Firefox64\dictionaries
	rmdir /S /Q ..\Firefox\App\Firefox64\uninstall
	del /Q ..\Firefox\App\Firefox64\browser\blocklist.xml
	del /Q ..\Firefox\App\Firefox64\crashreporter.*
	del /Q ..\Firefox\App\Firefox64\maintenanceservice*.*
	del /Q ..\Firefox\App\Firefox64\update*.*
rem )

if "%locale%"=="Russian" (
	echo ⪫祭 ⮢
) else (
	echo Disabling crash reports
)
rem if "xOS"=="x86" (
	sed -i "s/Enabled=1/Enabled=0/g" ..\Firefox\App\Firefox\application.ini
	sed -i "s/ServerURL=.*/ServerURL=-/" ..\Firefox\App\Firefox\application.ini
	sed -i "s/Enabled=1/Enabled=0/g" ..\Firefox\App\Firefox\webapprt\webapprt.ini
	sed -i "s/ServerURL=.*/ServerURL=-/" ..\Firefox\App\Firefox\webapprt\webapprt.ini
rem ) else (
	sed -i "s/Enabled=1/Enabled=0/g" ..\Firefox\App\Firefox64\application.ini
	sed -i "s/ServerURL=.*/ServerURL=-/" ..\Firefox\App\Firefox64\application.ini
	sed -i "s/Enabled=1/Enabled=0/g" ..\Firefox\App\Firefox64\webapprt\webapprt.ini
	sed -i "s/ServerURL=.*/ServerURL=-/" ..\Firefox\App\Firefox64\webapprt\webapprt.ini
rem )

if "%locale%"=="Russian" (
	echo 㧪  NoScript
) else (
	echo Downloading NoScript extension
)

"%CURL%" -L -f -# -O https://addons.mozilla.org/firefox/downloads/latest/noscript/addon-722-latest.xpi
if errorlevel 1 ( echo ERROR:%ErrorLevel% && pause && exit ) else (echo OK!)
copy /Y addon-722-latest.xpi ..\Firefox\App\Firefox\browser\extensions\{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi > nul
copy /Y addon-722-latest.xpi ..\Firefox\App\Firefox64\browser\extensions\{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi > nul
del /Q addon-722-latest.xpi

echo.
if "%locale%"=="Russian" (
	echo ஢ 䠩 ஥   Firefox
) else (
	echo Copying Firefox settings
)
copy /Y profile\* ..\Firefox\App\DefaultData\profile\ > nul
copy /Y settings\FirefoxPortable.ini ..\Firefox\ > nul

if "%locale%"=="Russian" (
	echo 㧪 I2Pd
) else (
	echo Downloading I2Pd
)
if "xOS"=="x86" (
	"%CURL%" -L -f -# -O https://github.com/PurpleI2P/i2pd/releases/download/2.12.0/i2pd_2.12.0_win32_mingw.zip
	if errorlevel 1 ( echo ERROR:%ErrorLevel% && pause && exit ) else (echo OK!)
	7z x -y -o..\i2pd i2pd_2.12.0_win32_mingw.zip > nul
	del /Q i2pd_2.12.0_win32_mingw.zip
) else (
	"%CURL%" -L -f -# -O https://github.com/PurpleI2P/i2pd/releases/download/2.12.0/i2pd_2.12.0_win64_mingw.zip
	if errorlevel 1 ( echo ERROR:%ErrorLevel% && pause && exit ) else (echo OK!)
	7z x -y -o..\i2pd i2pd_2.12.0_win64_mingw.zip > nul
	del /Q i2pd_2.12.0_win64_mingw.zip
)
xcopy /E /I /Y i2pd ..\i2pd > nul

echo.
if "%locale%"=="Russian" (
	echo I2Pd Browser portable ⮢  !
) else (
	echo I2Pd Browser portable is ready to start!
)
pause
exit

:GET_LOCALE
for /f "tokens=3" %%a in ('reg query "HKEY_USERS\.DEFAULT\Keyboard Layout\Preload"^|find "REG_SZ"') do (
	if %%a==00000419 (set locale=Russian) else (set locale=English)
	goto :eof
)
goto :eof

:GET_PROXY
set $X=&set $R=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings
for /F "Tokens=1,3" %%i in ('reg query "%$R%"^|find "Proxy"') do set %%i=%%j
if %ProxyEnable%==0x1 set $X=-x %ProxyServer%
goto :eof

:GET_ARCH
set xOS=x86
if defined PROCESSOR_ARCHITEW6432 (set xOS=x64) else if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set xOS=x64
goto :eof

:eof

@echo off

REM Copyright (c) 2013-2017, The PurpleI2P Project
REM This file is part of Purple i2pd project and licensed under BSD3
REM See full license text in LICENSE file at top of project tree

setlocal enableextensions

set CURL=%~dp0curl.exe
call :GET_LOCALE
call :GET_PROXY
call :GET_ARCH

if "%locale%"=="Russian" (
	echo ઠ I2Pd Browser Portable
	echo ⥬ : %locale%, ⥪: %xOS%
	echo.
	echo 㧪 ⠭騪 Firefox Portable ESR
) else (
	echo Building I2Pd Browser Portable
	echo System locale: %locale%, architecture: %xOS%
	echo.
	echo Downloading Firefox Portable ESR installer
)

"%CURL%" -L -f -# -O https://downloads.sourceforge.net/project/portableapps/Mozilla%%20Firefox%%2C%%20Portable%%20Ed./Mozilla%%20Firefox%%20ESR%%2C%%20Portable%%20Edition%%2045.8.0/FirefoxPortableESR_45.8.0_%locale%.paf.exe %$X%
if errorlevel 1 (
	echo ERROR:%ErrorLevel%
	pause
	exit
) else (echo OK!)

echo.
if "%locale%"=="Russian" (
	echo ᯠ ⠭騪  㤠  㦭 䠩
) else (
	echo Unpacking the installer and delete unnecessary files
)

7z x -y -o..\Firefox FirefoxPortableESR_45.8.0_%locale%.paf.exe > nul
del /Q FirefoxPortableESR_45.8.0_%locale%.paf.exe
rmdir /S /Q ..\Firefox\$PLUGINSDIR
rmdir /S /Q ..\Firefox\App\AppInfo
rmdir /S /Q ..\Firefox\App\Bin
rmdir /S /Q ..\Firefox\App\DefaultData\plugins
rmdir /S /Q ..\Firefox\App\DefaultData\settings
rmdir /S /Q ..\Firefox\Other
del /Q ..\Firefox\App\readme.txt
del /Q ..\Firefox\help.html
rem if "xOS"=="x86" (
rem	rmdir /S /Q ..\Firefox\App\Firefox64
	rmdir /S /Q ..\Firefox\App\Firefox\dictionaries
	rmdir /S /Q ..\Firefox\App\Firefox\uninstall
	del /Q ..\Firefox\App\Firefox\browser\blocklist.xml
	del /Q ..\Firefox\App\Firefox\crashreporter.*
	del /Q ..\Firefox\App\Firefox\maintenanceservice*.*
	del /Q ..\Firefox\App\Firefox\update*.*
rem ) else (
rem	rmdir /S /Q ..\Firefox\App\Firefox
	rmdir /S /Q ..\Firefox\App\Firefox64\dictionaries
	rmdir /S /Q ..\Firefox\App\Firefox64\uninstall
	del /Q ..\Firefox\App\Firefox64\browser\blocklist.xml
	del /Q ..\Firefox\App\Firefox64\crashreporter.*
	del /Q ..\Firefox\App\Firefox64\maintenanceservice*.*
	del /Q ..\Firefox\App\Firefox64\update*.*
rem )

if "%locale%"=="Russian" (
	echo ⪫祭 ⮢
) else (
	echo Disabling crash reports
)
rem if "xOS"=="x86" (
	sed -i "s/Enabled=1/Enabled=0/g" ..\Firefox\App\Firefox\application.ini
	sed -i "s/ServerURL=.*/ServerURL=-/" ..\Firefox\App\Firefox\application.ini
	sed -i "s/Enabled=1/Enabled=0/g" ..\Firefox\App\Firefox\webapprt\webapprt.ini
	sed -i "s/ServerURL=.*/ServerURL=-/" ..\Firefox\App\Firefox\webapprt\webapprt.ini
rem ) else (
	sed -i "s/Enabled=1/Enabled=0/g" ..\Firefox\App\Firefox64\application.ini
	sed -i "s/ServerURL=.*/ServerURL=-/" ..\Firefox\App\Firefox64\application.ini
	sed -i "s/Enabled=1/Enabled=0/g" ..\Firefox\App\Firefox64\webapprt\webapprt.ini
	sed -i "s/ServerURL=.*/ServerURL=-/" ..\Firefox\App\Firefox64\webapprt\webapprt.ini
rem )

if "%locale%"=="Russian" (
	echo 㧪  NoScript
) else (
	echo Downloading NoScript extension
)

"%CURL%" -L -f -# -O https://addons.mozilla.org/firefox/downloads/latest/noscript/addon-722-latest.xpi
if errorlevel 1 ( echo ERROR:%ErrorLevel% && pause && exit ) else (echo OK!)
copy /Y addon-722-latest.xpi ..\Firefox\App\Firefox\browser\extensions\{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi > nul
copy /Y addon-722-latest.xpi ..\Firefox\App\Firefox64\browser\extensions\{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi > nul
del /Q addon-722-latest.xpi

echo.
if "%locale%"=="Russian" (
	echo ஢ 䠩 ஥   Firefox
) else (
	echo Copying Firefox settings
)
copy /Y profile\* ..\Firefox\App\DefaultData\profile\ > nul
copy /Y settings\FirefoxPortable.ini ..\Firefox\ > nul

if "%locale%"=="Russian" (
	echo 㧪 I2Pd
) else (
	echo Downloading I2Pd
)
if "%xOS%"=="x86" (
	"%CURL%" -L -f -# -O https://github.com/PurpleI2P/i2pd/releases/download/2.12.0/i2pd_2.12.0_win32_mingw.zip
	if errorlevel 1 ( echo ERROR:%ErrorLevel% && pause && exit ) else (echo OK!)
	7z x -y -o..\i2pd i2pd_2.12.0_win32_mingw.zip > nul
	del /Q i2pd_2.12.0_win32_mingw.zip
) else (
	"%CURL%" -L -f -# -O https://github.com/PurpleI2P/i2pd/releases/download/2.12.0/i2pd_2.12.0_win64_mingw.zip
	if errorlevel 1 ( echo ERROR:%ErrorLevel% && pause && exit ) else (echo OK!)
	7z x -y -o..\i2pd i2pd_2.12.0_win64_mingw.zip > nul
	del /Q i2pd_2.12.0_win64_mingw.zip
)
xcopy /E /I /Y i2pd ..\i2pd > nul

echo.
if "%locale%"=="Russian" (
	echo I2Pd Browser portable ⮢  !
) else (
	echo I2Pd Browser portable is ready to start!
)
pause
exit

:GET_LOCALE
for /f "tokens=3" %%a in ('reg query "HKEY_USERS\.DEFAULT\Keyboard Layout\Preload"^|find "REG_SZ"') do (
	if %%a==00000419 (set locale=Russian) else (set locale=English)
	goto :eof
)
goto :eof

:GET_PROXY
set $X=&set $R=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings
for /F "Tokens=1,3" %%i in ('reg query "%$R%"^|find "Proxy"') do set %%i=%%j
if %ProxyEnable%==0x1 set $X=-x %ProxyServer%
goto :eof

:GET_ARCH
set xOS=x86
if defined PROCESSOR_ARCHITEW6432 (set xOS=x64) else if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set xOS=x64
goto :eof

:eof

fix variable check for i2pd download

fix variable check for i2pd download

Former-commit-id: 57c17f3c94bdc7fa3cf0f4b3dfd2325efd723bbc


md include
md include\google
md include\google\protobuf
md include\google\protobuf\stubs
md include\google\protobuf\io
md include\google\protobuf\compiler
md include\google\protobuf\compiler\cpp
md include\google\protobuf\compiler\java
md include\google\protobuf\compiler\python
copy ..\src\google\protobuf\stubs\common.h include\google\protobuf\stubs\common.h
copy ..\src\google\protobuf\stubs\once.h include\google\protobuf\stubs\once.h
copy ..\src\google\protobuf\descriptor.h include\google\protobuf\descriptor.h
copy ..\src\google\protobuf\descriptor.pb.h include\google\protobuf\descriptor.pb.h
copy ..\src\google\protobuf\descriptor_database.h include\google\protobuf\descriptor_database.h
copy ..\src\google\protobuf\dynamic_message.h include\google\protobuf\dynamic_message.h
copy ..\src\google\protobuf\extension_set.h include\google\protobuf\extension_set.h
copy ..\src\google\protobuf\generated_message_reflection.h include\google\protobuf\generated_message_reflection.h
copy ..\src\google\protobuf\message.h include\google\protobuf\message.h
copy ..\src\google\protobuf\reflection_ops.h include\google\protobuf\reflection_ops.h
copy ..\src\google\protobuf\repeated_field.h include\google\protobuf\repeated_field.h
copy ..\src\google\protobuf\service.h include\google\protobuf\service.h
copy ..\src\google\protobuf\text_format.h include\google\protobuf\text_format.h
copy ..\src\google\protobuf\unknown_field_set.h include\google\protobuf\unknown_field_set.h
copy ..\src\google\protobuf\wire_format.h include\google\protobuf\wire_format.h
copy ..\src\google\protobuf\wire_format_inl.h include\google\protobuf\wire_format_inl.h
copy ..\src\google\protobuf\io\coded_stream.h include\google\protobuf\io\coded_stream.h
copy ..\src\google\protobuf\io\gzip_stream.h include\google\protobuf\io\gzip_stream.h
copy ..\src\google\protobuf\io\printer.h include\google\protobuf\io\printer.h
copy ..\src\google\protobuf\io\tokenizer.h include\google\protobuf\io\tokenizer.h
copy ..\src\google\protobuf\io\zero_copy_stream.h include\google\protobuf\io\zero_copy_stream.h
copy ..\src\google\protobuf\io\zero_copy_stream_impl.h include\google\protobuf\io\zero_copy_stream_impl.h
copy ..\src\google\protobuf\compiler\code_generator.h include\google\protobuf\compiler\code_generator.h
copy ..\src\google\protobuf\compiler\command_line_interface.h include\google\protobuf\compiler\command_line_interface.h
copy ..\src\google\protobuf\compiler\importer.h include\google\protobuf\compiler\importer.h
copy ..\src\google\protobuf\compiler\parser.h include\google\protobuf\compiler\parser.h
copy ..\src\google\protobuf\compiler\cpp\cpp_generator.h include\google\protobuf\compiler\cpp\cpp_generator.h
copy ..\src\google\protobuf\compiler\java\java_generator.h include\google\protobuf\compiler\java\java_generator.h
copy ..\src\google\protobuf\compiler\python\python_generator.h include\google\protobuf\compiler\python\python_generator.h

md include
md include\google
md include\google\protobuf
md include\google\protobuf\stubs
md include\google\protobuf\io
md include\google\protobuf\compiler
md include\google\protobuf\compiler\cpp
md include\google\protobuf\compiler\java
md include\google\protobuf\compiler\python
copy ..\src\google\protobuf\stubs\common.h include\google\protobuf\stubs\common.h
copy ..\src\google\protobuf\stubs\once.h include\google\protobuf\stubs\once.h
copy ..\src\google\protobuf\descriptor.h include\google\protobuf\descriptor.h
copy ..\src\google\protobuf\descriptor.pb.h include\google\protobuf\descriptor.pb.h
copy ..\src\google\protobuf\descriptor_database.h include\google\protobuf\descriptor_database.h
copy ..\src\google\protobuf\dynamic_message.h include\google\protobuf\dynamic_message.h
copy ..\src\google\protobuf\extension_set.h include\google\protobuf\extension_set.h
copy ..\src\google\protobuf\generated_message_util.h include\google\protobuf\generated_message_util.h
copy ..\src\google\protobuf\generated_message_reflection.h include\google\protobuf\generated_message_reflection.h
copy ..\src\google\protobuf\message.h include\google\protobuf\message.h
copy ..\src\google\protobuf\message_lite.h include\google\protobuf\message_lite.h
copy ..\src\google\protobuf\reflection_ops.h include\google\protobuf\reflection_ops.h
copy ..\src\google\protobuf\repeated_field.h include\google\protobuf\repeated_field.h
copy ..\src\google\protobuf\service.h include\google\protobuf\service.h
copy ..\src\google\protobuf\text_format.h include\google\protobuf\text_format.h
copy ..\src\google\protobuf\unknown_field_set.h include\google\protobuf\unknown_field_set.h
copy ..\src\google\protobuf\wire_format.h include\google\protobuf\wire_format.h
copy ..\src\google\protobuf\wire_format_lite.h include\google\protobuf\wire_format_lite.h
copy ..\src\google\protobuf\wire_format_lite_inl.h include\google\protobuf\wire_format_lite_inl.h
copy ..\src\google\protobuf\io\coded_stream.h include\google\protobuf\io\coded_stream.h
copy ..\src\google\protobuf\io\gzip_stream.h include\google\protobuf\io\gzip_stream.h
copy ..\src\google\protobuf\io\printer.h include\google\protobuf\io\printer.h
copy ..\src\google\protobuf\io\tokenizer.h include\google\protobuf\io\tokenizer.h
copy ..\src\google\protobuf\io\zero_copy_stream.h include\google\protobuf\io\zero_copy_stream.h
copy ..\src\google\protobuf\io\zero_copy_stream_impl.h include\google\protobuf\io\zero_copy_stream_impl.h
copy ..\src\google\protobuf\io\zero_copy_stream_impl_lite.h include\google\protobuf\io\zero_copy_stream_impl_lite.h
copy ..\src\google\protobuf\compiler\code_generator.h include\google\protobuf\compiler\code_generator.h
copy ..\src\google\protobuf\compiler\command_line_interface.h include\google\protobuf\compiler\command_line_interface.h
copy ..\src\google\protobuf\compiler\importer.h include\google\protobuf\compiler\importer.h
copy ..\src\google\protobuf\compiler\parser.h include\google\protobuf\compiler\parser.h
copy ..\src\google\protobuf\compiler\cpp\cpp_generator.h include\google\protobuf\compiler\cpp\cpp_generator.h
copy ..\src\google\protobuf\compiler\java\java_generator.h include\google\protobuf\compiler\java\java_generator.h
copy ..\src\google\protobuf\compiler\python\python_generator.h include\google\protobuf\compiler\python\python_generator.h

Add new headers to extract_includes.bat.