diff options
author | jwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-01-26 06:28:27 +0000 |
---|---|---|
committer | jwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-01-26 06:28:27 +0000 |
commit | d59f2c721ba3d73fa8a871f2c34504ae7e42cb1b (patch) | |
tree | f5139240a87e6afc64be5d597a1ef5a5e5b4e141 /Tools/Python | |
parent | 149127db682552971634ad1017c522808367acc3 (diff) | |
download | edk2-platforms-d59f2c721ba3d73fa8a871f2c34504ae7e42cb1b.tar.xz |
- Remove the TOOL without NAME defined and its definition in ARCH_build.opt
- Prefix the tool path to its name in ARCH_build.opt
- Support the same library class in different package
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2325 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Python')
-rw-r--r-- | Tools/Python/buildgen/BuildFile.py | 26 | ||||
-rw-r--r-- | Tools/Python/buildgen/FrameworkElement.py | 2 | ||||
-rw-r--r-- | Tools/Python/buildgen/SurfaceAreaElement.py | 64 |
3 files changed, 58 insertions, 34 deletions
diff --git a/Tools/Python/buildgen/BuildFile.py b/Tools/Python/buildgen/BuildFile.py index 8514e4c8a4..9a2aae30b2 100644 --- a/Tools/Python/buildgen/BuildFile.py +++ b/Tools/Python/buildgen/BuildFile.py @@ -230,18 +230,19 @@ class AntPlatformBuildFile(BuildFile): """Generate ${ARCH}_build.opt which contains the default build&tool definitions"""
tools = self.Workspace.ToolConfig.ToolCodes
for arch in self.Workspace.ActiveArchs:
+ validTools = []
+ for tool in tools:
+ key = (self.Toolchain, self.Target, arch, tool, "NAME")
+ if self.Workspace.ToolConfig[key] == "": continue
+ validTools.append(tool)
+
optFileDir = os.path.join(self.Workspace.Path, self.Platform.OutputPath,
self.Target + "_" + self.Toolchain)
optFileName = arch + "_build.opt"
if not os.path.exists(optFileDir): os.makedirs(optFileDir)
f = open(os.path.join(optFileDir, optFileName), "w")
- for tool in tools:
- key = (self.Toolchain, self.Target, arch, tool, "FLAGS")
- flag = self.Workspace.ToolConfig[key]
- f.write("DEFAULT_%s_FLAGS=%s\n" % (tool, flag))
-
- f.write("\n")
- for tool in tools:
+
+ for tool in validTools:
key = (self.Toolchain, self.Target, arch, tool, "FLAGS")
if key in self.Platform.BuildOptions:
flag = self.Platform.BuildOptions[key]
@@ -254,15 +255,22 @@ class AntPlatformBuildFile(BuildFile): else:
flag = ""
f.write("PLATFORM_%s_FLAGS=%s\n" % (tool, flag))
+ f.write("\n")
+
+ for tool in validTools:
+ key = (self.Toolchain, self.Target, arch, tool, "FLAGS")
+ flag = self.Workspace.ToolConfig[key]
+ f.write("DEFAULT_%s_FLAGS=%s\n" % (tool, flag))
f.write("\n")
- for tool in tools:
+ for tool in validTools:
for attr in self.Workspace.ToolConfig.Attributes:
if attr == "FLAGS": continue
key = (self.Toolchain, self.Target, arch, tool, attr)
value = self.Workspace.ToolConfig[key]
if attr == "NAME":
- f.write("%s=%s\n" % (tool, value))
+ path = self.Workspace.ToolConfig[(self.Toolchain, self.Target, arch, tool, "PATH")]
+ f.write("%s=%s\n" % (tool, os.path.join(path, value)))
else:
f.write("%s_%s=%s\n" % (tool, attr, value))
f.write("%s_FLAGS=${DEFAULT_%s_FLAGS} ${DEFAULT_MODULE_%s_FLAGS} ${PLATFORM_%s_FLAGS} ${MODULE_%s_FLAGS}\n" %
diff --git a/Tools/Python/buildgen/FrameworkElement.py b/Tools/Python/buildgen/FrameworkElement.py index 6fd8740789..3be8eaae57 100644 --- a/Tools/Python/buildgen/FrameworkElement.py +++ b/Tools/Python/buildgen/FrameworkElement.py @@ -487,7 +487,7 @@ class Workspace(Element): "PATH" : {},
"NAME" : {},
}
- ## "NAME" : {name : library interface}
+ ## "NAME" : {name : [library interface]}
## "PATH" : {path : library interface}
self.LibraryInterfaceXref = {
"PATH" : {},
diff --git a/Tools/Python/buildgen/SurfaceAreaElement.py b/Tools/Python/buildgen/SurfaceAreaElement.py index 2f022c7ca6..ae1938ff9e 100644 --- a/Tools/Python/buildgen/SurfaceAreaElement.py +++ b/Tools/Python/buildgen/SurfaceAreaElement.py @@ -284,9 +284,6 @@ class LibraryClass(FrameworkElement.LibraryClass, SurfaceAreaElement): self.FavoriteIntance = FrameworkElement.Module()
self.FavoriteIntance.Version = attribute
- def Postprocess(self):
- self.Interface = self._Workspace.GetLibraryInterface(self.Name)
-
class SourceFile(FrameworkElement.SourceFile, SurfaceAreaElement):
def __init__(self, workspace, module, dom):
FrameworkElement.SourceFile.__init__(self)
@@ -758,7 +755,7 @@ class ModuleSurfaceArea(FrameworkElement.Module, SurfaceAreaElement): # resolve library class
if self._Elements.has_key("LibraryClassDefinitions"):
for lc in self._Elements["LibraryClassDefinitions"]:
- lc.Interface = self._Workspace.GetLibraryInterface(lc.Name)
+ lc.Interface = self.GetLibraryInterface(lc.Name)
if "ALWAYS_PRODUCED" in lc.Usage:
self.IsLibrary = True
lc.Interface.Instances.append(self)
@@ -811,6 +808,14 @@ class ModuleSurfaceArea(FrameworkElement.Module, SurfaceAreaElement): if arch not in self.Externs:
self.Externs[arch] = []
self.Externs[arch].append(extern)
+
+ def GetLibraryInterface(self, name):
+ if name in self.Package.LibraryInterfaces:
+ return self.Package.LibraryInterfaces[name]
+ for pd in self._Elements["PackageDependencies"]:
+ if name in pd.Package.LibraryInterfaces:
+ return pd.Package.LibraryInterfaces[name]
+ return ""
## def SetupEnvironment(self):
## self.Environment["MODULE"] = self.Name
## self.Environment["MODULE_GUID"] = self.GuidValue
@@ -1027,10 +1032,14 @@ class Workspace(FrameworkElement.Workspace, SurfaceAreaElement): return platform
return ""
- def GetLibraryInterface(self, name):
+ def GetLibraryInterface(self, name, package):
if name not in self.LibraryInterfaceXref["NAME"]:
return ""
- return self.LibraryInterfaceXref["NAME"][name]
+ liList = self.LibraryInterfaceXref["NAME"][name]
+ for li in liList:
+ if li.Package == package:
+ return li
+ return ""
def SubPath(self, *relativePathList):
return os.path.normpath(os.path.join(self.Path, *relativePathList))
@@ -1084,14 +1093,17 @@ class Workspace(FrameworkElement.Workspace, SurfaceAreaElement): ## library class name -> library class object
##
for lcname in p.LibraryInterfaces:
- if lcname in self.LibraryInterfaceXref["NAME"]:
- raise Exception("Duplicate library class: %s in package %s" % (lcname, name))
+ if lcname not in self.LibraryInterfaceXref["NAME"]:
+ # raise Exception("Duplicate library class: %s in package %s" % (lcname, name))
+ self.LibraryInterfaceXref["NAME"][lcname] = []
lcInterface = p.LibraryInterfaces[lcname]
- self.LibraryInterfaceXref["NAME"][lcname] = lcInterface
+ self.LibraryInterfaceXref["NAME"][lcname].append(lcInterface)
- if lcInterface not in self.LibraryInterfaceXref["PATH"]:
- self.LibraryInterfaceXref["PATH"][lcInterface] = []
- self.LibraryInterfaceXref["PATH"][lcInterface].append(lcname)
+ lcHeader = p.SubPath(lcInterface.Path)
+ if lcHeader not in self.LibraryInterfaceXref["PATH"]:
+ # raise Exception("Duplicate library class interface: %s in package %s" % (lcInterface, name))
+ self.LibraryInterfaceXref["PATH"][lcHeader] = []
+ self.LibraryInterfaceXref["PATH"][lcHeader].append(lcInterface)
##
## setup package cross reference as nest-dict
@@ -1111,7 +1123,10 @@ class Workspace(FrameworkElement.Workspace, SurfaceAreaElement): if guid not in moduleGuidIndex:
moduleGuidIndex[guid] = {}
else:
- print "! Duplicate module GUID found:", guid, path
+ print "! Duplicate module GUID found:", guid, p.SubPath(path)
+ dm = moduleGuidIndex[guid].values()[0][0]
+ print " ", dm.GuidValue,\
+ dm.Package.SubPath(dm.Path)
if version not in moduleGuidIndex[guid]:
moduleGuidIndex[guid][version] = []
@@ -1483,17 +1498,18 @@ def PrintWorkspace(ws): print "\n"
print "\nLibrary Classes:"
for name in ws.LibraryInterfaceXref["NAME"]:
- lc = ws.LibraryInterfaceXref["NAME"][name]
- pkgPath = os.path.dirname(lc.Package.Path)
- print "\n [%s] <%s>" % (lc.Name, pkgPath + os.path.sep + lc.Path)
-
- print " Produced By:"
- for li in lc.Instances:
- print " %-40s <%s>" % (li.Name+"-"+li.Version, li.Package.SubPath(li.Path))
-
- print " Consumed By:"
- for li in lc.Consumers:
- print " %-40s <%s>" % (li.Name+"-"+li.Version, li.Package.SubPath(li.Path))
+ lcList = ws.LibraryInterfaceXref["NAME"][name]
+ for lc in lcList:
+ pkgPath = os.path.dirname(lc.Package.Path)
+ print "\n [%s] <%s>" % (lc.Name, pkgPath + os.path.sep + lc.Path)
+
+ print " Produced By:"
+ for li in lc.Instances:
+ print " %-40s <%s>" % (li.Name+"-"+li.Version, li.Package.SubPath(li.Path))
+
+ print " Consumed By:"
+ for li in lc.Consumers:
+ print " %-40s <%s>" % (li.Name+"-"+li.Version, li.Package.SubPath(li.Path))
print "\nActive Platform:"
for arch in ws.ActivePlatform.Libraries:
|