BaseTools: Add support to merge Prebuild and Postbuild into build Process
This feature is enhance build tool to incorporate execution of prebuild and postbuild. 1.Prebuild script a.DEFINE PREBUILD in DSC [Defines] section b.Build command -D PREBUILD to override the one in DSC [Defines] section 1)If PREBUILD is a file, then this file will be used as prebuild script. 2)If PREBUILD is empty, then prebuild script will be disabled. 3)If PREBUILD is not defined in [Defines] section and not passed in on command line, then prebuild script is also disabled. 2.Prebuild option a.All options of build tool b.TARGET, ARCH and TOOL_CHAIN_TAG value, Those value will be from target.txt file if they are not in build command line. c.Additional options following prebuild definition. Quotes are needed when these additional options are present. d.Quotes would also be required if the path to the prebuild command contains space or special characters. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# This file is used to parse meta files
|
||||
#
|
||||
# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2015, Hewlett Packard Enterprise Development, L.P.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@ -831,7 +831,9 @@ class DscParser(MetaFileParser):
|
||||
"ISO_LANGUAGES",
|
||||
"TIME_STAMP_FILE",
|
||||
"VPD_TOOL_GUID",
|
||||
"FIX_LOAD_TOP_MEMORY_ADDRESS"
|
||||
"FIX_LOAD_TOP_MEMORY_ADDRESS",
|
||||
"PREBUILD",
|
||||
"POSTBUILD"
|
||||
]
|
||||
|
||||
SubSectionDefineKeywords = [
|
||||
|
@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# This file is used to create a database used by build tool
|
||||
#
|
||||
# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
@ -137,6 +137,8 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
self._PcdInfoFlag = None
|
||||
self._VarCheckFlag = None
|
||||
self._FlashDefinition = None
|
||||
self._Prebuild = None
|
||||
self._Postbuild = None
|
||||
self._BuildNumber = None
|
||||
self._MakefileName = None
|
||||
self._BsBaseAddress = None
|
||||
@ -227,6 +229,10 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
if ErrorCode != 0:
|
||||
EdkLogger.error('build', ErrorCode, File=self.MetaFile, Line=Record[-1],
|
||||
ExtraData=ErrorInfo)
|
||||
elif Name == TAB_DSC_PREBUILD:
|
||||
self._Prebuild = PathClass(NormPath(Record[2], self._Macros), GlobalData.gWorkspace)
|
||||
elif Name == TAB_DSC_POSTBUILD:
|
||||
self._Postbuild = PathClass(NormPath(Record[2], self._Macros), GlobalData.gWorkspace)
|
||||
elif Name == TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES:
|
||||
self._SupArchList = GetSplitValueList(Record[2], TAB_VALUE_SPLIT)
|
||||
elif Name == TAB_DSC_DEFINES_BUILD_TARGETS:
|
||||
@ -399,6 +405,22 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
self._FlashDefinition = ''
|
||||
return self._FlashDefinition
|
||||
|
||||
def _GetPrebuild(self):
|
||||
if self._Prebuild == None:
|
||||
if self._Header == None:
|
||||
self._GetHeaderInfo()
|
||||
if self._Prebuild == None:
|
||||
self._Prebuild = ''
|
||||
return self._Prebuild
|
||||
|
||||
def _GetPostbuild(self):
|
||||
if self._Postbuild == None:
|
||||
if self._Header == None:
|
||||
self._GetHeaderInfo()
|
||||
if self._Postbuild == None:
|
||||
self._Postbuild = ''
|
||||
return self._Postbuild
|
||||
|
||||
## Retrieve FLASH_DEFINITION
|
||||
def _GetBuildNumber(self):
|
||||
if self._BuildNumber == None:
|
||||
@ -1207,6 +1229,8 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
PcdInfoFlag = property(_GetPcdInfoFlag)
|
||||
VarCheckFlag = property(_GetVarCheckFlag)
|
||||
FlashDefinition = property(_GetFdfFile)
|
||||
Prebuild = property(_GetPrebuild)
|
||||
Postbuild = property(_GetPostbuild)
|
||||
BuildNumber = property(_GetBuildNumber)
|
||||
MakefileName = property(_GetMakefileName)
|
||||
BsBaseAddress = property(_GetBsBaseAddress)
|
||||
@ -2979,6 +3003,13 @@ determine whether database file is out of date!\n")
|
||||
PlatformList.append(Platform)
|
||||
return PlatformList
|
||||
|
||||
def _MapPlatform(self, Dscfile):
|
||||
try:
|
||||
Platform = self.BuildObject[PathClass(Dscfile), 'COMMON']
|
||||
except:
|
||||
Platform = None
|
||||
return Platform
|
||||
|
||||
PlatformList = property(_GetPlatformList)
|
||||
|
||||
##
|
||||
|
Reference in New Issue
Block a user