Added copyright&license header.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@973 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jwang36 2006-07-13 10:27:03 +00:00
parent a45e9a400d
commit 5f42a4bada
11 changed files with 177 additions and 93 deletions

View File

@ -1,3 +1,16 @@
/** @file
This file is to define Identification class.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.build.id; package org.tianocore.build.id;
import org.tianocore.build.global.GlobalData; import org.tianocore.build.global.GlobalData;

View File

@ -1,3 +1,16 @@
/** @file
This file is to define ModuleIdentification class.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.build.id; package org.tianocore.build.id;
import java.io.File; import java.io.File;

View File

@ -1,3 +1,16 @@
/** @file
This file is to define PackageIdentification class.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.build.id; package org.tianocore.build.id;
import java.io.File; import java.io.File;

View File

@ -1,3 +1,16 @@
/** @file
This file is to define PlatformIdentification class.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.build.id; package org.tianocore.build.id;
import java.io.File; import java.io.File;

View File

@ -1,13 +1,30 @@
/** @file
This file is to define ToolChainAttribute class.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.build.toolchain; package org.tianocore.build.toolchain;
/** /**
* TODO: Add class description
* ToolChainAttribute is used to define the enumeration value for the attributes
* @author jwang36 used in tool chain definition file.
*/
**/
public class ToolChainAttribute { public class ToolChainAttribute {
private static int nextValue = 0; private static int nextValue = 0;
//"NAME", "PATH", "DPATH", "SPATH", "EXT", "FAMILY", "FLAGS" //
// "NAME", "PATH", "DPATH", "SPATH", "EXT", "FAMILY", "FLAGS"
//
public final static ToolChainAttribute NAME = new ToolChainAttribute("NAME"); public final static ToolChainAttribute NAME = new ToolChainAttribute("NAME");
public final static ToolChainAttribute PATH = new ToolChainAttribute("PATH"); public final static ToolChainAttribute PATH = new ToolChainAttribute("PATH");
public final static ToolChainAttribute DPATH = new ToolChainAttribute("DPATH"); public final static ToolChainAttribute DPATH = new ToolChainAttribute("DPATH");

View File

@ -1,8 +1,7 @@
/** @file /** @file
ToolChainFactory class. ToolChainConfig class.
ToolChainFactory class parse all config files and get STD_FLAGS, GLOBAL_FLAGS, ToolChainFactory class parse all config files and get tool chain information.
and also command path + name.
Copyright (c) 2006, Intel Corporation Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
@ -27,38 +26,30 @@ import java.util.Set;
/** /**
This class parse all config files and get STD_FLAGS, GLOBAL_FLAGS, and also
command path + name. ToolChainFactory class parse all config files and get tool chain information.
@since GenBuild 1.0 **/
**/
public class ToolChainConfig { public class ToolChainConfig {
///
/// list of attributes
///
private final static String[] attributes = {"NAME", "PATH", "DPATH", "SPATH", "EXT", "FAMILY", "FLAGS"};
///
/// elements which are used to define one type of tool
///
private final static String[] elements = {"TARGET", "TOOLCHAIN", "ARCH", "CMD", "ATTRIBUTE" };
/// ///
/// tool chain definitions /// tool chain definitions
/// ///
private ToolChainMap config = null; private ToolChainMap config = null;
///
/// tool chain information (how many targets, archs, etc.)
///
private ToolChainInfo info = new ToolChainInfo(); private ToolChainInfo info = new ToolChainInfo();
/** /**
Public construct method. Public construct method.
**/ **/
public ToolChainConfig () { public ToolChainConfig () {
} }
/** /**
Public construct method. Public construct method.
@param confPath the path of config files @param toolChainFile File object representing the tool chain configuration file
@param toolChainTag TOOL_CHAIN name
**/ **/
public ToolChainConfig (File toolChainFile) { public ToolChainConfig (File toolChainFile) {
try { try {
@ -70,10 +61,13 @@ public class ToolChainConfig {
} }
} }
/// /**
/// Collect target, tool chain tag, arch and command information from key part
/// of configuration
public void parseToolChainDefKey (Set<ToolChainKey> toolChainDefKey) {
@param toolChainDefKey The set of keys in tool chain configuration
**/
private void parseToolChainDefKey (Set<ToolChainKey> toolChainDefKey) {
Iterator it = toolChainDefKey.iterator(); Iterator it = toolChainDefKey.iterator();
while (it.hasNext()) { while (it.hasNext()) {
ToolChainKey key = (ToolChainKey)it.next(); ToolChainKey key = (ToolChainKey)it.next();
@ -85,47 +79,29 @@ public class ToolChainConfig {
} }
} }
/** /**
public Set<String> getTargets() { Return the tool chain configuration information in a Map form
return info.getTargets();
} @return ToolChainMap Tool chain configurations in a ToolChainMap
**/
public Set<String> getTagnames() {
return info.getTagnames();
}
public Set<String> getArchs() {
return info.getArchs();
}
public Set<String> getCommands() {
return info.getCommands();
}
public String getValue(String key) {
return config.get(key);
}
public String getValue(String[] keySet) {
return config.get(keySet);
}
public String getValue(ToolChainKey key) {
return config.get(key);
}
**/
public ToolChainMap getConfig() { public ToolChainMap getConfig() {
return config; return config;
} }
/**
Return the tool chain's target, arch, tag and commands information
@return ToolChainInfo
**/
public ToolChainInfo getConfigInfo() { public ToolChainInfo getConfigInfo() {
return info; return info;
} }
/// /**
/// override toString() override toString()
///
@return String The converted configuration string in name=value form
**/
public String toString() { public String toString() {
StringBuffer ts = new StringBuffer(10240); StringBuffer ts = new StringBuffer(10240);
@ -133,7 +109,7 @@ public class ToolChainConfig {
while (it.hasNext()) { while (it.hasNext()) {
ToolChainKey key = (ToolChainKey)it.next(); ToolChainKey key = (ToolChainKey)it.next();
ts.append(key.toString() + " = "); ts.append(key.toString() + " = ");
// ts.append(config.get(key) + "\n"); ts.append(config.get(key) + "\n");
} }
return ts.toString(); return ts.toString();

View File

@ -1,13 +1,30 @@
/** @file
This file is to define ToolChainElement class.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.build.toolchain; package org.tianocore.build.toolchain;
/** /**
* TODO: Add class description
* This class is an enumeration definition for key elements in tool chain definition
* @author jwang36 file.
*/
**/
public class ToolChainElement { public class ToolChainElement {
private static int nextValue = 0; private static int nextValue = 0;
//"NAME", "PATH", "DPATH", "SPATH", "EXT", "FAMILY", "FLAGS" //
// "TARGET", "TOOLCHAIN", "ARCH", "TOOLCODE", "ATTRIBUTE"
//
public final static ToolChainElement TARGET = new ToolChainElement("TARGET"); public final static ToolChainElement TARGET = new ToolChainElement("TARGET");
public final static ToolChainElement TOOLCHAIN = new ToolChainElement("TOOLCHAIN"); public final static ToolChainElement TOOLCHAIN = new ToolChainElement("TOOLCHAIN");
public final static ToolChainElement ARCH = new ToolChainElement("ARCH"); public final static ToolChainElement ARCH = new ToolChainElement("ARCH");

View File

@ -1,3 +1,16 @@
/** @file
This file is to define ToolChainInfo class.
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.build.toolchain; package org.tianocore.build.toolchain;
import java.util.HashMap; import java.util.HashMap;
@ -6,17 +19,31 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
public class ToolChainInfo { public class ToolChainInfo {
//
// build target set
//
private Set<String> targets = new LinkedHashSet<String>(); private Set<String> targets = new LinkedHashSet<String>();
//
// tool chain tag name set
//
private Set<String> tagnames = new LinkedHashSet<String>(); private Set<String> tagnames = new LinkedHashSet<String>();
//
// build archs set
//
private Set<String> archs = new LinkedHashSet<String>(); private Set<String> archs = new LinkedHashSet<String>();
//
// build commands set
//
private Set<String> commands = new LinkedHashSet<String>(); private Set<String> commands = new LinkedHashSet<String>();
//
// build commands for specific tool chain
//
private Map<String, Set<String>> commandMap = new HashMap<String, Set<String>>(); private Map<String, Set<String>> commandMap = new HashMap<String, Set<String>>();
/**
Add a list of targets in the form of string separated by space
@param targetList target list string
**/
public void addTargets(String targetList) { public void addTargets(String targetList) {
// //
// targetList some targets separated by space " " // targetList some targets separated by space " "
@ -27,7 +54,11 @@ public class ToolChainInfo {
} }
addTargets(targetList.split(" ")); addTargets(targetList.split(" "));
} }
/**
Add a list of targets in the form of string array
@param targetArray target string array
**/
public void addTargets(String[] targetArray) { public void addTargets(String[] targetArray) {
if (targetArray == null ) { if (targetArray == null ) {
return ; return ;
@ -36,11 +67,19 @@ public class ToolChainInfo {
targets.add(targetArray[i]); targets.add(targetArray[i]);
} }
} }
/**
Add a list of target in the form of set
@param targetSet target string set
**/
public void addTargets(Set<String> targetSet) { public void addTargets(Set<String> targetSet) {
targets.addAll(targetSet); targets.addAll(targetSet);
} }
/**
Add a list of tool chain tag name in the form of string separated by space
@param tagnameList
**/
public void addTagnames(String tagnameList) { public void addTagnames(String tagnameList) {
// //
// tagnameList some tagnames separated by space " " // tagnameList some tagnames separated by space " "
@ -142,18 +181,14 @@ public class ToolChainInfo {
result.addTargets(union(this.targets, info.targets)); result.addTargets(union(this.targets, info.targets));
result.addTagnames(union(this.tagnames, info.tagnames)); result.addTagnames(union(this.tagnames, info.tagnames));
result.addArchs(union(this.archs, info.archs)); result.addArchs(union(this.archs, info.archs));
//result.addCommands(union(this.getCommands(), info.getCommands()));
return result; return result;
} }
public ToolChainInfo intersection(ToolChainInfo info) { public ToolChainInfo intersection(ToolChainInfo info) {
// System.out.println(this + "\n" + info);
ToolChainInfo result = new ToolChainInfo(); ToolChainInfo result = new ToolChainInfo();
result.addTargets(intersection(this.targets, info.targets)); result.addTargets(intersection(this.targets, info.targets));
result.addTagnames(intersection(this.tagnames, info.tagnames)); result.addTagnames(intersection(this.tagnames, info.tagnames));
result.addArchs(intersection(this.archs, info.archs)); result.addArchs(intersection(this.archs, info.archs));
// result.addCommands(union(this.commands, info.commands));
// System.out.println("result: " + result);
return result; return result;
} }
@ -182,7 +217,6 @@ public class ToolChainInfo {
result.retainAll(set2); result.retainAll(set2);
} }
// result.remove("*");
return result; return result;
} }

View File

@ -9,11 +9,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
ToolChainKey.java
Abstract:
--*/ --*/
package org.tianocore.build.toolchain; package org.tianocore.build.toolchain;

View File

@ -9,11 +9,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
ToolChainMap.java
Abstract:
--*/ --*/
package org.tianocore.build.toolchain; package org.tianocore.build.toolchain;

View File

@ -50,8 +50,6 @@ public class ToolChainTask extends Task{
**/ **/
public void execute() throws BuildException { public void execute() throws BuildException {
String toolChain = getProject().getProperty(toolsEnv); String toolChain = getProject().getProperty(toolsEnv);
// ToolChainConfig toolchain = new ToolChainConfig(new File(confPath + File.separatorChar + toolChain));
//getProject().setProperty("TARGET", toolchain.getCurrentTarget());
} }
/** /**