]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/GenBuild/org/tianocore/build/toolchain/ToolChainConfig.java
4 ToolChainFactory class parse all config files and get tool chain information.
6 Copyright (c) 2006, Intel Corporation
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 package org
.tianocore
.build
.toolchain
;
18 import org
.apache
.tools
.ant
.BuildException
;
20 import org
.tianocore
.common
.exception
.EdkException
;
21 import org
.tianocore
.build
.toolchain
.ToolChainKey
;
22 import org
.tianocore
.build
.toolchain
.ToolChainMap
;
25 import java
.util
.Iterator
;
31 ToolChainFactory class parse all config files and get tool chain information.
34 public class ToolChainConfig
{
36 /// tool chain definitions
38 private ToolChainMap config
= null;
40 /// tool chain information (how many targets, archs, etc.)
42 private ToolChainInfo info
= new ToolChainInfo();
45 Public construct method.
47 public ToolChainConfig () {
51 Public construct method.
53 @param toolChainFile File object representing the tool chain configuration file
55 public ToolChainConfig (File toolChainFile
) {
57 config
= ConfigReader
.parseToolChainConfig(toolChainFile
);
58 parseToolChainDefKey(config
.keySet());
60 catch (EdkException ex
) {
61 throw new BuildException(ex
.getMessage());
66 Collect target, tool chain tag, arch and command information from key part
69 @param toolChainDefKey The set of keys in tool chain configuration
71 private void parseToolChainDefKey (Set
<ToolChainKey
> toolChainDefKey
) {
72 Iterator it
= toolChainDefKey
.iterator();
73 while (it
.hasNext()) {
74 ToolChainKey key
= (ToolChainKey
)it
.next();
75 String
[] keySet
= key
.getKeySet();
76 info
.addTargets(keySet
[0]);
77 info
.addTagnames(keySet
[1]);
78 info
.addArchs(keySet
[2]);
79 info
.addCommands(keySet
[1], keySet
[3]);
84 Return the tool chain configuration information in a Map form
86 @return ToolChainMap Tool chain configurations in a ToolChainMap
88 public ToolChainMap
getConfig() {
93 Return the tool chain's target, arch, tag and commands information
97 public ToolChainInfo
getConfigInfo() {
104 @return String The converted configuration string in name=value form
106 public String
toString() {
107 StringBuffer ts
= new StringBuffer(10240);
109 Iterator it
= config
.keySet().iterator();
110 while (it
.hasNext()) {
111 ToolChainKey key
= (ToolChainKey
)it
.next();
112 ts
.append(key
.toString() + " = ");
113 ts
.append(config
.get(key
) + "\n");
116 return ts
.toString();