public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools: Add BaseTools/Scripts to path.
@ 2022-02-28  6:00 Yuwei Chen
  0 siblings, 0 replies; only message in thread
From: Yuwei Chen @ 2022-02-28  6:00 UTC (permalink / raw)
  To: devel; +Cc: MingYue Liang, Bob Feng, Liming Gao

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-28  6:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-28  6:00 [PATCH] BaseTools: Add BaseTools/Scripts to path Yuwei Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox