diff --git a/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd b/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd index 2e18a5f6370..ad30370a0d1 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd +++ b/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd @@ -16,6 +16,7 @@ + @@ -493,6 +494,26 @@ Additional special types exist to flag options of special relevance to the build + + + + An optional element that allows a tool implementor to supply a class that creates one or more dynamic toolchain elements. For example, the class might create a new tool reference based on the contents of a special file, and a new target that uses that reference. + + + + + + + + + + + + + + + + diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedConfigElement.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedConfigElement.java new file mode 100644 index 00000000000..73c2873593c --- /dev/null +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedConfigElement.java @@ -0,0 +1,42 @@ +/********************************************************************** + * Copyright (c) 2004 TimeSys 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: + * TimeSys Corporation - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.managedbuilder.core; + +/** + * This class represents a configuration element for loading the managed build + * model objects. They can either be loaded from the ManagedBuildInfo extension + * point, or from an instance of IManagedConfigProvider. + */ +public interface IManagedConfigElement { + + /** + * @return the name of this config element (i.e. tag name of the + * corresponding xml element) + */ + String getName(); + + /** + * @return the value of the attribute with the given name, or null + * if the attribute is unset. + */ + String getAttribute(String name); + + /** + * @return all child elements of the current config element. + */ + IManagedConfigElement[] getChildren(); + + /** + * @return all child elements of the current config element, such that + * child.getName().equals(elementName). + */ + IManagedConfigElement[] getChildren(String elementName); +} diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedConfigElementProvider.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedConfigElementProvider.java new file mode 100644 index 00000000000..e1a02d9e04a --- /dev/null +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedConfigElementProvider.java @@ -0,0 +1,30 @@ +/********************************************************************** + * Copyright (c) 2004 TimeSys 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: + * TimeSys Corporation - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.managedbuilder.core; +/** + * Clients may implement this interface to dynamically provided the config + * information that is otherwise specified in the ManagedBuidInfo extension + * point. It corresponds to the configProvider sub-element of + * the ManagedBuildInfo extension point. + */ +public interface IManagedConfigElementProvider { + + String ELEMENT_NAME = "dynamicElementProvider"; //$NON-NLS-1$ + String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ + + /** + * Each configuration element returned from this method is treated as if + * it were a direct sub-child of a ManagedBuildInfo extension. As such + * it should conform to ManagedBuildTools.exsd. The only exception is it + * should not contain nested configProvider elements. + */ + IManagedConfigElement[] getConfigElements(); +} diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java index 10eb0ffcc58..e2a5a4c4823 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java @@ -34,6 +34,7 @@ import org.eclipse.cdt.core.parser.IScannerInfo; import org.eclipse.cdt.core.parser.IScannerInfoChangeListener; import org.eclipse.cdt.core.parser.IScannerInfoProvider; import org.eclipse.cdt.managedbuilder.internal.core.Configuration; +import org.eclipse.cdt.managedbuilder.internal.core.DefaultManagedConfigElement; import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo; import org.eclipse.cdt.managedbuilder.internal.core.ToolReference; import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; @@ -357,7 +358,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI IConfiguration parentConfig = configuration.getParent(); // Get the config element for the parent from the map - IConfigurationElement configElement = getConfigElement(parentConfig); + IManagedConfigElement configElement = getConfigElement(parentConfig); // reset the configuration ((Configuration)configuration).reset(configElement); @@ -464,20 +465,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI for (int i = 0; i < extensions.length; ++i) { IExtension extension = extensions[i]; IConfigurationElement[] elements = extension.getConfigurationElements(); - for (int toolIndex = 0; toolIndex < elements.length; ++toolIndex) { - try { - IConfigurationElement element = elements[toolIndex]; - // Load the targets - if (element.getName().equals(ITool.TOOL_ELEMENT_NAME)) { - new Tool(element); - } else if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME)) { - new Target(element); - } - } catch (Exception ex) { - // TODO: log - ex.printStackTrace(); - } - } + loadConfigElements(DefaultManagedConfigElement.convertArray(elements)); } // Then call resolve. Iterator toolIter = getExtensionToolMap().values().iterator(); @@ -504,6 +492,40 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI extensionTargetsLoaded = true; } + private static void loadConfigElements(IManagedConfigElement[] elements) { + for (int toolIndex = 0; toolIndex < elements.length; ++toolIndex) { + try { + IManagedConfigElement element = elements[toolIndex]; + // Load the targets + if (element.getName().equals(ITool.TOOL_ELEMENT_NAME)) { + new Tool(element); + } else if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME)) { + new Target(element); + } else if (element.getName().equals(IManagedConfigElementProvider.ELEMENT_NAME)) { + // don't allow nested config providers. + if (element instanceof DefaultManagedConfigElement) { + IManagedConfigElement[] providedConfigs; + IManagedConfigElementProvider provider = createConfigProvider( + (DefaultManagedConfigElement)element); + providedConfigs = provider.getConfigElements(); + loadConfigElements(providedConfigs); + } + } + } catch (Exception ex) { + // TODO: log + ex.printStackTrace(); + } + } + } + + private static IManagedConfigElementProvider createConfigProvider( + DefaultManagedConfigElement element) throws CoreException { + + return (IManagedConfigElementProvider)element.getConfigurationElement(). + createExecutableExtension(IManagedConfigElementProvider.CLASS_ATTRIBUTE); + } + + /** * @param project * @return @@ -674,7 +696,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI * This method public for implementation reasons. Not intended for use * by clients. */ - public static void putConfigElement(IBuildObject buildObj, IConfigurationElement configElement) { + public static void putConfigElement(IBuildObject buildObj, IManagedConfigElement configElement) { getConfigElementMap().put(buildObj, configElement); } @@ -682,8 +704,8 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI * This method public for implementation reasons. Not intended for use * by clients. */ - public static IConfigurationElement getConfigElement(IBuildObject buildObj) { - return (IConfigurationElement)getConfigElementMap().get(buildObj); + public static IManagedConfigElement getConfigElement(IBuildObject buildObj) { + return (IManagedConfigElement)getConfigElementMap().get(buildObj); } } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java index bb87dbc6af5..cc93da6fa0d 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java @@ -19,6 +19,7 @@ import org.eclipse.cdt.core.CCProjectNature; import org.eclipse.cdt.core.CProjectNature; import org.eclipse.cdt.managedbuilder.core.BuildException; import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.ITarget; import org.eclipse.cdt.managedbuilder.core.ITool; @@ -26,7 +27,6 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -151,7 +151,7 @@ public class Configuration extends BuildObject implements IConfiguration { * @param target The Target the receiver will be added to. * @param element The element from the manifest that contains the default configuration settings. */ - public Configuration(Target target, IConfigurationElement element) { + public Configuration(Target target, IManagedConfigElement element) { this.target = target; // setup for resolving @@ -167,9 +167,9 @@ public class Configuration extends BuildObject implements IConfiguration { // name setName(element.getAttribute(IConfiguration.NAME)); - IConfigurationElement[] configElements = element.getChildren(); + IManagedConfigElement[] configElements = element.getChildren(); for (int l = 0; l < configElements.length; ++l) { - IConfigurationElement configElement = configElements[l]; + IManagedConfigElement configElement = configElements[l]; if (configElement.getName().equals(IConfiguration.TOOLREF_ELEMENT_NAME)) { new ToolReference(this, configElement); } @@ -192,7 +192,7 @@ public class Configuration extends BuildObject implements IConfiguration { public void resolveReferences() { if (!resolved) { resolved = true; -// IConfigurationElement element = ManagedBuildManager.getConfigElement(this); +// IManagedConfigElement element = ManagedBuildManager.getConfigElement(this); Iterator refIter = getLocalToolReferences().iterator(); while (refIter.hasNext()) { ToolReference ref = (ToolReference)refIter.next(); @@ -390,12 +390,12 @@ public class Configuration extends BuildObject implements IConfiguration { /** * @param targetElement */ - public void reset(IConfigurationElement element) { + public void reset(IManagedConfigElement element) { // I just need to reset the tool references getLocalToolReferences().clear(); - IConfigurationElement[] configElements = element.getChildren(); + IManagedConfigElement[] configElements = element.getChildren(); for (int l = 0; l < configElements.length; ++l) { - IConfigurationElement configElement = configElements[l]; + IManagedConfigElement configElement = configElements[l]; if (configElement.getName().equals(IConfiguration.TOOLREF_ELEMENT_NAME)) { ToolReference ref = new ToolReference(this, configElement); ref.resolveReferences(); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/DefaultManagedConfigElement.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/DefaultManagedConfigElement.java new file mode 100644 index 00000000000..fea746f5e30 --- /dev/null +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/DefaultManagedConfigElement.java @@ -0,0 +1,81 @@ +/********************************************************************** + * Copyright (c) 2004 TimeSys 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: + * TimeSys Corporation - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.managedbuilder.internal.core; + +import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; +import org.eclipse.core.runtime.IConfigurationElement; + +/** + * Implements the ManagedConfigElement by delegate all calls to an + * IConfigurationElement instance. This is used to load configuration + * information from the extension point. + */ +public class DefaultManagedConfigElement implements IManagedConfigElement { + + private IConfigurationElement element; + + /** + * @param element + */ + public DefaultManagedConfigElement(IConfigurationElement element) { + this.element = element; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getName() + */ + public String getName() { + return element.getName(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getAttribute(java.lang.String) + */ + public String getAttribute(String name) { + return element.getAttribute(name); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getChildren() + */ + public IManagedConfigElement[] getChildren() { + return convertArray(element.getChildren()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getChildren(java.lang.String) + */ + public IManagedConfigElement[] getChildren(String elementName) { + return convertArray(element.getChildren(elementName)); + } + + /** + * @return + */ + public IConfigurationElement getConfigurationElement() { + return element; + } + + /** + * Convenience method for converting an array of IConfigurationElements + * into an array of IManagedConfigElements. + */ + public static IManagedConfigElement[] convertArray( + IConfigurationElement[] elements) { + + IManagedConfigElement[] ret = new IManagedConfigElement[elements.length]; + for (int i = 0; i < elements.length; i++) { + ret[i] = new DefaultManagedConfigElement(elements[i]); + } + return ret; + } + +} diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java index c26134dadf2..d7746dd6031 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java @@ -17,12 +17,12 @@ import java.util.Map; import org.eclipse.cdt.managedbuilder.core.BuildException; import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.IOptionCategory; import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; -import org.eclipse.core.runtime.IConfigurationElement; public class Option extends BuildObject implements IOption { // Static default return values @@ -44,7 +44,7 @@ public class Option extends BuildObject implements IOption { this.tool = tool; } - public Option(Tool tool, IConfigurationElement element) { + public Option(Tool tool, IManagedConfigElement element) { this(tool); // setup for resolving ManagedBuildManager.putConfigElement(this, element); @@ -96,7 +96,7 @@ public class Option extends BuildObject implements IOption { break; case ENUMERATED: List enumList = new ArrayList(); - IConfigurationElement[] enumElements = element.getChildren(ENUM_VALUE); + IManagedConfigElement[] enumElements = element.getChildren(ENUM_VALUE); for (int i = 0; i < enumElements.length; ++i) { String optName = enumElements[i].getAttribute(NAME); String optCommand = enumElements[i].getAttribute(COMMAND); @@ -116,9 +116,9 @@ public class Option extends BuildObject implements IOption { case OBJECTS: List valueList = new ArrayList(); builtIns = new ArrayList(); - IConfigurationElement[] valueElements = element.getChildren(LIST_VALUE); + IManagedConfigElement[] valueElements = element.getChildren(LIST_VALUE); for (int i = 0; i < valueElements.length; ++i) { - IConfigurationElement valueElement = valueElements[i]; + IManagedConfigElement valueElement = valueElements[i]; Boolean isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN)); if (isBuiltIn.booleanValue()) { builtIns.add(valueElement.getAttribute(LIST_ITEM_VALUE)); @@ -137,7 +137,7 @@ public class Option extends BuildObject implements IOption { public void resolveReferences() { if (!resolved) { resolved = true; - IConfigurationElement element = ManagedBuildManager.getConfigElement(this); + IManagedConfigElement element = ManagedBuildManager.getConfigElement(this); // Options can be grouped into categories String categoryId = element.getAttribute(CATEGORY); if (categoryId != null) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java index ed7f007e0fc..821c8b02b24 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java @@ -14,12 +14,12 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.IOptionCategory; import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.IToolReference; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; -import org.eclipse.core.runtime.IConfigurationElement; /** * @@ -37,7 +37,7 @@ public class OptionCategory extends BuildObject implements IOptionCategory { this.owner = owner; } - public OptionCategory(Tool tool, IConfigurationElement element) { + public OptionCategory(Tool tool, IManagedConfigElement element) { // setup for resolving ManagedBuildManager.putConfigElement(this, element); resolved = false; @@ -56,7 +56,7 @@ public class OptionCategory extends BuildObject implements IOptionCategory { public void resolveReferences() { if (!resolved) { resolved = true; - IConfigurationElement element = ManagedBuildManager.getConfigElement(this); + IManagedConfigElement element = ManagedBuildManager.getConfigElement(this); String parentId = element.getAttribute(IOptionCategory.OWNER); if (parentId != null) owner = tool.getOptionCategory(parentId); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java index 0c5090d4cee..14c8b07bd91 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java @@ -16,12 +16,12 @@ import java.util.List; import java.util.ListIterator; import org.eclipse.cdt.managedbuilder.core.BuildException; +import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.IOptionCategory; import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; -import org.eclipse.core.runtime.IConfigurationElement; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -51,7 +51,7 @@ public class OptionReference implements IOption { * @param owner * @param element */ - public OptionReference(ToolReference owner, IConfigurationElement element) { + public OptionReference(ToolReference owner, IManagedConfigElement element) { // setup for resolving ManagedBuildManager.putConfigElement(this, element); resolved = false; @@ -131,7 +131,7 @@ public class OptionReference implements IOption { public void resolveReferences() { if (!resolved) { resolved = true; - IConfigurationElement element = ManagedBuildManager.getConfigElement(this); + IManagedConfigElement element = ManagedBuildManager.getConfigElement(this); // resolve parent (recursively) before calling methods on it. option = owner.getTool().getOption(element.getAttribute(ID)); @@ -166,9 +166,9 @@ public class OptionReference implements IOption { case LIBRARIES: case OBJECTS: List valueList = new ArrayList(); - IConfigurationElement[] valueElements = element.getChildren(LIST_VALUE); + IManagedConfigElement[] valueElements = element.getChildren(LIST_VALUE); for (int i = 0; i < valueElements.length; ++i) { - IConfigurationElement valueElement = valueElements[i]; + IManagedConfigElement valueElement = valueElements[i]; Boolean isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN)); if (isBuiltIn.booleanValue()) { getBuiltInList().add(valueElement.getAttribute(LIST_ITEM_VALUE)); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java index 9cc271aa90e..5f766090265 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java @@ -21,12 +21,12 @@ import java.util.StringTokenizer; import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; import org.eclipse.cdt.managedbuilder.core.ITarget; import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.core.boot.BootLoader; import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IConfigurationElement; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -104,7 +104,7 @@ public class Target extends BuildObject implements ITarget { * * @param element */ - public Target(IConfigurationElement element) { + public Target(IManagedConfigElement element) { // setup for resolving ManagedBuildManager.putConfigElement(this, element); resolved = false; @@ -151,17 +151,17 @@ public class Target extends BuildObject implements ITarget { } // Load any tool references we might have - IConfigurationElement[] toolRefs = element.getChildren(IConfiguration.TOOLREF_ELEMENT_NAME); + IManagedConfigElement[] toolRefs = element.getChildren(IConfiguration.TOOLREF_ELEMENT_NAME); for (int i=0; i < toolRefs.length; ++i) { new ToolReference(this, toolRefs[i]); } // Then load any tools defined for the target - IConfigurationElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME); + IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME); for (int j = 0; j < tools.length; ++j) { new Tool(this, tools[j]); } // Then load the configurations which may have tool references - IConfigurationElement[] configs = element.getChildren(IConfiguration.CONFIGURATION_ELEMENT_NAME); + IManagedConfigElement[] configs = element.getChildren(IConfiguration.CONFIGURATION_ELEMENT_NAME); for (int k = 0; k < configs.length; ++k) { new Configuration(this, configs[k]); } @@ -229,7 +229,7 @@ public class Target extends BuildObject implements ITarget { public void resolveReferences() { if (!resolved) { resolved = true; - IConfigurationElement element = ManagedBuildManager.getConfigElement(this); + IManagedConfigElement element = ManagedBuildManager.getConfigElement(this); // parent String parentId = element.getAttribute(PARENT); if (parentId != null) { diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java index 63b25b812a5..4f468825b0a 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java @@ -20,12 +20,12 @@ import java.util.StringTokenizer; import org.eclipse.cdt.managedbuilder.core.BuildException; import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.IOptionCategory; import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.IToolReference; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; -import org.eclipse.core.runtime.IConfigurationElement; /** * Represents a tool that can be invoked during a build. @@ -52,7 +52,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory { private boolean resolved = true; - public Tool(IConfigurationElement element) { + public Tool(IManagedConfigElement element) { loadFromManifest(element); // hook me up @@ -66,7 +66,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory { * @param target The target the receiver will belong to. * @param element The element containing the information. */ - public Tool(Target target, IConfigurationElement element) { + public Tool(Target target, IManagedConfigElement element) { loadFromManifest(element); // hook me up @@ -331,7 +331,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory { return getInterfaceExtensions().contains(ext); } - protected void loadFromManifest(IConfigurationElement element) { + protected void loadFromManifest(IManagedConfigElement element) { // setup for resolving ManagedBuildManager.putConfigElement(this, element); this.resolved = false; @@ -398,9 +398,9 @@ public class Tool extends BuildObject implements ITool, IOptionCategory { addOptionCategory(this); // Check for options - IConfigurationElement[] toolElements = element.getChildren(); + IManagedConfigElement[] toolElements = element.getChildren(); for (int l = 0; l < toolElements.length; ++l) { - IConfigurationElement toolElement = toolElements[l]; + IManagedConfigElement toolElement = toolElements[l]; if (toolElement.getName().equals(ITool.OPTION)) { new Option(this, toolElement); } else if (toolElement.getName().equals(ITool.OPTION_CAT)) { @@ -413,7 +413,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory { public void resolveReferences() { if (!resolved) { resolved = true; -// IConfigurationElement element = ManagedBuildManager.getConfigElement(this); +// IManagedConfigElement element = ManagedBuildManager.getConfigElement(this); // Tool doesn't have any references, but children might Iterator optionIter = options.iterator(); while (optionIter.hasNext()) { diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java index 133c0ec2ab8..f9461eb2147 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java @@ -18,10 +18,10 @@ import org.eclipse.cdt.managedbuilder.core.AbstractToolReference; import org.eclipse.cdt.managedbuilder.core.BuildException; import org.eclipse.cdt.managedbuilder.core.IBuildObject; import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; -import org.eclipse.core.runtime.IConfigurationElement; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -77,7 +77,7 @@ public class ToolReference extends AbstractToolReference { * @param owner The BuildObject the receiver will be added to. * @param element The element containing build information for the reference. */ - public ToolReference(BuildObject owner, IConfigurationElement element) { + public ToolReference(BuildObject owner, IManagedConfigElement element) { // setup for resolving ManagedBuildManager.putConfigElement(this, element); resolved = false; @@ -91,11 +91,12 @@ public class ToolReference extends AbstractToolReference { ((Target)owner).addToolReference(this); } + // Get the overridden tool command (if any) + command = element.getAttribute(ITool.COMMAND); - - IConfigurationElement[] toolElements = element.getChildren(); + IManagedConfigElement[] toolElements = element.getChildren(); for (int m = 0; m < toolElements.length; ++m) { - IConfigurationElement toolElement = toolElements[m]; + IManagedConfigElement toolElement = toolElements[m]; if (toolElement.getName().equals(ITool.OPTION_REF)) { new OptionReference(this, toolElement); } @@ -122,7 +123,7 @@ public class ToolReference extends AbstractToolReference { public void resolveReferences() { if (!resolved) { resolved = true; - IConfigurationElement element = ManagedBuildManager.getConfigElement(this); + IManagedConfigElement element = ManagedBuildManager.getConfigElement(this); // resolve my parent if (owner instanceof Configuration) { Target target = (Target) ((Configuration)owner).getTarget();