mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
Adding more work from Timesys to support dynamic toolchain model elements.
This commit is contained in:
parent
bea720fa70
commit
e25c54c01d
12 changed files with 256 additions and 59 deletions
|
@ -16,6 +16,7 @@
|
||||||
<element ref="target"/>
|
<element ref="target"/>
|
||||||
<element ref="tool"/>
|
<element ref="tool"/>
|
||||||
<element ref="configuration"/>
|
<element ref="configuration"/>
|
||||||
|
<element ref="dynamicElementProvider"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
<attribute name="point" type="string" use="required">
|
<attribute name="point" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
|
@ -493,6 +494,26 @@ Additional special types exist to flag options of special relevance to the build
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
|
<element name="dynamicElementProvider">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
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.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
<complexType>
|
||||||
|
<attribute name="class" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute kind="java"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
<annotation>
|
<annotation>
|
||||||
<appInfo>
|
<appInfo>
|
||||||
<meta.section type="since"/>
|
<meta.section type="since"/>
|
||||||
|
|
|
@ -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
|
||||||
|
* <code>child.getName().equals(elementName)</code>.
|
||||||
|
*/
|
||||||
|
IManagedConfigElement[] getChildren(String elementName);
|
||||||
|
}
|
|
@ -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 <code>configProvider</code> 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 <code>configProvider</code> elements.
|
||||||
|
*/
|
||||||
|
IManagedConfigElement[] getConfigElements();
|
||||||
|
}
|
|
@ -34,6 +34,7 @@ import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
|
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
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.ManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ToolReference;
|
import org.eclipse.cdt.managedbuilder.internal.core.ToolReference;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
|
@ -357,7 +358,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
IConfiguration parentConfig = configuration.getParent();
|
IConfiguration parentConfig = configuration.getParent();
|
||||||
|
|
||||||
// Get the config element for the parent from the map
|
// Get the config element for the parent from the map
|
||||||
IConfigurationElement configElement = getConfigElement(parentConfig);
|
IManagedConfigElement configElement = getConfigElement(parentConfig);
|
||||||
|
|
||||||
// reset the configuration
|
// reset the configuration
|
||||||
((Configuration)configuration).reset(configElement);
|
((Configuration)configuration).reset(configElement);
|
||||||
|
@ -464,20 +465,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
for (int i = 0; i < extensions.length; ++i) {
|
for (int i = 0; i < extensions.length; ++i) {
|
||||||
IExtension extension = extensions[i];
|
IExtension extension = extensions[i];
|
||||||
IConfigurationElement[] elements = extension.getConfigurationElements();
|
IConfigurationElement[] elements = extension.getConfigurationElements();
|
||||||
for (int toolIndex = 0; toolIndex < elements.length; ++toolIndex) {
|
loadConfigElements(DefaultManagedConfigElement.convertArray(elements));
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Then call resolve.
|
// Then call resolve.
|
||||||
Iterator toolIter = getExtensionToolMap().values().iterator();
|
Iterator toolIter = getExtensionToolMap().values().iterator();
|
||||||
|
@ -504,6 +492,40 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
extensionTargetsLoaded = true;
|
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
|
* @param project
|
||||||
* @return
|
* @return
|
||||||
|
@ -674,7 +696,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
* This method public for implementation reasons. Not intended for use
|
* This method public for implementation reasons. Not intended for use
|
||||||
* by clients.
|
* by clients.
|
||||||
*/
|
*/
|
||||||
public static void putConfigElement(IBuildObject buildObj, IConfigurationElement configElement) {
|
public static void putConfigElement(IBuildObject buildObj, IManagedConfigElement configElement) {
|
||||||
getConfigElementMap().put(buildObj, 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
|
* This method public for implementation reasons. Not intended for use
|
||||||
* by clients.
|
* by clients.
|
||||||
*/
|
*/
|
||||||
public static IConfigurationElement getConfigElement(IBuildObject buildObj) {
|
public static IManagedConfigElement getConfigElement(IBuildObject buildObj) {
|
||||||
return (IConfigurationElement)getConfigElementMap().get(buildObj);
|
return (IManagedConfigElement)getConfigElementMap().get(buildObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.cdt.core.CCProjectNature;
|
||||||
import org.eclipse.cdt.core.CProjectNature;
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
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.IOption;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITarget;
|
import org.eclipse.cdt.managedbuilder.core.ITarget;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
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.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
@ -151,7 +151,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
* @param target The <code>Target</code> the receiver will be added to.
|
* @param target The <code>Target</code> the receiver will be added to.
|
||||||
* @param element The element from the manifest that contains the default configuration settings.
|
* @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;
|
this.target = target;
|
||||||
|
|
||||||
// setup for resolving
|
// setup for resolving
|
||||||
|
@ -167,9 +167,9 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
// name
|
// name
|
||||||
setName(element.getAttribute(IConfiguration.NAME));
|
setName(element.getAttribute(IConfiguration.NAME));
|
||||||
|
|
||||||
IConfigurationElement[] configElements = element.getChildren();
|
IManagedConfigElement[] configElements = element.getChildren();
|
||||||
for (int l = 0; l < configElements.length; ++l) {
|
for (int l = 0; l < configElements.length; ++l) {
|
||||||
IConfigurationElement configElement = configElements[l];
|
IManagedConfigElement configElement = configElements[l];
|
||||||
if (configElement.getName().equals(IConfiguration.TOOLREF_ELEMENT_NAME)) {
|
if (configElement.getName().equals(IConfiguration.TOOLREF_ELEMENT_NAME)) {
|
||||||
new ToolReference(this, configElement);
|
new ToolReference(this, configElement);
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
public void resolveReferences() {
|
public void resolveReferences() {
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
resolved = true;
|
resolved = true;
|
||||||
// IConfigurationElement element = ManagedBuildManager.getConfigElement(this);
|
// IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
|
||||||
Iterator refIter = getLocalToolReferences().iterator();
|
Iterator refIter = getLocalToolReferences().iterator();
|
||||||
while (refIter.hasNext()) {
|
while (refIter.hasNext()) {
|
||||||
ToolReference ref = (ToolReference)refIter.next();
|
ToolReference ref = (ToolReference)refIter.next();
|
||||||
|
@ -390,12 +390,12 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
/**
|
/**
|
||||||
* @param targetElement
|
* @param targetElement
|
||||||
*/
|
*/
|
||||||
public void reset(IConfigurationElement element) {
|
public void reset(IManagedConfigElement element) {
|
||||||
// I just need to reset the tool references
|
// I just need to reset the tool references
|
||||||
getLocalToolReferences().clear();
|
getLocalToolReferences().clear();
|
||||||
IConfigurationElement[] configElements = element.getChildren();
|
IManagedConfigElement[] configElements = element.getChildren();
|
||||||
for (int l = 0; l < configElements.length; ++l) {
|
for (int l = 0; l < configElements.length; ++l) {
|
||||||
IConfigurationElement configElement = configElements[l];
|
IManagedConfigElement configElement = configElements[l];
|
||||||
if (configElement.getName().equals(IConfiguration.TOOLREF_ELEMENT_NAME)) {
|
if (configElement.getName().equals(IConfiguration.TOOLREF_ELEMENT_NAME)) {
|
||||||
ToolReference ref = new ToolReference(this, configElement);
|
ToolReference ref = new ToolReference(this, configElement);
|
||||||
ref.resolveReferences();
|
ref.resolveReferences();
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -17,12 +17,12 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
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.IOption;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
|
||||||
|
|
||||||
public class Option extends BuildObject implements IOption {
|
public class Option extends BuildObject implements IOption {
|
||||||
// Static default return values
|
// Static default return values
|
||||||
|
@ -44,7 +44,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
this.tool = tool;
|
this.tool = tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Option(Tool tool, IConfigurationElement element) {
|
public Option(Tool tool, IManagedConfigElement element) {
|
||||||
this(tool);
|
this(tool);
|
||||||
// setup for resolving
|
// setup for resolving
|
||||||
ManagedBuildManager.putConfigElement(this, element);
|
ManagedBuildManager.putConfigElement(this, element);
|
||||||
|
@ -96,7 +96,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
break;
|
break;
|
||||||
case ENUMERATED:
|
case ENUMERATED:
|
||||||
List enumList = new ArrayList();
|
List enumList = new ArrayList();
|
||||||
IConfigurationElement[] enumElements = element.getChildren(ENUM_VALUE);
|
IManagedConfigElement[] enumElements = element.getChildren(ENUM_VALUE);
|
||||||
for (int i = 0; i < enumElements.length; ++i) {
|
for (int i = 0; i < enumElements.length; ++i) {
|
||||||
String optName = enumElements[i].getAttribute(NAME);
|
String optName = enumElements[i].getAttribute(NAME);
|
||||||
String optCommand = enumElements[i].getAttribute(COMMAND);
|
String optCommand = enumElements[i].getAttribute(COMMAND);
|
||||||
|
@ -116,9 +116,9 @@ public class Option extends BuildObject implements IOption {
|
||||||
case OBJECTS:
|
case OBJECTS:
|
||||||
List valueList = new ArrayList();
|
List valueList = new ArrayList();
|
||||||
builtIns = 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) {
|
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));
|
Boolean isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN));
|
||||||
if (isBuiltIn.booleanValue()) {
|
if (isBuiltIn.booleanValue()) {
|
||||||
builtIns.add(valueElement.getAttribute(LIST_ITEM_VALUE));
|
builtIns.add(valueElement.getAttribute(LIST_ITEM_VALUE));
|
||||||
|
@ -137,7 +137,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
public void resolveReferences() {
|
public void resolveReferences() {
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
resolved = true;
|
resolved = true;
|
||||||
IConfigurationElement element = ManagedBuildManager.getConfigElement(this);
|
IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
|
||||||
// Options can be grouped into categories
|
// Options can be grouped into categories
|
||||||
String categoryId = element.getAttribute(CATEGORY);
|
String categoryId = element.getAttribute(CATEGORY);
|
||||||
if (categoryId != null)
|
if (categoryId != null)
|
||||||
|
|
|
@ -14,12 +14,12 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
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.IOption;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolReference;
|
import org.eclipse.cdt.managedbuilder.core.IToolReference;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
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;
|
this.owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OptionCategory(Tool tool, IConfigurationElement element) {
|
public OptionCategory(Tool tool, IManagedConfigElement element) {
|
||||||
// setup for resolving
|
// setup for resolving
|
||||||
ManagedBuildManager.putConfigElement(this, element);
|
ManagedBuildManager.putConfigElement(this, element);
|
||||||
resolved = false;
|
resolved = false;
|
||||||
|
@ -56,7 +56,7 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
public void resolveReferences() {
|
public void resolveReferences() {
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
resolved = true;
|
resolved = true;
|
||||||
IConfigurationElement element = ManagedBuildManager.getConfigElement(this);
|
IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
|
||||||
String parentId = element.getAttribute(IOptionCategory.OWNER);
|
String parentId = element.getAttribute(IOptionCategory.OWNER);
|
||||||
if (parentId != null)
|
if (parentId != null)
|
||||||
owner = tool.getOptionCategory(parentId);
|
owner = tool.getOptionCategory(parentId);
|
||||||
|
|
|
@ -16,12 +16,12 @@ import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
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.IOption;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
@ -51,7 +51,7 @@ public class OptionReference implements IOption {
|
||||||
* @param owner
|
* @param owner
|
||||||
* @param element
|
* @param element
|
||||||
*/
|
*/
|
||||||
public OptionReference(ToolReference owner, IConfigurationElement element) {
|
public OptionReference(ToolReference owner, IManagedConfigElement element) {
|
||||||
// setup for resolving
|
// setup for resolving
|
||||||
ManagedBuildManager.putConfigElement(this, element);
|
ManagedBuildManager.putConfigElement(this, element);
|
||||||
resolved = false;
|
resolved = false;
|
||||||
|
@ -131,7 +131,7 @@ public class OptionReference implements IOption {
|
||||||
public void resolveReferences() {
|
public void resolveReferences() {
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
resolved = true;
|
resolved = true;
|
||||||
IConfigurationElement element = ManagedBuildManager.getConfigElement(this);
|
IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
|
||||||
|
|
||||||
// resolve parent (recursively) before calling methods on it.
|
// resolve parent (recursively) before calling methods on it.
|
||||||
option = owner.getTool().getOption(element.getAttribute(ID));
|
option = owner.getTool().getOption(element.getAttribute(ID));
|
||||||
|
@ -166,9 +166,9 @@ public class OptionReference implements IOption {
|
||||||
case LIBRARIES:
|
case LIBRARIES:
|
||||||
case OBJECTS:
|
case OBJECTS:
|
||||||
List valueList = new ArrayList();
|
List valueList = new ArrayList();
|
||||||
IConfigurationElement[] valueElements = element.getChildren(LIST_VALUE);
|
IManagedConfigElement[] valueElements = element.getChildren(LIST_VALUE);
|
||||||
for (int i = 0; i < valueElements.length; ++i) {
|
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));
|
Boolean isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN));
|
||||||
if (isBuiltIn.booleanValue()) {
|
if (isBuiltIn.booleanValue()) {
|
||||||
getBuiltInList().add(valueElement.getAttribute(LIST_ITEM_VALUE));
|
getBuiltInList().add(valueElement.getAttribute(LIST_ITEM_VALUE));
|
||||||
|
|
|
@ -21,12 +21,12 @@ import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
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.ITarget;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.core.boot.BootLoader;
|
import org.eclipse.core.boot.BootLoader;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
@ -104,7 +104,7 @@ public class Target extends BuildObject implements ITarget {
|
||||||
*
|
*
|
||||||
* @param element
|
* @param element
|
||||||
*/
|
*/
|
||||||
public Target(IConfigurationElement element) {
|
public Target(IManagedConfigElement element) {
|
||||||
// setup for resolving
|
// setup for resolving
|
||||||
ManagedBuildManager.putConfigElement(this, element);
|
ManagedBuildManager.putConfigElement(this, element);
|
||||||
resolved = false;
|
resolved = false;
|
||||||
|
@ -151,17 +151,17 @@ public class Target extends BuildObject implements ITarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load any tool references we might have
|
// 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) {
|
for (int i=0; i < toolRefs.length; ++i) {
|
||||||
new ToolReference(this, toolRefs[i]);
|
new ToolReference(this, toolRefs[i]);
|
||||||
}
|
}
|
||||||
// Then load any tools defined for the target
|
// 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) {
|
for (int j = 0; j < tools.length; ++j) {
|
||||||
new Tool(this, tools[j]);
|
new Tool(this, tools[j]);
|
||||||
}
|
}
|
||||||
// Then load the configurations which may have tool references
|
// 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) {
|
for (int k = 0; k < configs.length; ++k) {
|
||||||
new Configuration(this, configs[k]);
|
new Configuration(this, configs[k]);
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ public class Target extends BuildObject implements ITarget {
|
||||||
public void resolveReferences() {
|
public void resolveReferences() {
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
resolved = true;
|
resolved = true;
|
||||||
IConfigurationElement element = ManagedBuildManager.getConfigElement(this);
|
IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
|
||||||
// parent
|
// parent
|
||||||
String parentId = element.getAttribute(PARENT);
|
String parentId = element.getAttribute(PARENT);
|
||||||
if (parentId != null) {
|
if (parentId != null) {
|
||||||
|
|
|
@ -20,12 +20,12 @@ import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
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.IOption;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolReference;
|
import org.eclipse.cdt.managedbuilder.core.IToolReference;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a tool that can be invoked during a build.
|
* 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;
|
private boolean resolved = true;
|
||||||
|
|
||||||
|
|
||||||
public Tool(IConfigurationElement element) {
|
public Tool(IManagedConfigElement element) {
|
||||||
loadFromManifest(element);
|
loadFromManifest(element);
|
||||||
|
|
||||||
// hook me up
|
// 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 target The target the receiver will belong to.
|
||||||
* @param element The element containing the information.
|
* @param element The element containing the information.
|
||||||
*/
|
*/
|
||||||
public Tool(Target target, IConfigurationElement element) {
|
public Tool(Target target, IManagedConfigElement element) {
|
||||||
loadFromManifest(element);
|
loadFromManifest(element);
|
||||||
|
|
||||||
// hook me up
|
// hook me up
|
||||||
|
@ -331,7 +331,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
return getInterfaceExtensions().contains(ext);
|
return getInterfaceExtensions().contains(ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void loadFromManifest(IConfigurationElement element) {
|
protected void loadFromManifest(IManagedConfigElement element) {
|
||||||
// setup for resolving
|
// setup for resolving
|
||||||
ManagedBuildManager.putConfigElement(this, element);
|
ManagedBuildManager.putConfigElement(this, element);
|
||||||
this.resolved = false;
|
this.resolved = false;
|
||||||
|
@ -398,9 +398,9 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
addOptionCategory(this);
|
addOptionCategory(this);
|
||||||
|
|
||||||
// Check for options
|
// Check for options
|
||||||
IConfigurationElement[] toolElements = element.getChildren();
|
IManagedConfigElement[] toolElements = element.getChildren();
|
||||||
for (int l = 0; l < toolElements.length; ++l) {
|
for (int l = 0; l < toolElements.length; ++l) {
|
||||||
IConfigurationElement toolElement = toolElements[l];
|
IManagedConfigElement toolElement = toolElements[l];
|
||||||
if (toolElement.getName().equals(ITool.OPTION)) {
|
if (toolElement.getName().equals(ITool.OPTION)) {
|
||||||
new Option(this, toolElement);
|
new Option(this, toolElement);
|
||||||
} else if (toolElement.getName().equals(ITool.OPTION_CAT)) {
|
} else if (toolElement.getName().equals(ITool.OPTION_CAT)) {
|
||||||
|
@ -413,7 +413,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
public void resolveReferences() {
|
public void resolveReferences() {
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
resolved = true;
|
resolved = true;
|
||||||
// IConfigurationElement element = ManagedBuildManager.getConfigElement(this);
|
// IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
|
||||||
// Tool doesn't have any references, but children might
|
// Tool doesn't have any references, but children might
|
||||||
Iterator optionIter = options.iterator();
|
Iterator optionIter = options.iterator();
|
||||||
while (optionIter.hasNext()) {
|
while (optionIter.hasNext()) {
|
||||||
|
|
|
@ -18,10 +18,10 @@ import org.eclipse.cdt.managedbuilder.core.AbstractToolReference;
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
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.IOption;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
@ -77,7 +77,7 @@ public class ToolReference extends AbstractToolReference {
|
||||||
* @param owner The <code>BuildObject</code> the receiver will be added to.
|
* @param owner The <code>BuildObject</code> the receiver will be added to.
|
||||||
* @param element The element containing build information for the reference.
|
* @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
|
// setup for resolving
|
||||||
ManagedBuildManager.putConfigElement(this, element);
|
ManagedBuildManager.putConfigElement(this, element);
|
||||||
resolved = false;
|
resolved = false;
|
||||||
|
@ -91,11 +91,12 @@ public class ToolReference extends AbstractToolReference {
|
||||||
((Target)owner).addToolReference(this);
|
((Target)owner).addToolReference(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the overridden tool command (if any)
|
||||||
|
command = element.getAttribute(ITool.COMMAND);
|
||||||
|
|
||||||
|
IManagedConfigElement[] toolElements = element.getChildren();
|
||||||
IConfigurationElement[] toolElements = element.getChildren();
|
|
||||||
for (int m = 0; m < toolElements.length; ++m) {
|
for (int m = 0; m < toolElements.length; ++m) {
|
||||||
IConfigurationElement toolElement = toolElements[m];
|
IManagedConfigElement toolElement = toolElements[m];
|
||||||
if (toolElement.getName().equals(ITool.OPTION_REF)) {
|
if (toolElement.getName().equals(ITool.OPTION_REF)) {
|
||||||
new OptionReference(this, toolElement);
|
new OptionReference(this, toolElement);
|
||||||
}
|
}
|
||||||
|
@ -122,7 +123,7 @@ public class ToolReference extends AbstractToolReference {
|
||||||
public void resolveReferences() {
|
public void resolveReferences() {
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
resolved = true;
|
resolved = true;
|
||||||
IConfigurationElement element = ManagedBuildManager.getConfigElement(this);
|
IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
|
||||||
// resolve my parent
|
// resolve my parent
|
||||||
if (owner instanceof Configuration) {
|
if (owner instanceof Configuration) {
|
||||||
Target target = (Target) ((Configuration)owner).getTarget();
|
Target target = (Target) ((Configuration)owner).getTarget();
|
||||||
|
|
Loading…
Add table
Reference in a new issue