summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/build/build.py
diff options
context:
space:
mode:
authorFeng, Bob C <bob.c.feng@intel.com>2019-07-22 11:09:22 +0800
committerFeng, Bob C <bob.c.feng@intel.com>2019-08-09 23:15:52 +0800
commite8449e1d8e3b40186eb16ff25242397cffb00a63 (patch)
tree91e6fd4742f6cc2b351be2f5bfe02ab1a4ea1b38 /BaseTools/Source/Python/build/build.py
parent197ca7febf8668be505ff904f75b97f9e465df82 (diff)
downloadedk2-e8449e1d8e3b40186eb16ff25242397cffb00a63.tar.gz
edk2-e8449e1d8e3b40186eb16ff25242397cffb00a63.tar.bz2
edk2-e8449e1d8e3b40186eb16ff25242397cffb00a63.zip
BaseTools: Decouple AutoGen Objects
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1875 1. Separate the AutoGen.py into 3 small py files. One is for AutoGen base class, one is for WorkspaceAutoGen class and PlatformAutoGen class, and the one for ModuleAutoGen class. 2. Create a new class DataPipe to store the Platform scope settings. Create a new class PlatformInfo to provide the same interface as PlatformAutoGen. PlatformInfo class is initialized by DataPipe instance. Create a new class WorkspaceInfo to provide the same interface as WorkspaceAutoGen. WorkspaceInfo class is initialized by DataPipe instance. 3. Change ModuleAutoGen to depends on DataPipe, PlatformInfo and WorkspaceInfo. Remove the dependency of ModuleAutoGen to PlatformAutoGen. Cc: Liming Gao <liming.gao@intel.com> Cc: Steven Shi <steven.shi@intel.com> Signed-off-by: Bob Feng <bob.c.feng@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/build/build.py')
-rw-r--r--BaseTools/Source/Python/build/build.py51
1 files changed, 31 insertions, 20 deletions
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 07693b9735..3d083f4eaa 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -12,42 +12,45 @@
# Import Modules
#
from __future__ import print_function
-import Common.LongFilePathOs as os
-import re
+from __future__ import absolute_import
+import os.path as path
import sys
+import os
+import re
import glob
import time
import platform
import traceback
-import encodings.ascii
import multiprocessing
-
-from struct import *
-from threading import *
+from threading import Thread,Event,BoundedSemaphore
import threading
+from subprocess import Popen,PIPE
+from collections import OrderedDict, defaultdict
from optparse import OptionParser
-from subprocess import *
+from AutoGen.PlatformAutoGen import PlatformAutoGen
+from AutoGen.ModuleAutoGen import ModuleAutoGen
+from AutoGen.WorkspaceAutoGen import WorkspaceAutoGen
+from AutoGen import GenMake
from Common import Misc as Utils
-from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.TargetTxtClassObject import TargetTxt
from Common.ToolDefClassObject import ToolDef
+from Common.Misc import PathClass,SaveFileOnChange,RemoveDirectory
+from Common.StringUtils import NormPath
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+from Common.BuildToolError import *
from Common.DataType import *
+import Common.EdkLogger as EdkLogger
from Common.BuildVersion import gBUILD_VERSION
-from AutoGen.AutoGen import *
-from Common.BuildToolError import *
-from Workspace.WorkspaceDatabase import WorkspaceDatabase
-from Common.MultipleWorkspace import MultipleWorkspace as mws
+from Workspace.WorkspaceDatabase import BuildDB
from BuildReport import BuildReport
-from GenPatchPcdTable.GenPatchPcdTable import *
-from PatchPcdValue.PatchPcdValue import *
+from GenPatchPcdTable.GenPatchPcdTable import PeImageClass,parsePcdInfoFromMapFile
+from PatchPcdValue.PatchPcdValue import PatchBinaryFile
-import Common.EdkLogger
import Common.GlobalData as GlobalData
from GenFds.GenFds import GenFds, GenFdsApi
-from collections import OrderedDict, defaultdict
# Version and Copyright
VersionNumber = "0.60" + ' ' + gBUILD_VERSION
@@ -775,7 +778,7 @@ class Build():
GlobalData.gDatabasePath = os.path.normpath(os.path.join(ConfDirectoryPath, GlobalData.gDatabasePath))
if not os.path.exists(os.path.join(GlobalData.gConfDirectory, '.cache')):
os.makedirs(os.path.join(GlobalData.gConfDirectory, '.cache'))
- self.Db = WorkspaceDatabase()
+ self.Db = BuildDB
self.BuildDatabase = self.Db.BuildObject
self.Platform = None
self.ToolChainFamily = None
@@ -1700,13 +1703,17 @@ class Build():
CmdListDict = self._GenFfsCmd(Wa.ArchList)
for Arch in Wa.ArchList:
+ PcdMaList = []
GlobalData.gGlobalDefines['ARCH'] = Arch
Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)
for Module in Pa.Platform.Modules:
# Get ModuleAutoGen object to generate C code file and makefile
- Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile)
+ Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile,Pa.DataPipe)
if Ma is None:
continue
+ if Ma.PcdIsDriver:
+ Ma.PlatformInfo = Pa
+ PcdMaList.append(Ma)
self.BuildModules.append(Ma)
self._BuildPa(self.Target, Pa, FfsCommand=CmdListDict)
@@ -1802,7 +1809,7 @@ class Build():
Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)
for Module in Pa.Platform.Modules:
if self.ModuleFile.Dir == Module.Dir and self.ModuleFile.Name == Module.Name:
- Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile)
+ Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile,Pa.DataPipe)
if Ma is None:
continue
MaList.append(Ma)
@@ -1982,6 +1989,7 @@ class Build():
ExitFlag.clear()
self.AutoGenTime += int(round((time.time() - WorkspaceAutoGenTime)))
for Arch in Wa.ArchList:
+ PcdMaList = []
AutoGenStart = time.time()
GlobalData.gGlobalDefines['ARCH'] = Arch
Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)
@@ -1999,10 +2007,13 @@ class Build():
ModuleList.append(Inf)
for Module in ModuleList:
# Get ModuleAutoGen object to generate C code file and makefile
- Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile)
+ Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile,Pa.DataPipe)
if Ma is None:
continue
+ if Ma.PcdIsDriver:
+ Ma.PlatformInfo = Pa
+ PcdMaList.append(Ma)
if Ma.CanSkipbyHash():
self.HashSkipModules.append(Ma)
if GlobalData.gBinCacheSource: