BaseTools: Remove unused logic for EDKI

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1350
Remove EDK module type support from BaseTools python code.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Feng, Bob C
2019-01-14 09:24:12 +08:00
parent 514c55c185
commit 8229250132
13 changed files with 116 additions and 461 deletions

View File

@@ -2174,42 +2174,7 @@ class PlatformAutoGen(AutoGen):
Pcd.MaxDatumSize = str(len(Value) - 1)
return Pcds.values()
## Resolve library names to library modules
#
# (for Edk.x modules)
#
# @param Module The module from which the library names will be resolved
#
# @retval library_list The list of library modules
#
def ResolveLibraryReference(self, Module):
EdkLogger.verbose("")
EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(Module), self.Arch))
LibraryConsumerList = [Module]
# "CompilerStub" is a must for Edk modules
if Module.Libraries:
Module.Libraries.append("CompilerStub")
LibraryList = []
while len(LibraryConsumerList) > 0:
M = LibraryConsumerList.pop()
for LibraryName in M.Libraries:
Library = self.Platform.LibraryClasses[LibraryName, ':dummy:']
if Library is None:
for Key in self.Platform.LibraryClasses.data:
if LibraryName.upper() == Key.upper():
Library = self.Platform.LibraryClasses[Key, ':dummy:']
break
if Library is None:
EdkLogger.warn("build", "Library [%s] is not found" % LibraryName, File=str(M),
ExtraData="\t%s [%s]" % (str(Module), self.Arch))
continue
if Library not in LibraryList:
LibraryList.append(Library)
LibraryConsumerList.append(Library)
EdkLogger.verbose("\t" + LibraryName + " : " + str(Library) + ' ' + str(type(Library)))
return LibraryList
## Calculate the priority value of the build option
#
@@ -2377,12 +2342,8 @@ class PlatformAutoGen(AutoGen):
#
def ApplyBuildOption(self, Module):
# Get the different options for the different style module
if Module.AutoGenVersion < 0x00010005:
PlatformOptions = self.EdkBuildOption
ModuleTypeOptions = self.Platform.GetBuildOptionsByModuleType(EDK_NAME, Module.ModuleType)
else:
PlatformOptions = self.EdkIIBuildOption
ModuleTypeOptions = self.Platform.GetBuildOptionsByModuleType(EDKII_NAME, Module.ModuleType)
PlatformOptions = self.EdkIIBuildOption
ModuleTypeOptions = self.Platform.GetBuildOptionsByModuleType(EDKII_NAME, Module.ModuleType)
ModuleTypeOptions = self._ExpandBuildOption(ModuleTypeOptions)
ModuleOptions = self._ExpandBuildOption(Module.BuildOptions)
if Module in self.Platform.Modules:
@@ -2422,11 +2383,6 @@ class PlatformAutoGen(AutoGen):
else:
BuildOptions[Tool][Attr] = mws.handleWsMacro(Value)
if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag is not None:
#
# Override UNI flag only for EDK module.
#
BuildOptions['BUILD']['FLAGS'] = self.Workspace.UniFlag
return BuildOptions, BuildRuleOrder
#
@@ -2962,14 +2918,13 @@ class ModuleAutoGen(AutoGen):
# EDK II modules must not reference header files outside of the packages they depend on or
# within the module's directory tree. Report error if violation.
#
if self.AutoGenVersion >= 0x00010005:
for Path in IncPathList:
if (Path not in self.IncludePathList) and (CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir):
ErrMsg = "The include directory for the EDK II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption)
EdkLogger.error("build",
PARAMETER_INVALID,
ExtraData=ErrMsg,
File=str(self.MetaFile))
for Path in IncPathList:
if (Path not in self.IncludePathList) and (CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir):
ErrMsg = "The include directory for the EDK II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption)
EdkLogger.error("build",
PARAMETER_INVALID,
ExtraData=ErrMsg,
File=str(self.MetaFile))
RetVal += IncPathList
return RetVal
@@ -2999,7 +2954,7 @@ class ModuleAutoGen(AutoGen):
continue
# add the file path into search path list for file including
if F.Dir not in self.IncludePathList and self.AutoGenVersion >= 0x00010005:
if F.Dir not in self.IncludePathList:
self.IncludePathList.insert(0, F.Dir)
RetVal.append(F)
@@ -3261,8 +3216,6 @@ class ModuleAutoGen(AutoGen):
# only merge library classes and PCD for non-library module
if self.IsLibrary:
return []
if self.AutoGenVersion < 0x00010005:
return self.PlatformInfo.ResolveLibraryReference(self.Module)
return self.PlatformInfo.ApplyLibraryInstance(self.Module)
## Get the list of PCDs from current module
@@ -3351,19 +3304,8 @@ class ModuleAutoGen(AutoGen):
@cached_property
def IncludePathList(self):
RetVal = []
if self.AutoGenVersion < 0x00010005:
for Inc in self.Module.Includes:
if Inc not in RetVal:
RetVal.append(Inc)
# for Edk modules
Inc = path.join(Inc, self.Arch.capitalize())
if os.path.exists(Inc) and Inc not in RetVal:
RetVal.append(Inc)
# Edk module needs to put DEBUG_DIR at the end of search path and not to use SOURCE_DIR all the time
RetVal.append(self.DebugDir)
else:
RetVal.append(self.MetaFile.Dir)
RetVal.append(self.DebugDir)
RetVal.append(self.MetaFile.Dir)
RetVal.append(self.DebugDir)
for Package in self.Module.Packages:
PackageDir = mws.join(self.WorkspaceDir, Package.MetaFile.Dir)
@@ -3526,10 +3468,6 @@ class ModuleAutoGen(AutoGen):
if self.IsAsBuiltInfCreated:
return
# Skip the following code for EDK I inf
if self.AutoGenVersion < 0x00010005:
return
# Skip the following code for libraries
if self.IsLibrary:
return
@@ -3986,17 +3924,10 @@ class ModuleAutoGen(AutoGen):
for File in self.AutoGenFileList:
if GenC.Generate(File.Path, self.AutoGenFileList[File], File.IsBinary):
#Ignore Edk AutoGen.c
if self.AutoGenVersion < 0x00010005 and File.Name == 'AutoGen.c':
continue
AutoGenList.append(str(File))
else:
IgoredAutoGenList.append(str(File))
# Skip the following code for EDK I inf
if self.AutoGenVersion < 0x00010005:
return
for ModuleType in self.DepexList:
# Ignore empty [depex] section or [depex] section for SUP_MODULE_USER_DEFINED module

