mirror of https://github.com/acidanthera/audk.git
BaseTools: Share a dictionary instead of keeping multiples
Move a dictionary to a shared location and use from there 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> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
parent
88c6c1b64c
commit
ee1ca53df6
|
@ -96,6 +96,21 @@ EDK_COMPONENT_TYPE_APPLICATION = 'APPLICATION'
|
||||||
EDK_NAME = 'EDK'
|
EDK_NAME = 'EDK'
|
||||||
EDKII_NAME = 'EDKII'
|
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,
|
||||||
|
}
|
||||||
|
|
||||||
BINARY_FILE_TYPE_FW = 'FW'
|
BINARY_FILE_TYPE_FW = 'FW'
|
||||||
BINARY_FILE_TYPE_GUID = 'GUID'
|
BINARY_FILE_TYPE_GUID = 'GUID'
|
||||||
BINARY_FILE_TYPE_PREEFORM = 'PREEFORM'
|
BINARY_FILE_TYPE_PREEFORM = 'PREEFORM'
|
||||||
|
|
|
@ -66,26 +66,6 @@ class InfBuildData(ModuleBuildClassObject):
|
||||||
TAB_COMPONENTS_SOURCE_OVERRIDE_PATH : "_SourceOverridePath",
|
TAB_COMPONENTS_SOURCE_OVERRIDE_PATH : "_SourceOverridePath",
|
||||||
}
|
}
|
||||||
|
|
||||||
# dict used to convert Component type to Module type
|
|
||||||
_MODULE_TYPE_ = {
|
|
||||||
"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,
|
|
||||||
SUP_MODULE_DXE_SMM_DRIVER : SUP_MODULE_DXE_SMM_DRIVER,
|
|
||||||
# "SMM_DRIVER" : SUP_MODULE_DXE_SMM_DRIVER,
|
|
||||||
# "BS_DRIVER" : SUP_MODULE_DXE_SMM_DRIVER,
|
|
||||||
# "BS_DRIVER" : SUP_MODULE_UEFI_DRIVER,
|
|
||||||
"APPLICATION" : SUP_MODULE_UEFI_APPLICATION,
|
|
||||||
"LOGO" : SUP_MODULE_BASE,
|
|
||||||
}
|
|
||||||
|
|
||||||
# regular expression for converting XXX_FLAGS in [nmake] section to new type
|
# regular expression for converting XXX_FLAGS in [nmake] section to new type
|
||||||
_NMAKE_FLAG_PATTERN_ = re.compile("(?:EBC_)?([A-Z]+)_(?:STD_|PROJ_|ARCH_)?FLAGS(?:_DLL|_ASL|_EXE)?", re.UNICODE)
|
_NMAKE_FLAG_PATTERN_ = re.compile("(?:EBC_)?([A-Z]+)_(?:STD_|PROJ_|ARCH_)?FLAGS(?:_DLL|_ASL|_EXE)?", re.UNICODE)
|
||||||
# dict used to convert old tool name used in [nmake] section to new ones
|
# dict used to convert old tool name used in [nmake] section to new ones
|
||||||
|
@ -362,8 +342,8 @@ class InfBuildData(ModuleBuildClassObject):
|
||||||
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
|
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
|
||||||
"COMPONENT_TYPE is not given", File=self.MetaFile)
|
"COMPONENT_TYPE is not given", File=self.MetaFile)
|
||||||
self._BuildType = self._ComponentType.upper()
|
self._BuildType = self._ComponentType.upper()
|
||||||
if self._ComponentType in self._MODULE_TYPE_:
|
if self._ComponentType in COMPONENT_TO_MODULE_MAP_DICT:
|
||||||
self._ModuleType = self._MODULE_TYPE_[self._ComponentType]
|
self._ModuleType = COMPONENT_TO_MODULE_MAP_DICT[self._ComponentType]
|
||||||
if self._ComponentType == 'LIBRARY':
|
if self._ComponentType == 'LIBRARY':
|
||||||
self._LibraryClass = [LibraryClassObject(self._BaseName, SUP_MODULE_LIST)]
|
self._LibraryClass = [LibraryClassObject(self._BaseName, SUP_MODULE_LIST)]
|
||||||
# make use some [nmake] section macros
|
# make use some [nmake] section macros
|
||||||
|
|
|
@ -47,21 +47,6 @@ from Common.DataType import *
|
||||||
import collections
|
import collections
|
||||||
from Common.Expression import *
|
from Common.Expression import *
|
||||||
|
|
||||||
gComponentType2ModuleType = {
|
|
||||||
"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,
|
|
||||||
}
|
|
||||||
|
|
||||||
## Pattern to extract contents in EDK DXS files
|
## Pattern to extract contents in EDK DXS files
|
||||||
gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL)
|
gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL)
|
||||||
|
|
||||||
|
@ -422,7 +407,7 @@ class DepexReport(object):
|
||||||
self._DepexFileName = os.path.join(M.BuildDir, "OUTPUT", M.Module.BaseName + ".depex")
|
self._DepexFileName = os.path.join(M.BuildDir, "OUTPUT", M.Module.BaseName + ".depex")
|
||||||
ModuleType = M.ModuleType
|
ModuleType = M.ModuleType
|
||||||
if not ModuleType:
|
if not ModuleType:
|
||||||
ModuleType = gComponentType2ModuleType.get(M.ComponentType, "")
|
ModuleType = COMPONENT_TO_MODULE_MAP_DICT.get(M.ComponentType, "")
|
||||||
|
|
||||||
if ModuleType in [SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_DXE_CORE, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_CORE_STANDALONE, SUP_MODULE_UEFI_APPLICATION]:
|
if ModuleType in [SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_DXE_CORE, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_CORE_STANDALONE, SUP_MODULE_UEFI_APPLICATION]:
|
||||||
return
|
return
|
||||||
|
@ -587,7 +572,7 @@ class ModuleReport(object):
|
||||||
if not M.IsLibrary:
|
if not M.IsLibrary:
|
||||||
ModuleType = M.ModuleType
|
ModuleType = M.ModuleType
|
||||||
if not ModuleType:
|
if not ModuleType:
|
||||||
ModuleType = gComponentType2ModuleType.get(M.ComponentType, "")
|
ModuleType = COMPONENT_TO_MODULE_MAP_DICT.get(M.ComponentType, "")
|
||||||
#
|
#
|
||||||
# If a module complies to PI 1.1, promote Module type to "SMM_DRIVER"
|
# If a module complies to PI 1.1, promote Module type to "SMM_DRIVER"
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue