]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/GenBuild/org/tianocore/build/toolchain/ToolChainConfig.java
2 ToolChainFactory class.
4 ToolChainFactory class parse all config files and get STD_FLAGS, GLOBAL_FLAGS,
5 and also command path + name.
7 Copyright (c) 2006, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 package org
.tianocore
.build
.toolchain
;
19 import org
.apache
.tools
.ant
.BuildException
;
20 import org
.tianocore
.build
.exception
.EdkException
;
21 import org
.tianocore
.build
.toolchain
.ToolChainKey
;
22 import org
.tianocore
.build
.toolchain
.ToolChainMap
;
25 import java
.util
.Iterator
;
30 This class parse all config files and get STD_FLAGS, GLOBAL_FLAGS, and also
35 public class ToolChainConfig
{
37 /// list of attributes
39 private final static String
[] attributes
= {"NAME", "PATH", "DPATH", "SPATH", "EXT", "FAMILY", "FLAGS"};
41 /// elements which are used to define one type of tool
43 private final static String
[] elements
= {"TARGET", "TOOLCHAIN", "ARCH", "CMD", "ATTRIBUTE" };
46 /// tool chain definitions
48 private ToolChainMap config
= null;
49 private ToolChainInfo info
= new ToolChainInfo();
52 Public construct method.
54 public ToolChainConfig () {
58 Public construct method.
60 @param confPath the path of config files
61 @param toolChainTag TOOL_CHAIN name
63 public ToolChainConfig (File toolChainFile
) {
65 config
= ConfigReader
.parseToolChainConfig(toolChainFile
);
66 parseToolChainDefKey(config
.keySet());
68 catch (EdkException ex
) {
69 throw new BuildException(ex
.getMessage());
76 public void parseToolChainDefKey (Set
<ToolChainKey
> toolChainDefKey
) {
77 Iterator it
= toolChainDefKey
.iterator();
78 while (it
.hasNext()) {
79 ToolChainKey key
= (ToolChainKey
)it
.next();
80 String
[] keySet
= key
.getKeySet();
81 info
.addTargets(keySet
[0]);
82 info
.addTagnames(keySet
[1]);
83 info
.addArchs(keySet
[2]);
84 info
.addCommands(keySet
[1], keySet
[3]);
89 public Set<String> getTargets() {
90 return info.getTargets();
93 public Set<String> getTagnames() {
94 return info.getTagnames();
97 public Set<String> getArchs() {
98 return info.getArchs();
101 public Set<String> getCommands() {
102 return info.getCommands();
105 public String getValue(String key) {
106 return config.get(key);
109 public String getValue(String[] keySet) {
110 return config.get(keySet);
113 public String getValue(ToolChainKey key) {
114 return config.get(key);
118 public ToolChainMap
getConfig() {
122 public ToolChainInfo
getConfigInfo() {
127 /// override toString()
129 public String
toString() {
130 StringBuffer ts
= new StringBuffer(10240);
132 Iterator it
= config
.keySet().iterator();
133 while (it
.hasNext()) {
134 ToolChainKey key
= (ToolChainKey
)it
.next();
135 ts
.append(key
.toString() + " = ");
136 // ts.append(config.get(key) + "\n");
139 return ts
.toString();