Jordan:
  Build_Rule.txt handles file extension in case sensitive way. So, this feature 
should be in case sensitive. To support all file extensions, we can update 
*_*_*_*_BUILDRULEORDER to include them all. For example:
*_*_*_*_BUILDRULEORDER = nasm Nasm NASM S s asm Asm ASM

  I would update the patch to include this change in tools_def.template. 

Thanks
Liming
-----Original Message-----
From: Liu, Yingke D 
Sent: Wednesday, May 20, 2015 9:32 AM
To: Justen, Jordan L; edk2-devel@lists.sourceforge.net; Gao, Liming
Subject: RE: [edk2] [Patch 1/2] BaseTools: Implement BUILDRULEORDER for 
tools_def

Jordan,

This code does not handle 1.NASM, it is case sensitive currently. If there is 
requirement that the ext is case insensitive, I will update patch accordingly.

And I will have a separate function for command build.

Thanks,

Dennis

-----Original Message-----
From: Justen, Jordan L
Sent: Tuesday, May 19, 2015 11:32 PM
To: edk2-devel@lists.sourceforge.net; Gao, Liming; Liu, Yingke D
Subject: Re: [edk2] [Patch 1/2] BaseTools: Implement BUILDRULEORDER for 
tools_def

Liming, for future reference, you might want to use

  git commit --author="Yingke Liu <yingke.d....@intel.com>"

when committing a patch for someone else. It won't make a difference while the 
server is svn, but with git, the author and committer are separate.

Dennis,

Do you think this code handles 1.NASM too? (upper case extension)

The CommandList rebuild code does seem to be duplicated. Do you think it is 
worth a separate function?

-Jordan

