[edk2-devel] [PATCH] BaseTools: Add BaseTools/Scripts to path.

Yuwei Chen posted 1 patch 2 years, 2 months ago
Failed in applying to current master (apply log)
BaseTools/BuildEnv      | 24 +++++++++++++++++++++---
BaseTools/toolsetup.bat |  6 ++++++
2 files changed, 27 insertions(+), 3 deletions(-)
[edk2-devel] [PATCH] BaseTools: Add BaseTools/Scripts to path.
Posted by Yuwei Chen 2 years, 2 months ago
From: MingYue Liang <mingyuex.liang@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2859

I'd like to add a git command extension to add a platform
scoped git grep. It turns out if you have git-<newCmdName>
in your path git will find you extension.

This patch adds basetools/scripts to the path in
both windows and Linux systems.

Signed-off-by: Mingyue Liang <mingyuex.liang@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---
 BaseTools/BuildEnv      | 24 +++++++++++++++++++++---
 BaseTools/toolsetup.bat |  6 ++++++
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/BaseTools/BuildEnv b/BaseTools/BuildEnv
index 275f4c5901..cdee304aee 100755
--- a/BaseTools/BuildEnv
+++ b/BaseTools/BuildEnv
@@ -187,7 +187,6 @@ AddDirToStartOfPath() {
 }
 
 AddEdkToolsToPath() {
-
   #
   # If EDK_TOOLS_PATH is not set, then we cannot update PATH
   #
@@ -208,9 +207,21 @@ AddEdkToolsToPath() {
     AddDirToStartOfPath $EDK_TOOLS_PATH/BinWrappers/PosixLike
   fi
 
-
   AddDirToStartOfPath $EDK_TOOLS_PATH_BIN
+}
 
+AddEdkToolsScriptsToPath() {
+  #
+  # If EDK_TOOLS_PATH is not set, then we cannot update PATH
+  #
+  if [ -z "$EDK_TOOLS_PATH" ]
+  then
+    return 1
+  fi
+
+  echo Add edk2/Basetools/Scripts to path
+  EDK_TOOLS_SCRIPTS_PATH=$EDK_TOOLS_PATH/Scripts
+  AddDirToStartOfPath $EDK_TOOLS_SCRIPTS_PATH
 }
 
 CopySingleTemplateFile() {
@@ -227,7 +238,6 @@ CopySingleTemplateFile() {
   echo "     to $DST_FILENAME"
   SRC_FILENAME=$EDK_TOOLS_PATH/$SRC_FILENAME
   cp $SRC_FILENAME $DST_FILENAME
-
 }
 
 CopyTemplateFiles() {
@@ -262,11 +272,19 @@ ScriptMain() {
     return 1
   fi
 
+  AddEdkToolsScriptsToPath
+  if [ $? -ne 0 ]
+  then
+    echo "Failure adding EDK Tools Scripts into PATH!"
+    return 1
+  fi
+
   StoreCurrentConfiguration
 
   echo WORKSPACE: $WORKSPACE
   echo EDK_TOOLS_PATH: $EDK_TOOLS_PATH
   echo CONF_PATH: $CONF_PATH
+  echo EDK_TOOLS_SCRIPTS_PATH: $EDK_TOOLS_SCRIPTS_PATH
 
   CopyTemplateFiles
 
diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
index 58fd26a4b5..e079a3bb68 100755
--- a/BaseTools/toolsetup.bat
+++ b/BaseTools/toolsetup.bat
@@ -145,9 +145,15 @@ if /I "%1"=="/?" goto Usage
   )
   set PATH=%EDK_TOOLS_BIN%;%PATH%
   set WORKSPACE_TOOLS_PATH=%EDK_TOOLS_PATH%
+  echo Add basetools/scripts to path...
+  set PATH=%BASE_TOOLS_PATH%\Scripts;%PATH%
+  echo Successfully added basetools/scripts to path
   goto PATH_ok
 
 :check_PATH
+  echo Add basetools/scripts to path...
+  set PATH=%BASE_TOOLS_PATH%\Scripts;%PATH%
+  echo Successfully added basetools/scripts to path.
   if "%EDK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto PATH_ok
   if not defined EDK_TOOLS_BIN (
     set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32
-- 
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87045): https://edk2.groups.io/g/devel/message/87045
Mute This Topic: https://groups.io/mt/89445556/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-