]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Update Edk2Setup.bat to support multiple workspaces
authorLiming Gao <liming.gao@intel.com>
Thu, 8 Oct 2015 09:29:36 +0000 (09:29 +0000)
committerlgao4 <lgao4@Edk2>
Thu, 8 Oct 2015 09:29:36 +0000 (09:29 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Wu Hao A <hao.a.wu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18583 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Scripts/SetVisualStudio.bat
BaseTools/Scripts/ShowEnvironment.bat
Edk2Setup.bat

index a302a835969f036d30093172a4b253cded311671..d379cd73dff4d3159eb30d215f5f0f800e2993ef 100755 (executable)
@@ -68,7 +68,7 @@ if not exist "%COMMONTOOLSx64%\vcvarsx86_amd64.bat" (
 @goto End\r
 \r
 :RebuildTools\r
-@call python "%WORKSPACE%\BaseTools\Scripts\UpdateBuildVersions.py"\r
+@call python "%BASE_TOOLS_PATH%\Scripts\UpdateBuildVersions.py"\r
 @set "BIN_DIR=%EDK_TOOLS_PATH%\Bin\Win32"\r
 if not exist "%BIN_DIR%" @mkdir "%BIN_DIR%"\r
 @echo Removing temporary and binary files\r
index c4613e11708fd3f21aef8561a730ef282db72c25..2b320fbc2152a5a2ffc2dcd865ac42903495fb1a 100755 (executable)
@@ -47,9 +47,11 @@ if defined SRC_CONF @goto SetEnv
 @echo #############################################################################\r
 @if defined WORKSPACE @echo     WORKSPACE            = %WORKSPACE%\r
 @if not defined WORKSPACE @echo     WORKSPACE            = Not Set\r
+@if defined PACKAGES_PATH @echo     PACKAGES_PATH        = %PACKAGES_PATH%\r
 @if defined EDK_TOOLS_PATH @echo     EDK_TOOLS_PATH       = %EDK_TOOLS_PATH%\r
 @if not defined EDK_TOOLS_PATH @echo     EDK_TOOLS_PATH       = Not Set\r
 @if defined BASE_TOOLS_PATH @echo     BASE_TOOLS_PATH      = %BASE_TOOLS_PATH%\r
+@if defined EDK_TOOLS_BIN @echo     EDK_TOOLS_BIN        = %EDK_TOOLS_BIN%\r
 @if defined PYTHON_FREEZER_PATH @echo     PYTHON_FREEZER_PATH  = %PYTHON_FREEZER_PATH%\r
 @if "%NT32PKG%"=="TRUE" (\r
     @echo.\r
index 0aa786d9ab94fbcec87314f31a9704a948904228..2d132349bc326e94951510667628c12c08fd0c8b 100755 (executable)
 \r
 @if not defined ORIGINAL_PATH set "ORIGINAL_PATH=%PATH%"\r
 @REM Always set the WORKSPACE environment variable to the current directory\r
-@set "WORKSPACE=%CD%"\r
-@if exist "%WORKSPACE%\BaseTools" @set "BASE_TOOLS_PATH=%WORKSPACE%\BaseTools"\r
+@if not defined WORKSPACE (\r
+  @set "WORKSPACE=%CD%"\r
+)\r
+@if not exist "%BASE_TOOLS_PATH%" (\r
+  @if exist "%WORKSPACE%\BaseTools" (\r
+    set "BASE_TOOLS_PATH=%WORKSPACE%\BaseTools"\r
+  ) else (\r
+    @if defined PACKAGES_PATH (\r
+      @for %%i IN (%PACKAGES_PATH%) DO (\r
+        @if exist %%~fi\BaseTools (\r
+          @set BASE_TOOLS_PATH=%%~fi\BaseTools\r
+          @goto checkBaseTools\r
+        )\r
+      )\r
+    )\r
+  )\r
+)\r
+:checkBaseTools\r
+@if not defined BASE_TOOLS_PATH (\r
+  @echo.\r
+  @echo !!! ERROR !!! The BaseTools Package was not found !!!\r
+  @echo.\r
+  @goto ExitFailure\r
+)\r
 @if not exist "%WORKSPACE%\Conf" @mkdir "%WORKSPACE%\Conf"\r
 \r
-@@if not defined EDK_TOOLS_PATH @set "EDK_TOOLS_PATH=%WORKSPACE%\BaseTools"\r
-@rem   @set "PATH=%WORKSPACE%\BaseTools\Bin\Win32;%PATH%"\r
-@rem   @set WORKSPACE_TOOLS_PATH=%WORKSPACE%\BaseTools\r
-@rem )\r
+@@if not defined EDK_TOOLS_PATH @set "EDK_TOOLS_PATH=%BASE_TOOLS_PATH%"\r
 \r
 @REM Keep the existing EDK_TOOLS_PATH value, the --reset flag will set it\r
 @REM back to WORKSPACE\BaseTools while the --location DIRECTORY flag will\r
 @echo %SCRIPT_NAME% Version: %SCRIPT_VERSION%%SVN_REVISION:~11,-1%\r
 @echo Copyright(c) 2014, Intel Corporation. All rights reserved.\r
 @set HIDE_PATH=TRUE\r
-@call "%WORKSPACE%\BaseTools\Scripts\ShowEnvironment.bat"\r
+@call "%BASE_TOOLS_PATH%\Scripts\ShowEnvironment.bat"\r
 @set HIDE_PATH=\r
 @goto ExitSuccess\r
 \r
 @REM copied or replaced from the WORKSPACE\BaseTools\Conf directories' template files.\r
 :SetConf\r
 @if not exist "%EDK_TOOLS_PATH%\Conf" (\r
-    @if exist "%WORKSPACE%\BaseTools\Conf" (\r
-        @set "SRC_CONF=%WORKSPACE%\BaseTools\Conf"\r
+    @if exist "%BASE_TOOLS_PATH%\Conf" (\r
+        @set "SRC_CONF=%BASE_TOOLS_PATH%\Conf"\r
     )\r
 ) else (\r
     @set "SRC_CONF=%EDK_TOOLS_PATH%\Conf"\r
 \r
 @REM The script will test to see if the files exist, and also use the RESET_ENVIRONMENT flag\r
 @REM to overwrite the WORKSPACE\Conf *.txt files.\r
-@call "%WORKSPACE%\BaseTools\Scripts\ShowEnvironment.bat"\r
+@call "%BASE_TOOLS_PATH%\Scripts\ShowEnvironment.bat"\r
 @if errorlevel 1 (\r
     @echo Unable to copy the template files from "%SRC_CONF%" to "%WORKSPACE%\Conf"\r
     @goto ExitFailure\r
 @REM Set up Visual Studio if required to build the Nt32Pkg/Nt32Pkg.dsc emulator\r
 @if "%NT32PKG%"=="TRUE" (\r
     @if not defined VSINSTALLDIR @set "PATH=%ORIGINAL_PATH%"\r
-    @if not defined NT32_X64 @call "%WORKSPACE%\BaseTools\get_vsvars.bat"\r
-    @if defined NT32_X64 call "%WORKSPACE%\BaseTools\Scripts\SetVisualStudio.bat"\r
+    @if not defined NT32_X64 @call "%BASE_TOOLS_PATH%\get_vsvars.bat"\r
+    @if defined NT32_X64 call "%BASE_TOOLS_PATH%\Scripts\SetVisualStudio.bat"\r
 )\r
 @if "%NT32PKG%"=="TRUE" (\r
     @if not defined VS_PATH set "VS_PATH=%PATH%"\r
 )\r
 @if defined VS_PATH @set "PATH=%VS_PATH%"\r
 @if not defined VS_PATH @set "PATH=%ORIGINAL_PATH%"\r
-@set "PATH=%EDK_TOOLS_PATH%\Bin\Win32;%PATH%"\r
+@if not defined EDK_TOOLS_BIN (\r
+  @if exist %EDK_TOOLS_PATH%\Bin\Win32 (\r
+    @set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32\r
+  ) else (\r
+    @echo.\r
+    @echo !!! ERROR !!! Cannot find BaseTools Bin Win32!!!\r
+    @echo Please check the directory %EDK_TOOLS_PATH%\Bin\Win32\r
+    @echo Or configure EDK_TOOLS_BIN env to point Win32 directory.\r
+    @echo. \r
+    @goto ExitFailure\r
+  )\r
+)\r
+@set "PATH=%EDK_TOOLS_BIN%;%PATH%"\r
 \r
 @if "%REBUILD_TOOLS%"=="TRUE" @goto Rebuild\r
 @if "%SVN_PULL%"== "TRUE" (\r
     if defined PYTHONHOME (\r
         @REM Use the python script if possible to test is the svn command is available, if it fails, the user may be\r
         @REM able to rebuild the Win32 binaries\r
-        @call "%WORKSPACE%\BaseTools\Scripts\UpdateBuildVersions.py" --svn-test -v\r
+        @call "%BASE_TOOLS_PATH%\Scripts\UpdateBuildVersions.py" --svn-test -v\r
         @if errorlevel 1 (\r
             @echo ERROR : The command-line svn tool is not available and the Win32 binaries do not exist\r
             @echo         Please re-run this script again with the --rebuild option to attempt to build \r
 \r
 @REM The following code is used to rebuild the Win32 BaseTools binaries - check that required tools are available\r
 :Rebuild\r
-@if not defined BASE_TOOLS_PATH @set "BASE_TOOLS_PATH=%WORKSPACE%\BaseTools"\r
 @if not exist "%BASE_TOOLS_PATH%\Source" @goto NoBaseTools\r
 @endlocal\r
 @if not defined VCINSTALLDIR @goto NoVisualStudio\r
     @if not exist "%PYTHONHOME%\Scripts\cxfreeze.bat" @goto NoCxFreeze\r
     @set "PYTHON_FREEZER_PATH=%PYTHONHOME%\Scripts"\r
 )\r
-@call "%WORKSPACE%\BaseTools\Scripts\SetVisualStudio.bat"\r
+@call "%BASE_TOOLS_PATH%\Scripts\SetVisualStudio.bat"\r
 @if errorlevel 1 @goto ExitFailure\r
 \r
 :ShowAndExit\r
-@call "%WORKSPACE%\BaseTools\Scripts\ShowEnvironment.bat"\r
+@call "%BASE_TOOLS_PATH%\Scripts\ShowEnvironment.bat"\r
 \r
 @REM #########################################################################################\r
 @REM EXIT ROUTINES\r