1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-20 23:45:23 +02:00

Patch for Sean Evoy:

the new project wizard now filters out targets that should
not be selected by the user, and that the build model
handles inherited option references properly now.
This commit is contained in:
Doug Schaefer 2003-09-26 00:24:42 +00:00
parent c20c27d234
commit db4d819623
13 changed files with 824 additions and 167 deletions

View file

@ -1,3 +1,46 @@
2003-09-25 Sean Evoy
This patch contains a lot of changes needed to implement fixes for 42648 and
43122.
For 42648, the schema for the the target had to be modified to include a
comma-separated list of valid host platforms.
* schema/ManagedBuildTools.exsd
The target had to be updated to properly read in and understand this info, and
the interface had to be updated to return a list to the clients in the UI. The
target was also changed slightly. It now uses a safer accessor method to get at
the list of tools it maintains. I have also stopped persisting non-variant info
to the project file on serialize. There are elements of the target that are not
subject to change by the user (yet) so they should not be saved.
* src/org/eclipse/cdt/managedbuilder/core/ITarget.java
* src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
For 43122, I started by simply adding a tool reference to the configurations.
The tool reference had option references for debug and optimization levels. It
should have worked, but the model was not handling the inheritance properly. The
JUnit tests were not finding it because of how they were configured. It was most
evident in the UI. So, the way configurations and tool reference search for
overridden option references had to be modified. While I was in there, I cleaned
up some of the accessor and iteration code in ToolReference and OptionReference.
For the configuration, the only significant change was a new search method to
find all option references for a given tool, no matter where they are stored.
The method had to consider what was overridden in a child config, what was added by
a child config, and what the parent (or parents) define.
* src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
Option reference now pays attention to overidden values in the plugin file. Until
now, it only handled the overrides in the project file.
* src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
The ToolReference now distinguishes between local option references which it
manages directly, and option references held by tool references in the parent(s)
of its owner. It only serializes its own references, but when asked for options
relating to the tool it references, it replies with all option references in its
hierarchy.
* src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java
2003-09-24 Sean Evoy 2003-09-24 Sean Evoy
Changed the implementor of IScannerInfo to answer only absolute paths when asked for Changed the implementor of IScannerInfo to answer only absolute paths when asked for
includes paths. Users will specify the includes paths in the managed build UI in such a way includes paths. Users will specify the includes paths in the managed build UI in such a way

View file

@ -394,6 +394,13 @@ Two additional types exist to flag options of special relevance to the build mod
</documentation> </documentation>
</annotation> </annotation>
</attribute> </attribute>
<attribute name="osList" type="string">
<annotation>
<documentation>
This field is used by the managed build system to decide when to show the user the target. The value should be a comma-separated list. Current values are &quot;win32&quot;, &quot;linux&quot;, and &quot;solaris&quot;.
</documentation>
</annotation>
</attribute>
</complexType> </complexType>
</element> </element>

View file

