From d5d56f1bc5e7bcebd08ad55e940fb907ea0af365 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Thu, 4 Mar 2010 05:29:52 +0000 Subject: Sync EDKII BaseTools to BaseTools project r1911. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10177 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/Python/build/BuildReport.py | 48 ++++++++++++++++------------ BaseTools/Source/Python/build/build.py | 13 +++++++- 2 files changed, 39 insertions(+), 22 deletions(-) (limited to 'BaseTools/Source/Python/build') diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index 23e819e5ca..eac21d1495 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -667,31 +667,31 @@ class PcdReport(object): if DecDefaultValue == None: DecMatch = True else: - DecMatch = (DecDefaultValue == PcdValue) + DecMatch = (DecDefaultValue.strip() == PcdValue.strip()) if InfDefaultValue == None: InfMatch = True else: - InfMatch = (InfDefaultValue == PcdValue) + InfMatch = (InfDefaultValue.strip() == PcdValue.strip()) if DscDefaultValue == None: DscMatch = True else: - DscMatch = (DscDefaultValue == PcdValue) + DscMatch = (DscDefaultValue.strip() == PcdValue.strip()) # # Report PCD item according to their override relationship # if DecMatch and InfMatch: - FileWrite(File, ' %-*s: %6s %10s = %-22s' % (self.MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', PcdValue)) + FileWrite(File, ' %-*s: %6s %10s = %-22s' % (self.MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', PcdValue.strip())) else: if DscMatch: if (Pcd.TokenCName, Key) in self.FdfPcdSet: - FileWrite(File, ' *F %-*s: %6s %10s = %-22s' % (self.MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', PcdValue)) + FileWrite(File, ' *F %-*s: %6s %10s = %-22s' % (self.MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', PcdValue.strip())) else: - FileWrite(File, ' *P %-*s: %6s %10s = %-22s' % (self.MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', PcdValue)) + FileWrite(File, ' *P %-*s: %6s %10s = %-22s' % (self.MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', PcdValue.strip())) else: - FileWrite(File, ' *M %-*s: %6s %10s = %-22s' % (self.MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', PcdValue)) + FileWrite(File, ' *M %-*s: %6s %10s = %-22s' % (self.MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', PcdValue.strip())) if TypeName in ('DYNHII', 'DEXHII', 'DYNVPD', 'DEXVPD'): for SkuInfo in Pcd.SkuInfoList.values(): @@ -701,13 +701,13 @@ class PcdReport(object): FileWrite(File, '%*s' % (self.MaxLen + 4, SkuInfo.VpdOffset)) if not DscMatch and DscDefaultValue != None: - FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', DscDefaultValue)) + FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', DscDefaultValue.strip())) if not InfMatch and InfDefaultValue != None: - FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', InfDefaultValue)) + FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', InfDefaultValue.strip())) if not DecMatch and DecDefaultValue != None: - FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DEC DEFAULT', DecDefaultValue)) + FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DEC DEFAULT', DecDefaultValue.strip())) if ModulePcdSet == None: ModuleOverride = self.ModulePcdOverride.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName), {}) @@ -717,10 +717,10 @@ class PcdReport(object): ModulePcdDefaultValueNumber = int(ModuleDefault.strip(), 0) Match = (ModulePcdDefaultValueNumber == PcdValueNumber) else: - Match = (ModuleDefault == PcdValue) + Match = (ModuleDefault.strip() == PcdValue.strip()) if Match: continue - FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 19, ModulePath, ModuleDefault)) + FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 19, ModulePath, ModuleDefault.strip())) if ModulePcdSet == None: FileWrite(File, gSectionEnd) @@ -1283,8 +1283,9 @@ class PlatformReport(object): # # @param self The object pointer # @param Wa Workspace context information + # @param MaList The list of modules in the platform build # - def __init__(self, Wa, ReportType): + def __init__(self, Wa, MaList, ReportType): self._WorkspaceDir = Wa.WorkspaceDir self.PlatformName = Wa.Name self.PlatformDscPath = Wa.Platform @@ -1299,7 +1300,7 @@ class PlatformReport(object): self.PcdReport = PcdReport(Wa) self.FdReportList = [] - if "FLASH" in ReportType and Wa.FdfProfile: + if "FLASH" in ReportType and Wa.FdfProfile and MaList == None: for Fd in Wa.FdfProfile.FdDict: self.FdReportList.append(FdReport(Wa.FdfProfile.FdDict[Fd], Wa)) @@ -1308,9 +1309,13 @@ class PlatformReport(object): self.PredictionReport = PredictionReport(Wa) self.ModuleReportList = [] - for Pa in Wa.AutoGenObjectList: - for ModuleKey in Pa.Platform.Modules: - self.ModuleReportList.append(ModuleReport(Pa.Platform.Modules[ModuleKey].M, ReportType)) + if MaList != None: + for Ma in MaList: + self.ModuleReportList.append(ModuleReport(Ma, ReportType)) + else: + for Pa in Wa.AutoGenObjectList: + for ModuleKey in Pa.Platform.Modules: + self.ModuleReportList.append(ModuleReport(Pa.Platform.Modules[ModuleKey].M, ReportType)) @@ -1386,10 +1391,11 @@ class BuildReport(object): # # @param self The object pointer # @param Wa Workspace context information + # @param MaList The list of modules in the platform build # - def AddPlatformReport(self, Wa): + def AddPlatformReport(self, Wa, MaList=None): if self.ReportFile: - self.ReportList.append(Wa) + self.ReportList.append((Wa, MaList)) ## # Generates the final report. @@ -1407,8 +1413,8 @@ class BuildReport(object): except IOError: EdkLogger.error(None, FILE_OPEN_FAILURE, ExtraData=self.ReportFile) try: - for Wa in self.ReportList: - PlatformReport(Wa, self.ReportType).GenerateReport(File, BuildDuration, self.ReportType) + for (Wa, MaList) in self.ReportList: + PlatformReport(Wa, MaList, self.ReportType).GenerateReport(File, BuildDuration, self.ReportType) EdkLogger.quiet("Report successfully saved to %s" % os.path.abspath(self.ReportFile)) except IOError: EdkLogger.error(None, FILE_WRITE_FAILURE, ExtraData=self.ReportFile) diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index 9705097606..e3a3dd9f3f 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -738,6 +738,16 @@ class Build(): # parse target.txt, tools_def.txt, and platform file #self.RestoreBuildData() self.LoadConfiguration() + + # + # @attention Treat $(TARGET) in meta data files as special macro when it has only one build target. + # This is not a complete support for $(TARGET) macro as it can only support one build target in ONE + # invocation of build command. However, it should cover the frequent usage model that $(TARGET) macro + # is used in DSC files to specify different libraries & PCD setting for debug/release build. + # + if len(self.BuildTargetList) == 1: + self.Db._GlobalMacros.setdefault("TARGET", self.BuildTargetList[0]) + self.InitBuild() # print current build environment and configuration @@ -1336,7 +1346,6 @@ class Build(): self.FvList, self.SkuId ) - self.BuildReport.AddPlatformReport(Wa) Wa.CreateMakeFile(False) self.Progress.Stop("done!") MaList = [] @@ -1345,6 +1354,8 @@ class Build(): if Ma == None: continue MaList.append(Ma) self._Build(self.Target, Ma) + + self.BuildReport.AddPlatformReport(Wa, MaList) if MaList == []: EdkLogger.error( 'build', -- cgit v1.2.3