]>
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
;
19 import org
.tianocore
.exception
.EdkException
;
20 import org
.tianocore
.build
.toolchain
.ToolChainKey
;
21 import org
.tianocore
.build
.toolchain
.ToolChainMap
;
24 import java
.util
.Iterator
;
30 ToolChainFactory class parse all config files and get tool chain information.
33 public class ToolChainConfig
{
35 /// tool chain definitions
37 private ToolChainMap config
= null;
39 /// tool chain information (how many targets, archs, etc.)
41 private ToolChainInfo info
= new ToolChainInfo();
44 Public construct method.
46 public ToolChainConfig () {
50 Public construct method.
52 @param toolChainFile File object representing the tool chain configuration file
54 public ToolChainConfig (File toolChainFile
) {
56 config
= ConfigReader
.parseToolChainConfig(toolChainFile
);
57 parseToolChainDefKey(config
.keySet());
59 catch (EdkException ex
) {
60 throw new BuildException(ex
.getMessage());
65 Collect target, tool chain tag, arch and command information from key part
68 @param toolChainDefKey The set of keys in tool chain configuration
70 private void parseToolChainDefKey (Set
<ToolChainKey
> toolChainDefKey
) {
71 Iterator it
= toolChainDefKey
.iterator();
72 while (it
.hasNext()) {
73 ToolChainKey key
= (ToolChainKey
)it
.next();
74 String
[] keySet
= key
.getKeySet();
75 info
.addTargets(keySet
[0]);
76 info
.addTagnames(keySet
[1]);
77 info
.addArchs(keySet
[2]);
78 info
.addCommands(keySet
[1], keySet
[3]);
83 Return the tool chain configuration information in a Map form
85 @return ToolChainMap Tool chain configurations in a ToolChainMap
87 public ToolChainMap
getConfig() {
92 Return the tool chain's target, arch, tag and commands information
96 public ToolChainInfo
getConfigInfo() {
103 @return String The converted configuration string in name=value form
105 public String
toString() {
106 StringBuffer ts
= new StringBuffer(10240);
108 Iterator it
= config
.keySet().iterator();
109 while (it
.hasNext()) {
110 ToolChainKey key
= (ToolChainKey
)it
.next();
111 ts
.append(key
.toString() + " = ");
112 ts
.append(config
.get(key
) + "\n");
115 return ts
.toString();