summaryrefslogtreecommitdiffstats
path: root/BaseTools
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2015-12-07 09:09:31 +0000
committeryzhu52 <yzhu52@Edk2>2015-12-07 09:09:31 +0000
commit48aed71c6572db9204bfa8af090039d5f24f5bea (patch)
tree6adb612d1155ef0f21c89e98f317d73169333078 /BaseTools
parent4aa9826def3bf9d817e7d245d46886a31de92c15 (diff)
downloadedk2-48aed71c6572db9204bfa8af090039d5f24f5bea.tar.gz
edk2-48aed71c6572db9204bfa8af090039d5f24f5bea.tar.bz2
edk2-48aed71c6572db9204bfa8af090039d5f24f5bea.zip
BaseTools: process the files by the priority in BUILDRULEORDER
By the BUILDRULEORDER feature to process files listed in INF [Sources] sections in priority order, if a filename is listed with multiple extensions, the tools will use only the file that matches the first extension in the space separated list. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19143 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 4c627dfb55..cf0b4466f9 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2713,9 +2713,36 @@ class ModuleAutoGen(AutoGen):
if F.Dir not in self.IncludePathList and self.AutoGenVersion >= 0x00010005:
self.IncludePathList.insert(0, F.Dir)
self._SourceFileList.append(F)
+
+ self._MatchBuildRuleOrder(self._SourceFileList)
+
+ for F in self._SourceFileList:
self._ApplyBuildRule(F, TAB_UNKNOWN_FILE)
return self._SourceFileList
+ def _MatchBuildRuleOrder(self, FileList):
+ Order_Dict = {}
+ self._GetModuleBuildOption()
+ for SingleFile in FileList:
+ if self.BuildRuleOrder and SingleFile.Ext in self.BuildRuleOrder:
+ key = SingleFile.Path.split(SingleFile.Ext)[0]
+ if key in Order_Dict:
+ Order_Dict[key].append(SingleFile.Ext)
+ else:
+ Order_Dict[key] = [SingleFile.Ext]
+
+ RemoveList = []
+ for F in Order_Dict:
+ if len(Order_Dict[F]) > 1:
+ Order_Dict[F].sort(key=lambda i: self.BuildRuleOrder.index(i))
+ for Ext in Order_Dict[F][1:]:
+ RemoveList.append(F + Ext)
+
+ for item in RemoveList:
+ FileList.remove(item)
+
+ return FileList
+
## Return the list of unicode files
def _GetUnicodeFileList(self):
if self._UnicodeFileList == None: