public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jaben Carsey <jaben.carsey@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>, Yonghong Zhu <yonghong.zhu@intel.com>
Subject: [PATCH v1 16/27] BaseTools: Replace EDK Component strings with predefined constant
Date: Fri, 20 Apr 2018 08:51:36 -0700	[thread overview]
Message-ID: <7ca2c5bf88ad69bc5ae86b73ee1aa696792c5794.1524239027.git.jaben.carsey@intel.com> (raw)
In-Reply-To: <cover.1524239027.git.jaben.carsey@intel.com>
In-Reply-To: <cover.1524239027.git.jaben.carsey@intel.com>

EDK_COMPONENT_TYPE_LIBRARY was 'LIBRARY'
EDK_COMPONENT_TYPE_SECURITY_CORE was 'SECURITY_CORE'
EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER was 'COMBINED_PEIM_DRIVER'
EDK_COMPONENT_TYPE_PIC_PEIM was 'PIC_PEIM'
EDK_COMPONENT_TYPE_RELOCATABLE_PEIM was 'RELOCATABLE_PEIM'
EDK_COMPONENT_TYPE_BS_DRIVER was 'BS_DRIVER'
EDK_COMPONENT_TYPE_RT_DRIVER was 'RT_DRIVER'
EDK_COMPONENT_TYPE_SAL_RT_DRIVER was 'SAL_RT_DRIVER'
EDK_COMPONENT_TYPE_APPLICATION was 'APPLICATION'

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
 BaseTools/Source/Python/Common/DataType.py        | 28 ++++++++++----------
 BaseTools/Source/Python/GenFds/FdfParser.py       |  6 ++---
 BaseTools/Source/Python/GenFds/Ffs.py             |  2 +-
 BaseTools/Source/Python/Workspace/InfBuildData.py |  2 +-
 BaseTools/Source/Python/build/BuildReport.py      |  6 ++---
 BaseTools/Source/Python/build/build.py            |  8 +++---
 6 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index ab9acb417331..74ed711abc52 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -80,7 +80,7 @@ SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
 SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE}
 
 EDK_COMPONENT_TYPE_LIBRARY = 'LIBRARY'
-EDK_COMPONENT_TYPE_SECUARITY_CORE = 'SECUARITY_CORE'
+EDK_COMPONENT_TYPE_SECURITY_CORE = 'SECURITY_CORE'
 EDK_COMPONENT_TYPE_PEI_CORE = SUP_MODULE_PEI_CORE
 EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER = 'COMBINED_PEIM_DRIVER'
 EDK_COMPONENT_TYPE_PIC_PEIM = 'PIC_PEIM'
@@ -93,18 +93,18 @@ EDK_NAME = 'EDK'
 EDKII_NAME = 'EDKII'
 
 COMPONENT_TO_MODULE_MAP_DICT = {
-    "LIBRARY"               :   SUP_MODULE_BASE,
-    "SECURITY_CORE"         :   SUP_MODULE_SEC,
-    SUP_MODULE_PEI_CORE     :   SUP_MODULE_PEI_CORE,
-    "COMBINED_PEIM_DRIVER"  :   SUP_MODULE_PEIM,
-    "PIC_PEIM"              :   SUP_MODULE_PEIM,
-    "RELOCATABLE_PEIM"      :   SUP_MODULE_PEIM,
-    "PE32_PEIM"             :   SUP_MODULE_PEIM,
-    "BS_DRIVER"             :   SUP_MODULE_DXE_DRIVER,
-    "RT_DRIVER"             :   SUP_MODULE_DXE_RUNTIME_DRIVER,
-    "SAL_RT_DRIVER"         :   SUP_MODULE_DXE_SAL_DRIVER,
-    "APPLICATION"           :   SUP_MODULE_UEFI_APPLICATION,
-    "LOGO"                  :   SUP_MODULE_BASE,
+    EDK_COMPONENT_TYPE_LIBRARY               :   SUP_MODULE_BASE,
+    EDK_COMPONENT_TYPE_SECURITY_CORE         :   SUP_MODULE_SEC,
+    EDK_COMPONENT_TYPE_PEI_CORE              :   SUP_MODULE_PEI_CORE,
+    EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER  :   SUP_MODULE_PEIM,
+    EDK_COMPONENT_TYPE_PIC_PEIM              :   SUP_MODULE_PEIM,
+    EDK_COMPONENT_TYPE_RELOCATABLE_PEIM      :   SUP_MODULE_PEIM,
+    "PE32_PEIM"                              :   SUP_MODULE_PEIM,
+    EDK_COMPONENT_TYPE_BS_DRIVER             :   SUP_MODULE_DXE_DRIVER,
+    EDK_COMPONENT_TYPE_RT_DRIVER             :   SUP_MODULE_DXE_RUNTIME_DRIVER,
+    EDK_COMPONENT_TYPE_SAL_RT_DRIVER         :   SUP_MODULE_DXE_SAL_DRIVER,
+    EDK_COMPONENT_TYPE_APPLICATION           :   SUP_MODULE_UEFI_APPLICATION,
+    "LOGO"                                   :   SUP_MODULE_BASE,
 }
 
 BINARY_FILE_TYPE_FW = 'FW'