@ -25,6 +25,7 @@ public interface ITarget extends IBuildObject {
public static final String IS_ABSTRACT = "isAbstract"; //$NON-NLS-1$ public static final String IS_ABSTRACT = "isAbstract"; //$NON-NLS-1$
public static final String IS_TEST = "isTest"; //$NON-NLS-1$ public static final String IS_TEST = "isTest"; //$NON-NLS-1$
public static final String MAKE_COMMAND = "makeCommand"; //$NON-NLS-1$ public static final String MAKE_COMMAND = "makeCommand"; //$NON-NLS-1$
public static final String OS_LIST = "osList"; //$NON-NLS-1$
public static final String PARENT = "parent"; //$NON-NLS-1$ public static final String PARENT = "parent"; //$NON-NLS-1$
/** /**
@ -35,7 +36,7 @@ public interface ITarget extends IBuildObject {
* *
* @param parent The <code>IConfiguration</code> to use as a settings template * @param parent The <code>IConfiguration</code> to use as a settings template
* @param id The unique id the new configuration will have * @param id The unique id the new configuration will have
* @return * @return IConfiguration
*/ */
public IConfiguration createConfiguration(IConfiguration parent, String id); public IConfiguration createConfiguration(IConfiguration parent, String id);
@ -44,34 +45,35 @@ public interface ITarget extends IBuildObject {
* the tools defined for that target and options set at their defaults. * the tools defined for that target and options set at their defaults.
* *
* @param id id for this configuration. * @param id id for this configuration.
* @return * @return IConfiguration
*/ */
public IConfiguration createConfiguration(String id); public IConfiguration createConfiguration(String id);
/** /**
* Get the name of the final build artifact. * Get the name of the final build artifact.
* *
* @return * @return String
*/ */
public String getArtifactName(); public String getArtifactName();
/** /**
* Answers the unique ID of the binary parser associated with the target. * Answers the unique ID of the binary parser associated with the target.
* *
* @return * @return String
*/ */
public String getBinaryParserId(); public String getBinaryParserId();
/** /**
* Answers the OS-specific command to remove files created by the build * Answers the OS-specific command to remove files created by the build
* *
* @return * @return String
*/ */
public String getCleanCommand(); public String getCleanCommand();
/** /**
* Returns all of the configurations defined by this target. * Returns all of the configurations defined by this target.
* @return *
* @return IConfiguration[]
*/ */
public IConfiguration[] getConfigurations(); public IConfiguration[] getConfigurations();
@ -79,14 +81,14 @@ public interface ITarget extends IBuildObject {
* Get the default extension that should be applied to build artifacts * Get the default extension that should be applied to build artifacts
* created by this target. * created by this target.
* *
* @return * @return String
*/ */
public String getDefaultExtension(); public String getDefaultExtension();
/** /**
* Answers the name of the make utility for the target. * Answers the name of the make utility for the target.
* *
* @return * @return String
*/ */
public String getMakeCommand(); public String getMakeCommand();
@ -94,27 +96,36 @@ public interface ITarget extends IBuildObject {
* Returns the configuration with the given id, or <code>null</code> if not found. * Returns the configuration with the given id, or <code>null</code> if not found.
* *
* @param id * @param id
* @return * @return IConfiguration
*/ */
public IConfiguration getConfiguration(String id); public IConfiguration getConfiguration(String id);
/** /**
* Gets the resource that this target is applied to. * Gets the resource that this target is applied to.
* *
* @return * @return IResource
*/ */
public IResource getOwner(); public IResource getOwner();
/** /**
* @return the <code>ITarget</code> that is the parent of the receiver. * Answers the <code>ITarget</code> that is the parent of the receiver.
*
* @return ITarget
*/ */
public ITarget getParent(); public ITarget getParent();
/**
* Answers an array of operating systems the target can be created on.
*
* @return String[]
*/
public String[] getTargetOSList();
/** /**
* Returns the list of platform specific tools associated with this * Returns the list of platform specific tools associated with this
* platform. * platform.
* *
* @return * @return ITool[]
*/ */
public ITool[] getTools(); public ITool[] getTools();
@ -123,13 +134,13 @@ public interface ITarget extends IBuildObject {
* Answers true if the receiver has a make command that differs from its * Answers true if the receiver has a make command that differs from its
* parent specification. * parent specification.
* *
* @return * @return boolean
*/ */
public boolean hasOverridenMakeCommand(); public boolean hasOverridenMakeCommand();
/** /**
* Returns whether this target is abstract. * Returns whether this target is abstract.
* @return * @return boolean
*/ */
public boolean isAbstract(); public boolean isAbstract();
@ -138,7 +149,7 @@ public interface ITarget extends IBuildObject {
* for testing purposes only, else <code>false</code>. A test target will * for testing purposes only, else <code>false</code>. A test target will
* not be shown in the UI but can still be manipulated programmatically. * not be shown in the UI but can still be manipulated programmatically.
* *
* @return * @return boolean
*/ */
public boolean isTestTarget(); public boolean isTestTarget();
@ -170,4 +181,5 @@ public interface ITarget extends IBuildObject {
* @param command * @param command
*/ */
public void setMakeCommand(String command); public void setMakeCommand(String command);
} }

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.managedbuilder.internal.core;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.eclipse.cdt.managedbuilder.core.BuildException; import org.eclipse.cdt.managedbuilder.core.BuildException;
@ -61,6 +62,9 @@ public class Configuration extends BuildObject implements IConfiguration {
this.target = target; this.target = target;
this.parent = parent; this.parent = parent;
// Get the tool references from the parent
getLocalToolReferences().addAll(((Configuration)parent).getLocalToolReferences());
target.addConfiguration(this); target.addConfiguration(this);
} }
@ -147,14 +151,29 @@ public class Configuration extends BuildObject implements IConfiguration {
if (parent != null) if (parent != null)
element.setAttribute(IConfiguration.PARENT, parent.getId()); element.setAttribute(IConfiguration.PARENT, parent.getId());
for (int i = 0; i < getToolReferences().size(); ++i) { // Serialize only the tool references defined in the configuration
ToolReference toolRef = (ToolReference)getToolReferences().get(i); Iterator iter = getLocalToolReferences().listIterator();
while (iter.hasNext()) {
ToolReference toolRef = (ToolReference) iter.next();
Element toolRefElement = doc.createElement(IConfiguration.TOOL_REF); Element toolRefElement = doc.createElement(IConfiguration.TOOL_REF);
element.appendChild(toolRefElement); element.appendChild(toolRefElement);
toolRef.serialize(doc, toolRefElement); toolRef.serialize(doc, toolRefElement);
} }
} }
/* (non-javadoc)
* A safety method to avoid NPEs. It answers the tool reference list in the
* receiver. It does not look at the tool references defined in the parent.
*
* @return List
*/
protected List getLocalToolReferences() {
if (toolReferences == null) {
toolReferences = new ArrayList();
}
return toolReferences;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getName() * @see org.eclipse.cdt.core.build.managed.IConfiguration#getName()
*/ */
@ -162,16 +181,6 @@ public class Configuration extends BuildObject implements IConfiguration {
return (name == null && parent != null) ? parent.getName() : name; return (name == null && parent != null) ? parent.getName() : name;
} }
/*
* @return
*/
private List getToolReferences() {
if (toolReferences == null) {
toolReferences = new ArrayList();
}
return toolReferences;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getTools() * @see org.eclipse.cdt.core.build.managed.IConfiguration#getTools()
*/ */
@ -180,7 +189,7 @@ public class Configuration extends BuildObject implements IConfiguration {
? parent.getTools() ? parent.getTools()
: target.getTools(); : target.getTools();
// Replace tools with overrides // Replace tools with local overrides
for (int i = 0; i < tools.length; ++i) { for (int i = 0; i < tools.length; ++i) {
ToolReference ref = getToolReference(tools[i]); ToolReference ref = getToolReference(tools[i]);
if (ref != null) if (ref != null)
@ -195,7 +204,7 @@ public class Configuration extends BuildObject implements IConfiguration {
*/ */
public void reset(IConfigurationElement element) { public void reset(IConfigurationElement element) {
// I just need to reset the tool references // I just need to reset the tool references
getToolReferences().clear(); getLocalToolReferences().clear();
IConfigurationElement[] configElements = element.getChildren(); IConfigurationElement[] configElements = element.getChildren();
for (int l = 0; l < configElements.length; ++l) { for (int l = 0; l < configElements.length; ++l) {
IConfigurationElement configElement = configElements[l]; IConfigurationElement configElement = configElements[l];
@ -211,6 +220,35 @@ public class Configuration extends BuildObject implements IConfiguration {
public IConfiguration getParent() { public IConfiguration getParent() {
return parent; return parent;
} }
/* (non-javadoc)
*
* @param tool
* @return List
*/
protected List getOptionReferences(ITool tool) {
List references = new ArrayList();
// Get all the option references I add for this tool
ToolReference toolRef = getToolReference(tool);
if (toolRef != null) {
references.addAll(toolRef.getLocalOptionRefs());
}
// See if there is anything that my parents add that I don't
if (parent != null) {
List temp = ((Configuration)parent).getOptionReferences(tool);
Iterator iter = temp.listIterator();
while (iter.hasNext()) {
OptionReference ref = (OptionReference) iter.next();
if (!references.contains(ref)) {
references.add(ref);
}
}
}
return references;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getTarget() * @see org.eclipse.cdt.core.build.managed.IConfiguration#getTarget()
@ -227,22 +265,29 @@ public class Configuration extends BuildObject implements IConfiguration {
} }
/** /**
* Returns the reference for a given tool. * Returns the reference for a given tool or <code>null</code> if one is not
* found.
* *
* @param tool * @param tool
* @return * @return ToolReference
*/ */
private ToolReference getToolReference(ITool tool) { private ToolReference getToolReference(ITool tool) {
for (int i = 0; i < getToolReferences().size(); ++i) { // See if the receiver has a reference to the tool
ToolReference toolRef = (ToolReference)getToolReferences().get(i); ToolReference ref = null;
if (toolRef.references(tool)) Iterator iter = getLocalToolReferences().listIterator();
return toolRef; while (iter.hasNext()) {
ToolReference temp = (ToolReference)iter.next();
if (temp.references(tool)) {
ref = temp;
break;
}
} }
return null;
return ref;
} }
public void addToolReference(ToolReference toolRef) { public void addToolReference(ToolReference toolRef) {
getToolReferences().add(toolRef); getLocalToolReferences().add(toolRef);
} }
public OptionReference createOptionReference(IOption option) { public OptionReference createOptionReference(IOption option) {

View file

@ -76,11 +76,15 @@ public class OptionReference implements IOption {
value = element.getAttribute(IOption.DEFAULT_VALUE); value = element.getAttribute(IOption.DEFAULT_VALUE);
break; break;
case IOption.ENUMERATED: case IOption.ENUMERATED:
try { String temp = element.getAttribute(DEFAULT_VALUE);
value = option.getSelectedEnum(); if (temp == null) {
} catch (BuildException e) { try {
value = new String(); temp = option.getSelectedEnum();
} catch (BuildException e) {
temp = new String();
}
} }
value = temp;
break; break;
case IOption.STRING_LIST: case IOption.STRING_LIST:
case IOption.INCLUDE_PATH: case IOption.INCLUDE_PATH:

View file

@ -16,6 +16,7 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
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;
@ -42,8 +43,9 @@ public class Target extends BuildObject implements ITarget {
private String makeCommand; private String makeCommand;
private IResource owner; private IResource owner;
private ITarget parent; private ITarget parent;
private List targetOSList;
private Map toolMap; private Map toolMap;
private List tools; private List toolList;
private static final IConfiguration[] emptyConfigs = new IConfiguration[0]; private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
private static final String EMPTY_STRING = new String(); private static final String EMPTY_STRING = new String();
@ -78,7 +80,8 @@ public class Target extends BuildObject implements ITarget {
} }
/** /**
* This constructor is called to create a target defined by an extension. * This constructor is called to create a target defined by an extension point in
* a plugin manifest file.
* *
* @param element * @param element
*/ */
@ -113,8 +116,7 @@ public class Target extends BuildObject implements ITarget {
} }
// isAbstract // isAbstract
if ("true".equals(element.getAttribute(IS_ABSTRACT))) isAbstract = ("true".equals(element.getAttribute(IS_ABSTRACT)));
isAbstract = true;
// Is this a test target // Is this a test target
isTest = ("true".equals(element.getAttribute(IS_TEST))); isTest = ("true".equals(element.getAttribute(IS_TEST)));
@ -133,12 +135,29 @@ public class Target extends BuildObject implements ITarget {
makeCommand = parent.getMakeCommand(); makeCommand = parent.getMakeCommand();
} }
// Get the comma-separated list of valid OS
String os = element.getAttribute(OS_LIST);
if (os != null) {
targetOSList = new ArrayList();
StringTokenizer tokens = new StringTokenizer(os, ",");
while (tokens.hasMoreTokens()) {
targetOSList.add(tokens.nextToken().trim());
}
}
IConfigurationElement[] targetElements = element.getChildren(); IConfigurationElement[] targetElements = element.getChildren();
for (int k = 0; k < targetElements.length; ++k) { int k;
// Load the tools first
for (k = 0; k < targetElements.length; ++k) {
IConfigurationElement targetElement = targetElements[k]; IConfigurationElement targetElement = targetElements[k];
if (targetElement.getName().equals(ITool.TOOL_ELEMENT_NAME)) { if (targetElement.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
new Tool(this, targetElement); new Tool(this, targetElement);
} else if (targetElement.getName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) { }
}
// Then load the configurations which may have tool references
for (k = 0; k < targetElements.length; ++k) {
IConfigurationElement targetElement = targetElements[k];
if (targetElement.getName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
new Configuration(this, targetElement); new Configuration(this, targetElement);
} }
} }
@ -146,7 +165,7 @@ public class Target extends BuildObject implements ITarget {
} }
/** /**
* Create target from project file * Create target from project file.
* *
* @param buildInfo * @param buildInfo
* @param element * @param element
@ -167,9 +186,6 @@ public class Target extends BuildObject implements ITarget {
// contain what the user entered in the UI). // contain what the user entered in the UI).
artifactName = element.getAttribute(ARTIFACT_NAME); artifactName = element.getAttribute(ARTIFACT_NAME);
// Get the ID of the binary parser
binaryParserId = element.getAttribute(BINARY_PARSER);
// Get the default extension // Get the default extension
defaultExtension = element.getAttribute(DEFAULT_EXTENSION); defaultExtension = element.getAttribute(DEFAULT_EXTENSION);
@ -238,7 +254,6 @@ public class Target extends BuildObject implements ITarget {
element.setAttribute(PARENT, parent.getId()); element.setAttribute(PARENT, parent.getId());
element.setAttribute(IS_ABSTRACT, isAbstract ? "true" : "false"); element.setAttribute(IS_ABSTRACT, isAbstract ? "true" : "false");
element.setAttribute(ARTIFACT_NAME, getArtifactName()); element.setAttribute(ARTIFACT_NAME, getArtifactName());
element.setAttribute(BINARY_PARSER, getBinaryParserId());
element.setAttribute(DEFAULT_EXTENSION, getDefaultExtension()); element.setAttribute(DEFAULT_EXTENSION, getDefaultExtension());
element.setAttribute(IS_TEST, isTest ? "true" : "false"); element.setAttribute(IS_TEST, isTest ? "true" : "false");
element.setAttribute(CLEAN_COMMAND, getCleanCommand()); element.setAttribute(CLEAN_COMMAND, getCleanCommand());
@ -277,6 +292,22 @@ public class Target extends BuildObject implements ITarget {
return parent; return parent;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getTargetOSList()
*/
public String[] getTargetOSList() {
if (targetOSList == null) {
// Ask parent for its list
if (parent != null) {
return parent.getTargetOSList();
} else {
// I have no parent and no defined list but never return null
return new String[0];
}
}
return (String[]) targetOSList.toArray(new String[targetOSList.size()]);
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getOwner() * @see org.eclipse.cdt.managedbuilder.core.ITarget#getOwner()
*/ */
@ -285,25 +316,41 @@ public class Target extends BuildObject implements ITarget {
} }
private int getNumTools() { private int getNumTools() {
int n = (tools == null) ? 0 : tools.size(); int n = getToolList().size();
if (parent != null) if (parent != null)
n += ((Target)parent).getNumTools(); n += ((Target)parent).getNumTools();
return n; return n;
} }
private int addToolsToArray(ITool[] toolArray, int start) { private int addToolsToArray(ITool[] toolArray, int start) {
int n = start; int n = start;
if (parent != null) if (parent != null)
n = ((Target)parent).addToolsToArray(toolArray, start); n = ((Target)parent).addToolsToArray(toolArray, start);
if (tools != null) { for (int i = 0; i < getToolList().size(); ++i) {
for (int i = 0; i < tools.size(); ++i) toolArray[n++] = (ITool)getToolList().get(i);
toolArray[n++] = (ITool)tools.get(i);
} }
return n; return n;
} }
private List getToolList() {
if (toolList == null) {
toolList = new ArrayList();
toolList.clear();
}
return toolList;
}
private Map getToolMap() {
if (toolMap == null) {
toolMap = new HashMap();
toolMap.clear();
}
return toolMap;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getTools() * @see org.eclipse.cdt.managedbuilder.core.ITarget#getTools()
*/ */
@ -322,16 +369,19 @@ public class Target extends BuildObject implements ITarget {
/** /**
* @param id * @param id
* @return * @return ITool
*/ */
public ITool getTool(String id) { public ITool getTool(String id) {
ITool result = null; ITool result = null;
// See if receiver has it in list // See if receiver has it in list
result = (ITool)toolMap.get(id); result = (ITool) getToolMap().get(id);
// If not, check if parent has it // If not, check if parent has it
if (result == null && parent != null) { if (result == null && parent != null) {
result = ((Target)parent).getTool(id); result = ((Target)parent).getTool(id);
} }
return result; return result;
} }
@ -339,13 +389,8 @@ public class Target extends BuildObject implements ITarget {
* @param tool * @param tool
*/ */
public void addTool(ITool tool) { public void addTool(ITool tool) {
if (tools == null) { getToolList().add(tool);
tools = new ArrayList(); getToolMap().put(tool.getId(), tool);
toolMap = new HashMap();
}
tools.add(tool);
toolMap.put(tool.getId(), tool);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -377,15 +422,33 @@ public class Target extends BuildObject implements ITarget {
* @see org.eclipse.cdt.core.build.managed.ITarget#getArtifactName() * @see org.eclipse.cdt.core.build.managed.ITarget#getArtifactName()
*/ */
public String getArtifactName() { public String getArtifactName() {
// Return name or an empty string if (artifactName == null) {
return artifactName == null ? EMPTY_STRING : artifactName; // If I have a parent, ask it
if (parent != null) {
return parent.getArtifactName();
} else {
// I'm it and this is not good!
return EMPTY_STRING;
}
} else {
return artifactName;
}
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getBinaryParserId() * @see org.eclipse.cdt.managedbuilder.core.ITarget#getBinaryParserId()
*/ */
public String getBinaryParserId() { public String getBinaryParserId() {
return binaryParserId == null ? EMPTY_STRING : binaryParserId; if (binaryParserId == null) {
// If I have a parent, ask it
if (parent != null) {
return parent.getBinaryParserId();
} else {
// I'm it and this is not good!
return EMPTY_STRING;
}
}
return binaryParserId;
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.managedbuilder.internal.core; package org.eclipse.cdt.managedbuilder.internal.core;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -49,6 +50,15 @@ public class ToolReference implements ITool {
owner.addToolReference(this); owner.addToolReference(this);
} }
/**
* Adds the option reference specified in the argument to the receiver.
*
* @param optionRef
*/
public void addOptionReference(OptionReference optionRef) {
getLocalOptionRefs().add(optionRef);
}
/** /**
* Created tool reference from an extension defined in a plugin manifest. * Created tool reference from an extension defined in a plugin manifest.
* *
@ -58,7 +68,7 @@ public class ToolReference implements ITool {
public ToolReference(Configuration owner, IConfigurationElement element) { public ToolReference(Configuration owner, IConfigurationElement element) {
this.owner = owner; this.owner = owner;
parent = ((Target)owner.getTarget()).getTool(element.getAttribute("id")); parent = ((Target)owner.getTarget()).getTool(element.getAttribute(ID));
owner.addToolReference(this); owner.addToolReference(this);
@ -104,14 +114,13 @@ public class ToolReference implements ITool {
*/ */
public void serialize(Document doc, Element element) { public void serialize(Document doc, Element element) {
element.setAttribute(ITool.ID, parent.getId()); element.setAttribute(ITool.ID, parent.getId());
Iterator iter = getLocalOptionRefs().listIterator();
if (optionReferences != null) while (iter.hasNext()) {
for (int i = 0; i < optionReferences.size(); ++i) { OptionReference optionRef = (OptionReference) iter.next();
OptionReference optionRef = (OptionReference)optionReferences.get(i); Element optionRefElement = doc.createElement(ITool.OPTION_REF);
Element optionRefElement = doc.createElement(ITool.OPTION_REF); element.appendChild(optionRefElement);
element.appendChild(optionRefElement); optionRef.serialize(doc, optionRefElement);
optionRef.serialize(doc, optionRefElement); }
}
} }
public IConfiguration getConfiguration() { public IConfiguration getConfiguration() {
@ -254,6 +263,11 @@ public class ToolReference implements ITool {
return parent.producesFileType(outputExtension); return parent.producesFileType(outputExtension);
} }
protected List getAllOptionRefs() {
// First get all the option references this tool reference contains
return ((Configuration)owner).getOptionReferences(parent);
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getId() * @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
*/ */
@ -283,35 +297,63 @@ public class ToolReference implements ITool {
} }
public boolean references(ITool target) { public boolean references(ITool target) {
if (equals(target)) if (equals(target)) {
// we are the target // we are the target
return true; return true;
else if (parent instanceof ToolReference) }
else if (parent instanceof ToolReference) {
// check the reference we are overriding // check the reference we are overriding
return ((ToolReference)parent).references(target); return ((ToolReference)parent).references(target);
else }
else if (target instanceof ToolReference) {
return parent.equals(((ToolReference)target).parent);
}
else {
// the real reference // the real reference
return parent.equals(target); return parent.equals(target);
}
} }
/* (non-javadoc)
* Answers an option reference that overrides the option, or <code>null</code>
*
* @param option
* @return OptionReference
*/
private OptionReference getOptionReference(IOption option) { private OptionReference getOptionReference(IOption option) {
if (optionReferences != null) // Get all the option references for this option
for (int i = 0; i < optionReferences.size(); ++i) { Iterator iter = getAllOptionRefs().listIterator();
OptionReference optionRef = (OptionReference)optionReferences.get(i); while (iter.hasNext()) {
if (optionRef.references(option)) OptionReference optionRef = (OptionReference) iter.next();
return optionRef; if (optionRef.references(option))
} return optionRef;
}
return null; return null;
} }
public OptionReference createOptionReference(IOption option) { protected List getLocalOptionRefs() {
return new OptionReference(this, option); if (optionReferences == null) {
optionReferences = new ArrayList();
optionReferences.clear();
}
return optionReferences;
} }
public void addOptionReference(OptionReference optionRef) { /**
if (optionReferences == null) * Answers a reference to the option. If the reference does not exist,
optionReferences = new ArrayList(); * a new reference is created.
optionReferences.add(optionRef); *
* @param option
* @return OptionReference
*/
public OptionReference createOptionReference(IOption option) {
// Check if the option reference already exists
OptionReference ref = getOptionReference(option);
if (ref == null) {
ref = new OptionReference(this, option);
}
return ref;
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -1,3 +1,24 @@
2003-09-25 Sean Evoy
This patch contains a lot of changes needed to implement fixes for 42648 and
43122.
The properties file has been updated to externalize some of the option labels
to try and address some of the concern about continuity between UIs on
different platforms.
* plugin.properties
There are changes in the plugin XML file to accomodate showing the targets
only on the correct host platform. Option names have bee replaced with
externalized equivalents where possible. The release and debug configurations
for each configuration now apply "reasonable" defaults for debug and optimization
option. Finally, the Cygwinb tool specification has been brought closer to those
for *nix.
* plugin.xml
Only targets that correspond to the host platforms are shown in the drop-down
list.
* src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java
2003-09-23 Sean Evoy 2003-09-23 Sean Evoy
I added a fix for critical bug 43439. The new project wizard is ready to be hooked I added a fix for critical bug 43439. The new project wizard is ready to be hooked
up to the help system content on F1. There is a new file with the string constant up to the help system content on F1. There is a new file with the string constant

View file

@ -22,7 +22,21 @@ OptionCategory.Debug=Debugging
OptionCategory.Warn=Warnings OptionCategory.Warn=Warnings
OptionCategory.Misc=Miscellaneous OptionCategory.Misc=Miscellaneous
OptionCategory.Libs=Libraries OptionCategory.Libs=Libraries
Option.Posix.PreprocOnly=Preprocess only (-E) Option.Posix.PreprocOnly=Preprocess only (-E)
Option.Posix.Nostdinc=Do not search system directories (-nostdinc)
Option.Posix.DefSym=Defined symbols (-D) Option.Posix.DefSym=Defined symbols (-D)
Option.Posix.UndefSym=Undefined symbols (-U)
Option.Posix.Optimize.None=None (-O0)
Option.Posix.Optimize.Optimize=Optimize (-O1)
Option.Posix.Optimize.More=Optimize more (-O2)
Option.Posix.Optimize.Most=Optimize most (-O3)
Option.Posix.Verbose=Verbose (-v)
Option.OtherFlags=Other flags
Option.Posix.Linker.Flags=Linker flags
Option.Posix.Libs=Libraries (-l) Option.Posix.Libs=Libraries (-l)
Option.Posix.Libsearch=Library search path (-L) Option.Posix.Libsearch=Library search path (-L)

View file

@ -61,19 +61,21 @@
</filter> </filter>
</page> </page>
</extension> </extension>
<!-- Managed Make Builder Tool Specifications -->
<extension <extension
id="cdt.managed.build.info" id="cdt.managed.build.info"
name="Managed Build Tools Description" name="Managed Build Tools Description"
point="org.eclipse.cdt.managedbuilder.core.ManagedBuildInfo"> point="org.eclipse.cdt.managedbuilder.core.ManagedBuildInfo">
<target <target
makeFlags="-k"
isTest="false"
cleanCommand="rm -rf"
name="Cygwin" name="Cygwin"
binaryParser="org.eclipse.cdt.core.PE" id="cygwin"
cleanCommand="rm -rf"
isTest="false"
isAbstract="true" isAbstract="true"
makeCommand="make" makeCommand="make"
id="cygwin"> binaryParser="org.eclipse.cdt.core.PE"
makeFlags="-k"
osList="win32">
<tool <tool
sources="c,cc,cpp,cxx,C" sources="c,cc,cpp,cxx,C"
name="%ToolName.compiler" name="%ToolName.compiler"
@ -88,7 +90,7 @@
</optionCategory> </optionCategory>
<option <option
defaultValue="false" defaultValue="false"
name="Do not search system directories (-nostdinc)" name="%Option.Posix.Nostdinc"
category="cygwin.compiler.category.preprocessor" category="cygwin.compiler.category.preprocessor"
command="-nostdinc" command="-nostdinc"
valueType="boolean" valueType="boolean"
@ -210,7 +212,7 @@
</listOptionValue> </listOptionValue>
</option> </option>
<option <option
name="Undefined symbols (-U)" name="%Option.Posix.UndefSym"
category="cygwin.gnu.compiler.category.symbols" category="cygwin.gnu.compiler.category.symbols"
command="-U" command="-U"
valueType="stringList" valueType="stringList"
@ -221,36 +223,30 @@
name="%OptionCategory.General" name="%OptionCategory.General"
id="cygwin.compiler.category.general"> id="cygwin.compiler.category.general">
</optionCategory> </optionCategory>
<option
defaultValue="-c"
name="Compiler Flags"
category="cygwin.compiler.category.general"
valueType="string"
id="cygwin.compiler.general.ccflags">
</option>
<option <option
name="Optimization Level" name="Optimization Level"
category="cygwin.compiler.category.general" category="cygwin.compiler.category.general"
valueType="enumerated" valueType="enumerated"
id="cygwin.compiler.general.optimization.level"> id="cygwin.compiler.general.optimization.level">
<enumeratedOptionValue <enumeratedOptionValue
name="None (-O0)" name="%Option.Posix.Optimize.None"
isDefault="false"
command="-O0" command="-O0"
id="cygwin.optimization.level.none"> id="cygwin.optimization.level.none">
</enumeratedOptionValue> </enumeratedOptionValue>
<enumeratedOptionValue <enumeratedOptionValue
name="Optimize (-O1)" name="%Option.Posix.Optimize.Optimize"
command="-O1" command="-O1"
id="cygwin.optimization.level.optimize"> id="cygwin.optimization.level.optimize">
</enumeratedOptionValue> </enumeratedOptionValue>
<enumeratedOptionValue <enumeratedOptionValue
name="Optimize more (-O2)" name="%Option.Posix.Optimize.More"
isDefault="true" isDefault="true"
command="-O2" command="-O2"
id="cygwin.optimization.level.more"> id="cygwin.optimization.level.more">
</enumeratedOptionValue> </enumeratedOptionValue>
<enumeratedOptionValue <enumeratedOptionValue
name="Optimize most (-O3)" name="%Option.Posix.Optimize.Most"
command="-O3" command="-O3"
id="cygwin.optimization.level.most"> id="cygwin.optimization.level.most">
</enumeratedOptionValue> </enumeratedOptionValue>
@ -294,13 +290,78 @@
builtIn="true"> builtIn="true">
</listOptionValue> </listOptionValue>
</option> </option>
<optionCategory
owner="org.eclipse.cdt.build.tool.cygwin.compiler"
name="%OptionCategory.Warn"
id="cygwin.compiler.category.warnings">
</optionCategory>
<option <option
defaultValue="false" defaultValue="false"
name="Verbose" name="Check syntax only (-fsyntax-only)"
category="cygwin.compiler.category.general" category="cygwin.compiler.category.warnings"
command="-fsyntax-only"
valueType="boolean"
id="cygwin.gnu.compiler.warnings.syntax">
</option>
<option
defaultValue="false"
name="Pedantic (-pedantic)"
category="cygwin.compiler.category.warnings"
command="-pedantic"
valueType="boolean"
id="cygwin.gnu.compiler.warnings.pedantic">
</option>
<option
defaultValue="false"
name="Pedantic warnings as errors (-pedantic-errors)"
category="cygwin.compiler.category.warnings"
command="-pedantic-errors"
valueType="boolean"
id="cygwin.gnu.compiler.warnings.pedantic.error">
</option>
<option
defaultValue="false"
name="Inhibit all warnings (-w)"
category="cygwin.compiler.category.warnings"
command="-w"
valueType="boolean"
id="cygwin.gnu.compiler.warnings.nowarn">
</option>
<option
defaultValue="true"
name="All warnings (-Wall)"
category="cygwin.compiler.category.warnings"
command="-Wall"
valueType="boolean"
id="cygwin.gnu.compiler.warnings.allwarn">
</option>
<option
defaultValue="false"
name="Warnings as errors (-werror)"
category="cygwin.compiler.category.warnings"
command="-werror"
valueType="boolean"
id="cygwin.gnu.compiler.warnings.toerrors">
</option>
<optionCategory
owner="cdt.build.tool.linux.gnu.compiler"
name="%OptionCategory.Misc"
id="cygwin.compiler.category.other">
</optionCategory>
<option
defaultValue="-c"
name="%Option.OtherFlags"
category="cygwin.compiler.category.other"
valueType="string"
id="cygwin.compiler.misc.other">
</option>
<option
defaultValue="false"
name="%Option.Posix.Verbose"
category="cygwin.compiler.category.other"
command="-v" command="-v"
valueType="boolean" valueType="boolean"
id="cygwin.compiler.general.verbose"> id="cygwin.compiler.misc.verbose">
</option> </option>
</tool> </tool>
</target> </target>
@ -315,10 +376,35 @@
<configuration <configuration
name="%ConfigName.Rel" name="%ConfigName.Rel"
id="cygwin.exec.release"> id="cygwin.exec.release">
<toolReference
id="org.eclipse.cdt.build.tool.cygwin.compiler">
<optionReference
defaultValue="Optimize most (-O3)"
command="-O3"
id="cygwin.compiler.general.optimization.level">
</optionReference>
<optionReference
defaultValue="None"
id="cygwin.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<configuration <configuration
name="%ConfigName.Dbg" name="%ConfigName.Dbg"
id="cygwin.exec.debug"> id="cygwin.exec.debug">
<toolReference
id="org.eclipse.cdt.build.tool.cygwin.compiler">
<optionReference
defaultValue="None (-O0)"
command="-O0"
id="cygwin.compiler.general.optimization.level">
</optionReference>
<optionReference
defaultValue="Maximum (-g3)"
command="-g3"
id="cygwin.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<tool <tool
name="%ToolName.linker" name="%ToolName.linker"
@ -364,10 +450,35 @@
<configuration <configuration
name="%ConfigName.Rel" name="%ConfigName.Rel"
id="cygwin.so.release"> id="cygwin.so.release">
<toolReference
id="org.eclipse.cdt.build.tool.cygwin.compiler">
<optionReference
defaultValue="Optimize most (-O3)"
command="-O3"
id="cygwin.compiler.general.optimization.level">
</optionReference>
<optionReference
defaultValue="None"
id="cygwin.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<configuration <configuration
name="%ConfigName.Dbg" name="%ConfigName.Dbg"
id="cygwin.so.debug"> id="cygwin.so.debug">
<toolReference
id="org.eclipse.cdt.build.tool.cygwin.compiler">
<optionReference
defaultValue="None (-O0)"
command="-O0"
id="cygwin.compiler.general.optimization.level">
</optionReference>
<optionReference
defaultValue="Maximum (-g3)"
command="-g3"
id="cygwin.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<tool <tool
name="%ToolName.linker" name="%ToolName.linker"
@ -415,10 +526,35 @@
<configuration <configuration
name="%ConfigName.Rel" name="%ConfigName.Rel"
id="cygwin.exp.release"> id="cygwin.exp.release">
<toolReference
id="org.eclipse.cdt.build.tool.cygwin.compiler">
<optionReference
defaultValue="Optimize most (-O3)"
command="-O3"
id="cygwin.compiler.general.optimization.level">
</optionReference>
<optionReference
defaultValue="None"
id="cygwin.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<configuration <configuration
name="%ConfigName.Dbg" name="%ConfigName.Dbg"
id="cygwin.exp.debug"> id="cygwin.exp.debug">
<toolReference
id="org.eclipse.cdt.build.tool.cygwin.compiler">
<optionReference
defaultValue="None (-O0)"
command="-O0"
id="cygwin.compiler.general.optimization.level">
</optionReference>
<optionReference
defaultValue="Maximum (-g3)"
command="-g3"
id="cygwin.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<tool <tool
name="%ToolName.linker" name="%ToolName.linker"
@ -466,10 +602,35 @@
<configuration <configuration
name="%ConfigName.Rel" name="%ConfigName.Rel"
id="cygwin.lib.release"> id="cygwin.lib.release">
<toolReference
id="org.eclipse.cdt.build.tool.cygwin.compiler">
<optionReference
defaultValue="Optimize most (-O3)"
command="-O3"
id="cygwin.compiler.general.optimization.level">
</optionReference>
<optionReference
defaultValue="None"
id="cygwin.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<configuration <configuration
name="%ConfigName.Dbg" name="%ConfigName.Dbg"
id="cygwin.lib.debug"> id="cygwin.lib.debug">
<toolReference
id="org.eclipse.cdt.build.tool.cygwin.compiler">
<optionReference
defaultValue="None (-O0)"
command="-O0"
id="cygwin.compiler.general.optimization.level">
</optionReference>
<optionReference
defaultValue="Maximum (-g3)"
command="-g3"
id="cygwin.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<tool <tool
name="%ToolName.archiver" name="%ToolName.archiver"
@ -492,14 +653,15 @@
</tool> </tool>
</target> </target>
<target <target
makeFlags="-k"
isTest="false"
cleanCommand="rm -rf"
name="Linux" name="Linux"
binaryParser="org.eclipse.cdt.core.ELF" id="linux.gnu"
cleanCommand="rm -rf"
isTest="false"
isAbstract="true" isAbstract="true"
makeCommand="make" makeCommand="make"
id="linux.gnu"> binaryParser="org.eclipse.cdt.core.ELF"
makeFlags="-k"
osList="linux">
<tool <tool
sources="c,C,cc,cxx,cpp" sources="c,C,cc,cxx,cpp"
name="%ToolName.compiler" name="%ToolName.compiler"
@ -514,7 +676,7 @@
</optionCategory> </optionCategory>
<option <option
defaultValue="false" defaultValue="false"
name="Do not search system directories (-nostdinc)" name="%Option.Posix.Nostdinc"
category="linux.gnu.compiler.category.preprocessor" category="linux.gnu.compiler.category.preprocessor"
command="-nostdinc" command="-nostdinc"
valueType="boolean" valueType="boolean"
@ -595,6 +757,13 @@
builtIn="true"> builtIn="true">
</listOptionValue> </listOptionValue>
</option> </option>
<option
name="%Option.Posix.UndefSym"
category="linux.gnu.compiler.category.preprocessor"
command="-U"
valueType="stringList"
id="linux.gnu.compiler.preprocessor.undef">
</option>
<optionCategory <optionCategory
owner="cdt.build.tool.linux.gnu.compiler" owner="cdt.build.tool.linux.gnu.compiler"
name="%OptionCategory.Dirs" name="%OptionCategory.Dirs"
@ -626,23 +795,23 @@
valueType="enumerated" valueType="enumerated"
id="linux.gnu.compiler.optimization.level"> id="linux.gnu.compiler.optimization.level">
<enumeratedOptionValue <enumeratedOptionValue
name="None (-O0)" name="%Option.Posix.Optimize.None"
command="-O0" command="-O0"
id="linux.gnu.compiler.optimization.level.none"> id="linux.gnu.compiler.optimization.level.none">
</enumeratedOptionValue> </enumeratedOptionValue>
<enumeratedOptionValue <enumeratedOptionValue
name="Optimize (-O1)" name="%Option.Posix.Optimize.Optimize"
command="-O1" command="-O1"
id="linux.gnu.compiler.optimization.level.optimize"> id="linux.gnu.compiler.optimization.level.optimize">
</enumeratedOptionValue> </enumeratedOptionValue>
<enumeratedOptionValue <enumeratedOptionValue
name="Optimize more (-O2)" name="%Option.Posix.Optimize.More"
isDefault="true" isDefault="true"
command="-O2" command="-O2"
id="linux.gnu.compiler.optimization.level.more"> id="linux.gnu.compiler.optimization.level.more">
</enumeratedOptionValue> </enumeratedOptionValue>
<enumeratedOptionValue <enumeratedOptionValue
name="Optimize most (-O3)" name="%Option.Posix.Optimize.Most"
command="-O3" command="-O3"
id="linux.gnu.compiler.optimization.level.most"> id="linux.gnu.compiler.optimization.level.most">
</enumeratedOptionValue> </enumeratedOptionValue>
@ -766,21 +935,21 @@
name="%OptionCategory.Misc" name="%OptionCategory.Misc"
id="linux.gnu.compiler.category.other"> id="linux.gnu.compiler.category.other">
</optionCategory> </optionCategory>
<option
defaultValue="-c"
name="%Option.OtherFlags"
category="linux.gnu.compiler.category.other"
valueType="string"
id="linux.gnu.compiler.other.other">
</option>
<option <option
defaultValue="false" defaultValue="false"
name="Verbose (-v)" name="%Option.Posix.Verbose"
category="linux.gnu.compiler.category.other" category="linux.gnu.compiler.category.other"
command="-v" command="-v"
valueType="boolean" valueType="boolean"
id="linux.gnu.compiler.other.verbose"> id="linux.gnu.compiler.other.verbose">
</option> </option>
<option
defaultValue="-c"
name="Other flags"
category="linux.gnu.compiler.category.other"
valueType="string"
id="linux.gnu.compiler.other.other">
</option>
</tool> </tool>
</target> </target>
<target <target
@ -793,10 +962,32 @@
<configuration <configuration
name="%ConfigName.Rel" name="%ConfigName.Rel"
id="linux.gnu.exec.release"> id="linux.gnu.exec.release">
<toolReference
id="cdt.build.tool.linux.gnu.compiler">
<optionReference
defaultValue="Optimize most (-O3)"
id="linux.gnu.compiler.optimization.level">
</optionReference>
<optionReference
defaultValue="None"
id="linux.gnu.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<configuration <configuration
name="%ConfigName.Dbg" name="%ConfigName.Dbg"
id="linux.gnu.exec.debug"> id="linux.gnu.exec.debug">
<toolReference
id="cdt.build.tool.linux.gnu.compiler">
<optionReference
defaultValue="None (-O0)"
id="linux.gnu.compiler.optimization.level">
</optionReference>
<optionReference
defaultValue="Maximum (-g3)"
id="linux.gnu.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<tool <tool
sources="o" sources="o"
@ -861,6 +1052,12 @@
name="%OptionCategory.Libs" name="%OptionCategory.Libs"
id="linux.gnu.linker.category.libs"> id="linux.gnu.linker.category.libs">
</optionCategory> </optionCategory>
<option
name="%Option.Posix.Linker.Flags"
category="linux.gnu.linker.category.libs"
valueType="string"
id="linux.gnu.linker.libs.flags">
</option>
<option <option
name="%Option.Posix.Libs" name="%Option.Posix.Libs"
category="linux.gnu.linker.category.libs" category="linux.gnu.linker.category.libs"
@ -888,10 +1085,32 @@
<configuration <configuration
name="%ConfigName.Rel" name="%ConfigName.Rel"
id="linux.gnu.so.release"> id="linux.gnu.so.release">
<toolReference
id="cdt.build.tool.linux.gnu.compiler">
<optionReference
defaultValue="Optimize most (-O3)"
id="linux.gnu.compiler.optimization.level">
</optionReference>
<optionReference
defaultValue="None"
id="linux.gnu.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<configuration <configuration
name="%ConfigName.Dbg" name="%ConfigName.Dbg"
id="linux.gnu.so.debug"> id="linux.gnu.so.debug">
<toolReference
id="cdt.build.tool.linux.gnu.compiler">
<optionReference
defaultValue="None (-O0)"
id="linux.gnu.compiler.optimization.level">
</optionReference>
<optionReference
defaultValue="Maximum (-g3)"
id="linux.gnu.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<tool <tool
sources="o" sources="o"
@ -966,6 +1185,12 @@
name="%OptionCategory.Libs" name="%OptionCategory.Libs"
id="linux.gnu.solink.category.libs"> id="linux.gnu.solink.category.libs">
</optionCategory> </optionCategory>
<option
category="linux.gnu.solink.category.libs"
name="%Option.Posix.Linker.Flags"
id="linux.gnu.solink.libs.flags"
valueType="string">
</option>
<option <option
name="%Option.Posix.Libs" name="%Option.Posix.Libs"
category="linux.gnu.solink.category.libs" category="linux.gnu.solink.category.libs"
@ -993,10 +1218,32 @@
<configuration <configuration
name="%ConfigName.Rel" name="%ConfigName.Rel"
id="linux.gnu.lib.release"> id="linux.gnu.lib.release">
<toolReference
id="cdt.build.tool.linux.gnu.compiler">
<optionReference
defaultValue="Optimize most (-O3)"
id="linux.gnu.compiler.optimization.level">
</optionReference>
<optionReference
defaultValue="None"
id="linux.gnu.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<configuration <configuration
name="%ConfigName.Dbg" name="%ConfigName.Dbg"
id="linux.gnu.lib.debug"> id="linux.gnu.lib.debug">
<toolReference
id="cdt.build.tool.linux.gnu.compiler">
<optionReference
defaultValue="None (-O0)"
id="linux.gnu.compiler.optimization.level">
</optionReference>
<optionReference
defaultValue="Maximum (-g3)"
id="linux.gnu.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<tool <tool
sources="o" sources="o"
@ -1020,14 +1267,15 @@
</tool> </tool>
</target> </target>
<target <target
makeFlags="-k"
isTest="false"
cleanCommand="rm -rf"
name="Solaris" name="Solaris"
binaryParser="org.eclipse.cdt.core.ELF" id="solaris.gnu"
cleanCommand="rm -rf"
isTest="false"
isAbstract="true" isAbstract="true"
makeCommand="make" makeCommand="make"
id="solaris.gnu"> binaryParser="org.eclipse.cdt.core.ELF"
makeFlags="-k"
osList="solaris">
<tool <tool
sources="c,C,cc,cxx,cpp" sources="c,C,cc,cxx,cpp"
name="%ToolName.compiler" name="%ToolName.compiler"
@ -1042,7 +1290,7 @@
</optionCategory> </optionCategory>
<option <option
defaultValue="false" defaultValue="false"
name="Do not search system directories (-nostdinc)" name="%Option.Posix.Nostdinc"
category="solaris.gnu.compiler.category.preprocessor" category="solaris.gnu.compiler.category.preprocessor"
command="-nostdinc" command="-nostdinc"
valueType="boolean" valueType="boolean"
@ -1146,23 +1394,23 @@
valueType="enumerated" valueType="enumerated"
id="solaris.gnu.compiler.optimization.level"> id="solaris.gnu.compiler.optimization.level">
<enumeratedOptionValue <enumeratedOptionValue
name="None (-O0)" name="%Option.Posix.Optimize.None"
command="-O0" command="-O0"
id="solaris.gnu.compiler.optimization.level.none"> id="solaris.gnu.compiler.optimization.level.none">
</enumeratedOptionValue> </enumeratedOptionValue>
<enumeratedOptionValue <enumeratedOptionValue
name="Optimize (-O1)" name="%Option.Posix.Optimize.Optimize"
command="-O1" command="-O1"
id="solaris.gnu.compiler.optimization.level.optimize"> id="solaris.gnu.compiler.optimization.level.optimize">
</enumeratedOptionValue> </enumeratedOptionValue>
<enumeratedOptionValue <enumeratedOptionValue
name="Optimize more (-O2)" name="%Option.Posix.Optimize.More"
isDefault="true" isDefault="true"
command="-O2" command="-O2"
id="solaris.gnu.compiler.optimization.level.more"> id="solaris.gnu.compiler.optimization.level.more">
</enumeratedOptionValue> </enumeratedOptionValue>
<enumeratedOptionValue <enumeratedOptionValue
name="Optimize most (-O3)" name="%Option.Posix.Optimize.Most"
command="-O3" command="-O3"
id="solaris.gnu.compiler.optimization.level.most"> id="solaris.gnu.compiler.optimization.level.most">
</enumeratedOptionValue> </enumeratedOptionValue>
@ -1286,21 +1534,21 @@
name="%OptionCategory.Misc" name="%OptionCategory.Misc"
id="solaris.gnu.compiler.category.other"> id="solaris.gnu.compiler.category.other">
</optionCategory> </optionCategory>
<option
defaultValue="-c"
name="%Option.OtherFlags"
category="solaris.gnu.compiler.category.other"
valueType="string"
id="solaris.gnu.compiler.other.other">
</option>
<option <option
defaultValue="false" defaultValue="false"
name="Verbose (-v)" name="%Option.Posix.Verbose"
category="solaris.gnu.compiler.category.other" category="solaris.gnu.compiler.category.other"
command="-v" command="-v"
valueType="boolean" valueType="boolean"
id="solaris.gnu.compiler.other.verbose"> id="solaris.gnu.compiler.other.verbose">
</option> </option>
<option
defaultValue="-c"
name="Other flags"
category="solaris.gnu.compiler.category.other"
valueType="string"
id="solaris.gnu.compiler.other.other">
</option>
</tool> </tool>
</target> </target>
<target <target
@ -1313,10 +1561,32 @@
<configuration <configuration
name="%ConfigName.Rel" name="%ConfigName.Rel"
id="solaris.gnu.exec.release"> id="solaris.gnu.exec.release">
<toolReference
id="cdt.build.tool.solaris.gnu.compiler">
<optionReference
defaultValue="Optimize most (-O3)"
id="solaris.gnu.compiler.optimization.level">
</optionReference>
<optionReference
defaultValue="None"
id="solaris.gnu.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<configuration <configuration
name="%ConfigName.Dbg" name="%ConfigName.Dbg"
id="solaris.gnu.exec.debug"> id="solaris.gnu.exec.debug">
<toolReference
id="cdt.build.tool.solaris.gnu.compiler">
<optionReference
defaultValue="None (-O0)"
id="solaris.gnu.compiler.optimization.level">
</optionReference>
<optionReference
defaultValue="Maximum (-g3)"
id="solaris.gnu.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<tool <tool
sources="o" sources="o"
@ -1381,6 +1651,12 @@
name="%OptionCategory.Libs" name="%OptionCategory.Libs"
id="solaris.gnu.linker.category.libs"> id="solaris.gnu.linker.category.libs">
</optionCategory> </optionCategory>
<option
category="solaris.gnu.linker.category.libs"
name="%Option.Posix.Linker.Flags"
id="solaris.gnu.linker.libs.flags"
valueType="string">
</option>
<option <option
name="%Option.Posix.Libs" name="%Option.Posix.Libs"
category="solaris.gnu.linker.category.libs" category="solaris.gnu.linker.category.libs"
@ -1408,10 +1684,32 @@
<configuration <configuration
name="%ConfigName.Rel" name="%ConfigName.Rel"
id="solaris.gnu.so.release"> id="solaris.gnu.so.release">
<toolReference
id="cdt.build.tool.solaris.gnu.compiler">
<optionReference
defaultValue="Optimize most (-O3)"
id="solaris.gnu.compiler.optimization.level">
</optionReference>
<optionReference
defaultValue="None"
id="solaris.gnu.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<configuration <configuration
name="%ConfigName.Dbg" name="%ConfigName.Dbg"
id="solaris.gnu.so.debug"> id="solaris.gnu.so.debug">
<toolReference
id="cdt.build.tool.solaris.gnu.compiler">
<optionReference
defaultValue="None (-O0)"
id="solaris.gnu.compiler.optimization.level">
</optionReference>
<optionReference
defaultValue="Maximum (-g3)"
id="solaris.gnu.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<tool <tool
sources="o" sources="o"
@ -1486,6 +1784,12 @@
name="%OptionCategory.Libs" name="%OptionCategory.Libs"
id="solaris.gnu.solink.category.libs"> id="solaris.gnu.solink.category.libs">
</optionCategory> </optionCategory>
<option
name="%Option.Posix.Linker.Flags"
category="solaris.gnu.solink.category.libs"
valueType="string"
id="solaris.gnu.solink.libs.flags">
</option>
<option <option
name="%Option.Posix.Libs" name="%Option.Posix.Libs"
category="solaris.gnu.solink.category.libs" category="solaris.gnu.solink.category.libs"
@ -1513,10 +1817,32 @@
<configuration <configuration
name="%ConfigName.Rel" name="%ConfigName.Rel"
id="solaris.gnu.lib.release"> id="solaris.gnu.lib.release">
<toolReference
id="cdt.build.tool.solaris.gnu.compiler">
<optionReference
defaultValue="Optimize most (-O3)"
id="solaris.gnu.compiler.optimization.level">
</optionReference>
<optionReference
defaultValue="None"
id="solaris.gnu.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<configuration <configuration
name="%ConfigName.Dbg" name="%ConfigName.Dbg"
id="solaris.gnu.lib.debug"> id="solaris.gnu.lib.debug">
<toolReference
id="cdt.build.tool.solaris.gnu.compiler">
<optionReference
defaultValue="None (-O0)"
id="solaris.gnu.compiler.optimization.level">
</optionReference>
<optionReference
defaultValue="Maximum (-g3)"
id="solaris.gnu.compiler.debugging.level">
</optionReference>
</toolReference>
</configuration> </configuration>
<tool <tool
sources="o" sources="o"

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
@ -21,6 +22,7 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderHelpContextIds; import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderHelpContextIds;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin; import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.utils.ui.controls.ControlFactory; import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.boot.BootLoader;
import org.eclipse.jface.viewers.CheckboxTableViewer; import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.SelectionChangedEvent;
@ -202,11 +204,15 @@ public class CProjectPlatformPage extends WizardPage {
// Get a list of platforms defined by plugins // Get a list of platforms defined by plugins
ITarget[] allTargets = ManagedBuildManager.getDefinedTargets(null); ITarget[] allTargets = ManagedBuildManager.getDefinedTargets(null);
targets = new ArrayList(); targets = new ArrayList();
String os = BootLoader.getOS();
// Add all of the concrete targets to the target list // Add all of the concrete targets to the target list
for (int index = 0; index < allTargets.length; ++index) { for (int index = 0; index < allTargets.length; ++index) {
ITarget target = allTargets[index]; ITarget target = allTargets[index];
if (!target.isAbstract() && !target.isTestTarget()) { if (!target.isAbstract() && !target.isTestTarget()) {
targets.add(target); List targetOSList = Arrays.asList(target.getTargetOSList());
if (targetOSList.contains(os)) {
targets.add(target);
}
} }
} }
targets.trimToSize(); targets.trimToSize();

View file

@ -32,6 +32,7 @@ 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.cdt.managedbuilder.core.ManagedCProjectNature; import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
import org.eclipse.cdt.managedbuilder.internal.core.OptionReference;
import org.eclipse.cdt.managedbuilder.internal.core.ToolReference; import org.eclipse.cdt.managedbuilder.internal.core.ToolReference;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IProjectDescription;
@ -156,7 +157,7 @@ public class ManagedBuildTests extends TestCase {
// These are the expected path settings // These are the expected path settings
final String[] expectedPaths = new String[4]; final String[] expectedPaths = new String[4];
// This first path is a built-in, so it will not be manipulated by build manager // This first path is a built-in, so it will not be manipulated by build manager
expectedPaths[0] = "/usr/gnu/include"; expectedPaths[0] = "/usr/gnu/include";
expectedPaths[1] = (new Path("/usr/include")).toOSString(); expectedPaths[1] = (new Path("/usr/include")).toOSString();
expectedPaths[2] = (new Path("/opt/gnome/include")).toOSString(); expectedPaths[2] = (new Path("/opt/gnome/include")).toOSString();
expectedPaths[3] = (new Path("C:\\home\\tester/include")).toOSString(); expectedPaths[3] = (new Path("C:\\home\\tester/include")).toOSString();
@ -187,9 +188,9 @@ public class ManagedBuildTests extends TestCase {
// Change the default configuration to the sub config // Change the default configuration to the sub config
IConfiguration[] configs = newTarget.getConfigurations(); IConfiguration[] configs = newTarget.getConfigurations();
assertEquals(3, configs.length); assertEquals(4, configs.length);
IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project); IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
buildInfo.setDefaultConfiguration(newTarget.getConfiguration("sub.config.2")); buildInfo.setDefaultConfiguration(newTarget.getConfiguration(configs[3].getId()));
// Use the plugin mechanism to discover the supplier of the path information // Use the plugin mechanism to discover the supplier of the path information
IExtensionPoint extensionPoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("ScannerInfoProvider"); IExtensionPoint extensionPoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("ScannerInfoProvider");
@ -275,6 +276,8 @@ public class ManagedBuildTests extends TestCase {
String rootName = "Root Config"; String rootName = "Root Config";
String overrideConfigId = "test.root.1.1"; String overrideConfigId = "test.root.1.1";
String overrideName = "Root Override Config"; String overrideName = "Root Override Config";
String completeOverrideConfigId = "test.root.1.2";
String completeOverrideName = "Complete Override Config";
// Open the test project // Open the test project
IProject project = createProject(projectName); IProject project = createProject(projectName);
@ -284,16 +287,18 @@ public class ManagedBuildTests extends TestCase {
assertEquals(1, definedTargets.length); assertEquals(1, definedTargets.length);
ITarget rootTarget = definedTargets[0]; ITarget rootTarget = definedTargets[0];
IConfiguration[] definedConfigs = rootTarget.getConfigurations(); IConfiguration[] definedConfigs = rootTarget.getConfigurations();
assertEquals(2, definedConfigs.length); assertEquals(3, definedConfigs.length);
IConfiguration baseConfig = definedConfigs[0]; IConfiguration baseConfig = definedConfigs[0];
assertEquals(definedConfigs[0].getId(), rootConfigId); assertEquals(definedConfigs[0].getId(), rootConfigId);
assertEquals(definedConfigs[0].getName(), rootName); assertEquals(definedConfigs[0].getName(), rootName);
assertEquals(definedConfigs[1].getId(), overrideConfigId); assertEquals(definedConfigs[1].getId(), overrideConfigId);
assertEquals(definedConfigs[1].getName(), overrideName); assertEquals(definedConfigs[1].getName(), overrideName);
assertEquals(definedConfigs[2].getId(), completeOverrideConfigId);
assertEquals(definedConfigs[2].getName(), completeOverrideName);
// Create a new configuration and test the rename function // Create a new configuration and test the rename function
IConfiguration newConfig = rootTarget.createConfiguration(baseConfig, testConfigId); IConfiguration newConfig = rootTarget.createConfiguration(baseConfig, testConfigId);
assertEquals(3, rootTarget.getConfigurations().length); assertEquals(4, rootTarget.getConfigurations().length);
newConfig.setName(testConfigName); newConfig.setName(testConfigName);
assertEquals(newConfig.getId(), testConfigId); assertEquals(newConfig.getId(), testConfigId);
assertEquals(newConfig.getName(), testConfigName); assertEquals(newConfig.getName(), testConfigName);
@ -332,10 +337,10 @@ public class ManagedBuildTests extends TestCase {
assertEquals(1, definedTargets.length); assertEquals(1, definedTargets.length);
rootTarget = definedTargets[0]; rootTarget = definedTargets[0];
definedConfigs = rootTarget.getConfigurations(); definedConfigs = rootTarget.getConfigurations();
assertEquals(3, definedConfigs.length); assertEquals(4, definedConfigs.length);
rootTarget.removeConfiguration(testConfigId); rootTarget.removeConfiguration(testConfigId);
definedConfigs = rootTarget.getConfigurations(); definedConfigs = rootTarget.getConfigurations();
assertEquals(2, definedConfigs.length); assertEquals(3, definedConfigs.length);
assertEquals(definedConfigs[0].getId(), rootConfigId); assertEquals(definedConfigs[0].getId(), rootConfigId);
assertEquals(definedConfigs[0].getName(), rootName); assertEquals(definedConfigs[0].getName(), rootName);
assertEquals(definedConfigs[1].getId(), overrideConfigId); assertEquals(definedConfigs[1].getId(), overrideConfigId);
@ -554,7 +559,7 @@ public class ManagedBuildTests extends TestCase {
// Now get the configs // Now get the configs
IConfiguration[] definedConfigs = rootTarget.getConfigurations(); IConfiguration[] definedConfigs = rootTarget.getConfigurations();
assertEquals(3, definedConfigs.length); assertEquals(4, definedConfigs.length);
IConfiguration newConfig = rootTarget.getConfiguration(testConfigId); IConfiguration newConfig = rootTarget.getConfiguration(testConfigId);
assertNotNull(newConfig); assertNotNull(newConfig);
@ -603,11 +608,13 @@ public class ManagedBuildTests extends TestCase {
// Target stuff // Target stuff
String expectedCleanCmd = "del /myworld"; String expectedCleanCmd = "del /myworld";
String expectedParserId = "org.eclipse.cdt.core.PE"; String expectedParserId = "org.eclipse.cdt.core.PE";
String[] expectedOSList = {"win32"};
assertTrue(target.isTestTarget()); assertTrue(target.isTestTarget());
assertEquals(target.getDefaultExtension(), rootExt); assertEquals(target.getDefaultExtension(), rootExt);
assertEquals(expectedCleanCmd, target.getCleanCommand()); assertEquals(expectedCleanCmd, target.getCleanCommand());
assertEquals("make", target.getMakeCommand()); assertEquals("make", target.getMakeCommand());
assertEquals(expectedParserId, target.getBinaryParserId()); assertEquals(expectedParserId, target.getBinaryParserId());
assertTrue(Arrays.equals(expectedOSList, target.getTargetOSList()));
// Tools // Tools
ITool[] tools = target.getTools(); ITool[] tools = target.getTools();
@ -663,8 +670,10 @@ public class ManagedBuildTests extends TestCase {
assertEquals("String Option in Category", options[0].getName()); assertEquals("String Option in Category", options[0].getName());
assertEquals("Enumerated Option in Category", options[1].getName()); assertEquals("Enumerated Option in Category", options[1].getName());
// Configs // There should be 3 defined configs
IConfiguration[] configs = target.getConfigurations(); IConfiguration[] configs = target.getConfigurations();
assertEquals(3, configs.length);
// Root Config // Root Config
IConfiguration rootConfig = configs[0]; IConfiguration rootConfig = configs[0];
assertEquals("Root Config", rootConfig.getName()); assertEquals("Root Config", rootConfig.getName());
@ -679,7 +688,7 @@ public class ManagedBuildTests extends TestCase {
assertEquals("doIt", tools[0].getToolCommand()); assertEquals("doIt", tools[0].getToolCommand());
assertEquals("", tools[0].getOutputPrefix()); assertEquals("", tools[0].getOutputPrefix());
// Root Override Config // Partially Overriden Configuration
assertEquals("Root Override Config", configs[1].getName()); assertEquals("Root Override Config", configs[1].getName());
tools = configs[1].getTools(); tools = configs[1].getTools();
assertEquals(1, tools.length); assertEquals(1, tools.length);
@ -693,6 +702,8 @@ public class ManagedBuildTests extends TestCase {
assertEquals("a", valueList[0]); assertEquals("a", valueList[0]);
assertEquals("b", valueList[1]); assertEquals("b", valueList[1]);
assertEquals("Boolean Option in Top", options[1].getName()); assertEquals("Boolean Option in Top", options[1].getName());
assertEquals(true, options[1].getBooleanValue());
assertEquals("-b", options[1].getCommand());
categories = topCategory.getChildCategories(); categories = topCategory.getChildCategories();
options = categories[0].getOptions(configs[1]); options = categories[0].getOptions(configs[1]);
assertEquals(2, options.length); assertEquals(2, options.length);
@ -712,6 +723,41 @@ public class ManagedBuildTests extends TestCase {
assertTrue(tools[0].buildsFileType("bar")); assertTrue(tools[0].buildsFileType("bar"));
assertTrue(tools[0].producesFileType("toor")); assertTrue(tools[0].producesFileType("toor"));
assertEquals("doIt", tools[0].getToolCommand()); assertEquals("doIt", tools[0].getToolCommand());
// Completely Overridden configuration
assertEquals("Complete Override Config", configs[2].getName());
tools = configs[2].getTools();
assertEquals(1, tools.length);
assertTrue(tools[0] instanceof ToolReference);
assertEquals("Root Tool", tools[0].getName());
topCategory = tools[0].getTopOptionCategory();
options = topCategory.getOptions(configs[2]);
assertEquals(2, options.length);
// Check that there's an empty string list and a true boolean (commands should not have changed)
assertTrue(options[0] instanceof OptionReference);
assertEquals("List Option in Top", options[0].getName());
assertEquals(IOption.STRING_LIST, options[0].getValueType());
valueList = options[0].getStringListValue();
assertTrue(valueList.length == 0);
assertEquals("-L", options[0].getCommand());
assertEquals("Boolean Option in Top", options[1].getName());
assertTrue(options[1] instanceof OptionReference);
assertEquals("Boolean Option in Top", options[1].getName());
assertEquals(IOption.BOOLEAN, options[1].getValueType());
assertEquals(true, options[1].getBooleanValue());
assertEquals("-b", options[1].getCommand());
// Check that there's an overridden enumeration and string
categories = topCategory.getChildCategories();
options = categories[0].getOptions(configs[2]);
assertEquals(2, options.length);
assertTrue(options[0] instanceof OptionReference);
assertEquals("String Option in Category", options[0].getName());
assertEquals(IOption.STRING, options[0].getValueType());
assertEquals("overridden", options[0].getStringValue());
assertTrue(options[1] instanceof OptionReference);
assertEquals("Enumerated Option in Category", options[1].getName());
assertEquals(IOption.ENUMERATED, options[1].getValueType());
assertEquals("-e2", options[1].getSelectedEnum());
} }
/* /*
@ -724,6 +770,9 @@ public class ManagedBuildTests extends TestCase {
assertEquals("nmake", target.getMakeCommand()); assertEquals("nmake", target.getMakeCommand());
// Make sure we get the proper binary parser // Make sure we get the proper binary parser
assertEquals("org.eclipse.cdt.core.ELF", target.getBinaryParserId()); assertEquals("org.eclipse.cdt.core.ELF", target.getBinaryParserId());
// Make sure the list is inherited
String[] expectedOSList = {"win32","linux","solaris"};
assertTrue(Arrays.equals(expectedOSList, target.getTargetOSList()));
} }
/* /*
@ -740,6 +789,8 @@ public class ManagedBuildTests extends TestCase {
assertEquals("make", target.getMakeCommand()); assertEquals("make", target.getMakeCommand());
// Make sure the binary parser is hard-coded and available // Make sure the binary parser is hard-coded and available
assertEquals("org.eclipse.cdt.core.PE", target.getBinaryParserId()); assertEquals("org.eclipse.cdt.core.PE", target.getBinaryParserId());
String[] expectedOSList = {"win32","linux","solaris"};
assertTrue(Arrays.equals(expectedOSList, target.getTargetOSList()));
// Make sure this is a test target // Make sure this is a test target
assertTrue(target.isTestTarget()); assertTrue(target.isTestTarget());
@ -791,15 +842,14 @@ public class ManagedBuildTests extends TestCase {
assertEquals("C:\\home\\tester/include", moreIncPath[0]); assertEquals("C:\\home\\tester/include", moreIncPath[0]);
assertEquals("-I", subOpts[2].getCommand()); assertEquals("-I", subOpts[2].getCommand());
// Get the configs for this target // Get the configs for this target; it should inherit all the configs defined for the parent
IConfiguration[] configs = target.getConfigurations(); IConfiguration[] configs = target.getConfigurations();
// Check inheritance assertEquals(4, configs.length);
IConfiguration rootConfig = configs[0]; IConfiguration rootConfig = configs[0];
assertEquals("Root Config", rootConfig.getName()); assertEquals("Root Config", rootConfig.getName());
assertEquals("Root Override Config", configs[1].getName()); assertEquals("Root Override Config", configs[1].getName());
// Check the defined config for target assertEquals("Complete Override Config", configs[2].getName());
IConfiguration subConfig = configs[2]; assertEquals("Sub Config", configs[3].getName());
assertEquals("Sub Config", subConfig.getName());
} }
/** /**

View file

@ -37,7 +37,8 @@
isAbstract="false" isAbstract="false"
makeCommand="make" makeCommand="make"
binaryParser="org.eclipse.cdt.core.PE" binaryParser="org.eclipse.cdt.core.PE"
makeFlags="-k"> makeFlags="-k"
osList="win32">
<tool <tool
sources="foo,bar" sources="foo,bar"
name="Root Tool" name="Root Tool"
@ -118,6 +119,28 @@
</optionReference> </optionReference>
</toolReference> </toolReference>
</configuration> </configuration>
<configuration
name="Complete Override Config"
id="complete.override.config">
<toolReference
id="root.tool">
<optionReference
id="string.option"
defaultValue="overridden">
</optionReference>
<optionReference
id="boolean.option"
defaultValue="true">
</optionReference>
<optionReference
defaultValue="-e2"
id="enumerated.option">
</optionReference>
<optionReference
id="list.option">
</optionReference>
</toolReference>
</configuration>
</target> </target>
<target <target
name="Test Sub" name="Test Sub"
@ -128,7 +151,8 @@
isAbstract="false" isAbstract="false"
binaryParser="org.eclipse.cdt.core.PE" binaryParser="org.eclipse.cdt.core.PE"
makeFlags="-d" makeFlags="-d"
parent="test.root"> parent="test.root"
osList="win32,linux,solaris">
<configuration <configuration
name="Sub Config" name="Sub Config"
id="sub.config"> id="sub.config">