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:
Yonghong Zhu
2016-03-31 14:05:59 +08:00
parent d7cd335681
commit f0dc69e61b
8 changed files with 268 additions and 22 deletions

View File

@ -1,7 +1,7 @@
## @file
# This file is used to define a class object to describe a platform
#
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2007 - 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
@ -86,6 +86,24 @@ class PlatformFlashDefinitionFileClass(object):
self.Preferred = False
self.FilePath = ''
## BuildScriptClass
#
# This class defined PREBUILD/POSTBUILD item used in platform file
#
# @param object: Inherited from object class
#
# @var Id: To store value for Id
# @var UiName: To store value for UiName
# @var Preferred: To store value for Preferred
# @var FilePath: To store value for FilePath
#
class BuildScriptClass(object):
def __init__(self):
self.Id = ''
self.UiName = ''
self.Preferred = False
self.FilePath = ''
## PlatformFvImageOptionClass
#
# This class defined FvImageOption item used in platform file
@ -401,6 +419,10 @@ class PlatformModuleClasses(IncludeStatementClass):
# PlatformModuleClasses
# @var FlashDefinitionFile: To store value for FlashDefinitionFile, it is a structure as
# PlatformFlashDefinitionFileClass
# @var Prebuild: To store value for PREBUILD, it is a structure as
# BuildScriptClass
# @var Postbuild: To store value for POSTBUILD, it is a structure as
# BuildScriptClass
# @var BuildOptions: To store value for BuildOptions, it is a structure as
# PlatformBuildOptionClasses
# @var DynamicPcdBuildDefinitions: To store value for DynamicPcdBuildDefinitions, it is a list structure as
@ -418,6 +440,8 @@ class PlatformClass(object):
self.LibraryClasses = PlatformLibraryClasses()
self.Modules = PlatformModuleClasses()
self.FlashDefinitionFile = PlatformFlashDefinitionFileClass()
self.Prebuild = BuildScriptClass()
self.Postbuild = BuildScriptClass()
self.BuildOptions = PlatformBuildOptionClasses()
self.DynamicPcdBuildDefinitions = []
self.Fdf = []