@@ -125,7 +125,7 @@ BINARY_FILE_TYPE_UI = 'UI'
 BINARY_FILE_TYPE_BIN = 'BIN'
 BINARY_FILE_TYPE_FV = 'FV'
 
-PLATFORM_COMPONENT_TYPE_LIBRARY = 'LIBRARY'
+PLATFORM_COMPONENT_TYPE_LIBRARY = EDK_COMPONENT_TYPE_LIBRARY
 PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS = 'LIBRARY_CLASS'
 PLATFORM_COMPONENT_TYPE_MODULE = 'MODULE'
 
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 4ec114a81883..e117a3717d42 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -3637,8 +3637,8 @@ class FdfParser:
                              SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, \
                              SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, \
                              SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, "DEFAULT", SUP_MODULE_BASE, \
-                             "SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC_PEIM", "RELOCATABLE_PEIM", \
-                                        "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE):
+                             EDK_COMPONENT_TYPE_SECURITY_CORE, EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER, EDK_COMPONENT_TYPE_PIC_PEIM, EDK_COMPONENT_TYPE_RELOCATABLE_PEIM, \
+                                        "PE32_PEIM", EDK_COMPONENT_TYPE_BS_DRIVER, EDK_COMPONENT_TYPE_RT_DRIVER, EDK_COMPONENT_TYPE_SAL_RT_DRIVER, EDK_COMPONENT_TYPE_APPLICATION, "ACPITABLE", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE):
             raise Warning("Unknown Module type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
         return self.__Token
 
@@ -3681,7 +3681,7 @@ class FdfParser:
 
         Type = self.__Token.strip().upper()
         if Type not in ("RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,\
-                             "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_CORE, "APPLICATION", "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE):
+                             "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_CORE, EDK_COMPONENT_TYPE_APPLICATION, "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE):
             raise Warning("Unknown FV type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
 
         if not self.__IsToken("="):
diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Python/GenFds/Ffs.py
index fc760ae8beda..f15d2330ce58 100644
--- a/BaseTools/Source/Python/GenFds/Ffs.py
+++ b/BaseTools/Source/Python/GenFds/Ffs.py
@@ -48,7 +48,7 @@ class Ffs(FDClassObject):
         SUP_MODULE_DXE_CORE          : 'EFI_FV_FILETYPE_DXE_CORE',
         'FREEFORM'          : 'EFI_FV_FILETYPE_FREEFORM',
         'DRIVER'            : 'EFI_FV_FILETYPE_DRIVER',
-        'APPLICATION'       : 'EFI_FV_FILETYPE_APPLICATION',
+        EDK_COMPONENT_TYPE_APPLICATION       : 'EFI_FV_FILETYPE_APPLICATION',
         'FV_IMAGE'          : 'EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE',
         'RAW'               : 'EFI_FV_FILETYPE_RAW',
         'PEI_DXE_COMBO'     : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER',
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index d64a281a98f7..27ef163eb40c 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -344,7 +344,7 @@ class InfBuildData(ModuleBuildClassObject):
             self._BuildType = self._ComponentType.upper()
             if self._ComponentType in COMPONENT_TO_MODULE_MAP_DICT:
                 self._ModuleType = COMPONENT_TO_MODULE_MAP_DICT[self._ComponentType]
-            if self._ComponentType == 'LIBRARY':
+            if self._ComponentType == EDK_COMPONENT_TYPE_LIBRARY:
                 self._LibraryClass = [LibraryClassObject(self._BaseName, SUP_MODULE_LIST)]
             # make use some [nmake] section macros
             Macros = self._Macros
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index 5846c2870d2e..02e01a1fa2ab 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -599,7 +599,7 @@ class ModuleReport(object):
                 self.ModulePcdSet.setdefault((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Type), (Pcd.InfDefaultValue, Pcd.DefaultValue))
 
         self.LibraryReport = None
-        if "LIBRARY" in ReportType:
+        if EDK_COMPONENT_TYPE_LIBRARY in ReportType:
             self.LibraryReport = LibraryReport(M)
 
         self.DepexReport = None
@@ -702,7 +702,7 @@ class ModuleReport(object):
         if "PCD" in ReportType:
             GlobalPcdReport.GenerateReport(File, self.ModulePcdSet)
 
-        if "LIBRARY" in ReportType:
+        if EDK_COMPONENT_TYPE_LIBRARY in ReportType:
             self.LibraryReport.GenerateReport(File)
 
         if "DEPEX" in ReportType:
@@ -2097,7 +2097,7 @@ class BuildReport(object):
                     if ReportTypeItem not in self.ReportType:
                         self.ReportType.append(ReportTypeItem)
             else:
-                self.ReportType = ["PCD", "LIBRARY", "BUILD_FLAGS", "DEPEX", "HASH", "FLASH", "FIXED_ADDRESS"]
+                self.ReportType = ["PCD", EDK_COMPONENT_TYPE_LIBRARY, "BUILD_FLAGS", "DEPEX", "HASH", "FLASH", "FIXED_ADDRESS"]
     ##
     # Adds platform report to the list
     #
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 81d59dd3eedf..29ad0c7228c7 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -1587,13 +1587,13 @@ class Build():
                     if not ImageClass.IsValid:
                         EdkLogger.error("build", FILE_PARSE_FAILURE, ExtraData=ImageClass.ErrorInfo)
                     ImageInfo = PeImageInfo(Module.Name, Module.Guid, Module.Arch, Module.OutputDir, Module.DebugDir, ImageClass)
-                    if Module.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, 'COMBINED_PEIM_DRIVER', 'PIC_PEIM', 'RELOCATABLE_PEIM', SUP_MODULE_DXE_CORE]:
+                    if Module.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER, EDK_COMPONENT_TYPE_PIC_PEIM, EDK_COMPONENT_TYPE_RELOCATABLE_PEIM, SUP_MODULE_DXE_CORE]:
                         PeiModuleList[Module.MetaFile] = ImageInfo
                         PeiSize += ImageInfo.Image.Size
