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
;
20 import java
.util
.HashMap
;
21 import java
.util
.HashSet
;
22 import java
.util
.Iterator
;
23 import java
.util
.List
;
26 import java
.util
.logging
.Logger
;
28 import org
.apache
.tools
.ant
.BuildException
;
29 import org
.apache
.xmlbeans
.XmlObject
;
31 import org
.tianocore
.common
.exception
.EdkException
;
32 import org
.tianocore
.common
.logger
.EdkLog
;
33 import org
.tianocore
.pcd
.entity
.MemoryDatabaseManager
;
34 import org
.tianocore
.DbPathAndFilename
;
35 import org
.tianocore
.FrameworkDatabaseDocument
;
36 import org
.tianocore
.ModuleSurfaceAreaDocument
;
37 import org
.tianocore
.ModuleSurfaceAreaDocument
.ModuleSurfaceArea
;
38 import org
.tianocore
.build
.id
.FpdModuleIdentification
;
39 import org
.tianocore
.build
.id
.ModuleIdentification
;
40 import org
.tianocore
.build
.id
.PackageIdentification
;
41 import org
.tianocore
.build
.id
.PlatformIdentification
;
42 import org
.tianocore
.build
.toolchain
.ToolChainAttribute
;
43 import org
.tianocore
.build
.toolchain
.ToolChainConfig
;
44 import org
.tianocore
.build
.toolchain
.ToolChainElement
;
45 import org
.tianocore
.build
.toolchain
.ToolChainInfo
;
46 import org
.tianocore
.build
.toolchain
.ToolChainKey
;
47 import org
.tianocore
.build
.toolchain
.ToolChainMap
;
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
>();
135 Parse framework database (DB) and all SPD files listed in DB to initialize
136 the environment for next build. This method will only be executed only once
137 in the whole build process.
139 @param workspaceDatabaseFile the file name of framework database
140 @param workspaceDir current workspace directory path
141 @throws BuildException
142 Framework Dababase or SPD or MSA file is not valid
144 public synchronized static void initInfo(String workspaceDatabaseFile
, String workspaceDir
, String toolsDefFilename
) throws BuildException
{
146 // ensure this method will be revoked only once
154 // Backup workspace directory. It will be used by other method
156 GlobalData
.workspaceDir
= workspaceDir
.replaceAll("(\\\\)", "/");
159 // Parse tools definition file
162 // If ToolChain has been set up before, do nothing.
163 // CONF dir + tools definition file name
165 File toolsDefFile
= new File(workspaceDir
+ File
.separatorChar
+ toolsDefFilename
);
166 System
.out
.println("Using tool definiton file [" + toolsDefFile
.getPath() + "].");
168 toolsDef
= new ToolChainConfig(toolsDefFile
);
169 } catch (Exception e
) {
170 throw new BuildException(e
.getMessage());
174 // Parse Framework Database
176 File dbFile
= new File(workspaceDir
+ File
.separatorChar
+ workspaceDatabaseFile
);
178 FrameworkDatabaseDocument db
= (FrameworkDatabaseDocument
) XmlObject
.Factory
.parse(dbFile
);
180 // validate FrameworkDatabaseFile
182 if (!db
.validate()) {
183 throw new BuildException("Framework Database file [" + dbFile
.getPath() + "] format is invalid!");
188 if (db
.getFrameworkDatabase().getPackageList() != null ) {
189 List
<DbPathAndFilename
> packages
= db
.getFrameworkDatabase().getPackageList().getFilenameList();
190 Iterator
<DbPathAndFilename
> iter
= packages
.iterator();
191 while (iter
.hasNext()) {
192 String fileName
= iter
.next().getStringValue();
193 Spd spd
= new Spd(new File(workspaceDir
+ File
.separatorChar
+ fileName
));
194 packageList
.add(spd
.getPackageId());
195 spdTable
.put(spd
.getPackageId(), spd
);
202 if (db
.getFrameworkDatabase().getPlatformList() != null) {
203 List
<DbPathAndFilename
> platforms
= db
.getFrameworkDatabase().getPlatformList().getFilenameList();
204 Iterator
<DbPathAndFilename
> iter
= platforms
.iterator();
205 while (iter
.hasNext()) {
206 String fileName
= iter
.next().getStringValue();
207 File fpdFile
= new File(workspaceDir
+ File
.separatorChar
+ fileName
);
208 if ( !fpdFile
.exists() ) {
209 throw new BuildException("Platform file [" + fpdFile
.getPath() + "] not exists. ");
211 XmlObject fpdDoc
= XmlObject
.Factory
.parse(fpdFile
);
213 // Verify FPD file, if is invalid, throw Exception
215 if (!fpdDoc
.validate()) {
216 throw new BuildException("Framework Platform Surface Area file [" + fpdFile
.getPath() + "] format is invalid!");
219 // We can change Map to XmlObject
222 // TBD check SPD or FPD is existed in FS
224 Map
<String
, XmlObject
> fpdDocMap
= new HashMap
<String
, XmlObject
>();
225 fpdDocMap
.put("PlatformSurfaceArea", fpdDoc
);
226 SurfaceAreaQuery
.setDoc(fpdDocMap
);
227 PlatformIdentification platformId
= SurfaceAreaQuery
.getFpdHeader();
228 platformId
.setFpdFile(fpdFile
);
229 platformList
.add(platformId
);
232 } catch (Exception e
) {
233 throw new BuildException("Parse WORKSPACE Database file [" + dbFile
.getPath() + "] Error.\n" + e
.getMessage());
238 Get the current WORKSPACE Directory.
240 @return current workspace directory
242 public synchronized static String
getWorkspacePath() {
248 Get the MSA file name with absolute path
250 public synchronized static File
getMsaFile(ModuleIdentification moduleId
) throws BuildException
{
253 // TBD. Do only when package is null.
255 Iterator iter
= packageList
.iterator();
256 while (iter
.hasNext()) {
257 PackageIdentification packageId
= (PackageIdentification
)iter
.next();
258 Spd spd
= spdTable
.get(packageId
);
259 msaFile
= spd
.getModuleFile(moduleId
);
260 if (msaFile
!= null ) {
264 if (msaFile
== null){
265 throw new BuildException("Can't find Module [" + moduleId
.getName() + "] in any SPD package!");
271 public synchronized static PackageIdentification
getPackageForModule(ModuleIdentification moduleId
) {
273 // If package already defined in module
275 if (moduleId
.getPackage() != null) {
276 return moduleId
.getPackage();
279 PackageIdentification packageId
= null;
280 Iterator iter
= packageList
.iterator();
281 while (iter
.hasNext()) {
282 packageId
= (PackageIdentification
)iter
.next();
283 moduleId
.setPackage(packageId
);
284 Spd spd
= spdTable
.get(packageId
);
285 if (spd
.getModuleFile(moduleId
) != null ) {
289 if (packageId
== null){
290 throw new BuildException("Can't find Module [" + moduleId
.getName() + "] in any SPD package!");
297 Difference between build and parse: ToolChain and Target
299 public synchronized static boolean isModuleBuilt(FpdModuleIdentification moduleId
) {
300 return builtModules
.contains(moduleId
);
303 public synchronized static void registerBuiltModule(FpdModuleIdentification fpdModuleId
) {
304 builtModules
.add(fpdModuleId
);
308 public synchronized static void registerFpdModuleSA(FpdModuleIdentification fpdModuleId
, Map
<String
, XmlObject
> doc
) {
309 Map
<String
, XmlObject
> result
= new HashMap
<String
, XmlObject
>();
310 Set keySet
= doc
.keySet();
311 Iterator iter
= keySet
.iterator();
312 while (iter
.hasNext()){
313 String key
= (String
)iter
.next();
314 XmlObject item
= cloneXmlObject(doc
.get(key
), true);
315 result
.put(key
, item
);
317 fpdModuleSA
.put(fpdModuleId
, result
);
320 public synchronized static boolean hasFpdModuleSA(FpdModuleIdentification fpdModuleId
) {
321 return fpdModuleSA
.containsKey(fpdModuleId
);
325 Query module surface area information.
327 <p>Note that surface area parsing is incremental. That means the method will
328 only parse the MSA files if necessary. </p>
330 @param fpdModuleId Module ID with arch
331 @return ModuleSA info and MSA info for fpdModuleId
332 @throws BuildException Can't find MSA
334 public synchronized static Map
<String
, XmlObject
> getDoc(FpdModuleIdentification fpdModuleId
) throws BuildException
{
335 if (parsedModules
.containsKey(fpdModuleId
)) {
336 return parsedModules
.get(fpdModuleId
);
338 Map
<String
, XmlObject
> doc
= new HashMap
<String
, XmlObject
>();
339 ModuleIdentification moduleId
= fpdModuleId
.getModule();
341 // First part: get the MSA files info
343 doc
.putAll(getNativeMsa(moduleId
));
346 // Second part: put build options
348 doc
.put("BuildOptions", fpdBuildOptions
);
351 // Third part: get Module info from FPD, such as Library instances, PCDs
353 if (fpdModuleSA
.containsKey(fpdModuleId
)){
355 // merge module info in FPD to final Doc
356 // For Library Module, do nothing here
358 doc
.putAll(fpdModuleSA
.get(fpdModuleId
));
360 parsedModules
.put(fpdModuleId
, doc
);
364 public synchronized static Map
<String
, XmlObject
> getDoc(ModuleIdentification moduleId
, String arch
) throws BuildException
{
365 FpdModuleIdentification fpdModuleId
= new FpdModuleIdentification(moduleId
, arch
);
366 return getDoc(fpdModuleId
);
369 Query the native MSA information with module base name.
371 <p>Note that MSA parsing is incremental. That means the method will
372 only to parse the MSA files when never parsed before. </p>
374 @param moduleName the base name of the module
375 @return the native MSA information
376 @throws BuildException
377 MSA file is not valid
379 public synchronized static Map
<String
, XmlObject
> getNativeMsa(ModuleIdentification moduleId
) throws BuildException
{
380 if (nativeMsa
.containsKey(moduleId
)) {
381 return nativeMsa
.get(moduleId
);
383 File msaFile
= getMsaFile(moduleId
);
384 Map
<String
, XmlObject
> msaMap
= getNativeMsa(msaFile
);
385 nativeMsa
.put(moduleId
, msaMap
);
389 public synchronized static Map
<String
, XmlObject
> getNativeMsa(File msaFile
) throws BuildException
{
390 if (!msaFile
.exists()) {
391 throw new BuildException("Module Surface Area file [" + msaFile
.getPath() + "] can't be found!");
394 ModuleSurfaceAreaDocument doc
= (ModuleSurfaceAreaDocument
)XmlObject
.Factory
.parse(msaFile
);
396 // Validate File if they accord with XML Schema
398 if ( !doc
.validate()){
399 throw new BuildException("Module Surface Area file [" + msaFile
.getPath() + "] format is invalid!");
404 ModuleSurfaceArea msa
= doc
.getModuleSurfaceArea();
405 Map
<String
, XmlObject
> msaMap
= new HashMap
<String
, XmlObject
>();
406 msaMap
.put("MsaHeader", cloneXmlObject(msa
.getMsaHeader(), true));
407 msaMap
.put("ModuleDefinitions", cloneXmlObject(msa
.getModuleDefinitions(), true));
408 msaMap
.put("LibraryClassDefinitions", cloneXmlObject(msa
.getLibraryClassDefinitions(), true));
409 msaMap
.put("SourceFiles", cloneXmlObject(msa
.getSourceFiles(), true));
410 msaMap
.put("PackageDependencies", cloneXmlObject(msa
.getPackageDependencies(), true));
411 msaMap
.put("Protocols", cloneXmlObject(msa
.getProtocols(), true));
412 msaMap
.put("PPIs", cloneXmlObject(msa
.getPPIs(), true));
413 msaMap
.put("Guids", cloneXmlObject(msa
.getGuids(), true));
414 msaMap
.put("Externs", cloneXmlObject(msa
.getExterns(), true));
415 msaMap
.put("PcdCoded", cloneXmlObject(msa
.getPcdCoded(), true));
418 catch (Exception ex
){
419 throw new BuildException(ex
.getMessage());
423 public static Map
<String
, XmlObject
> getFpdBuildOptions() {
424 Map
<String
, XmlObject
> map
= new HashMap
<String
, XmlObject
>();
425 map
.put("BuildOptions", fpdBuildOptions
);
429 public static void setFpdBuildOptions(XmlObject fpdBuildOptions
) {
430 GlobalData
.fpdBuildOptions
= cloneXmlObject(fpdBuildOptions
, true);
433 public static XmlObject
getFpdDynamicPcds() {
434 return fpdDynamicPcds
;
437 public static void setFpdDynamicPcds(XmlObject fpdDynamicPcds
) {
438 GlobalData
.fpdDynamicPcds
= fpdDynamicPcds
;
441 public static Set
<ModuleIdentification
> getModules(PackageIdentification packageId
){
442 Spd spd
= spdTable
.get(packageId
);
444 Set
<ModuleIdentification
> dummy
= new HashSet
<ModuleIdentification
>();
447 return spd
.getModules();
452 * The header file path is relative to workspace dir
454 public static String
[] getLibraryClassHeaderFiles(
455 PackageIdentification
[] packages
, String name
)
456 throws BuildException
{
457 if (packages
== null) {
458 // throw Exception or not????
459 return new String
[0];
461 String
[] result
= null;
462 for (int i
= 0; i
< packages
.length
; i
++) {
463 Spd spd
= spdTable
.get(packages
[i
]);
465 // If find one package defined the library class
467 if ((result
= spd
.getLibClassIncluder(name
)) != null) {
472 // If can't find library class declaration in every package
474 throw new BuildException("Can not find library class [" + name
475 + "] declaration in any SPD package!");
479 * The header file path is relative to workspace dir
481 public static String
getPackageHeaderFiles(PackageIdentification packages
,
482 String moduleType
) throws BuildException
{
483 if (packages
== null) {
484 return new String("");
486 Spd spd
= spdTable
.get(packages
);
488 // If can't find package header file, skip it
492 if ((temp
= spd
.getPackageIncluder(moduleType
)) != null) {
504 * return two values: {cName, GuidValue}
506 public static String
[] getGuid(List
<PackageIdentification
> packages
, String name
)
507 throws BuildException
{
508 if (packages
== null) {
509 // throw Exception or not????
510 return new String
[0];
512 String
[] result
= null;
513 Iterator item
= packages
.iterator();
514 while (item
.hasNext()){
515 Spd spd
= spdTable
.get(item
.next());
517 // If find one package defined the GUID
519 if ((result
= spd
.getGuid(name
)) != null) {
528 * return two values: {cName, GuidValue}
530 public static String
[] getPpiGuid(List
<PackageIdentification
> packages
,
531 String name
) throws BuildException
{
532 if (packages
== null) {
533 return new String
[0];
535 String
[] result
= null;
536 Iterator item
= packages
.iterator();
537 while (item
.hasNext()){
538 Spd spd
= spdTable
.get(item
.next());
540 // If find one package defined the Ppi GUID
542 if ((result
= spd
.getPpi(name
)) != null) {
551 * return two values: {cName, GuidValue}
553 public static String
[] getProtocolGuid(List
<PackageIdentification
> packages
,
554 String name
) throws BuildException
{
555 if (packages
== null) {
556 return new String
[0];
558 String
[] result
= null;
559 Iterator item
= packages
.iterator();
560 while (item
.hasNext()){
561 Spd spd
= spdTable
.get(item
.next());
563 // If find one package defined the protocol GUID
565 if ((result
= spd
.getProtocol(name
))!= null){
573 public synchronized static PlatformIdentification
getPlatformByName(String name
) throws BuildException
{
574 Iterator iter
= platformList
.iterator();
575 while(iter
.hasNext()){
576 PlatformIdentification platformId
= (PlatformIdentification
)iter
.next();
577 if (platformId
.getName().equalsIgnoreCase(name
)) {
581 throw new BuildException("Can't find platform [" + name
+ "] in the current WORKSPACE database!");
584 public synchronized static PlatformIdentification
getPlatform(String filename
) throws BuildException
{
585 File file
= new File(workspaceDir
+ File
.separatorChar
+ filename
);
586 Iterator iter
= platformList
.iterator();
587 while(iter
.hasNext()){
588 PlatformIdentification platformId
= (PlatformIdentification
)iter
.next();
589 if (platformId
.getFpdFile().getPath().equalsIgnoreCase(file
.getPath())) {
593 throw new BuildException("Can't find platform file [" + filename
+ "] in the current WORKSPACE database!");
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() + " in the current workspace!");
609 public synchronized static ModuleIdentification
refreshModuleIdentification(ModuleIdentification moduleId
) throws BuildException
{
610 PackageIdentification packageId
= getPackageForModule(moduleId
);
611 moduleId
.setPackage(packageId
);
612 Spd spd
= spdTable
.get(packageId
);
614 throw new BuildException("Can't find package GUID value " + packageId
.getGuid() + " in the current workspace!");
616 Set
<ModuleIdentification
> modules
= spd
.getModules();
617 Iterator
<ModuleIdentification
> iter
= modules
.iterator();
618 while (iter
.hasNext()) {
619 ModuleIdentification item
= iter
.next();
620 if (item
.equals(moduleId
)) {
621 moduleId
.setName(item
.getName());
622 moduleId
.setModuleType(item
.getModuleType());
623 moduleId
.setMsaFile(item
.getMsaFile());
627 throw new BuildException("Can't find module GUID value " + moduleId
.getGuid() + " in package, " + packageId
+ ", in the current workspace!");
630 public synchronized static Set
<PackageIdentification
> getPackageList(){
635 BUGBUG: It is a walk around method. If do not clone, can't query info with
638 @param object XmlObject
639 @param deep flag for deep clone
640 @return XmlObject after clone
641 @throws BuildException parse original XmlObject error.
643 private static XmlObject
cloneXmlObject(XmlObject object
, boolean deep
) throws BuildException
{
644 if ( object
== null) {
647 XmlObject result
= null;
649 result
= XmlObject
.Factory
.parse(object
.getDomNode()
651 } catch (Exception ex
) {
652 throw new BuildException(ex
.getMessage());
657 ////// Tool Chain Related, try to refine and put some logic process to ToolChainFactory
659 public static ToolChainInfo
getToolChainInfo() {
660 // GlobalData.log.info(toolsDef.getConfigInfo() + "" + toolChainEnvInfo + toolChainPlatformInfo);
661 if (toolChainInfo
== null) {
662 toolChainInfo
= toolsDef
.getConfigInfo().intersection(toolChainEnvInfo
);
663 if (toolChainPlatformInfo
!= null) {
664 toolChainInfo
= toolChainInfo
.intersection(toolChainPlatformInfo
);
666 toolChainInfo
.addCommands(toolsDef
.getConfigInfo().getCommands());
667 toolChainInfo
.normalize();
668 GlobalData
.log
.info(toolChainInfo
+ "");
670 return toolChainInfo
;
675 public static void setPlatformToolChainFamilyOption(ToolChainMap map
) {
676 platformToolChainFamilyOption
= map
;
679 public static void setPlatformToolChainOption(ToolChainMap map
) {
680 platformToolChainOption
= map
;
683 public static void addModuleToolChainOption(FpdModuleIdentification fpdModuleId
,
684 ToolChainMap toolChainOption
) {
685 moduleToolChainOption
.put(fpdModuleId
, toolChainOption
);
688 public static void addModuleToolChainFamilyOption(FpdModuleIdentification fpdModuleId
,
689 ToolChainMap toolChainOption
) {
690 moduleToolChainFamilyOption
.put(fpdModuleId
, toolChainOption
);
693 public static boolean isCommandSet(String target
, String toolchain
, String arch
) {
694 String
[] commands
= getToolChainInfo().getCommands();
696 for (int i
= 0; i
< commands
.length
; ++i
) {
697 String cmdName
= toolsDef
.getConfig().get(new String
[] {target
, toolchain
, arch
, commands
[i
], ToolChainAttribute
.NAME
.toString()});
698 if (cmdName
!= null && cmdName
.length() != 0) {
706 public static String
getCommandSetting(String
[] commandDescription
, FpdModuleIdentification fpdModuleId
) throws EdkException
{
707 ToolChainKey toolChainKey
= new ToolChainKey(commandDescription
);
708 ToolChainMap toolChainConfig
= toolsDef
.getConfig();
709 String setting
= null;
711 if (!commandDescription
[ToolChainElement
.ATTRIBUTE
.value
].equals(ToolChainAttribute
.FLAGS
.toString())) {
712 setting
= toolChainConfig
.get(toolChainKey
);
713 if (setting
== null) {
720 // get module specific options, if any
723 ToolChainMap option
= moduleToolChainOption
.get(fpdModuleId
);
724 ToolChainKey toolChainFamilyKey
= null;
726 if ((option
== null) || (option
!= null && (setting
= option
.get(toolChainKey
)) == null)) {
728 // then tool chain family
730 toolChainFamilyKey
= new ToolChainKey(commandDescription
);
731 toolChainFamilyKey
.setKey(ToolChainAttribute
.FAMILY
.toString(), ToolChainElement
.ATTRIBUTE
.value
);
732 String family
= toolChainConfig
.get(toolChainFamilyKey
);
733 toolChainFamilyKey
.setKey(family
, ToolChainElement
.TOOLCHAIN
.value
);
734 toolChainFamilyKey
.setKey(ToolChainAttribute
.FLAGS
.toString(), ToolChainElement
.ATTRIBUTE
.value
);
736 option
= moduleToolChainFamilyOption
.get(fpdModuleId
);
737 if (option
!= null) {
738 setting
= option
.get(toolChainFamilyKey
);
743 // get platform options, if any
745 if (setting
== null) {
747 if (platformToolChainOption
== null || (setting
= platformToolChainOption
.get(toolChainKey
)) == null) {
748 // then tool chain family
749 if (toolChainFamilyKey
== null) {
750 toolChainFamilyKey
= new ToolChainKey(commandDescription
);
751 toolChainFamilyKey
.setKey(ToolChainAttribute
.FAMILY
.toString(), ToolChainElement
.ATTRIBUTE
.value
);
752 String family
= toolChainConfig
.get(toolChainFamilyKey
);
753 toolChainFamilyKey
.setKey(family
, ToolChainElement
.TOOLCHAIN
.value
);
754 toolChainFamilyKey
.setKey(ToolChainAttribute
.FLAGS
.toString(), ToolChainElement
.ATTRIBUTE
.value
);
757 setting
= platformToolChainFamilyOption
.get(toolChainFamilyKey
);
761 if (setting
== null) {
768 public static void setToolChainEnvInfo(ToolChainInfo envInfo
) {
769 toolChainEnvInfo
= envInfo
;
771 public static void setToolChainPlatformInfo(ToolChainInfo platformInfo
) {
772 toolChainPlatformInfo
= platformInfo
;
778 public synchronized static MemoryDatabaseManager
getPCDMemoryDBManager() {
783 // For PCD get tokenSpaceGUid
785 public synchronized static String
getGuidInfoFromCname(String cName
){
786 String cNameGuid
= null;
788 Set set
= spdTable
.keySet();
789 Iterator iter
= set
.iterator();
795 while (iter
.hasNext()){
796 Spd spd
= (Spd
) spdTable
.get(iter
.next());
797 guid
= spd
.getGuidFromCname(cName
);
809 public synchronized static Map
<FpdModuleIdentification
, XmlObject
>
810 getFpdModuleSaXmlObject(String xmlObjectName
) {
811 Set
<FpdModuleIdentification
> fpdModuleSASet
= fpdModuleSA
.keySet();
812 Iterator item
= fpdModuleSASet
.iterator();
815 Map
<FpdModuleIdentification
, XmlObject
> SAPcdBuildDef
= new HashMap
<FpdModuleIdentification
, XmlObject
>();
816 Map
<String
, XmlObject
> SANode
= new HashMap
<String
, XmlObject
>();
817 FpdModuleIdentification moduleId
;
818 while (item
.hasNext()) {
820 moduleId
= (FpdModuleIdentification
) item
.next();
821 SANode
= fpdModuleSA
.get(moduleId
);
823 if (SANode
.get(xmlObjectName
)!= null){
824 SAPcdBuildDef
.put(moduleId
,
825 (XmlObject
) SANode
.get(xmlObjectName
));
828 } catch (Exception e
){
829 EdkLog
.log(EdkLog
.EDK_INFO
, e
.getMessage());
832 return SAPcdBuildDef
;
835 public synchronized static Map
<FpdModuleIdentification
,XmlObject
> getFpdPcdBuildDefinitions() {
836 Map
<FpdModuleIdentification
,XmlObject
> pcdBuildDef
= getFpdModuleSaXmlObject ("PcdBuildDefinition");