\r
return True\r
\r
+ ## hash() operator of PlatformAutoGen\r
+ #\r
+ # The platform file path and arch string will be used to represent\r
+ # hash value of this object\r
+ #\r
+ # @retval int Hash value of the platform file path and arch\r
+ #\r
+ @cached_class_function\r
+ def __hash__(self):\r
+ return hash((self.MetaFile, self.Arch))\r
+\r
@cached_class_function\r
def __repr__(self):\r
return "%s [%s]" % (self.MetaFile, self.Arch)\r
self.ReferenceModules = []\r
self.ConstPcd = {}\r
\r
+ ## hash() operator of ModuleAutoGen\r
+ #\r
+ # The module file path and arch string will be used to represent\r
+ # hash value of this object\r
+ #\r
+ # @retval int Hash value of the module file path and arch\r
+ #\r
+ @cached_class_function\r
+ def __hash__(self):\r
+ return hash((self.MetaFile, self.Arch))\r
\r
def __repr__(self):\r
return "%s [%s]" % (self.MetaFile, self.Arch)\r
IncPathList = [NormPath(Path, self.Macros) for Path in BuildOptIncludeRegEx.findall(FlagOption)]\r
else:\r
#\r
- # RVCT may specify a list of directory seperated by commas\r
+ # RVCT may specify a list of directory separated by commas\r
#\r
IncPathList = []\r
for Path in BuildOptIncludeRegEx.findall(FlagOption):\r
fInputfile.close ()\r
return OutputName\r
\r
+ @cached_property\r
+ def OutputFile(self):\r
+ retVal = set()\r
+ OutputDir = self.OutputDir.replace('\\', '/').strip('/')\r
+ DebugDir = self.DebugDir.replace('\\', '/').strip('/')\r
+ for Item in self.CodaTargetList:\r
+ File = Item.Target.Path.replace('\\', '/').strip('/').replace(DebugDir, '').replace(OutputDir, '').strip('/')\r
+ retVal.add(File)\r
+ if self.DepexGenerated:\r
+ retVal.add(self.Name + '.depex')\r
+\r
+ Bin = self._GenOffsetBin()\r
+ if Bin:\r
+ retVal.add(Bin)\r
+\r
+ for Root, Dirs, Files in os.walk(OutputDir):\r
+ for File in Files:\r
+ if File.lower().endswith('.pdb'):\r
+ retVal.add(File)\r
+\r
+ return retVal\r
+\r
## Create AsBuilt INF file the module\r
#\r
- def CreateAsBuiltInf(self, IsOnlyCopy = False):\r
- self.OutputFile = set()\r
- if IsOnlyCopy and GlobalData.gBinCacheDest:\r
- self.CopyModuleToCache()\r
- return\r
+ def CreateAsBuiltInf(self):\r
\r
if self.IsAsBuiltInfCreated:\r
return\r
\r
- # Skip the following code for libraries\r
+ # Skip INF file generation for libraries\r
if self.IsLibrary:\r
return\r
\r
DebugDir = self.DebugDir.replace('\\', '/').strip('/')\r
for Item in self.CodaTargetList:\r
File = Item.Target.Path.replace('\\', '/').strip('/').replace(DebugDir, '').replace(OutputDir, '').strip('/')\r
- self.OutputFile.add(File)\r
if os.path.isabs(File):\r
File = File.replace('\\', '/').strip('/').replace(OutputDir, '').strip('/')\r
if Item.Target.Ext.lower() == '.aml':\r
if os.path.exists(DepexFile):\r
self.DepexGenerated = True\r
if self.DepexGenerated:\r
- self.OutputFile.add(self.Name + '.depex')\r
if self.ModuleType in [SUP_MODULE_PEIM]:\r
AsBuiltInfDict['binary_item'].append('PEI_DEPEX|' + self.Name + '.depex')\r
elif self.ModuleType in [SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER]:\r
Bin = self._GenOffsetBin()\r
if Bin:\r
AsBuiltInfDict['binary_item'].append('BIN|%s' % Bin)\r
- self.OutputFile.add(Bin)\r
\r
for Root, Dirs, Files in os.walk(OutputDir):\r
for File in Files:\r
if File.lower().endswith('.pdb'):\r
AsBuiltInfDict['binary_item'].append('DISPOSABLE|' + File)\r
- self.OutputFile.add(File)\r
HeaderComments = self.Module.HeaderComments\r
StartPos = 0\r
for Index in range(len(HeaderComments)):\r
SaveFileOnChange(os.path.join(self.OutputDir, self.Name + '.inf'), str(AsBuiltInf), False)\r
\r
self.IsAsBuiltInfCreated = True\r
- if GlobalData.gBinCacheDest:\r
- self.CopyModuleToCache()\r
\r
def CopyModuleToCache(self):\r
- FileDir = path.join(GlobalData.gBinCacheDest, self.PlatformInfo.Name, self.BuildTarget + "_" + self.ToolChain, self.Arch, self.SourceDir, self.MetaFile.BaseName)\r
+ FileDir = path.join(GlobalData.gBinCacheDest, self.PlatformInfo.OutputDir, self.BuildTarget + "_" + self.ToolChain, self.Arch, self.SourceDir, self.MetaFile.BaseName)\r
CreateDirectory (FileDir)\r
HashFile = path.join(self.BuildDir, self.Name + '.hash')\r
if os.path.exists(HashFile):\r
- shutil.copy2(HashFile, FileDir)\r
- if not self.IsLibrary:\r
- ModuleFile = path.join(self.OutputDir, self.Name + '.inf')\r
- if os.path.exists(ModuleFile):\r
- shutil.copy2(ModuleFile, FileDir)\r
+ CopyFileOnChange(HashFile, FileDir)\r
+ ModuleFile = path.join(self.OutputDir, self.Name + '.inf')\r
+ if os.path.exists(ModuleFile):\r
+ CopyFileOnChange(ModuleFile, FileDir)\r
+\r
if not self.OutputFile:\r
Ma = self.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]\r
self.OutputFile = Ma.Binaries\r
- if self.OutputFile:\r
- for File in self.OutputFile:\r
- File = str(File)\r
- if not os.path.isabs(File):\r
- File = os.path.join(self.OutputDir, File)\r
- if os.path.exists(File):\r
- sub_dir = os.path.relpath(File, self.OutputDir)\r
- destination_file = os.path.join(FileDir, sub_dir)\r
- destination_dir = os.path.dirname(destination_file)\r
- CreateDirectory(destination_dir)\r
- shutil.copy2(File, destination_dir)\r
+\r
+ for File in self.OutputFile:\r
+ File = str(File)\r
+ if not os.path.isabs(File):\r
+ File = os.path.join(self.OutputDir, File)\r
+ if os.path.exists(File):\r
+ sub_dir = os.path.relpath(File, self.OutputDir)\r
+ destination_file = os.path.join(FileDir, sub_dir)\r
+ destination_dir = os.path.dirname(destination_file)\r
+ CreateDirectory(destination_dir)\r
+ CopyFileOnChange(File, destination_dir)\r
\r
def AttemptModuleCacheCopy(self):\r
# If library or Module is binary do not skip by hash\r
for f_ext in self.SourceFileList:\r
if '.inc' in str(f_ext):\r
return False\r
- FileDir = path.join(GlobalData.gBinCacheSource, self.PlatformInfo.Name, self.BuildTarget + "_" + self.ToolChain, self.Arch, self.SourceDir, self.MetaFile.BaseName)\r
+ FileDir = path.join(GlobalData.gBinCacheSource, self.PlatformInfo.OutputDir, self.BuildTarget + "_" + self.ToolChain, self.Arch, self.SourceDir, self.MetaFile.BaseName)\r
HashFile = path.join(FileDir, self.Name + '.hash')\r
if os.path.exists(HashFile):\r
f = open(HashFile, 'r')\r
for root, dir, files in os.walk(FileDir):\r
for f in files:\r
if self.Name + '.hash' in f:\r
- shutil.copy2(HashFile, self.BuildDir)\r
+ CopyFileOnChange(HashFile, self.BuildDir)\r
else:\r
File = path.join(root, f)\r
sub_dir = os.path.relpath(File, FileDir)\r
destination_file = os.path.join(self.OutputDir, sub_dir)\r
destination_dir = os.path.dirname(destination_file)\r
CreateDirectory(destination_dir)\r
- shutil.copy2(File, destination_dir)\r
+ CopyFileOnChange(File, destination_dir)\r
if self.Name == "PcdPeim" or self.Name == "PcdDxe":\r
CreatePcdDatabaseCode(self, TemplateString(), TemplateString())\r
return True\r
#\r
@cached_class_function\r
def CreateMakeFile(self, CreateLibraryMakeFile=True, GenFfsList = []):\r
- # nest this function inside it's only caller.\r
+ # nest this function inside its only caller.\r
def CreateTimeStamp():\r
FileSet = {self.MetaFile.Path}\r
\r
for LibraryAutoGen in self.LibraryAutoGenList:\r
LibraryAutoGen.CreateMakeFile()\r
\r
- if self.CanSkip():\r
+ # Don't enable if hash feature enabled, CanSkip uses timestamps to determine build skipping\r
+ if not GlobalData.gUseHashCache and self.CanSkip():\r
return\r
\r
if len(self.CustomMakefile) == 0:\r
for LibraryAutoGen in self.LibraryAutoGenList:\r
LibraryAutoGen.CreateCodeFile()\r
\r
- if self.CanSkip():\r
+ # Don't enable if hash feature enabled, CanSkip uses timestamps to determine build skipping\r
+ if not GlobalData.gUseHashCache and self.CanSkip():\r
return\r
\r
AutoGenList = []\r