View File

@@ -1681,22 +1681,6 @@ def CreateUnicodeStringCode(Info, AutoGenC, AutoGenH, UniGenCFlag, UniGenBinBuff
# Get all files under [Sources] section in inf file for EDK-II module
EDK2Module = True
SrcList = [F for F in Info.SourceFileList]
if Info.AutoGenVersion < 0x00010005:
EDK2Module = False
# Get all files under the module directory for EDK-I module
Cwd = os.getcwd()
os.chdir(Info.MetaFile.Dir)
for Root, Dirs, Files in os.walk("."):
if 'CVS' in Dirs:
Dirs.remove('CVS')
if '.svn' in Dirs:
Dirs.remove('.svn')
for File in Files:
File = PathClass(os.path.join(Root, File), Info.MetaFile.Dir)
if File in SrcList:
continue
SrcList.append(File)
os.chdir(Cwd)
if 'BUILD' in Info.BuildOption and Info.BuildOption['BUILD']['FLAGS'].find('-c') > -1:
CompatibleMode = True
@@ -1984,42 +1968,41 @@ def CreateHeaderCode(Info, AutoGenC, AutoGenH):
# header file Prologue
AutoGenH.Append(gAutoGenHPrologueString.Replace({'File':'AUTOGENH','Guid':Info.Guid.replace('-', '_')}))
AutoGenH.Append(gAutoGenHCppPrologueString)
if Info.AutoGenVersion >= 0x00010005:
# header files includes
if Info.ModuleType in gModuleTypeHeaderFile:
AutoGenH.Append("#include <%s>\n" % gModuleTypeHeaderFile[Info.ModuleType][0])
#
# if either PcdLib in [LibraryClasses] sections or there exist Pcd section, add PcdLib.h
# As if modules only uses FixedPcd, then PcdLib is not needed in [LibraryClasses] section.
#
if 'PcdLib' in Info.Module.LibraryClasses or Info.Module.Pcds:
AutoGenH.Append("#include <Library/PcdLib.h>\n")
AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;')
AutoGenH.Append('\nextern CHAR8 *gEfiCallerBaseName;\n\n')
# header files includes
if Info.ModuleType in gModuleTypeHeaderFile:
AutoGenH.Append("#include <%s>\n" % gModuleTypeHeaderFile[Info.ModuleType][0])
#
# if either PcdLib in [LibraryClasses] sections or there exist Pcd section, add PcdLib.h
# As if modules only uses FixedPcd, then PcdLib is not needed in [LibraryClasses] section.
#
if 'PcdLib' in Info.Module.LibraryClasses or Info.Module.Pcds:
AutoGenH.Append("#include <Library/PcdLib.h>\n")
if Info.IsLibrary:
return
AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;')
AutoGenH.Append('\nextern CHAR8 *gEfiCallerBaseName;\n\n')
AutoGenH.Append("#define EFI_CALLER_ID_GUID \\\n %s\n" % GuidStringToGuidStructureString(Info.Guid))
if Info.IsLibrary:
return
AutoGenH.Append("#define EFI_CALLER_ID_GUID \\\n %s\n" % GuidStringToGuidStructureString(Info.Guid))
if Info.IsLibrary:
return
# C file header
AutoGenC.Append(gAutoGenHeaderString.Replace({'FileName':'AutoGen.c'}))
if Info.AutoGenVersion >= 0x00010005:
# C file header files includes
if Info.ModuleType in gModuleTypeHeaderFile:
for Inc in gModuleTypeHeaderFile[Info.ModuleType]:
AutoGenC.Append("#include <%s>\n" % Inc)
else:
AutoGenC.Append("#include <%s>\n" % gBasicHeaderFile)
# C file header files includes
if Info.ModuleType in gModuleTypeHeaderFile:
for Inc in gModuleTypeHeaderFile[Info.ModuleType]:
AutoGenC.Append("#include <%s>\n" % Inc)
else:
AutoGenC.Append("#include <%s>\n" % gBasicHeaderFile)
#
# Publish the CallerId Guid
#
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = %s;\n' % GuidStringToGuidStructureString(Info.Guid))
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gEfiCallerBaseName = "%s";\n' % Info.Name)
#
# Publish the CallerId Guid
#
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = %s;\n' % GuidStringToGuidStructureString(Info.Guid))
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gEfiCallerBaseName = "%s";\n' % Info.Name)
## Create common code for header file
#
@@ -2045,15 +2028,14 @@ def CreateFooterCode(Info, AutoGenC, AutoGenH):
def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer, StringIdf, IdfGenCFlag, IdfGenBinBuffer):
CreateHeaderCode(Info, AutoGenC, AutoGenH)
if Info.AutoGenVersion >= 0x00010005:
CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH)
CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH)
CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH)
CreatePcdCode(Info, AutoGenC, AutoGenH)
CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH)
CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH)
CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH)
CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH)
CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH)
CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH)
CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH)
CreatePcdCode(Info, AutoGenC, AutoGenH)
CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH)
CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH)
CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH)
CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH)
if Info.UnicodeFileList:
FileName = "%sStrDefs.h" % Info.Name
@@ -2112,10 +2094,6 @@ def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer,
CreateFooterCode(Info, AutoGenC, AutoGenH)
# no generation of AutoGen.c for Edk modules without unicode file
if Info.AutoGenVersion < 0x00010005 and len(Info.UnicodeFileList) == 0:
AutoGenC.String = ''
## Create the code file
#
# @param FilePath The path of code file

View File

@@ -476,18 +476,11 @@ cleanlib:
else:
ModuleEntryPoint = "_ModuleEntryPoint"
# Intel EBC compiler enforces EfiMain
if MyAgo.AutoGenVersion < 0x00010005 and MyAgo.Arch == "EBC":
ArchEntryPoint = "EfiMain"
else:
ArchEntryPoint = ModuleEntryPoint
ArchEntryPoint = ModuleEntryPoint
if MyAgo.Arch == "EBC":
# EBC compiler always use "EfiStart" as entry point. Only applies to EdkII modules
ImageEntryPoint = "EfiStart"
elif MyAgo.AutoGenVersion < 0x00010005:
# Edk modules use entry point specified in INF file
ImageEntryPoint = ModuleEntryPoint
else:
# EdkII modules always use "_ModuleEntryPoint" as entry point
ImageEntryPoint = "_ModuleEntryPoint"
@@ -625,11 +618,6 @@ cleanlib:
False
)
# Edk modules need <BaseName>StrDefs.h for string ID
#if MyAgo.AutoGenVersion < 0x00010005 and len(MyAgo.UnicodeFileList) > 0:
# BcTargetList = ['strdefs']
#else:
# BcTargetList = []
BcTargetList = []
MakefileName = self._FILE_NAME_[self._FileType]
@@ -1537,13 +1525,9 @@ class TopLevelMakefile(BuildFile):
if MyAgo.FdfFile is not None and MyAgo.FdfFile != "":
FdfFileList = [MyAgo.FdfFile]
# macros passed to GenFds
MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource.replace('\\', '\\\\')))
MacroList.append('"%s=%s"' % ("EDK_SOURCE", GlobalData.gEdkSource.replace('\\', '\\\\')))
MacroDict = {}
MacroDict.update(GlobalData.gGlobalDefines)
MacroDict.update(GlobalData.gCommandLineDefines)
MacroDict.pop("EFI_SOURCE", "dummy")
MacroDict.pop("EDK_SOURCE", "dummy")
for MacroName in MacroDict:
if MacroDict[MacroName] != "":
MacroList.append('"%s=%s"' % (MacroName, MacroDict[MacroName].replace('\\', '\\\\')))