Change to new XML Schema.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@682 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
wuyizhong
2006-06-30 17:57:58 +00:00
parent 5fc17c922b
commit 509693ccfd
5 changed files with 228 additions and 917 deletions

View File

@ -19,17 +19,15 @@ package net.sf.antcontrib.cpptasks.userdefine;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.FileList;
import org.apache.tools.ant.types.FileSet;
import sun.nio.cs.ext.TIS_620;
import net.sf.antcontrib.cpptasks.ProcessorDef;
import net.sf.antcontrib.cpptasks.types.AslcompilerArgument;
import net.sf.antcontrib.cpptasks.types.ConditionalPath;
import net.sf.antcontrib.cpptasks.types.IncludePath;
import net.sf.antcontrib.cpptasks.types.LibrarySet;
@ -39,31 +37,33 @@ public class UserDefineDef extends ProcessorDef{
public UserDefineDef () {}
private String type = "CC";
private String family = "MSFT";
private String cmd;
private String includepathDelimiter;
private File outdir;
private String outputDelimiter;
private File workdir;
private String inputSuffix;
private String outputSuffix;
private Vector<IncludePath> includePaths= new Vector<IncludePath>();
private Vector<FileList> fileSetList = new Vector<FileList>();
private Vector includePaths= new Vector();
/**
* New adding for support GCC toolchain.
* Most of those only have one value for example :
* entryPoint, mapFile, pdbFile, define those as element because
* if attribut too much the command line is not good-lookinng.
*/
private String outputFile;
private Vector<UserDefineElement> includeFiles = new Vector<UserDefineElement>();
private Vector<UserDefineElement> outPutFiles = new Vector<UserDefineElement>();
private Vector<UserDefineElement> subSystem = new Vector<UserDefineElement>();
private Vector<UserDefineElement> entryPoint = new Vector<UserDefineElement>();
private Vector<UserDefineElement> map = new Vector<UserDefineElement>();
private Vector<UserDefineElement> pdb = new Vector<UserDefineElement>();
private Vector<LibrarySet> libSet = new Vector<LibrarySet>();
private Vector _libset = new Vector();
public void addLibset(LibrarySet libset) {
if (isReference()) {
throw noChildrenAllowed();
}
if (libset == null) {
throw new NullPointerException("libset");
}
_libset.add(libset);
}
public void execute() throws org.apache.tools.ant.BuildException {
throw new org.apache.tools.ant.BuildException(
@ -173,51 +173,6 @@ public class UserDefineDef extends ProcessorDef{
this.includepathDelimiter = includepathDelimiter;
}
public String getInputSuffix() {
if (isReference()) {
return ((UserDefineDef) getCheckedRef(UserDefineDef.class,
"UserDefineDef")).getInputSuffix();
}
return inputSuffix;
}
public void setInputSuffix(String inputSuffix) {
if (isReference()) {
throw tooManyAttributes();
}
this.inputSuffix = inputSuffix;
}
public File getOutdir() {
if (isReference()) {
return ((UserDefineDef) getCheckedRef(UserDefineDef.class,
"UserDefineDef")).getOutdir();
}
return outdir;
}
public void setOutdir(File outdir) {
if (isReference()) {
throw tooManyAttributes();
}
this.outdir = outdir;
}
public String getOutputSuffix() {
if (isReference()) {
return ((UserDefineDef) getCheckedRef(UserDefineDef.class,
"UserDefineDef")).getOutputSuffix();
}
return outputSuffix;
}
public void setOutputSuffix(String outputSuffix) {
if (isReference()) {
throw tooManyAttributes();
}
this.outputSuffix = outputSuffix;
}
public String getType() {
if (isReference()) {
return ((UserDefineDef) getCheckedRef(UserDefineDef.class,
@ -233,11 +188,40 @@ public class UserDefineDef extends ProcessorDef{
this.type = type;
}
public File getWorkdir() {
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
if (isReference()) {
return ((UserDefineDef) getCheckedRef(UserDefineDef.class,
"UserDefineDef")).getWorkdir();
throw tooManyAttributes();
}
this.cmd = cmd;
}
public String getFamily() {
return family;
}
public void setFamily(String family) {
if (isReference()) {
throw tooManyAttributes();
}
this.family = family;
}
public String getOutputFile() {
return outputFile;
}
public void setOutputFile(String outputFile) {
if (isReference()) {
throw tooManyAttributes();
}
this.outputFile = outputFile;
}
public File getWorkdir() {
return workdir;
}
@ -247,251 +231,38 @@ public class UserDefineDef extends ProcessorDef{
}
this.workdir = workdir;
}
/**
* Add an libSet.
*/
public LibrarySet createLibset() {
if (isReference()){
throw noChildrenAllowed();
}
LibrarySet lib = new LibrarySet();
libSet.addElement(lib);
return lib;
}
public String getLibSetString(){
String libString = null;
for (int i = 0; i < libSet.size(); i++){
String[] libList = libSet.get(i).getLibs();
for (int j = 0; j < libList.length; j++){
libString = libString + libList[j] + " ";
public String[] get_libset() {
Set libs = new LinkedHashSet();
Iterator iter = _libset.iterator();
while (iter.hasNext()) {
LibrarySet librarySet = (LibrarySet)iter.next();
File basedir = librarySet.getDir(getProject());
String[] libStrArray = librarySet.getLibs();
for (int i = 0 ; i < libStrArray.length; i ++) {
if (basedir != null) {
File libFile = new File(libStrArray[i]);
if (libFile.isAbsolute()) {
libs.add(libFile.getPath());
}
else {
libs.add(basedir.getPath() + File.separatorChar + libFile.getPath());
}
}
else {
libs.add(libStrArray[i]);
}
}
}
return libString;
return (String[])libs.toArray(new String[libs.size()]);
}
public Vector<LibrarySet> getLibSet(){
return this.libSet;
public String getOutputDelimiter() {
return outputDelimiter;
}
/**
* Add map element
*/
public void addMap(UserDefineElement mapElement){
if (isReference()){
throw noChildrenAllowed();
}else{
this.map.addElement(mapElement);
}
}
public Vector<UserDefineElement> getMap (){
return this.map;
}
public String getMapvalue (){
if (this.map.size() > 0){
/*
* If user set more than one map use the first one.
*/
return this.map.get(0).value;
}
return null;
}
public String getMapFlag(){
if (this.map.size() > 0){
/*
* If user set more than one map use the first one.
*/
return this.map.get(0).flag;
}
return null;
}
/**
* Add pdb element
*/
public void addPdb(UserDefineElement pdbElement){
if (isReference()){
throw noChildrenAllowed();
}
this.pdb.addElement(pdbElement);
}
public Vector<UserDefineElement> getPdb(){
return this.pdb;
}
public String getPdbvalue (){
if (this.pdb.size() > 0){
/*
* If user set more than one pdb use the first one.
*
*/
return this.pdb.get(0).value;
}
return null;
}
public String getPdbFlag(){
if (this.pdb.size() > 0){
/*
* If user set more than one pdb use the first one.
*/
return this.pdb.get(0).flag;
}
return null;
}
/**
* add entryPoint element.
*/
public void addEntryPoint(UserDefineElement entryPointElement){
if (isReference()){
throw noChildrenAllowed();
}
this.entryPoint.addElement(entryPointElement);
}
public Vector<UserDefineElement> getEntryPoint(){
return this.entryPoint;
}
public String getEntryPointvalue (){
if (this.entryPoint.size() > 0){
/*
* If user set more than one entryPoint use the first one.
*/
return this.entryPoint.get(0).value;
}
return null;
}
public String getEntryPointFlag(){
if (this.entryPoint.size() > 0){
/*
* If user set more than one entry point use the first one.
*/
return this.entryPoint.get(0).flag;
}
return null;
}
/**
* Add subSystem element.
*/
public void addSubSystem (UserDefineElement subSystem){
if (isReference()){
throw noChildrenAllowed();
}
this.subSystem.addElement(subSystem);
}
public Vector<UserDefineElement> getSubSystem (){
return this.subSystem;
}
public String getSubSystemvalue (){
if (this.subSystem.size() > 0){
/*
* If user set more than one subsystem use the first one.
*/
return this.subSystem.get(0).value;
}
return null;
}
public String getSubSystemFlag(){
if (this.subSystem.size() > 0){
/*
* If user set more than one subsystem use the first one.
*/
return this.subSystem.get(0).flag;
}
return null;
}
/**
* Add includeFile element
*/
public void addIncludeFile (UserDefineElement includeFile){
if (isReference()){
throw noChildrenAllowed();
}
this.includeFiles.addElement(includeFile);
}
public Vector<UserDefineElement> getIncludeFiles(){
return this.includeFiles;
}
public String getIncludeFile (){
if (this.includeFiles.size() > 0){
/*
* If user set more than one map use the first one.
*/
return this.includeFiles.get(0).value;
}
return null;
}
public String getIncludeFileFlag(){
if (this.includeFiles.size() > 0){
/*
* If user set more than one map use the first one.
*/
return this.includeFiles.get(0).flag;
}
return null;
}
/**
* Add OutputFile element
*/
public void addOutputFile (UserDefineElement outPutFile){
if (isReference()){
throw noChildrenAllowed();
}
this.outPutFiles.addElement(outPutFile);
}
public Vector<UserDefineElement> getOutputFiles(){
return this.outPutFiles;
}
public String getOutputFile (){
if (this.outPutFiles.size() > 0){
/*
* If user set more than one map use the first one.
*/
return this.outPutFiles.get(0).value;
}
return null;
}
public String getOutPutFlag(){
if (this.outPutFiles.size() > 0){
/*
* If user set more than one map use the first one.
*/
return this.outPutFiles.get(0).flag;
}
return null;
}
/**
* Add fileSet list
*/
public void addFileList(FileList fileSet){
this.fileSetList.addElement(fileSet);
}
public Vector<String> getFileList(){
Project p = getProject();
Vector<String> fileListVector = new Vector<String>();
for (int i = 0; i < this.fileSetList.size(); i++){
String[] tempStrList = this.fileSetList.get(i).getFiles(p);
for (int j = 0; j < tempStrList.length; j++){
fileListVector .addElement(tempStrList[j]);
}
}
return fileListVector;
public void setOutputDelimiter(String outputDelimiter) {
this.outputDelimiter = outputDelimiter;
}
}