@@ -3579,19 +3579,37 @@ def _GenOffsetBin(self):
3579
3579
fInputfile .close ()
3580
3580
return OutputName
3581
3581
3582
+ @cached_property
3583
+ def OutputFile (self ):
3584
+ retVal = set ()
3585
+ OutputDir = self .OutputDir .replace ('\\ ' , '/' ).strip ('/' )
3586
+ DebugDir = self .DebugDir .replace ('\\ ' , '/' ).strip ('/' )
3587
+ for Item in self .CodaTargetList :
3588
+ File = Item .Target .Path .replace ('\\ ' , '/' ).strip ('/' ).replace (DebugDir , '' ).replace (OutputDir , '' ).strip ('/' )
3589
+ retVal .add (File )
3590
+ if self .DepexGenerated :
3591
+ retVal .add (self .Name + '.depex' )
3592
+
3593
+ Bin = self ._GenOffsetBin ()
3594
+ if Bin :
3595
+ retVal .add (Bin )
3596
+
3597
+ for Root , Dirs , Files in os .walk (OutputDir ):
3598
+ for File in Files :
3599
+ if File .lower ().endswith ('.pdb' ):
3600
+ retVal .add (File )
3601
+
3602
+ return retVal
3603
+
3582
3604
## Create AsBuilt INF file the module
3583
3605
#
3584
3606
def CreateAsBuiltInf (self ):
3585
- self .OutputFile = set ()
3586
3607
3587
3608
if self .IsAsBuiltInfCreated :
3588
3609
return
3589
3610
3590
3611
# Skip INF file generation for libraries
3591
3612
if self .IsLibrary :
3592
- # Only store the library cache if needed
3593
- if GlobalData .gBinCacheDest :
3594
- self .CopyModuleToCache ()
3595
3613
return
3596
3614
3597
3615
# Skip the following code for modules with no source files
@@ -3712,7 +3730,6 @@ def CreateAsBuiltInf(self):
3712
3730
DebugDir = self .DebugDir .replace ('\\ ' , '/' ).strip ('/' )
3713
3731
for Item in self .CodaTargetList :
3714
3732
File = Item .Target .Path .replace ('\\ ' , '/' ).strip ('/' ).replace (DebugDir , '' ).replace (OutputDir , '' ).strip ('/' )
3715
- self .OutputFile .add (File )
3716
3733
if os .path .isabs (File ):
3717
3734
File = File .replace ('\\ ' , '/' ).strip ('/' ).replace (OutputDir , '' ).strip ('/' )
3718
3735
if Item .Target .Ext .lower () == '.aml' :
@@ -3728,7 +3745,6 @@ def CreateAsBuiltInf(self):
3728
3745
if os .path .exists (DepexFile ):
3729
3746
self .DepexGenerated = True
3730
3747
if self .DepexGenerated :
3731
- self .OutputFile .add (self .Name + '.depex' )
3732
3748
if self .ModuleType in [SUP_MODULE_PEIM ]:
3733
3749
AsBuiltInfDict ['binary_item' ].append ('PEI_DEPEX|' + self .Name + '.depex' )
3734
3750
elif self .ModuleType in [SUP_MODULE_DXE_DRIVER , SUP_MODULE_DXE_RUNTIME_DRIVER , SUP_MODULE_DXE_SAL_DRIVER , SUP_MODULE_UEFI_DRIVER ]:
@@ -3739,13 +3755,11 @@ def CreateAsBuiltInf(self):
3739
3755
Bin = self ._GenOffsetBin ()
3740
3756
if Bin :
3741
3757
AsBuiltInfDict ['binary_item' ].append ('BIN|%s' % Bin )
3742
- self .OutputFile .add (Bin )
3743
3758
3744
3759
for Root , Dirs , Files in os .walk (OutputDir ):
3745
3760
for File in Files :
3746
3761
if File .lower ().endswith ('.pdb' ):
3747
3762
AsBuiltInfDict ['binary_item' ].append ('DISPOSABLE|' + File )
3748
- self .OutputFile .add (File )
3749
3763
HeaderComments = self .Module .HeaderComments
3750
3764
StartPos = 0
3751
3765
for Index in range (len (HeaderComments )):
@@ -3914,39 +3928,31 @@ def CreateAsBuiltInf(self):
3914
3928
SaveFileOnChange (os .path .join (self .OutputDir , self .Name + '.inf' ), str (AsBuiltInf ), False )
3915
3929
3916
3930
self .IsAsBuiltInfCreated = True
3917
- if GlobalData .gBinCacheDest :
3918
- self .CopyModuleToCache ()
3919
3931
3920
3932
def CopyModuleToCache (self ):
3921
3933
FileDir = path .join (GlobalData .gBinCacheDest , self .PlatformInfo .OutputDir , self .BuildTarget + "_" + self .ToolChain , self .Arch , self .SourceDir , self .MetaFile .BaseName )
3922
3934
CreateDirectory (FileDir )
3923
3935
HashFile = path .join (self .BuildDir , self .Name + '.hash' )
3924
3936
if os .path .exists (HashFile ):
3925
3937
CopyFileOnChange (HashFile , FileDir )
3926
- if not self .IsLibrary :
3927
- ModuleFile = path .join (self .OutputDir , self .Name + '.inf' )
3928
- if os .path .exists (ModuleFile ):
3929
- CopyFileOnChange (ModuleFile , FileDir )
3930
- else :
3931
- OutputDir = self .OutputDir .replace ('\\ ' , '/' ).strip ('/' )
3932
- DebugDir = self .DebugDir .replace ('\\ ' , '/' ).strip ('/' )
3933
- for Item in self .CodaTargetList :
3934
- File = Item .Target .Path .replace ('\\ ' , '/' ).strip ('/' ).replace (DebugDir , '' ).replace (OutputDir , '' ).strip ('/' )
3935
- self .OutputFile .add (File )
3938
+ ModuleFile = path .join (self .OutputDir , self .Name + '.inf' )
3939
+ if os .path .exists (ModuleFile ):
3940
+ CopyFileOnChange (ModuleFile , FileDir )
3941
+
3936
3942
if not self .OutputFile :
3937
3943
Ma = self .BuildDatabase [self .MetaFile , self .Arch , self .BuildTarget , self .ToolChain ]
3938
3944
self .OutputFile = Ma .Binaries
3939
- if self . OutputFile :
3940
- for File in self .OutputFile :
3941
- File = str (File )
3942
- if not os .path .isabs (File ):
3943
- File = os .path .join (self .OutputDir , File )
3944
- if os .path .exists (File ):
3945
- sub_dir = os .path .relpath (File , self .OutputDir )
3946
- destination_file = os .path .join (FileDir , sub_dir )
3947
- destination_dir = os .path .dirname (destination_file )
3948
- CreateDirectory (destination_dir )
3949
- CopyFileOnChange (File , destination_dir )
3945
+
3946
+ for File in self .OutputFile :
3947
+ File = str (File )
3948
+ if not os .path .isabs (File ):
3949
+ File = os .path .join (self .OutputDir , File )
3950
+ if os .path .exists (File ):
3951
+ sub_dir = os .path .relpath (File , self .OutputDir )
3952
+ destination_file = os .path .join (FileDir , sub_dir )
3953
+ destination_dir = os .path .dirname (destination_file )
3954
+ CreateDirectory (destination_dir )
3955
+ CopyFileOnChange (File , destination_dir )
3950
3956
3951
3957
def AttemptModuleCacheCopy (self ):
3952
3958
# If library or Module is binary do not skip by hash
0 commit comments