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
;
27 import org
.apache
.tools
.ant
.BuildException
;
28 import org
.apache
.xmlbeans
.XmlObject
;
30 import org
.tianocore
.common
.exception
.EdkException
;
31 import org
.tianocore
.common
.logger
.EdkLog
;
32 import org
.tianocore
.pcd
.entity
.MemoryDatabaseManager
;
33 import org
.tianocore
.DbPathAndFilename
;
34 import org
.tianocore
.FrameworkDatabaseDocument
;
35 import org
.tianocore
.ModuleSurfaceAreaDocument
;
36 import org
.tianocore
.ModuleSurfaceAreaDocument
.ModuleSurfaceArea
;
37 import org
.tianocore
.build
.id
.FpdModuleIdentification
;
38 import org
.tianocore
.build
.id
.ModuleIdentification
;
39 import org
.tianocore
.build
.id
.PackageIdentification
;
40 import org
.tianocore
.build
.id
.PlatformIdentification
;
41 import org
.tianocore
.build
.toolchain
.ToolChainAttribute
;
42 import org
.tianocore
.build
.toolchain
.ToolChainConfig
;
43 import org
.tianocore
.build
.toolchain
.ToolChainElement
;
44 import org
.tianocore
.build
.toolchain
.ToolChainInfo
;
45 import org
.tianocore
.build
.toolchain
.ToolChainKey
;
46 import org
.tianocore
.build
.toolchain
.ToolChainMap
;
49 GlobalData provide initializing, instoring, querying and update global data.
50 It is a bridge to intercommunicate between multiple component, such as AutoGen,
53 <p>Note that all global information are initialized incrementally. All data will
54 parse and record only of necessary during build time. </p>
58 public class GlobalData
{
60 /// Record current WORKSPACE Directory
62 private static String workspaceDir
= "";
65 /// Be used to ensure Global data will be initialized only once.
67 private static boolean globalFlag
= false;
70 /// Framework Database information: package list and platform list
72 private static Set
<PackageIdentification
> packageList
= new HashSet
<PackageIdentification
>();
74 private static Set
<PlatformIdentification
> platformList
= new HashSet
<PlatformIdentification
>();
77 /// Every detail SPD informations: Module list, Library class definition,
78 /// Package header file, GUID/PPI/Protocol definitions
80 private static final Map
<PackageIdentification
, Spd
> spdTable
= new HashMap
<PackageIdentification
, Spd
>();
83 /// Build informations are divided into three parts:
84 /// 1. From MSA 2. From FPD 3. From FPD' ModuleSA
86 private static Map
<ModuleIdentification
, Map
<String
, XmlObject
>> nativeMsa
= new HashMap
<ModuleIdentification
, Map
<String
, XmlObject
>>();
88 private static Map
<FpdModuleIdentification
, Map
<String
, XmlObject
>> fpdModuleSA
= new HashMap
<FpdModuleIdentification
, Map
<String
, XmlObject
>>();
90 private static XmlObject fpdBuildOptions
;
92 private static XmlObject fpdDynamicPcds
;
95 /// Parsed modules list
97 private static Map
<FpdModuleIdentification
, Map
<String
, XmlObject
>> parsedModules
= new HashMap
<FpdModuleIdentification
, Map
<String
, XmlObject
>>();
100 /// built modules list with ARCH, TARGET, TOOLCHAIN
102 private static Set
<FpdModuleIdentification
> builtModules
= new HashSet
<FpdModuleIdentification
>();
105 /// PCD memory database stored all PCD information which collected from FPD,MSA and SPD.
107 private static final MemoryDatabaseManager pcdDbManager
= new MemoryDatabaseManager();
110 /// build target + tool chain family/tag name + arch + command types + command options
114 /// toolsDef - build tool program information
115 /// fpdBuildOption - all modules's build options for tool tag or tool chain families
116 /// moduleSaBuildOption - build options for a specific module
118 private static ToolChainConfig toolsDef
;
120 private static ToolChainInfo toolChainInfo
;
121 private static ToolChainInfo toolChainEnvInfo
;
122 private static ToolChainInfo toolChainPlatformInfo
;
124 private static ToolChainMap platformToolChainOption
;
125 private static ToolChainMap platformToolChainFamilyOption
;
127 private static Map
<FpdModuleIdentification
, ToolChainMap
> moduleToolChainOption
= new HashMap
<FpdModuleIdentification
, ToolChainMap
>();
128 private static Map
<FpdModuleIdentification
, ToolChainMap
> moduleToolChainFamilyOption
= new HashMap
<FpdModuleIdentification
, ToolChainMap
>();
131 Parse framework database (DB) and all SPD files listed in DB to initialize
132 the environment for next build. This method will only be executed only once
133 in the whole build process.
135 @param workspaceDatabaseFile the file name of framework database
136 @param workspaceDir current workspace directory path
137 @throws BuildException
138 Framework Dababase or SPD or MSA file is not valid
140 public synchronized static void initInfo(String workspaceDatabaseFile
, String workspaceDir
, String toolsDefFilename
) throws BuildException
{
142 // ensure this method will be revoked only once
150 // Backup workspace directory. It will be used by other method
152 GlobalData
.workspaceDir
= workspaceDir
.replaceAll("(\\\\)", "/");
155 // Parse tools definition file
158 // If ToolChain has been set up before, do nothing.
159 // CONF dir + tools definition file name
161 File toolsDefFile
= new File(workspaceDir
+ File
.separatorChar
+ toolsDefFilename
);
162 System
.out
.println("Using tool definiton file [" + toolsDefFile
.getPath() + "].");
164 toolsDef
= new ToolChainConfig(toolsDefFile
);
165 } catch (Exception e
) {
166 throw new BuildException(e
.getMessage());
170 // Parse Framework Database
172 File dbFile
= new File(workspaceDir
+ File
.separatorChar
+ workspaceDatabaseFile
);
174 FrameworkDatabaseDocument db
= (FrameworkDatabaseDocument
) XmlObject
.Factory
.parse(dbFile
);
176 // validate FrameworkDatabaseFile
178 if (!db
.validate()) {
179 throw new BuildException("Framework Database file [" + dbFile
.getPath() + "] format is invalid!");
184 if (db
.getFrameworkDatabase().getPackageList() != null ) {
185 List
<DbPathAndFilename
> packages
= db
.getFrameworkDatabase().getPackageList().getFilenameList();
186 Iterator
<DbPathAndFilename
> iter
= packages
.iterator();
187 while (iter
.hasNext()) {
188 String fileName
= iter
.next().getStringValue();
189 Spd spd
= new Spd(new File(workspaceDir
+ File
.separatorChar
+ fileName
));
190 packageList
.add(spd
.getPackageId());
191 spdTable
.put(spd
.getPackageId(), spd
);
198 if (db
.getFrameworkDatabase().getPlatformList() != null) {
199 List
<DbPathAndFilename
> platforms
= db
.getFrameworkDatabase().getPlatformList().getFilenameList();
200 Iterator
<DbPathAndFilename
> iter
= platforms
.iterator();
201 while (iter
.hasNext()) {
202 String fileName
= iter
.next().getStringValue();
203 File fpdFile
= new File(workspaceDir
+ File
.separatorChar
+ fileName
);
204 if ( !fpdFile
.exists() ) {
205 throw new BuildException("Platform file [" + fpdFile
.getPath() + "] not exists. ");
207 XmlObject fpdDoc
= XmlObject
.Factory
.parse(fpdFile
);
209 // Verify FPD file, if is invalid, throw Exception
211 if (!fpdDoc
.validate()) {
212 throw new BuildException("Framework Platform Surface Area file [" + fpdFile
.getPath() + "] format is invalid!");
215 // We can change Map to XmlObject
218 // TBD check SPD or FPD is existed in FS
220 Map
<String
, XmlObject
> fpdDocMap
= new HashMap
<String
, XmlObject
>();
221 fpdDocMap
.put("PlatformSurfaceArea", fpdDoc
);
222 SurfaceAreaQuery
.setDoc(fpdDocMap
);
223 PlatformIdentification platformId
= SurfaceAreaQuery
.getFpdHeader();
224 platformId
.setFpdFile(fpdFile
);
225 platformList
.add(platformId
);
228 } catch (Exception e
) {
229 throw new BuildException("Parse WORKSPACE Database file [" + dbFile
.getPath() + "] Error.\n" + e
.getMessage());
234 Get the current WORKSPACE Directory.
236 @return current workspace directory
238 public synchronized static String
getWorkspacePath() {
244 Get the MSA file name with absolute path
246 public synchronized static File
getMsaFile(ModuleIdentification moduleId
) throws BuildException
{
249 // TBD. Do only when package is null.
251 Iterator iter
= packageList
.iterator();
252 while (iter
.hasNext()) {
253 PackageIdentification packageId
= (PackageIdentification
)iter
.next();
254 Spd spd
= spdTable
.get(packageId
);
255 msaFile
= spd
.getModuleFile(moduleId
);
256 if (msaFile
!= null ) {
260 if (msaFile
== null){
261 throw new BuildException("Can't find Module [" + moduleId
.getName() + "] in any SPD package!");
267 public synchronized static PackageIdentification
getPackageForModule(ModuleIdentification moduleId
) {
269 // If package already defined in module
271 if (moduleId
.getPackage() != null) {
272 return moduleId
.getPackage();
275 PackageIdentification packageId
= null;
276 Iterator iter
= packageList
.iterator();
277 while (iter
.hasNext()) {
278 packageId
= (PackageIdentification
)iter
.next();
279 moduleId
.setPackage(packageId
);
280 Spd spd
= spdTable
.get(packageId
);
281 if (spd
.getModuleFile(moduleId
) != null ) {
285 if (packageId
== null){
286 throw new BuildException("Can't find Module [" + moduleId
.getName() + "] in any SPD package!");
293 Difference between build and parse: ToolChain and Target
295 public synchronized static boolean isModuleBuilt(FpdModuleIdentification moduleId
) {
296 return builtModules
.contains(moduleId
);
299 public synchronized static void registerBuiltModule(FpdModuleIdentification fpdModuleId
) {
300 builtModules
.add(fpdModuleId
);
304 public synchronized static void registerFpdModuleSA(FpdModuleIdentification fpdModuleId
, Map
<String
, XmlObject
> doc
) {
305 Map
<String
, XmlObject
> result
= new HashMap
<String
, XmlObject
>();
306 Set keySet
= doc
.keySet();
307 Iterator iter
= keySet
.iterator();
308 while (iter
.hasNext()){
309 String key
= (String
)iter
.next();
310 XmlObject item
= cloneXmlObject(doc
.get(key
), true);
311 result
.put(key
, item
);
313 fpdModuleSA
.put(fpdModuleId
, result
);
316 public synchronized static boolean hasFpdModuleSA(FpdModuleIdentification fpdModuleId
) {
317 return fpdModuleSA
.containsKey(fpdModuleId
);
321 Query module surface area information.
323 <p>Note that surface area parsing is incremental. That means the method will
324 only parse the MSA files if necessary. </p>
326 @param fpdModuleId Module ID with arch
327 @return ModuleSA info and MSA info for fpdModuleId
328 @throws BuildException Can't find MSA
330 public synchronized static Map
<String
, XmlObject
> getDoc(FpdModuleIdentification fpdModuleId
) throws BuildException
{
331 if (parsedModules
.containsKey(fpdModuleId
)) {
332 return parsedModules
.get(fpdModuleId
);
334 Map
<String
, XmlObject
> doc
= new HashMap
<String
, XmlObject
>();
335 ModuleIdentification moduleId
= fpdModuleId
.getModule();
337 // First part: get the MSA files info
339 doc
.putAll(getNativeMsa(moduleId
));
342 // Second part: put build options
344 doc
.put("BuildOptions", fpdBuildOptions
);
347 // Third part: get Module info from FPD, such as Library instances, PCDs
349 if (fpdModuleSA
.containsKey(fpdModuleId
)){
351 // merge module info in FPD to final Doc
352 // For Library Module, do nothing here
354 doc
.putAll(fpdModuleSA
.get(fpdModuleId
));
356 parsedModules
.put(fpdModuleId
, doc
);
360 public synchronized static Map
<String
, XmlObject
> getDoc(ModuleIdentification moduleId
, String arch
) throws BuildException
{
361 FpdModuleIdentification fpdModuleId
= new FpdModuleIdentification(moduleId
, arch
);
362 return getDoc(fpdModuleId
);
365 Query the native MSA information with module base name.
367 <p>Note that MSA parsing is incremental. That means the method will
368 only to parse the MSA files when never parsed before. </p>
370 @param moduleName the base name of the module
371 @return the native MSA information
372 @throws BuildException
373 MSA file is not valid
375 public synchronized static Map
<String
, XmlObject
> getNativeMsa(ModuleIdentification moduleId
) throws BuildException
{
376 if (nativeMsa
.containsKey(moduleId
)) {
377 return nativeMsa
.get(moduleId
);
379 File msaFile
= getMsaFile(moduleId
);
380 Map
<String
, XmlObject
> msaMap
= getNativeMsa(msaFile
);
381 nativeMsa
.put(moduleId
, msaMap
);
385 public synchronized static Map
<String
, XmlObject
> getNativeMsa(File msaFile
) throws BuildException
{
386 if (!msaFile
.exists()) {
387 throw new BuildException("Module Surface Area file [" + msaFile
.getPath() + "] can't be found!");
390 ModuleSurfaceAreaDocument doc
= (ModuleSurfaceAreaDocument
)XmlObject
.Factory
.parse(msaFile
);
392 // Validate File if they accord with XML Schema
394 if ( !doc
.validate()){
395 throw new BuildException("Module Surface Area file [" + msaFile
.getPath() + "] format is invalid!");
400 ModuleSurfaceArea msa
= doc
.getModuleSurfaceArea();
401 Map
<String
, XmlObject
> msaMap
= new HashMap
<String
, XmlObject
>();
402 msaMap
.put("MsaHeader", cloneXmlObject(msa
.getMsaHeader(), true));
403 msaMap
.put("ModuleDefinitions", cloneXmlObject(msa
.getModuleDefinitions(), true));
404 msaMap
.put("LibraryClassDefinitions", cloneXmlObject(msa
.getLibraryClassDefinitions(), true));
405 msaMap
.put("SourceFiles", cloneXmlObject(msa
.getSourceFiles(), true));
406 msaMap
.put("PackageDependencies", cloneXmlObject(msa
.getPackageDependencies(), true));
407 msaMap
.put("Protocols", cloneXmlObject(msa
.getProtocols(), true));
408 msaMap
.put("PPIs", cloneXmlObject(msa
.getPPIs(), true));
409 msaMap
.put("Guids", cloneXmlObject(msa
.getGuids(), true));
410 msaMap
.put("Externs", cloneXmlObject(msa
.getExterns(), true));
411 msaMap
.put("PcdCoded", cloneXmlObject(msa
.getPcdCoded(), true));
414 catch (Exception ex
){
415 throw new BuildException("Parsing MSA file [" + msaFile
.getPath() + "] error. \n" + ex
.getMessage() );
419 public static Map
<String
, XmlObject
> getFpdBuildOptions() {
420 Map
<String
, XmlObject
> map
= new HashMap
<String
, XmlObject
>();
421 map
.put("BuildOptions", fpdBuildOptions
);
425 public static void setFpdBuildOptions(XmlObject fpdBuildOptions
) {
426 GlobalData
.fpdBuildOptions
= cloneXmlObject(fpdBuildOptions
, true);
429 public static XmlObject
getFpdDynamicPcds() {
430 return fpdDynamicPcds
;
433 public static void setFpdDynamicPcds(XmlObject fpdDynamicPcds
) {
434 GlobalData
.fpdDynamicPcds
= fpdDynamicPcds
;
437 public static Set
<ModuleIdentification
> getModules(PackageIdentification packageId
){
438 Spd spd
= spdTable
.get(packageId
);
440 Set
<ModuleIdentification
> dummy
= new HashSet
<ModuleIdentification
>();
443 return spd
.getModules();
448 * The header file path is relative to workspace dir
450 public static String
[] getLibraryClassHeaderFiles(
451 PackageIdentification
[] packages
, String name
)
452 throws BuildException
{
453 if (packages
== null) {
454 // throw Exception or not????
455 return new String
[0];
457 String
[] result
= null;
458 for (int i
= 0; i
< packages
.length
; i
++) {
459 Spd spd
= spdTable
.get(packages
[i
]);
461 // If find one package defined the library class
463 if ((result
= spd
.getLibClassIncluder(name
)) != null) {
468 // If can't find library class declaration in every package
470 throw new BuildException("Can not find library class [" + name
471 + "] declaration in any SPD package!");
475 * The header file path is relative to workspace dir
477 public static String
getPackageHeaderFiles(PackageIdentification packages
,
478 String moduleType
) throws BuildException
{
479 if (packages
== null) {
480 return new String("");
482 Spd spd
= spdTable
.get(packages
);
484 // If can't find package header file, skip it
488 if ((temp
= spd
.getPackageIncluder(moduleType
)) != null) {
500 * return two values: {cName, GuidValue}
502 public static String
[] getGuid(List
<PackageIdentification
> packages
, String name
)
503 throws BuildException
{
504 if (packages
== null) {
505 // throw Exception or not????
506 return new String
[0];
508 String
[] result
= null;
509 Iterator item
= packages
.iterator();
510 while (item
.hasNext()){
511 Spd spd
= spdTable
.get(item
.next());
513 // If find one package defined the GUID
515 if ((result
= spd
.getGuid(name
)) != null) {
524 * return two values: {cName, GuidValue}
526 public static String
[] getPpiGuid(List
<PackageIdentification
> packages
,
527 String name
) throws BuildException
{
528 if (packages
== null) {
529 return new String
[0];
531 String
[] result
= null;
532 Iterator item
= packages
.iterator();
533 while (item
.hasNext()){
534 Spd spd
= spdTable
.get(item
.next());
536 // If find one package defined the Ppi GUID
538 if ((result
= spd
.getPpi(name
)) != null) {
546 * return two values: {cName, GuidValue}
548 public static String
[] getProtocolGuid(List
<PackageIdentification
> packages
,
549 String name
) throws BuildException
{
550 if (packages
== null) {
551 return new String
[0];
553 String
[] result
= null;
554 Iterator item
= packages
.iterator();
555 while (item
.hasNext()){
556 Spd spd
= spdTable
.get(item
.next());
558 // If find one package defined the protocol GUID
560 if ((result
= spd
.getProtocol(name
))!= null){
568 public synchronized static PlatformIdentification
getPlatformByName(String name
) throws BuildException
{
569 Iterator iter
= platformList
.iterator();
570 while(iter
.hasNext()){
571 PlatformIdentification platformId
= (PlatformIdentification
)iter
.next();
572 if (platformId
.getName().equalsIgnoreCase(name
)) {
576 throw new BuildException("Can't find platform [" + name
+ "] in the current WORKSPACE database!");
579 public synchronized static PlatformIdentification
getPlatform(String filename
) throws BuildException
{
580 File file
= new File(workspaceDir
+ File
.separatorChar
+ filename
);
581 Iterator iter
= platformList
.iterator();
582 while(iter
.hasNext()){
583 PlatformIdentification platformId
= (PlatformIdentification
)iter
.next();
584 if (platformId
.getFpdFile().getPath().equalsIgnoreCase(file
.getPath())) {
588 throw new BuildException("Can't find platform file [" + filename
+ "] in the current WORKSPACE database!");
591 public synchronized static PackageIdentification
refreshPackageIdentification(PackageIdentification packageId
) throws BuildException
{
592 Iterator iter
= packageList
.iterator();
593 while(iter
.hasNext()){
594 PackageIdentification packageItem
= (PackageIdentification
)iter
.next();
595 if (packageItem
.equals(packageId
)) {
596 packageId
.setName(packageItem
.getName());
597 packageId
.setSpdFile(packageItem
.getSpdFile());
601 throw new BuildException("Can't find package GUID value " + packageId
.toGuidString() + " in the current workspace!");
604 public synchronized static ModuleIdentification
refreshModuleIdentification(ModuleIdentification moduleId
) throws BuildException
{
605 PackageIdentification packageId
= getPackageForModule(moduleId
);
606 moduleId
.setPackage(packageId
);
607 Spd spd
= spdTable
.get(packageId
);
609 throw new BuildException("Can't find package GUID value " + packageId
.toGuidString() + " in the current workspace!");
611 Set
<ModuleIdentification
> modules
= spd
.getModules();
612 Iterator
<ModuleIdentification
> iter
= modules
.iterator();
613 while (iter
.hasNext()) {
614 ModuleIdentification item
= iter
.next();
615 if (item
.equals(moduleId
)) {
616 moduleId
.setName(item
.getName());
617 moduleId
.setModuleType(item
.getModuleType());
618 moduleId
.setMsaFile(item
.getMsaFile());
622 throw new BuildException("Can't find module GUID value " + moduleId
.toGuidString() + " in " + packageId
+ " under the current workspace!");
625 public synchronized static Set
<PackageIdentification
> getPackageList(){
630 BUGBUG: It is a walk around method. If do not clone, can't query info with
633 @param object XmlObject
634 @param deep flag for deep clone
635 @return XmlObject after clone
636 @throws BuildException parse original XmlObject error.
638 private static XmlObject
cloneXmlObject(XmlObject object
, boolean deep
) throws BuildException
{
639 if ( object
== null) {
642 XmlObject result
= null;
644 result
= XmlObject
.Factory
.parse(object
.getDomNode()
646 } catch (Exception ex
) {
647 throw new BuildException(ex
.getMessage());
653 /// Tool Chain Related, try to refine and put some logic process to ToolChainFactory
655 public static ToolChainInfo
getToolChainInfo() {
656 if (toolChainInfo
== null) {
657 toolChainInfo
= toolsDef
.getConfigInfo().intersection(toolChainEnvInfo
);
658 if (toolChainPlatformInfo
!= null) {
659 toolChainInfo
= toolChainInfo
.intersection(toolChainPlatformInfo
);
661 toolChainInfo
.addCommands(toolsDef
.getConfigInfo().getCommands());
662 toolChainInfo
.normalize();
663 System
.out
.println("Current build tool chain information summary: ");
664 System
.out
.println(toolChainInfo
+ "");
666 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 boolean isCommandSet(String target
, String toolchain
, String arch
) {
688 String
[] commands
= getToolChainInfo().getCommands();
690 for (int i
= 0; i
< commands
.length
; ++i
) {
691 String cmdName
= toolsDef
.getConfig().get(new String
[] {target
, toolchain
, arch
, commands
[i
], ToolChainAttribute
.NAME
.toString()});
692 if (cmdName
!= null && cmdName
.length() != 0) {
700 public static String
getCommandSetting(String
[] commandDescription
, FpdModuleIdentification fpdModuleId
) throws EdkException
{
701 ToolChainKey toolChainKey
= new ToolChainKey(commandDescription
);
702 ToolChainMap toolChainConfig
= toolsDef
.getConfig();
703 String setting
= null;
705 if (!commandDescription
[ToolChainElement
.ATTRIBUTE
.value
].equals(ToolChainAttribute
.FLAGS
.toString())) {
706 setting
= toolChainConfig
.get(toolChainKey
);
707 if (setting
== null) {
714 // get module specific options, if any
717 ToolChainMap option
= moduleToolChainOption
.get(fpdModuleId
);
718 ToolChainKey toolChainFamilyKey
= null;
720 if ((option
== null) || (option
!= null && (setting
= option
.get(toolChainKey
)) == null)) {
722 // then tool chain family
724 toolChainFamilyKey
= new ToolChainKey(commandDescription
);
725 toolChainFamilyKey
.setKey(ToolChainAttribute
.FAMILY
.toString(), ToolChainElement
.ATTRIBUTE
.value
);
726 String family
= toolChainConfig
.get(toolChainFamilyKey
);
727 toolChainFamilyKey
.setKey(family
, ToolChainElement
.TOOLCHAIN
.value
);
728 toolChainFamilyKey
.setKey(ToolChainAttribute
.FLAGS
.toString(), ToolChainElement
.ATTRIBUTE
.value
);
730 option
= moduleToolChainFamilyOption
.get(fpdModuleId
);
731 if (option
!= null) {
732 setting
= option
.get(toolChainFamilyKey
);
737 // get platform options, if any
739 if (setting
== null) {
741 if (platformToolChainOption
== null || (setting
= platformToolChainOption
.get(toolChainKey
)) == null) {
742 // then tool chain family
743 if (toolChainFamilyKey
== null) {
744 toolChainFamilyKey
= new ToolChainKey(commandDescription
);
745 toolChainFamilyKey
.setKey(ToolChainAttribute
.FAMILY
.toString(), ToolChainElement
.ATTRIBUTE
.value
);
746 String family
= toolChainConfig
.get(toolChainFamilyKey
);
747 toolChainFamilyKey
.setKey(family
, ToolChainElement
.TOOLCHAIN
.value
);
748 toolChainFamilyKey
.setKey(ToolChainAttribute
.FLAGS
.toString(), ToolChainElement
.ATTRIBUTE
.value
);
751 setting
= platformToolChainFamilyOption
.get(toolChainFamilyKey
);
755 if (setting
== null) {
762 public static void setToolChainEnvInfo(ToolChainInfo envInfo
) {
763 toolChainEnvInfo
= envInfo
;
765 public static void setToolChainPlatformInfo(ToolChainInfo platformInfo
) {
766 toolChainPlatformInfo
= platformInfo
;
772 public synchronized static MemoryDatabaseManager
getPCDMemoryDBManager() {
777 // For PCD get tokenSpaceGUid
779 public synchronized static String
getGuidInfoFromCname(String cName
){
780 String cNameGuid
= null;
782 Set set
= spdTable
.keySet();
783 Iterator iter
= set
.iterator();
789 while (iter
.hasNext()){
790 Spd spd
= (Spd
) spdTable
.get(iter
.next());
791 guid
= spd
.getGuidFromCname(cName
);
803 public synchronized static Map
<FpdModuleIdentification
, XmlObject
>
804 getFpdModuleSaXmlObject(String xmlObjectName
) {
805 Set
<FpdModuleIdentification
> fpdModuleSASet
= fpdModuleSA
.keySet();
806 Iterator item
= fpdModuleSASet
.iterator();
809 Map
<FpdModuleIdentification
, XmlObject
> SAPcdBuildDef
= new HashMap
<FpdModuleIdentification
, XmlObject
>();
810 Map
<String
, XmlObject
> SANode
= new HashMap
<String
, XmlObject
>();
811 FpdModuleIdentification moduleId
;
812 while (item
.hasNext()) {
814 moduleId
= (FpdModuleIdentification
) item
.next();
815 SANode
= fpdModuleSA
.get(moduleId
);
817 if (SANode
.get(xmlObjectName
)!= null){
818 SAPcdBuildDef
.put(moduleId
,
819 (XmlObject
) SANode
.get(xmlObjectName
));
822 } catch (Exception e
){
823 EdkLog
.log(EdkLog
.EDK_INFO
, e
.getMessage());
826 return SAPcdBuildDef
;
829 public synchronized static Map
<FpdModuleIdentification
,XmlObject
> getFpdPcdBuildDefinitions() {
830 Map
<FpdModuleIdentification
,XmlObject
> pcdBuildDef
= getFpdModuleSaXmlObject ("PcdBuildDefinition");