On 2015-05-19 01:08:55, Liming Gao wrote:
> This feature allows the toolchain to choose a preference for source 
> file extensions in tools_def.txt. The first extension is given the highest 
> priority.
> 
> Here is an example usage for tools_def.txt:
> *_*_*_*_BUILDRULEORDER = nasm asm S
> *_XCODE5_*_*_ BUILDRULEORDER = S nasm
> 
> Now, if a .inf lists these sources: 1.nasm, 1.asm and 1.S All 
> toolchains, except XCODE5 will use the 1.nasm file. The XCODE5 
> toolchain will use the 1.S file.
> 
> Note that the build_rule.txt file also impacts the decision, because, 
> for instance there is no build rule for .asm files on GCC toolchains.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yingke Liu <yingke.d....@intel.com>
> ---
>  BaseTools/Source/Python/AutoGen/AutoGen.py     | 26 
> +++++++++++++++++++++++---
>  BaseTools/Source/Python/AutoGen/BuildEngine.py | 19 +++++++++++++++++--
>  BaseTools/Source/Python/Common/DataType.py     |  1 +
>  3 files changed, 41 insertions(+), 5 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> b/BaseTools/Source/Python/AutoGen/AutoGen.py
> index a1e1818..b2d9f6a 100644
> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> @@ -2080,10 +2080,17 @@ class PlatformAutoGen(AutoGen):
>              PlatformModule = self.Platform.Modules[str(Module)]
>              PlatformModuleOptions = 
> self._ExpandBuildOption(PlatformModule.BuildOptions)
>          else:
>              PlatformModuleOptions = {}
>  
> +        BuildRuleOrder = None
> +        for Options in [self.ToolDefinition, ModuleOptions, PlatformOptions, 
> PlatformModuleOptions]:
> +            for Tool in Options:
> +                for Attr in Options[Tool]:
> +                    if Attr == TAB_TOD_DEFINES_BUILDRULEORDER:
> +                        BuildRuleOrder = Options[Tool][Attr]
> +
>          AllTools = set(ModuleOptions.keys() + PlatformOptions.keys() + 
> PlatformModuleOptions.keys() + self.ToolDefinition.keys())
>          BuildOptions = {}
>          for Tool in AllTools:
>              if Tool not in BuildOptions:
>                  BuildOptions[Tool] = {} @@ -2091,10 +2098,15 @@ class
> PlatformAutoGen(AutoGen):
>              for Options in [self.ToolDefinition, ModuleOptions, 
> PlatformOptions, PlatformModuleOptions]:
>                  if Tool not in Options:
>                      continue
>                  for Attr in Options[Tool]:
>                      Value = Options[Tool][Attr]
> +                    #
> +                    # Do not generate it in Makefile
> +                    #
> +                    if Attr == TAB_TOD_DEFINES_BUILDRULEORDER:
> +                        continue
>                      if Attr not in BuildOptions[Tool]:
>                          BuildOptions[Tool][Attr] = ""
>                      # check if override is indicated
>                      if Value.startswith('='):
>                          BuildOptions[Tool][Attr] = Value[1:] @@
> -2105,11 +2117,11 @@ class PlatformAutoGen(AutoGen):
>              # Override UNI flag only for EDK module.
>              #
>              if 'BUILD' not in BuildOptions:
>                  BuildOptions['BUILD'] = {}
>              BuildOptions['BUILD']['FLAGS'] = self.Workspace.UniFlag
> -        return BuildOptions
> +        return BuildOptions, BuildRuleOrder
>  
>      Platform            = property(_GetPlatform)
>      Name                = property(_GetName)
>      Guid                = property(_GetGuid)
>      Version             = property(_GetVersion)
> @@ -2193,10 +2205,11 @@ class ModuleAutoGen(AutoGen):
>          self.IsCodeFileCreated = False
>          self.IsAsBuiltInfCreated = False
>          self.DepexGenerated = False
>  
>          self.BuildDatabase = self.Workspace.BuildDatabase
> +        self.BuildRuleOrder = None
>  
>          self._Module          = None
>          self._Name            = None
>          self._Guid            = None
>          self._Version         = None
> @@ -2585,11 +2598,13 @@ class ModuleAutoGen(AutoGen):
>      #   @param      PlatformInfo    The object of PlatformBuildInfo
>      #   @retval     dict            The dict containing valid options
>      #
>      def _GetModuleBuildOption(self):
>          if self._BuildOption == None:
> -            self._BuildOption = 
> self.PlatformInfo.ApplyBuildOption(self.Module)
> +            self._BuildOption, self.BuildRuleOrder = 
> self.PlatformInfo.ApplyBuildOption(self.Module)
> +            if self.BuildRuleOrder:
> +                self.BuildRuleOrder = ['.%s' % Ext for Ext in 
> + self.BuildRuleOrder.split()]
>          return self._BuildOption
>  
>      ## Get include path list from tool option for the module build
>      #
>      #   @retval     list            The include path list
> @@ -2744,10 +2759,15 @@ class ModuleAutoGen(AutoGen):
>              CreateDirectory(SubDirectory)
>          LastTarget = None
>          RuleChain = []
>          SourceList = [File]
>          Index = 0
> +        #
> +        # Make sure to get build rule order value
> +        #
> +        self._GetModuleBuildOption()
> +
>          while Index < len(SourceList):
>              Source = SourceList[Index]
>              Index = Index + 1
>  
>              if Source != File:
> @@ -2777,11 +2797,11 @@ class ModuleAutoGen(AutoGen):
>              if self.IsLibrary and FileType == TAB_STATIC_LIBRARY:
>                  if LastTarget:
>                      self._FinalBuildTargetList.add(LastTarget)
>                  break
>  
> -            Target = RuleObject.Apply(Source)
> +            Target = RuleObject.Apply(Source, self.BuildRuleOrder)
>              if not Target:
>                  if LastTarget:
>                      self._FinalBuildTargetList.add(LastTarget)
>                  break
>              elif not Target.Outputs:
> diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py
> b/BaseTools/Source/Python/AutoGen/BuildEngine.py
> index d15ccc0..4289dd1 100644
> --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
> +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
> @@ -218,11 +218,11 @@ class FileBuildRule:
>      #   @param  RelativeToDir   The relative path of the source file
>      #   @param  PathSeparator   Path separator
>      #
>      #   @retval     tuple       (Source file in full path, List of 
> individual sourcefiles, Destionation file, List of build commands)
>      #
> -    def Apply(self, SourceFile):
> +    def Apply(self, SourceFile, BuildRuleOrder=None):
>          if not self.CommandList or not self.DestFileList:
>              return None
>  
>          # source file
>          if self.IsMultipleInput:
> @@ -279,11 +279,26 @@ class FileBuildRule:
>              File = 
> string.Template(str(File)).safe_substitute(BuildRulePlaceholderDict)
>              DstFile.append(PathClass(File, IsBinary=True))
>  
>          if DstFile[0] in self.BuildTargets:
>              TargetDesc = self.BuildTargets[DstFile[0]]
> -            TargetDesc.AddInput(SourceFile)
> +            if BuildRuleOrder and SourceFile.Ext in BuildRuleOrder:
> +                Index = BuildRuleOrder.index(SourceFile.Ext)
> +                for Input in TargetDesc.Inputs:
> +                    if Input.Ext not in BuildRuleOrder or 
> BuildRuleOrder.index(Input.Ext) > Index:
> +                        #
> +                        # Command line should be regenerated since some 
> macros are different
> +                        #
> +                        CommandList = []
> +                        for CommandString in self.CommandList:
> +                            CommandString = 
> string.Template(CommandString).safe_substitute(BuildRulePlaceholderDict)
> +                            CommandString = 
> string.Template(CommandString).safe_substitute(BuildRulePlaceholderDict)
> +                            CommandList.append(CommandString)
> +                        TargetDesc._Init([SourceFile], DstFile, CommandList, 
> self.ExtraSourceFileList)
> +                        break
> +            else:
> +                TargetDesc.AddInput(SourceFile)
>          else:
>              CommandList = []
>              for CommandString in self.CommandList:
>                  CommandString = 
> string.Template(CommandString).safe_substitute(BuildRulePlaceholderDict)
>                  CommandString =
> string.Template(CommandString).safe_substitute(BuildRulePlaceholderDic
> t) diff --git a/BaseTools/Source/Python/Common/DataType.py
> b/BaseTools/Source/Python/Common/DataType.py
> index b4abc88..4fd46ed 100644
> --- a/BaseTools/Source/Python/Common/DataType.py
> +++ b/BaseTools/Source/Python/Common/DataType.py
> @@ -430,10 +430,11 @@ TAB_TOD_DEFINES_TARGET = 'TARGET'
>  TAB_TOD_DEFINES_TOOL_CHAIN_TAG = 'TOOL_CHAIN_TAG'
>  TAB_TOD_DEFINES_TARGET_ARCH = 'TARGET_ARCH'
>  TAB_TOD_DEFINES_COMMAND_TYPE = 'COMMAND_TYPE'
>  TAB_TOD_DEFINES_FAMILY = 'FAMILY'
>  TAB_TOD_DEFINES_BUILDRULEFAMILY = 'BUILDRULEFAMILY'
> +TAB_TOD_DEFINES_BUILDRULEORDER = 'BUILDRULEORDER'
>  
>  #
>  # Conditional Statements
>  #
>  TAB_IF = '!if'
> --
> 1.9.5.msysgit.0
> 
> 
> ----------------------------------------------------------------------
> -------- One dashboard for servers and applications across 
> Physical-Virtual-Cloud Widest out-of-the-box monitoring support with
> 50+ applications Performance metrics, stats and reports that give you
> Actionable Insights Deep dive visibility with transaction tracing 
> using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to