2019-05-22 20:10:31 +03:00
|
|
|
@REM ----------------------------------------------------------------------
|
2019-11-18 23:45:06 +03:00
|
|
|
@REM Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
@REM Licensed under the MIT License
|
2019-05-22 20:10:31 +03:00
|
|
|
@REM ----------------------------------------------------------------------
|
|
|
|
@echo off
|
|
|
|
|
2019-05-29 20:29:56 +03:00
|
|
|
IF "%~1"=="" (
|
2019-05-22 20:10:31 +03:00
|
|
|
echo.
|
|
|
|
echo This script bootstraps common library enlistment and setup.
|
|
|
|
echo.
|
|
|
|
echo Usage:
|
2019-10-08 21:24:48 +03:00
|
|
|
echo %0 ^<common code dir^> ["/name=<custom environment name>"]
|
2019-05-22 20:10:31 +03:00
|
|
|
echo.
|
|
|
|
|
|
|
|
exit /B -1
|
|
|
|
)
|
|
|
|
|
2019-05-29 20:29:56 +03:00
|
|
|
set _COMMON_CODE_DIR=%~1
|
2019-05-23 08:33:48 +03:00
|
|
|
shift /1
|
|
|
|
|
2019-05-22 20:10:31 +03:00
|
|
|
if "%DEVELOPMENT_ENVIRONMENT_REPOSITORY_ACTIVATED_FLAG%" NEQ "" (
|
|
|
|
echo.
|
|
|
|
echo ERROR: Please run this from a standard ^(non-activated^) command prompt.
|
|
|
|
echo.
|
|
|
|
|
|
|
|
exit /B -1
|
|
|
|
)
|
|
|
|
|
|
|
|
REM Bootstrap enlistment and setup of Common_Environment, and then invoke
|
2019-10-08 21:24:48 +03:00
|
|
|
REM enlistment and setup once python is available.
|
2019-05-22 20:10:31 +03:00
|
|
|
|
2019-05-23 08:33:48 +03:00
|
|
|
IF NOT EXIST "%_COMMON_CODE_DIR%\Common\Environment" (
|
2019-10-08 21:24:48 +03:00
|
|
|
git clone https://github.com/davidbrownell/Common_Environment_v3.git "%_COMMON_CODE_DIR%\Common\Environment.tmp"
|
|
|
|
if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL%
|
|
|
|
|
|
|
|
move "%_COMMON_CODE_DIR%\Common\Environment.tmp" "%_COMMON_CODE_DIR%\Common\Environment"
|
2019-05-22 20:10:31 +03:00
|
|
|
if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL%
|
|
|
|
)
|
|
|
|
|
2019-05-23 08:33:48 +03:00
|
|
|
REM Note that the following loop has been crafted to work around batch's crazy
|
|
|
|
REM expansion rules. Modify at your own risk!
|
|
|
|
set _BOOTSTRAP_NAME=
|
|
|
|
set _BOOTSTRAP_CLA=
|
|
|
|
|
|
|
|
:GetRemainingArgs_Begin
|
|
|
|
|
2019-05-29 20:29:56 +03:00
|
|
|
if "%~1"=="" goto :GetRemainingArgs_End
|
2019-05-23 08:33:48 +03:00
|
|
|
|
2019-05-29 20:29:56 +03:00
|
|
|
set _ARG=%~1
|
2019-05-23 08:33:48 +03:00
|
|
|
|
2019-08-05 20:38:36 +03:00
|
|
|
if "%_ARG:~,6%"=="/name=" goto :GetRemainingArgs_Name1
|
|
|
|
if "%_ARG:~,6%"=="-name=" goto :GetRemainingArgs_Name1
|
|
|
|
|
|
|
|
if "%_ARG:~,9%"=="/name_EQ_" goto :GetRemainingArgs_Name2
|
|
|
|
if "%_ARG:~,9%"=="-name_EQ_" goto :GetRemainingArgs_Name2
|
2019-05-23 08:33:48 +03:00
|
|
|
|
|
|
|
REM If here, we are looking at an arg that should be passed to the script
|
|
|
|
set _BOOTSTRAP_CLA=%_BOOTSTRAP_CLA% "%_ARG%"
|
|
|
|
goto :GetRemainingArgs_Continue
|
|
|
|
|
2019-08-05 20:38:36 +03:00
|
|
|
:GetRemainingArgs_Name1
|
|
|
|
REM If here, we are looking at a name argument
|
|
|
|
set _BOOTSTRAP_NAME=%_ARG:~6%
|
|
|
|
goto :GetRemainingArgs_Continue
|
|
|
|
|
|
|
|
:GetRemainingArgs_Name2
|
2019-05-23 08:33:48 +03:00
|
|
|
REM If here, we are looking at a name argument
|
|
|
|
set _BOOTSTRAP_NAME=%_ARG:~9%
|
|
|
|
goto :GetRemainingArgs_Continue
|
|
|
|
|
|
|
|
:GetRemainingArgs_Continue
|
|
|
|
shift /1
|
|
|
|
goto :GetRemainingArgs_Begin
|
|
|
|
|
|
|
|
:GetRemainingArgs_End
|
|
|
|
|
|
|
|
set _BOOTSTRAP_NAME_ARG=
|
|
|
|
if "%_BOOTSTRAP_NAME%" NEQ "" (
|
2019-10-08 21:24:48 +03:00
|
|
|
set _BOOTSTRAP_NAME_ARG="/name=%_BOOTSTRAP_NAME%"
|
2019-05-23 08:33:48 +03:00
|
|
|
)
|
|
|
|
|
2019-06-05 05:10:16 +03:00
|
|
|
REM This works around a strange problem when attempting to invoke a command file using
|
|
|
|
REM a relative path.
|
2019-10-08 21:24:48 +03:00
|
|
|
pushd "%_COMMON_CODE_DIR%"
|
2019-06-05 05:10:16 +03:00
|
|
|
set _COMMON_CODE_ABSOLUTE_DIR=%CD%
|
|
|
|
popd
|
|
|
|
|
2019-08-05 20:38:36 +03:00
|
|
|
call "%_COMMON_CODE_ABSOLUTE_DIR%\Common\Environment\Setup.cmd" %_BOOTSTRAP_NAME_ARG%
|
2019-05-22 20:10:31 +03:00
|
|
|
if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL%
|
|
|
|
|
|
|
|
REM Write the environment activation and python execution statements to a temporary
|
|
|
|
REM file so this environment remains unactivated (by doing this, the current script
|
|
|
|
REM can be invoked multiple times from the same environment).
|
2019-05-23 08:33:48 +03:00
|
|
|
set _ACTIVATE_CMD=Activate.cmd
|
|
|
|
|
|
|
|
if "%_BOOTSTRAP_NAME%" NEQ "" (
|
|
|
|
set _ACTIVATE_CMD=Activate.%_BOOTSTRAP_NAME%.cmd
|
|
|
|
)
|
|
|
|
|
2019-05-22 20:10:31 +03:00
|
|
|
(
|
|
|
|
echo @echo off
|
2019-10-08 21:24:48 +03:00
|
|
|
echo.
|
2019-05-23 08:33:48 +03:00
|
|
|
echo call "%_COMMON_CODE_DIR%\Common\Environment\%_ACTIVATE_CMD%" python36
|
2019-10-08 21:24:48 +03:00
|
|
|
echo if %%ERRORLEVEL%% NEQ 0 exit /B %%ERRORLEVEL%%
|
|
|
|
echo.
|
|
|
|
echo call %~dp0Setup.cmd Enlist "%_COMMON_CODE_DIR%" /recurse %_BOOTSTRAP_CLA%
|
|
|
|
echo if %%ERRORLEVEL%% NEQ 0 exit /B %%ERRORLEVEL%%
|
|
|
|
echo.
|
|
|
|
echo call %~dp0Setup.cmd /recurse %_BOOTSTRAP_CLA%
|
|
|
|
echo if %%ERRORLEVEL%% NEQ 0 exit /B %%ERRORLEVEL%%
|
2019-05-22 20:10:31 +03:00
|
|
|
) >bootstrap_tmp.cmd
|
|
|
|
|
|
|
|
cmd /C bootstrap_tmp.cmd
|
|
|
|
set _ERRORLEVEL=%ERRORLEVEL%
|
|
|
|
del bootstrap_tmp.cmd
|
|
|
|
|
2019-05-23 08:33:48 +03:00
|
|
|
set _ACTIVATE_CMD=
|
|
|
|
set _ARG=
|
|
|
|
set _BOOTSTRAP_CLA=
|
|
|
|
set _BOOTSTRAP_NAME=
|
|
|
|
set _BOOTSTRAP_NAME_ARG=
|
|
|
|
set _COMMON_CODE_DIR=
|
2019-06-05 05:10:16 +03:00
|
|
|
set _COMMON_CODE_ABSOLUTE_DIR=
|
2019-05-23 08:33:48 +03:00
|
|
|
|
2019-05-22 20:10:31 +03:00
|
|
|
if %_ERRORLEVEL% NEQ 0 exit /B %_ERRORLEVEL%
|