4 GlobalData provide initializing, instoring, querying and update global data.
5 It is a bridge to intercommunicate between multiple component, such as AutoGen,
8 Copyright (c) 2006, Intel Corporation
9 All rights reserved. This program and the accompanying materials
10 are licensed and made available under the terms and conditions of the BSD License
11 which accompanies this distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 package org
.tianocore
.build
.global
;
19 import org
.apache
.tools
.ant
.BuildException
;
20 import org
.apache
.xmlbeans
.XmlObject
;
21 import org
.tianocore
.DbPathAndFilename
;
22 import org
.tianocore
.FrameworkDatabaseDocument
;
23 import org
.tianocore
.ModuleSurfaceAreaDocument
;
24 import org
.tianocore
.PcdBuildDefinitionDocument
;
25 import org
.tianocore
.ModuleSurfaceAreaDocument
.ModuleSurfaceArea
;
26 import org
.tianocore
.build
.id
.FpdModuleIdentification
;
27 import org
.tianocore
.build
.id
.ModuleIdentification
;
28 import org
.tianocore
.build
.id
.PackageIdentification
;
29 import org
.tianocore
.build
.id
.PlatformIdentification
;
30 import org
.tianocore
.build
.pcd
.entity
.MemoryDatabaseManager
;
31 import org
.tianocore
.build
.toolchain
.ToolChainAttribute
;
32 import org
.tianocore
.build
.toolchain
.ToolChainConfig
;
33 import org
.tianocore
.build
.toolchain
.ToolChainElement
;
34 import org
.tianocore
.build
.toolchain
.ToolChainInfo
;
35 import org
.tianocore
.build
.toolchain
.ToolChainKey
;
36 import org
.tianocore
.build
.toolchain
.ToolChainMap
;
37 import org
.tianocore
.exception
.EdkException
;
38 import org
.tianocore
.logger
.EdkLog
;
41 import java
.util
.HashMap
;
42 import java
.util
.HashSet
;
43 import java
.util
.Iterator
;
44 import java
.util
.List
;
47 import java
.util
.logging
.Logger
;
50 GlobalData provide initializing, instoring, querying and update global data.
51 It is a bridge to intercommunicate between multiple component, such as AutoGen,
54 <p>Note that all global information are initialized incrementally. All data will
55 parse and record only of necessary during build time. </p>
59 public class GlobalData
{
61 public static Logger log
= Logger
.getAnonymousLogger();
64 /// Record current WORKSPACE Directory
66 private static String workspaceDir
= "";
69 /// Be used to ensure Global data will be initialized only once.
71 private static boolean globalFlag
= false;
74 /// Framework Database information: package list and platform list
76 private static Set
<PackageIdentification
> packageList
= new HashSet
<PackageIdentification
>();
78 private static Set
<PlatformIdentification
> platformList
= new HashSet
<PlatformIdentification
>();
81 /// Every detail SPD informations: Module list, Library class definition,
82 /// Package header file, GUID/PPI/Protocol definitions
84 private static final Map
<PackageIdentification
, Spd
> spdTable
= new HashMap
<PackageIdentification
, Spd
>();
87 /// Build informations are divided into three parts:
88 /// 1. From MSA 2. From FPD 3. From FPD' ModuleSA
90 private static Map
<ModuleIdentification
, Map
<String
, XmlObject
>> nativeMsa
= new HashMap
<ModuleIdentification
, Map
<String
, XmlObject
>>();
92 private static Map
<FpdModuleIdentification
, Map
<String
, XmlObject
>> fpdModuleSA
= new HashMap
<FpdModuleIdentification
, Map
<String
, XmlObject
>>();
94 private static XmlObject fpdBuildOptions
;
96 private static XmlObject fpdDynamicPcds
;
99 /// Parsed modules list
101 private static Map
<FpdModuleIdentification
, Map
<String
, XmlObject
>> parsedModules
= new HashMap
<FpdModuleIdentification
, Map
<String
, XmlObject
>>();
104 /// built modules list with ARCH, TARGET, TOOLCHAIN
106 private static Set
<FpdModuleIdentification
> builtModules
= new HashSet
<FpdModuleIdentification
>();
109 /// PCD memory database stored all PCD information which collected from FPD,MSA and SPD.
111 // private static final MemoryDatabaseManager pcdDbManager = new MemoryDatabaseManager();
114 /// build target + tool chain family/tag name + arch + command types + command options
118 /// toolsDef - build tool program information
119 /// fpdBuildOption - all modules's build options for tool tag or tool chain families
120 /// moduleSaBuildOption - build options for a specific module
122 private static ToolChainConfig toolsDef
;
124 private static ToolChainInfo toolChainInfo
;
125 private static ToolChainInfo toolChainEnvInfo
;
126 private static ToolChainInfo toolChainPlatformInfo
;
128 private static ToolChainMap platformToolChainOption
;
129 private static ToolChainMap platformToolChainFamilyOption
;
131 private static Map
<FpdModuleIdentification
, ToolChainMap
> moduleToolChainOption
= new HashMap
<FpdModuleIdentification
, ToolChainMap
>();
132 private static Map
<FpdModuleIdentification
, ToolChainMap
> moduleToolChainFamilyOption
= new HashMap
<FpdModuleIdentification
, ToolChainMap
>();
134 private static final MemoryDatabaseManager pcdDbManager
= new MemoryDatabaseManager();
139 Parse framework database (DB) and all SPD files listed in DB to initialize
140 the environment for next build. This method will only be executed only once
141 in the whole build process.
143 @param workspaceDatabaseFile the file name of framework database
144 @param workspaceDir current workspace directory path
145 @throws BuildException
146 Framework Dababase or SPD or MSA file is not valid
148 public synchronized static void initInfo(String workspaceDatabaseFile
, String workspaceDir
, String toolsDefFilename
) throws BuildException
{
150 // ensure this method will be revoked only once
158 // Backup workspace directory. It will be used by other method
160 GlobalData
.workspaceDir
= workspaceDir
.replaceAll("(\\\\)", "/");
163 // Parse tools definition file
166 // If ToolChain has been set up before, do nothing.
167 // CONF dir + tools definition file name
169 String confDir
= GlobalData
.workspaceDir
+ File
.separatorChar
+ "Tools" + File
.separatorChar
+ "Conf";
170 File toolsDefFile
= new File(confDir
+ File
.separatorChar
+ toolsDefFilename
);
171 System
.out
.println("Using file [" + toolsDefFile
.getPath() + "] as tools definition file. ");
172 toolsDef
= new ToolChainConfig(toolsDefFile
);
175 // Parse Framework Database
177 File dbFile
= new File(workspaceDir
+ File
.separatorChar
+ workspaceDatabaseFile
);
179 FrameworkDatabaseDocument db
= (FrameworkDatabaseDocument
) XmlObject
.Factory
.parse(dbFile
);
181 // validate FrameworkDatabaseFile
183 if (! db
.validate()) {
184 throw new BuildException("Framework Database file [" + dbFile
.getPath() + "] is invalid.");
189 if (db
.getFrameworkDatabase().getPackageList() != null ) {
190 List
<DbPathAndFilename
> packages
= db
.getFrameworkDatabase().getPackageList().getFilenameList();
191 Iterator
<DbPathAndFilename
> iter
= packages
.iterator();
192 while (iter
.hasNext()) {
193 String fileName
= iter
.next().getStringValue();
194 Spd spd
= new Spd(new File(workspaceDir
+ File
.separatorChar
+ fileName
));
195 packageList
.add(spd
.getPackageId());
196 spdTable
.put(spd
.getPackageId(), spd
);
203 if (db
.getFrameworkDatabase().getPlatformList() != null) {
204 List
<DbPathAndFilename
> platforms
= db
.getFrameworkDatabase().getPlatformList().getFilenameList();
205 Iterator
<DbPathAndFilename
> iter
= platforms
.iterator();
206 while (iter
.hasNext()) {
207 String fileName
= iter
.next().getStringValue();
208 File fpdFile
= new File(workspaceDir
+ File
.separatorChar
+ fileName
);
209 if ( ! fpdFile
.exists() ) {
210 throw new BuildException("Platform file [" + fpdFile
.getPath() + "] not exists. ");
212 XmlObject fpdDoc
= XmlObject
.Factory
.parse(fpdFile
);
214 // Verify FPD file, if is invalid, throw Exception
216 if (! fpdDoc
.validate()) {
217 throw new BuildException("Framework Platform Surface Area file [" + fpdFile
.getPath() + "] is invalid. ");
220 // We can change Map to XmlObject
223 // TBD check SPD or FPD is existed in FS
225 Map
<String
, XmlObject
> fpdDocMap
= new HashMap
<String
, XmlObject
>();
226 fpdDocMap
.put("PlatformSurfaceArea", fpdDoc
);
227 SurfaceAreaQuery
.setDoc(fpdDocMap
);
228 PlatformIdentification platformId
= SurfaceAreaQuery
.getFpdHeader();
229 platformId
.setFpdFile(fpdFile
);
230 platformList
.add(platformId
);
233 } catch (Exception e
) {
235 throw new BuildException("Parse workspace Database [" + dbFile
.getPath() + "] Error.\n" + e
.getMessage());
240 Get the current WORKSPACE Directory.
242 @return current workspace directory
244 public synchronized static String
getWorkspacePath() {
250 Get the MSA file name with absolute path
252 public synchronized static File
getMsaFile(ModuleIdentification moduleId
) throws BuildException
{
255 // TBD. Do only when package is null.
257 Iterator iter
= packageList
.iterator();
258 while (iter
.hasNext()) {
259 PackageIdentification packageId
= (PackageIdentification
)iter
.next();
260 Spd spd
= spdTable
.get(packageId
);
261 msaFile
= spd
.getModuleFile(moduleId
);
262 if (msaFile
!= null ) {
266 if (msaFile
== null){
267 throw new BuildException("Can't find Module [" + moduleId
.getName() + "] in all packages. ");
274 public synchronized static PackageIdentification
getPackageForModule(ModuleIdentification moduleId
) {
276 // If package already defined in module
278 if (moduleId
.getPackage() != null) {
279 return moduleId
.getPackage();
282 PackageIdentification packageId
= null;
283 Iterator iter
= packageList
.iterator();
284 while (iter
.hasNext()) {
285 packageId
= (PackageIdentification
)iter
.next();
286 moduleId
.setPackage(packageId
);
287 Spd spd
= spdTable
.get(packageId
);
288 if (spd
.getModuleFile(moduleId
) != null ) {
292 if (packageId
== null){
293 throw new BuildException("Can't find Module [" + moduleId
.getName() + "] in all packages. ");
301 Difference between build and parse: ToolChain and Target
303 public synchronized static boolean isModuleBuilt(FpdModuleIdentification moduleId
) {
304 return builtModules
.contains(moduleId
);
307 public synchronized static void registerBuiltModule(FpdModuleIdentification fpdModuleId
) {
308 builtModules
.add(fpdModuleId
);
312 public synchronized static void registerFpdModuleSA(FpdModuleIdentification fpdModuleId
, Map
<String
, XmlObject
> doc
) {
313 Map
<String
, XmlObject
> result
= new HashMap
<String
, XmlObject
>();
314 Set keySet
= doc
.keySet();
315 Iterator iter
= keySet
.iterator();
316 while (iter
.hasNext()){
317 String key
= (String
)iter
.next();
318 XmlObject item
= cloneXmlObject(doc
.get(key
), true);
319 result
.put(key
, item
);
321 fpdModuleSA
.put(fpdModuleId
, result
);
325 Query overrided module surface area information. If current is Package
326 or Platform build, also include the information from FPD file.
328 <p>Note that surface area parsing is incremental. That means the method will
329 only parse the MSA and MBD files if necessary. </p>
331 @param moduleName the base name of the module
332 @return the overrided module surface area information
333 @throws BuildException
334 MSA or MBD is not valid
336 public synchronized static Map
<String
, XmlObject
> getDoc(FpdModuleIdentification fpdModuleId
) throws BuildException
{
337 if (parsedModules
.containsKey(fpdModuleId
)) {
338 return parsedModules
.get(fpdModuleId
);
340 Map
<String
, XmlObject
> doc
= new HashMap
<String
, XmlObject
>();
341 ModuleIdentification moduleId
= fpdModuleId
.getModule();
343 // First part: get the MSA files info
345 doc
.putAll(getNativeMsa(moduleId
));
348 // Second part: put build options
350 doc
.put("BuildOptions", fpdBuildOptions
);
353 // Third part: get Module info from FPD, such as Library instances, PCDs
355 if (fpdModuleSA
.containsKey(fpdModuleId
)){
357 // merge module info in FPD to final Doc
358 // For Library Module, do nothing here
360 doc
.putAll(fpdModuleSA
.get(fpdModuleId
));
362 parsedModules
.put(fpdModuleId
, doc
);
366 public synchronized static Map
<String
, XmlObject
> getDoc(ModuleIdentification moduleId
, String arch
) throws BuildException
{
367 FpdModuleIdentification fpdModuleId
= new FpdModuleIdentification(moduleId
, arch
);
368 return getDoc(fpdModuleId
);
371 Query the native MSA information with module base name.
373 <p>Note that MSA parsing is incremental. That means the method will
374 only to parse the MSA files when never parsed before. </p>
376 @param moduleName the base name of the module
377 @return the native MSA information
378 @throws BuildException
379 MSA file is not valid
381 public synchronized static Map
<String
, XmlObject
> getNativeMsa(ModuleIdentification moduleId
) throws BuildException
{
382 if (nativeMsa
.containsKey(moduleId
)) {
383 return nativeMsa
.get(moduleId
);
385 File msaFile
= getMsaFile(moduleId
);
386 Map
<String
, XmlObject
> msaMap
= getNativeMsa(msaFile
);
387 nativeMsa
.put(moduleId
, msaMap
);
391 public synchronized static Map
<String
, XmlObject
> getNativeMsa(File msaFile
) throws BuildException
{
392 if (! msaFile
.exists()) {
393 throw new BuildException("Surface Area file [" + msaFile
.getPath() + "] can't found.");
396 ModuleSurfaceAreaDocument doc
= (ModuleSurfaceAreaDocument
)XmlObject
.Factory
.parse(msaFile
);
398 // Validate File if they accord with XML Schema
400 if ( ! doc
.validate()){
401 throw new BuildException("Module Surface Area file [" + msaFile
.getPath() + "] is invalid.");
406 ModuleSurfaceArea msa
= doc
.getModuleSurfaceArea();
407 Map
<String
, XmlObject
> msaMap
= new HashMap
<String
, XmlObject
>();
408 msaMap
.put("MsaHeader", cloneXmlObject(msa
.getMsaHeader(), true));
409 msaMap
.put("ModuleDefinitions", cloneXmlObject(msa
.getModuleDefinitions(), true));
410 msaMap
.put("LibraryClassDefinitions", cloneXmlObject(msa
.getLibraryClassDefinitions(), true));
411 msaMap
.put("SourceFiles", cloneXmlObject(msa
.getSourceFiles(), true));
412 msaMap
.put("PackageDependencies", cloneXmlObject(msa
.getPackageDependencies(), true));
413 msaMap
.put("Protocols", cloneXmlObject(msa
.getProtocols(), true));
414 msaMap
.put("PPIs", cloneXmlObject(msa
.getPPIs(), true));
415 msaMap
.put("Guids", cloneXmlObject(msa
.getGuids(), true));
416 msaMap
.put("Externs", cloneXmlObject(msa
.getExterns(), true));
417 msaMap
.put("PcdCoded", cloneXmlObject(msa
.getPcdCoded(), true));
420 catch (Exception ex
){
421 throw new BuildException(ex
.getMessage());
425 public static Map
<String
, XmlObject
> getFpdBuildOptions() {
426 Map
<String
, XmlObject
> map
= new HashMap
<String
, XmlObject
>();
427 map
.put("BuildOptions", fpdBuildOptions
);
431 public static void setFpdBuildOptions(XmlObject fpdBuildOptions
) {
432 GlobalData
.fpdBuildOptions
= cloneXmlObject(fpdBuildOptions
, true);
435 public static XmlObject
getFpdDynamicPcds() {
436 return fpdDynamicPcds
;
439 public static void setFpdDynamicPcds(XmlObject fpdDynamicPcds
) {
440 GlobalData
.fpdDynamicPcds
= fpdDynamicPcds
;
443 //////////////////////////////////////////////
444 //////////////////////////////////////////////
446 public static Set
<ModuleIdentification
> getModules(PackageIdentification packageId
){
447 Spd spd
= spdTable
.get(packageId
);
449 Set
<ModuleIdentification
> dummy
= new HashSet
<ModuleIdentification
>();
453 return spd
.getModules();
458 * The header file path is relative to workspace dir
460 public static String
[] getLibraryClassHeaderFiles(
461 PackageIdentification
[] packages
, String name
)
462 throws BuildException
{
463 if (packages
== null) {
464 // throw Exception or not????
465 return new String
[0];
467 String
[] result
= null;
468 for (int i
= 0; i
< packages
.length
; i
++) {
469 Spd spd
= spdTable
.get(packages
[i
]);
471 // If find one package defined the library class
473 if ((result
= spd
.getLibClassIncluder(name
)) != null) {
478 // If can't find library class declaration in every package
480 throw new BuildException("Can not find library class [" + name
481 + "] declaration in every packages. ");
485 * The header file path is relative to workspace dir
487 public static String
getPackageHeaderFiles(PackageIdentification packages
,
488 String moduleType
) throws BuildException
{
489 if (packages
== null) {
490 return new String("");
492 Spd spd
= spdTable
.get(packages
);
494 // If can't find package header file, skip it
498 if ((temp
= spd
.getPackageIncluder(moduleType
)) != null) {
510 * return two values: {cName, GuidValue}
512 public static String
[] getGuid(List
<PackageIdentification
> packages
, String name
)
513 throws BuildException
{
514 if (packages
== null) {
515 // throw Exception or not????
516 return new String
[0];
518 String
[] result
= null;
519 Iterator item
= packages
.iterator();
520 while (item
.hasNext()){
521 Spd spd
= spdTable
.get(item
.next());
523 // If find one package defined the GUID
525 if ((result
= spd
.getGuid(name
)) != null) {
534 * return two values: {cName, GuidValue}
536 public static String
[] getPpiGuid(List
<PackageIdentification
> packages
,
537 String name
) throws BuildException
{
538 if (packages
== null) {
539 return new String
[0];
541 String
[] result
= null;
542 Iterator item
= packages
.iterator();
543 while (item
.hasNext()){
544 Spd spd
= spdTable
.get(item
.next());
546 // If find one package defined the Ppi GUID
548 if ((result
= spd
.getPpi(name
)) != null) {
557 * return two values: {cName, GuidValue}
559 public static String
[] getProtocolGuid(List
<PackageIdentification
> packages
,
560 String name
) throws BuildException
{
561 if (packages
== null) {
562 return new String
[0];
564 String
[] result
= null;
565 Iterator item
= packages
.iterator();
566 while (item
.hasNext()){
567 Spd spd
= spdTable
.get(item
.next());
569 // If find one package defined the protocol GUID
571 if ((result
= spd
.getProtocol(name
))!= null){
579 /////////////////////////// Update!! Update!! Update!!
580 // public synchronized static MemoryDatabaseManager getPCDMemoryDBManager() {
581 // return pcdDbManager;
583 ///////////////////////////
584 public synchronized static PlatformIdentification
getPlatform(String name
) throws BuildException
{
585 Iterator iter
= platformList
.iterator();
586 while(iter
.hasNext()){
587 PlatformIdentification platformId
= (PlatformIdentification
)iter
.next();
588 if (platformId
.getName().equalsIgnoreCase(name
)) {
589 // GlobalData.log.info("Platform: " + platformId + platformId.getFpdFile());
593 throw new BuildException("Can't find platform [" + name
+ "] in current workspace. ");
596 public synchronized static PackageIdentification
refreshPackageIdentification(PackageIdentification packageId
) throws BuildException
{
597 Iterator iter
= packageList
.iterator();
598 while(iter
.hasNext()){
599 PackageIdentification packageItem
= (PackageIdentification
)iter
.next();
600 if (packageItem
.equals(packageId
)) {
601 packageId
.setName(packageItem
.getName());
602 packageId
.setSpdFile(packageItem
.getSpdFile());
606 throw new BuildException("Can't find package GUID value " + packageId
.getGuid() + " under current workspace. ");
609 public synchronized static ModuleIdentification
refreshModuleIdentification(ModuleIdentification moduleId
) throws BuildException
{
610 // System.out.println("1");
611 // System.out.println("##" + moduleId.getGuid());
612 PackageIdentification packageId
= getPackageForModule(moduleId
);
613 // System.out.println("" + packageId.getGuid());
614 moduleId
.setPackage(packageId
);
615 Spd spd
= spdTable
.get(packageId
);
617 throw new BuildException("Can't find package GUID value " + packageId
.getGuid() + " under current workspace. ");
619 Set
<ModuleIdentification
> modules
= spd
.getModules();
620 Iterator
<ModuleIdentification
> iter
= modules
.iterator();
621 while (iter
.hasNext()) {
622 ModuleIdentification item
= iter
.next();
623 if (item
.equals(moduleId
)) {
624 moduleId
.setName(item
.getName());
625 moduleId
.setModuleType(item
.getModuleType());
626 moduleId
.setMsaFile(item
.getMsaFile());
630 throw new BuildException("Can't find module GUID value " + moduleId
.getGuid() + " in " + packageId
+ " under current workspace. ");
633 public synchronized static Set
<PackageIdentification
> getPackageList(){
637 private static XmlObject
cloneXmlObject(XmlObject object
, boolean deep
) throws BuildException
{
638 if ( object
== null) {
641 XmlObject result
= null;
643 result
= XmlObject
.Factory
.parse(object
.getDomNode()
645 } catch (Exception ex
) {
646 throw new BuildException(ex
.getMessage());
651 ////// Tool Chain Related, try to refine and put some logic process to ToolChainFactory
653 public static ToolChainInfo
getToolChainInfo() {
654 // GlobalData.log.info(toolsDef.getConfigInfo() + "" + toolChainEnvInfo + toolChainPlatformInfo);
655 if (toolChainInfo
== null) {
656 toolChainInfo
= toolsDef
.getConfigInfo().intersection(toolChainEnvInfo
);
657 if (toolChainPlatformInfo
!= null) {
658 toolChainInfo
= toolChainInfo
.intersection(toolChainPlatformInfo
);
660 toolChainInfo
.addCommands(toolsDef
.getConfigInfo().getCommands());
661 toolChainInfo
.normalize();
662 GlobalData
.log
.info(toolChainInfo
+ "");
664 return toolChainInfo
;
669 public static void setPlatformToolChainFamilyOption(ToolChainMap map
) {
670 platformToolChainFamilyOption
= map
;
673 public static void setPlatformToolChainOption(ToolChainMap map
) {
674 platformToolChainOption
= map
;
677 public static void addModuleToolChainOption(FpdModuleIdentification fpdModuleId
,
678 ToolChainMap toolChainOption
) {
679 moduleToolChainOption
.put(fpdModuleId
, toolChainOption
);
682 public static void addModuleToolChainFamilyOption(FpdModuleIdentification fpdModuleId
,
683 ToolChainMap toolChainOption
) {
684 moduleToolChainFamilyOption
.put(fpdModuleId
, toolChainOption
);
687 public static String
getCommandSetting(String
[] commandDescription
, FpdModuleIdentification fpdModuleId
) throws EdkException
{
688 ToolChainKey toolChainKey
= new ToolChainKey(commandDescription
);
689 ToolChainMap toolChainConfig
= toolsDef
.getConfig();
690 String setting
= null;
692 if (!commandDescription
[ToolChainElement
.ATTRIBUTE
.value
].equals(ToolChainAttribute
.FLAGS
.toString())) {
693 setting
= toolChainConfig
.get(toolChainKey
);
694 if (setting
== null) {
701 // get module specific options, if any
704 ToolChainMap option
= moduleToolChainOption
.get(fpdModuleId
);
705 ToolChainKey toolChainFamilyKey
= null;
707 if ((option
== null) || (option
!= null && (setting
= option
.get(toolChainKey
)) == null)) {
709 // then tool chain family
711 toolChainFamilyKey
= new ToolChainKey(commandDescription
);
712 toolChainFamilyKey
.setKey(ToolChainAttribute
.FAMILY
.toString(), ToolChainElement
.ATTRIBUTE
.value
);
713 String family
= toolChainConfig
.get(toolChainFamilyKey
);
714 toolChainFamilyKey
.setKey(family
, ToolChainElement
.TOOLCHAIN
.value
);
715 toolChainFamilyKey
.setKey(ToolChainAttribute
.FLAGS
.toString(), ToolChainElement
.ATTRIBUTE
.value
);
717 option
= moduleToolChainFamilyOption
.get(fpdModuleId
);
718 if (option
!= null) {
719 setting
= option
.get(toolChainFamilyKey
);
724 // get platform options, if any
726 if (setting
== null) {
728 if (platformToolChainOption
== null || (setting
= platformToolChainOption
.get(toolChainKey
)) == null) {
729 // then tool chain family
730 if (toolChainFamilyKey
== null) {
731 toolChainFamilyKey
= new ToolChainKey(commandDescription
);
732 toolChainFamilyKey
.setKey(ToolChainAttribute
.FAMILY
.toString(), ToolChainElement
.ATTRIBUTE
.value
);
733 String family
= toolChainConfig
.get(toolChainFamilyKey
);
734 toolChainFamilyKey
.setKey(family
, ToolChainElement
.TOOLCHAIN
.value
);
735 toolChainFamilyKey
.setKey(ToolChainAttribute
.FLAGS
.toString(), ToolChainElement
.ATTRIBUTE
.value
);
738 setting
= platformToolChainFamilyOption
.get(toolChainFamilyKey
);
742 if (setting
== null) {
749 public static void setToolChainEnvInfo(ToolChainInfo envInfo
) {
750 toolChainEnvInfo
= envInfo
;
752 public static void setToolChainPlatformInfo(ToolChainInfo platformInfo
) {
753 toolChainPlatformInfo
= platformInfo
;
759 public synchronized static MemoryDatabaseManager
getPCDMemoryDBManager() {
764 // For PCD get tokenSpaceGUid
766 public synchronized static String
[] getGuidInfoFromCname(String cName
){
767 String cNameGuid
[] = null;
769 Set set
= spdTable
.keySet();
770 Iterator iter
= set
.iterator();
772 while (iter
.hasNext()){
773 Spd spd
= (Spd
) spdTable
.get(iter
.next());
774 guid
= spd
.getGuidFromCname(cName
);
776 cNameGuid
[0] = new String(cName
);
777 cNameGuid
[1] = new String(guid
);
787 public synchronized static Map
<FpdModuleIdentification
, XmlObject
> getFpdModuleSaXmlObject(
788 String xmlObjectName
) {
789 Set
<FpdModuleIdentification
> fpdModuleSASet
= fpdModuleSA
.keySet();
790 Iterator item
= fpdModuleSASet
.iterator();
793 Map
<FpdModuleIdentification
, XmlObject
> SAPcdBuildDef
= new HashMap
<FpdModuleIdentification
, XmlObject
>();
794 Map
<String
, XmlObject
> SANode
= new HashMap
<String
, XmlObject
>();
795 FpdModuleIdentification moduleId
;
796 while (item
.hasNext()) {
798 moduleId
= (FpdModuleIdentification
) item
.next();
799 SANode
= fpdModuleSA
.get(moduleId
);
801 if (SANode
.get(xmlObjectName
)!= null){
802 SAPcdBuildDef
.put(moduleId
,
804 .get(xmlObjectName
));
809 } catch (Exception e
){
810 EdkLog
.log(EdkLog
.EDK_INFO
, e
.getMessage());
813 return SAPcdBuildDef
;