From 851383895527019b9541a1ce5b31a9cd26f7f9c4 Mon Sep 17 00:00:00 2001 From: John Camelon Date: Thu, 31 Jul 2003 13:20:37 +0000 Subject: [PATCH] Patch for Sean Evoy I am in the process of documenting the build model and as I go along, a number of things will have to be cleaned up in the actual model itself. This patch is purely a bookeeping change to make it easier for me to maintain the build model in the face of these changes as we go forward. Where I used to access XML elements using hard-coded strings, I have moved the string into the appropriate interface class. If the name of the attribute changes in the future, I only have to update it one place. I have also begun the process of renaming certain attributes of the schema to make them better reflect what they are doing. My hope is that if they have intuitive names, toolchain implementers will have less difficulty understanding their intent. In any case, I have changed four attribute names; optionRef -> optionReference, toolRef -> toolReference, optionValue -> listOptionValue, and optionEnum -> enumeratedOptionValue. Unfortunately, these changes will invalidate the dot-cdtbuild files for any managed build projects in your workspace. If you can't bear to create a new project, move the files over, and set-up the compiler options again, you can always hand-edit the changes in the file yourself. Just remember to restart CDT after you do so. --- core/org.eclipse.cdt.core.tests/ChangeLog | 5 + core/org.eclipse.cdt.core.tests/plugin.xml | 40 +++--- core/org.eclipse.cdt.core/ChangeLog | 25 ++++ .../cdt/core/build/managed/IBuildObject.java | 26 ++-- .../core/build/managed/IConfiguration.java | 3 + .../cdt/core/build/managed/IOption.java | 17 +++ .../core/build/managed/IOptionCategory.java | 3 + .../eclipse/cdt/core/build/managed/ITool.java | 9 ++ .../core/build/managed/Configuration.java | 26 ++-- .../internal/core/build/managed/Option.java | 38 +++--- .../core/build/managed/OptionCategory.java | 8 +- .../core/build/managed/OptionReference.java | 30 ++--- .../cdt/internal/core/build/managed/Tool.java | 28 ++--- .../core/build/managed/ToolReference.java | 8 +- .../schema/ManagedBuildTools.exsd | 115 +++++++++++++----- core/org.eclipse.cdt.ui/ChangeLog | 5 + core/org.eclipse.cdt.ui/plugin.xml | 32 ++--- 17 files changed, 269 insertions(+), 149 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog index 96c1b135c25..24408c5cd8f 100644 --- a/core/org.eclipse.cdt.core.tests/ChangeLog +++ b/core/org.eclipse.cdt.core.tests/ChangeLog @@ -5,6 +5,11 @@ The CModelElementsTests has the pointer to function test back in its original place (a variable) +2003-07-30 Sean Evoy + * plugin.xml: + Updated the attribute names to reflect changes to the ManagedBuildInfo + extension point schema. + 2003-07-30 Victor Mozgin Moved testBug39532() from ASTFailedTests.java to QuickParseASTTests.java. diff --git a/core/org.eclipse.cdt.core.tests/plugin.xml b/core/org.eclipse.cdt.core.tests/plugin.xml index c0fd0d79f94..efbea920c9a 100644 --- a/core/org.eclipse.cdt.core.tests/plugin.xml +++ b/core/org.eclipse.cdt.core.tests/plugin.xml @@ -52,12 +52,12 @@ command="-L" valueType="stringList" id="list.option"> - - - + - + - - - - + - - + + - - - + - + diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog index 5a40d48ba6c..4d1c76eda5c 100644 --- a/core/org.eclipse.cdt.core/ChangeLog +++ b/core/org.eclipse.cdt.core/ChangeLog @@ -1,6 +1,31 @@ 2003-07-30 Hoda Amer The C Model recognizes pointers to functions. +2003-07-30 Sean Evoy + The managed build model is going to go through a bit of change over the next while. + In order to make that more manageable, I have moved all the hard-coded strings used + to access the XML elements of the extension point definition into the appropriate + interface classes. + + * build/org/eclipse/cdt/core/build/managed/IBuildObject.java + * build/org/eclipse/cdt/core/build/managed/IConfiguration.java + * build/org/eclipse/cdt/core/build/managed/IOption.java + * build/org/eclipse/cdt/core/build/managed/IOptionCategory.java + * build/org/eclipse/cdt/core/build/managed/ITool.java + * build/org/eclipse/cdt/internal/core/build/managed/Configuration.java + * build/org/eclipse/cdt/internal/core/build/managed/Option.java + * build/org/eclipse/cdt/internal/core/build/managed/OptionCategory.java + * build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java + * build/org/eclipse/cdt/internal/core/build/managed/Tool.java + * build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java: + Moved the hard-coded strings used to access the XML elements into appropropriate interfaces. + + * schema/ManagedBuildTools.exsd: + Renamed four attributes optionRef->optionReference, toolRef->toolReference, + optionValue->listOptionValue, and optionEnum->enumeratedOptionValue. In the first + 2 cases, I was just trying to remove the tech-ese from the names. In the later 2, I + tried to use a more descriptive name. + 2003-07-29 Alain Magloire To discover if an application has debug info for DWARF-2 format diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IBuildObject.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IBuildObject.java index 1cce486b013..2529da7ec8b 100644 --- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IBuildObject.java +++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IBuildObject.java @@ -1,21 +1,21 @@ -/* - * Created on Apr 9, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ +/********************************************************************** + * Copyright (c) 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ package org.eclipse.cdt.core.build.managed; -/** - * @author dschaefe - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ public interface IBuildObject { + // Schema element names + public static final String ID = "id"; + public static final String NAME = "name"; public String getId(); - public String getName(); } diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java index 65d8309258e..84cf2f187cb 100644 --- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java +++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java @@ -13,6 +13,9 @@ package org.eclipse.cdt.core.build.managed; import org.eclipse.core.resources.IResource; public interface IConfiguration extends IBuildObject { + // Schema element names + public static final String TOOL_REF = "toolReference"; + public static final String PARENT = "parent"; /** * Returns the target for this configuration. diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java index c4042236d27..006044796e8 100644 --- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java +++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java @@ -23,6 +23,23 @@ public interface IOption extends IBuildObject { public static final int PREPROCESSOR_SYMBOLS = 5; public static final int LIBRARIES = 6; + // Schema element names for options + public static final String CATEGORY = "category"; + public static final String COMMAND = "command"; + public static final String DEFAULT_VALUE = "defaultValue"; + public static final String ENUM_VALUE = "enumeratedOptionValue"; + public static final String IS_DEFAULT = "isDefault"; + public static final String LIST_VALUE = "listOptionValue"; + public static final String TYPE_BOOL = "boolean"; + public static final String TYPE_ENUM = "enumerated"; + public static final String TYPE_INC_PATH = "includePath"; + public static final String TYPE_LIB = "libs"; + public static final String TYPE_STRING = "string"; + public static final String TYPE_STR_LIST = "stringList"; + public static final String VALUE_TYPE = "valueType"; + public static final String VALUE = "value"; + + /** * If this option is defined as an enumeration, this function returns * the list of possible values for that enum. diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOptionCategory.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOptionCategory.java index 4ba523abd7a..e0b5a7bfcf6 100644 --- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOptionCategory.java +++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOptionCategory.java @@ -15,6 +15,9 @@ package org.eclipse.cdt.core.build.managed; */ public interface IOptionCategory extends IBuildObject { + // Schema element names + public static final String PARENT = "parent"; + /** * Returns the list of children of this node in the option category tree * diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java index e7cef1c63c9..d7002965208 100644 --- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java +++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java @@ -14,6 +14,15 @@ package org.eclipse.cdt.core.build.managed; * */ public interface ITool extends IBuildObject { + // Schema element names + public static final String COMMAND = "command"; + public static final String OPTION = "option"; + public static final String OPTION_CAT = "optionCategory"; + public static final String OPTION_REF = "optionReference"; + public static final String OUTPUT_FLAG = "outputFlag"; + public static final String OUTPUT_PREFIX = "outputPrefix"; + public static final String OUTPUTS = "outputs"; + public static final String SOURCES = "sources"; public static final String WHITE_SPACE = " "; /** diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java index 45af3a8f52a..94b2b27acf6 100644 --- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java +++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java @@ -74,18 +74,18 @@ public class Configuration extends BuildObject implements IConfiguration { this.target = target; // id - setId(element.getAttribute("id")); + setId(element.getAttribute(IConfiguration.ID)); // hook me up target.addConfiguration(this); // name - setName(element.getAttribute("name")); + setName(element.getAttribute(IConfiguration.NAME)); IConfigurationElement[] configElements = element.getChildren(); for (int l = 0; l < configElements.length; ++l) { IConfigurationElement configElement = configElements[l]; - if (configElement.getName().equals("toolRef")) { + if (configElement.getName().equals(IConfiguration.TOOL_REF)) { new ToolReference(this, configElement); } } @@ -101,21 +101,21 @@ public class Configuration extends BuildObject implements IConfiguration { this.target = target; // id - setId(element.getAttribute("id")); + setId(element.getAttribute(IConfiguration.ID)); // hook me up target.addConfiguration(this); // name - if (element.hasAttribute("name")) - setName(element.getAttribute("name")); + if (element.hasAttribute(IConfiguration.NAME)) + setName(element.getAttribute(IConfiguration.NAME)); - if (element.hasAttribute("parent")) { + if (element.hasAttribute(IConfiguration.PARENT)) { // See if the target has a parent ITarget targetParent = target.getParent(); // If so, then get my parent from it if (targetParent != null) { - parent = targetParent.getConfiguration(element.getAttribute("parent")); + parent = targetParent.getConfiguration(element.getAttribute(IConfiguration.PARENT)); } else { parent = null; @@ -125,7 +125,7 @@ public class Configuration extends BuildObject implements IConfiguration { NodeList configElements = element.getChildNodes(); for (int i = 0; i < configElements.getLength(); ++i) { Node configElement = configElements.item(i); - if (configElement.getNodeName().equals("toolRef")) { + if (configElement.getNodeName().equals(IConfiguration.TOOL_REF)) { new ToolReference(this, (Element)configElement); } } @@ -139,18 +139,18 @@ public class Configuration extends BuildObject implements IConfiguration { * @param element */ public void serialize(Document doc, Element element) { - element.setAttribute("id", id); + element.setAttribute(IConfiguration.ID, id); if (name != null) - element.setAttribute("name", name); + element.setAttribute(IConfiguration.NAME, name); if (parent != null) - element.setAttribute("parent", parent.getId()); + element.setAttribute(IConfiguration.PARENT, parent.getId()); if (toolReferences != null) for (int i = 0; i < toolReferences.size(); ++i) { ToolReference toolRef = (ToolReference)toolReferences.get(i); - Element toolRefElement = doc.createElement("toolRef"); + Element toolRefElement = doc.createElement(IConfiguration.TOOL_REF); element.appendChild(toolRefElement); toolRef.serialize(doc, toolRefElement); } diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java index 17a7cbfef34..e3e5cd59563 100644 --- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java +++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java @@ -47,37 +47,37 @@ public class Option extends BuildObject implements IOption { this(tool); // Get the unique id of the option - setId(element.getAttribute("id")); + setId(element.getAttribute(IOption.ID)); // Hook me up to a tool tool.addOption(this); // Get the option Name (this is what the user will see in the UI) - setName(element.getAttribute("name")); + setName(element.getAttribute(IOption.NAME)); // Options can be grouped into categories - String categoryId = element.getAttribute("category"); + String categoryId = element.getAttribute(IOption.CATEGORY); if (categoryId != null) setCategory(tool.getOptionCategory(categoryId)); // Get the command defined for the option - command = element.getAttribute("command"); + command = element.getAttribute(IOption.COMMAND); // Options hold different types of values - String valueTypeStr = element.getAttribute("valueType"); + String valueTypeStr = element.getAttribute(IOption.VALUE_TYPE); if (valueTypeStr == null) valueType = -1; - else if (valueTypeStr.equals("string")) + else if (valueTypeStr.equals(IOption.TYPE_STRING)) valueType = IOption.STRING; - else if (valueTypeStr.equals("stringList")) + else if (valueTypeStr.equals(IOption.TYPE_STR_LIST)) valueType = IOption.STRING_LIST; - else if (valueTypeStr.equals("boolean")) + else if (valueTypeStr.equals(IOption.TYPE_BOOL)) valueType = IOption.BOOLEAN; - else if (valueTypeStr.equals("enumerated")) + else if (valueTypeStr.equals(IOption.TYPE_ENUM)) valueType = IOption.ENUMERATED; - else if (valueTypeStr.equals("includePath")) + else if (valueTypeStr.equals(IOption.TYPE_INC_PATH)) valueType = IOption.INCLUDE_PATH; - else if (valueTypeStr.equals("libs")) + else if (valueTypeStr.equals(IOption.TYPE_LIB)) valueType = IOption.LIBRARIES; else valueType = IOption.PREPROCESSOR_SYMBOLS; @@ -87,21 +87,21 @@ public class Option extends BuildObject implements IOption { switch (valueType) { case IOption.BOOLEAN: // Convert the string to a boolean - value = new Boolean(element.getAttribute("defaultValue")); + value = new Boolean(element.getAttribute(IOption.DEFAULT_VALUE)); break; case IOption.STRING: // Just get the value out of the option directly - value = element.getAttribute("defaultValue"); + value = element.getAttribute(IOption.DEFAULT_VALUE); break; case IOption.ENUMERATED: List enumList = new ArrayList(); - IConfigurationElement[] enumElements = element.getChildren("optionEnum"); + IConfigurationElement[] enumElements = element.getChildren(IOption.ENUM_VALUE); for (int i = 0; i < enumElements.length; ++i) { - String optName = enumElements[i].getAttribute("name"); - String optCommand = enumElements[i].getAttribute("command"); + String optName = enumElements[i].getAttribute(IOption.NAME); + String optCommand = enumElements[i].getAttribute(IOption.COMMAND); enumList.add(optName); enumCommands.put(optName, optCommand); - Boolean isDefault = new Boolean(enumElements[i].getAttribute("isDefault")); + Boolean isDefault = new Boolean(enumElements[i].getAttribute(IOption.IS_DEFAULT)); if (isDefault.booleanValue()) { defaultEnumName = optName; } @@ -113,9 +113,9 @@ public class Option extends BuildObject implements IOption { case IOption.PREPROCESSOR_SYMBOLS: case IOption.LIBRARIES: List valueList = new ArrayList(); - IConfigurationElement[] valueElements = element.getChildren("optionValue"); + IConfigurationElement[] valueElements = element.getChildren(IOption.LIST_VALUE); for (int i = 0; i < valueElements.length; ++i) { - valueList.add(valueElements[i].getAttribute("value")); + valueList.add(valueElements[i].getAttribute(IOption.VALUE)); } value = valueList; break; diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionCategory.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionCategory.java index 41b4af476a5..e8e6ec6e8a8 100644 --- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionCategory.java +++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionCategory.java @@ -34,17 +34,17 @@ public class OptionCategory extends BuildObject implements IOptionCategory { } public OptionCategory(Tool tool, IConfigurationElement element) { - String parentId = element.getAttribute("parent"); + String parentId = element.getAttribute(IOptionCategory.PARENT); if (parentId != null) - owner = tool.getOptionCategory(element.getAttribute("parent")); + owner = tool.getOptionCategory(element.getAttribute(IOptionCategory.PARENT)); else owner = tool; // id - setId(element.getAttribute("id")); + setId(element.getAttribute(IOptionCategory.ID)); // Name - setName(element.getAttribute("name")); + setName(element.getAttribute(IOptionCategory.NAME)); // Hook me in if (owner instanceof Tool) diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java index e4db4b0530e..f1c15492425 100644 --- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java +++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java @@ -60,17 +60,17 @@ public class OptionReference implements IOption { */ public OptionReference(ToolReference owner, IConfigurationElement element) { this.owner = owner; - option = owner.getTool().getOption(element.getAttribute("id")); + option = owner.getTool().getOption(element.getAttribute(IOption.ID)); owner.addOptionReference(this); // value switch (option.getValueType()) { case IOption.BOOLEAN: - value = new Boolean(element.getAttribute("defaultValue")); + value = new Boolean(element.getAttribute(IOption.DEFAULT_VALUE)); break; case IOption.STRING: - value = element.getAttribute("defaultValue"); + value = element.getAttribute(IOption.DEFAULT_VALUE); break; case IOption.ENUMERATED: try { @@ -84,9 +84,9 @@ public class OptionReference implements IOption { case IOption.PREPROCESSOR_SYMBOLS: case IOption.LIBRARIES: List valueList = new ArrayList(); - IConfigurationElement[] valueElements = element.getChildren("optionValue"); + IConfigurationElement[] valueElements = element.getChildren(IOption.LIST_VALUE); for (int i = 0; i < valueElements.length; ++i) { - valueList.add(valueElements[i].getAttribute("value")); + valueList.add(valueElements[i].getAttribute(IOption.VALUE)); } value = valueList; break; @@ -101,29 +101,29 @@ public class OptionReference implements IOption { */ public OptionReference(ToolReference owner, Element element) { this.owner = owner; - option = owner.getTool().getOption(element.getAttribute("id")); + option = owner.getTool().getOption(element.getAttribute(IOption.ID)); owner.addOptionReference(this); // value switch (option.getValueType()) { case IOption.BOOLEAN: - value = new Boolean(element.getAttribute("defaultValue")); + value = new Boolean(element.getAttribute(IOption.DEFAULT_VALUE)); break; case IOption.STRING: case IOption.ENUMERATED: - value = (String) element.getAttribute("defaultValue"); + value = (String) element.getAttribute(IOption.DEFAULT_VALUE); break; case IOption.STRING_LIST: case IOption.INCLUDE_PATH: case IOption.PREPROCESSOR_SYMBOLS: case IOption.LIBRARIES: List valueList = new ArrayList(); - NodeList nodes = element.getElementsByTagName("optionValue"); + NodeList nodes = element.getElementsByTagName(IOption.LIST_VALUE); for (int i = 0; i < nodes.getLength(); ++i) { Node node = nodes.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { - valueList.add(((Element)node).getAttribute("value")); + valueList.add(((Element)node).getAttribute(IOption.VALUE)); } } value = valueList; @@ -139,16 +139,16 @@ public class OptionReference implements IOption { * @param element */ public void serialize(Document doc, Element element) { - element.setAttribute("id", option.getId()); + element.setAttribute(IOption.ID, option.getId()); // value switch (option.getValueType()) { case IOption.BOOLEAN: - element.setAttribute("defaultValue", ((Boolean)value).toString()); + element.setAttribute(IOption.DEFAULT_VALUE, ((Boolean)value).toString()); break; case IOption.STRING: case IOption.ENUMERATED: - element.setAttribute("defaultValue", (String)value); + element.setAttribute(IOption.DEFAULT_VALUE, (String)value); break; case IOption.STRING_LIST: case IOption.INCLUDE_PATH: @@ -157,8 +157,8 @@ public class OptionReference implements IOption { ArrayList stringList = (ArrayList)value; ListIterator iter = stringList.listIterator(); while (iter.hasNext()) { - Element valueElement = doc.createElement("optionValue"); - valueElement.setAttribute("value", (String)iter.next()); + Element valueElement = doc.createElement(IOption.LIST_VALUE); + valueElement.setAttribute(IOption.VALUE, (String)iter.next()); element.appendChild(valueElement); } break; diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java index 5564b5b72b7..488e1fb8d95 100644 --- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java +++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java @@ -62,42 +62,42 @@ public class Tool extends BuildObject implements ITool, IOptionCategory { this(target); // id - setId(element.getAttribute("id")); + setId(element.getAttribute(ITool.ID)); // hook me up target.addTool(this); // name - setName(element.getAttribute("name")); + setName(element.getAttribute(ITool.NAME)); // Get the supported input file extension - String inputs = element.getAttribute("sources") == null ? + String inputs = element.getAttribute(ITool.SOURCES) == null ? new String() : - element.getAttribute("sources"); + element.getAttribute(ITool.SOURCES); StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR); while (tokenizer.hasMoreElements()) { getInputExtensions().add(tokenizer.nextElement()); } // Get the output extension - outputExtension = element.getAttribute("outputs") == null ? + outputExtension = element.getAttribute(ITool.OUTPUTS) == null ? new String() : - element.getAttribute("outputs"); + element.getAttribute(ITool.OUTPUTS); // Get the tool invocation - command = element.getAttribute("command") == null ? + command = element.getAttribute(ITool.COMMAND) == null ? new String() : - element.getAttribute("command"); + element.getAttribute(ITool.COMMAND); // Get the flag to control output - outputFlag = element.getAttribute("outputFlag") == null ? + outputFlag = element.getAttribute(ITool.OUTPUT_FLAG) == null ? new String() : - element.getAttribute("outputFlag"); + element.getAttribute(ITool.OUTPUT_FLAG); // Get the output prefix - outputPrefix = element.getAttribute("outputPrefix") == null ? + outputPrefix = element.getAttribute(ITool.OUTPUT_PREFIX) == null ? new String() : - element.getAttribute("outputPrefix"); + element.getAttribute(ITool.OUTPUT_PREFIX); // set up the category map categoryMap = new HashMap(); @@ -107,9 +107,9 @@ public class Tool extends BuildObject implements ITool, IOptionCategory { IConfigurationElement[] toolElements = element.getChildren(); for (int l = 0; l < toolElements.length; ++l) { IConfigurationElement toolElement = toolElements[l]; - if (toolElement.getName().equals("option")) { + if (toolElement.getName().equals(ITool.OPTION)) { new Option(this, toolElement); - } else if (toolElement.getName().equals("optionCategory")) { + } else if (toolElement.getName().equals(ITool.OPTION_CAT)) { new OptionCategory(this, toolElement); } } diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java index 3ce12a2890f..a670db24dc6 100644 --- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java +++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java @@ -65,7 +65,7 @@ public class ToolReference implements ITool { IConfigurationElement[] toolElements = element.getChildren(); for (int m = 0; m < toolElements.length; ++m) { IConfigurationElement toolElement = toolElements[m]; - if (toolElement.getName().equals("optionRef")) { + if (toolElement.getName().equals(ITool.OPTION_REF)) { new OptionReference(this, toolElement); } } @@ -89,7 +89,7 @@ public class ToolReference implements ITool { NodeList configElements = element.getChildNodes(); for (int i = 0; i < configElements.getLength(); ++i) { Node configElement = configElements.item(i); - if (configElement.getNodeName().equals("optionRef")) { + if (configElement.getNodeName().equals(ITool.OPTION_REF)) { new OptionReference(this, (Element)configElement); } } @@ -103,12 +103,12 @@ public class ToolReference implements ITool { * to persist settings. */ public void serialize(Document doc, Element element) { - element.setAttribute("id", parent.getId()); + element.setAttribute(ITool.ID, parent.getId()); if (optionReferences != null) for (int i = 0; i < optionReferences.size(); ++i) { OptionReference optionRef = (OptionReference)optionReferences.get(i); - Element optionRefElement = doc.createElement("optionRef"); + Element optionRefElement = doc.createElement(ITool.OPTION_REF); element.appendChild(optionRefElement); optionRef.serialize(doc, optionRefElement); } diff --git a/core/org.eclipse.cdt.core/schema/ManagedBuildTools.exsd b/core/org.eclipse.cdt.core/schema/ManagedBuildTools.exsd index c87d96db2e3..49276a0ccd3 100644 --- a/core/org.eclipse.cdt.core/schema/ManagedBuildTools.exsd +++ b/core/org.eclipse.cdt.core/schema/ManagedBuildTools.exsd @@ -6,7 +6,7 @@ - Describes targets, configurations, and toolchains for the build system. + The managed build information model describes targets, configurations, and toolchains for the build system. @@ -80,16 +80,6 @@ - - - - A reference to the class that will calculate the dependencies for a given file. For example, a compiler might require a dependency calculator for source files that discovers the dependenncies on header files. - - - - - - @@ -111,14 +101,29 @@ + + + + This is an optional field that specifies the class that provides the dependency calculation for a given tool. + + + + + + + + + An option is associated with a tool. Options can contain boolean values, a simple text string, a selection from an enumerated list, or a list of values. Options also map the value they contain to a command-line flag, such as '-g' in the case of debugging symbol information for compilers. + + - - + + @@ -192,7 +197,7 @@ Two additional types exist to flag options of special relevance to the build mod - + Defines a single value of an enumerated option. @@ -231,31 +236,36 @@ Two additional types exist to flag options of special relevance to the build mod + + + A configuration is used to gather together certain default tools and options to build target a certain way. For example, a "Debug" configuration might supply tools with the options set to build with debugging symbols, whereas a "Release" configuration would supply tools with options set to create the best performance. + + - + - + Unique identifier for the configuration. - + A descriptive name for the configuration to be used in the UI. - + - + @@ -267,7 +277,7 @@ Two additional types exist to flag options of special relevance to the build mod - + Option references hold onto information the user has changed through the UI. Not all fields will be populated, depending on the option type the reference overrides. For example, the 'name' field is used by enumerated options only. @@ -277,7 +287,7 @@ Two additional types exist to flag options of special relevance to the build mod - + The ID of the option the reference is for. @@ -392,38 +402,38 @@ Two additional types exist to flag options of special relevance to the build mod - + Used by the build model to uniquely identify the option category. - + A human-readable category name, such as 'Preprocessor Options'. This will be the name the user sees displayed in the UI. - + Option categories can be nested inside other option categories. This is the ID of the owner of the category. - + - A value for defining individual elements of a string list option. + A value for defining individual elements of a list option. - + The contents of the list item. @@ -444,7 +454,49 @@ Two additional types exist to flag options of special relevance to the build mod - [Enter extension point usage example here.] + The following is an example of the extension point usage: +<p> +<pre> + <extension + id="buildExample" + name="Tools for Build Example" + point="org.eclipse.cdt.core.ManagedBuildInfo"> + <target + makeFlags="-k" + isTest="false" + cleanCommand="rm -rf" + name="Executable" + defaultExtension=".exe" + isAbstract="false" + makeCommand="make" + id="example.target.executable"> + <tool + sources="C" + name="Compiler" + outputFlag="-o" + outputs="exe" + command="g++" + id="executable.compiler"> + <optionCategory + owner="executable.compiler" + name="Flags" + id="compiler.category.flags"> + </optionCategory> + <option + defaultValue="-c" + name="Compiler Flags" + category="compiler.category.flags" + valueType="string" + id="category.flags.comp_flags"> + </option> + </tool> + <configuration + name="Default" + id="example.config.default"> + </configuration> + </target> + </extension> +</pre> @@ -453,7 +505,7 @@ Two additional types exist to flag options of special relevance to the build mod - [Enter API information here.] + @@ -462,7 +514,7 @@ Two additional types exist to flag options of special relevance to the build mod - [Enter information about supplied implementation of this extension point.] + An implementation of this extension point is supplied in <samp>org.eclipse.cdt.ui</samp> @@ -471,7 +523,8 @@ Two additional types exist to flag options of special relevance to the build mod - + Copyright (c) 2003 IBM Corporation and others. +All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available on the <a href="http://www.eclipse.org/legal/cpl-v10.html"> Eclipse</a> website. diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index 17d5b60c8d1..7a0ec53a332 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,6 +1,11 @@ 2003-07-30 Hoda Amer The New Class Wizard uses search to look for base classes in the workspace. +2003-07-30 Sean Evoy + * plugin.xml: + Updated the attribute names to reflect changes to the ManagedBuildInfo + extension point schema. + 2003-07-29 Andrew Niefer - Refactoring Search Result Collecting: * CSearchResultCollector now extends BasicSearchResultCollector diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml index 421478d7bce..6207ef29f80 100644 --- a/core/org.eclipse.cdt.ui/plugin.xml +++ b/core/org.eclipse.cdt.ui/plugin.xml @@ -671,55 +671,55 @@ category="cygwin.compiler.category.general" valueType="enumerated" id="cygwin.compiler.general.optimization.level"> - - - + - - + - - + - +