-                    elif Module.ModuleType in ['BS_DRIVER', SUP_MODULE_DXE_DRIVER, SUP_MODULE_UEFI_DRIVER]:
+                    elif Module.ModuleType in [EDK_COMPONENT_TYPE_BS_DRIVER, SUP_MODULE_DXE_DRIVER, SUP_MODULE_UEFI_DRIVER]:
                         BtModuleList[Module.MetaFile] = ImageInfo
                         BtSize += ImageInfo.Image.Size
-                    elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER, 'RT_DRIVER', SUP_MODULE_DXE_SAL_DRIVER, 'SAL_RT_DRIVER']:
+                    elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER, EDK_COMPONENT_TYPE_RT_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, EDK_COMPONENT_TYPE_SAL_RT_DRIVER]:
                         RtModuleList[Module.MetaFile] = ImageInfo
                         #IPF runtime driver needs to be at 2 page alignment.
                         if IsIpfPlatform and ImageInfo.Image.Size % 0x2000 != 0:
@@ -2356,7 +2356,7 @@ def MyOptionParser():
     Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".")
 
     Parser.add_option("-y", "--report-file", action="store", dest="ReportFile", help="Create/overwrite the report to the specified filename.")
-    Parser.add_option("-Y", "--report-type", action="append", type="choice", choices=['PCD','LIBRARY','FLASH','DEPEX','BUILD_FLAGS','FIXED_ADDRESS','HASH','EXECUTION_ORDER'], dest="ReportType", default=[],
+    Parser.add_option("-Y", "--report-type", action="append", type="choice", choices=['PCD',EDK_COMPONENT_TYPE_LIBRARY,'FLASH','DEPEX','BUILD_FLAGS','FIXED_ADDRESS','HASH','EXECUTION_ORDER'], dest="ReportType", default=[],
         help="Flags that control the type of build report to generate.  Must be one of: [PCD, LIBRARY, FLASH, DEPEX, BUILD_FLAGS, FIXED_ADDRESS, HASH, EXECUTION_ORDER].  "\
              "To specify more than one flag, repeat this option on the command line and the default flag set is [PCD, LIBRARY, FLASH, DEPEX, HASH, BUILD_FLAGS, FIXED_ADDRESS]")
     Parser.add_option("-F", "--flag", action="store", type="string", dest="Flag",
-- 
2.16.2.windows.1



  parent reply	other threads:[~2018-04-20 15:51 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-20 15:51 [PATCH v1 00/27] BaseTools refactoring Jaben Carsey
2018-04-20 15:51 ` [PATCH v1 01/27] BaseTools: Misc - refactor RegEx to minimize multiple compiling Jaben Carsey
2018-04-25  8:49   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 02/27] BaseTools: GenPatchPcdTable " Jaben Carsey
2018-04-25  8:50   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 03/27] BaseTools: Share RegEx between files Jaben Carsey
2018-04-25  8:51   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 04/27] BaseTools: Workspace - refactor RegEx to minimize multiple compiling Jaben Carsey
2018-04-25  8:50   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 05/27] BaseTools: Autogen - replace string constants with those from DataType Jaben Carsey
2018-04-25  8:50   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 06/27] BaseTools: simplify if call Jaben Carsey
2018-04-25  8:50   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 07/27] BaseTools: Workspace - refactor GetStructurePcdInfo Jaben Carsey
2018-04-25  8:50   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 08/27] BaseTools: AutoGen - remove dictionary populated, but never accessed Jaben Carsey
2018-04-25  8:50   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 09/27] BaseTools: AutoGen - remove unused variables Jaben Carsey
2018-04-25  8:52   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 10/27] BaseTools: Remove extra .keys() Jaben Carsey
2018-04-25  8:51   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 11/27] BaseTools: Workspace/MetaFileParser - refactor dicts Jaben Carsey
2018-04-20 15:51 ` [PATCH v1 12/27] BaseTools: remove dict from DscBuildData Jaben Carsey
2018-04-25  8:50   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 13/27] BaseTools: replace string constants used for module types Jaben Carsey
2018-04-25  5:57   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 14/27] BaseTools: Define and use a set for common list Jaben Carsey
2018-05-02  6:48   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 15/27] BaseTools: Share a dictionary instead of keeping multiples Jaben Carsey
2018-04-20 15:51 ` Jaben Carsey [this message]
2018-04-24  7:42   ` [PATCH v1 16/27] BaseTools: Replace EDK Component strings with predefined constant Zhu, Yonghong
2018-04-24 14:13     ` Carsey, Jaben
2018-04-20 15:51 ` [PATCH v1 17/27] BaseTools: DataType - cleanup list constants Jaben Carsey
2018-05-04 11:14   ` Laszlo Ersek
2018-05-04 14:18     ` Carsey, Jaben
2018-05-04 15:03       ` Laszlo Ersek
2018-04-20 15:51 ` [PATCH v1 18/27] BaseTools: Replace PCD type strings with predefined constant Jaben Carsey
2018-04-25  6:00   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 19/27] BaseTools: Replace Binary File " Jaben Carsey
2018-04-24  7:38   ` Zhu, Yonghong
2018-04-24 14:12     ` Carsey, Jaben
2018-04-20 15:51 ` [PATCH v1 20/27] BaseTools: remove duplicate variable Jaben Carsey
2018-04-25  8:51   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 21/27] BaseTools: replace string with predefined constant Jaben Carsey
2018-04-25  6:04   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 22/27] BaseTools: remove redundant if comparison Jaben Carsey
2018-05-02  6:49   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 23/27] BaseTools: AutoGen - use dafultdict instead of dict Jaben Carsey
2018-04-20 15:51 ` [PATCH v1 24/27] BaseTools: GenFds - simplify testing for Hex number Jaben Carsey
2018-04-25  8:51   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 25/27] BaseTools: AutoGen - use defaultdict to auto initialize Jaben Carsey
2018-04-25  8:52   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 26/27] BaseTools: remove unused MigrationUtilities.py Jaben Carsey
2018-05-02  6:49   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 27/27] BaseTools: CommonClass - remove unused classes Jaben Carsey
2018-04-25  8:51   ` Zhu, Yonghong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ca2c5bf88ad69bc5ae86b73ee1aa696792c5794.1524239027.git.jaben.carsey@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox