1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 15:05:36 +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
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

View file

@ -394,6 +394,13 @@ Two additional types exist to flag options of special relevance to the build mod
</documentation>
</annotation>
</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>
</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_TEST = "isTest"; //$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$
/**
@ -35,7 +36,7 @@ public interface ITarget extends IBuildObject {
*
* @param parent The <code>IConfiguration</code> to use as a settings template
* @param id The unique id the new configuration will have
* @return
* @return IConfiguration
*/
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.
*
* @param id id for this configuration.
* @return
* @return IConfiguration
*/
public IConfiguration createConfiguration(String id);
/**
* Get the name of the final build artifact.
*
* @return
* @return String
*/
public String getArtifactName();
/**
* Answers the unique ID of the binary parser associated with the target.
*
* @return
* @return String
*/
public String getBinaryParserId();
/**
* Answers the OS-specific command to remove files created by the build
*
* @return
* @return String
*/
public String getCleanCommand();
/**
* Returns all of the configurations defined by this target.
* @return
*
* @return IConfiguration[]
*/
public IConfiguration[] getConfigurations();
@ -79,14 +81,14 @@ public interface ITarget extends IBuildObject {
* Get the default extension that should be applied to build artifacts
* created by this target.
*
* @return
* @return String
*/
public String getDefaultExtension();
/**
* Answers the name of the make utility for the target.
*
* @return
* @return String
*/
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.
*
* @param id
* @return
* @return IConfiguration
*/
public IConfiguration getConfiguration(String id);
/**
* Gets the resource that this target is applied to.
*
* @return
* @return IResource
*/
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();
/**
* 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
* platform.
*
* @return
* @return ITool[]
*/
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
* parent specification.
*
* @return
* @return boolean
*/
public boolean hasOverridenMakeCommand();
/**
* Returns whether this target is abstract.
* @return
* @return boolean
*/
public boolean isAbstract();
@ -138,7 +149,7 @@ public interface ITarget extends IBuildObject {
* for testing purposes only, else <code>false</code>. A test target will
* not be shown in the UI but can still be manipulated programmatically.
*
* @return
* @return boolean
*/
public boolean isTestTarget();
@ -170,4 +181,5 @@ public interface ITarget extends IBuildObject {
* @param 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.Arrays;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.managedbuilder.core.BuildException;
@ -61,6 +62,9 @@ public class Configuration extends BuildObject implements IConfiguration {
this.target = target;
this.parent = parent;
// Get the tool references from the parent
getLocalToolReferences().addAll(((Configuration)parent).getLocalToolReferences());
target.addConfiguration(this);
}
@ -147,14 +151,29 @@ public class Configuration extends BuildObject implements IConfiguration {
if (parent != null)
element.setAttribute(IConfiguration.PARENT, parent.getId());
for (int i = 0; i < getToolReferences().size(); ++i) {
ToolReference toolRef = (ToolReference)getToolReferences().get(i);
// Serialize only the tool references defined in the configuration
Iterator iter = getLocalToolReferences().listIterator();
while (iter.hasNext()) {
ToolReference toolRef = (ToolReference) iter.next();
Element toolRefElement = doc.createElement(IConfiguration.TOOL_REF);
element.appendChild(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)
* @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
*/
private List getToolReferences() {
if (toolReferences == null) {
toolReferences = new ArrayList();
}
return toolReferences;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getTools()
*/
@ -180,7 +189,7 @@ public class Configuration extends BuildObject implements IConfiguration {
? parent.getTools()
: target.getTools();
// Replace tools with overrides
// Replace tools with local overrides
for (int i = 0; i < tools.length; ++i) {
ToolReference ref = getToolReference(tools[i]);
if (ref != null)
@ -195,7 +204,7 @@ public class Configuration extends BuildObject implements IConfiguration {
*/
public void reset(IConfigurationElement element) {
// I just need to reset the tool references
getToolReferences().clear();
getLocalToolReferences().clear();
IConfigurationElement[] configElements = element.getChildren();
for (int l = 0; l < configElements.length; ++l) {
IConfigurationElement configElement = configElements[l];
@ -211,6 +220,35 @@ public class Configuration extends BuildObject implements IConfiguration {
public IConfiguration getParent() {
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)
* @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
* @return
* @return ToolReference
*/
private ToolReference getToolReference(ITool tool) {
for (int i = 0; i < getToolReferences().size(); ++i) {
ToolReference toolRef = (ToolReference)getToolReferences().get(i);
if (toolRef.references(tool))
return toolRef;
// See if the receiver has a reference to the tool
ToolReference ref = null;
Iterator iter = getLocalToolReferences().listIterator();
while (iter.hasNext()) {
ToolReference temp = (ToolReference)iter.next();
if (temp.references(tool)) {
ref = temp;
break;
}
}
return null;
return ref;
}
public void addToolReference(ToolReference toolRef) {
getToolReferences().add(toolRef);
getLocalToolReferences().add(toolRef);
}
public OptionReference createOptionReference(IOption option) {

View file

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

View file

@ -16,6 +16,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
@ -42,8 +43,9 @@ public class Target extends BuildObject implements ITarget {
private String makeCommand;
private IResource owner;
private ITarget parent;
private List targetOSList;
private Map toolMap;
private List tools;
private List toolList;
private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
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
*/
@ -113,8 +116,7 @@ public class Target extends BuildObject implements ITarget {
}
// isAbstract
if ("true".equals(element.getAttribute(IS_ABSTRACT)))
isAbstract = true;
isAbstract = ("true".equals(element.getAttribute(IS_ABSTRACT)));
// Is this a test target
isTest = ("true".equals(element.getAttribute(IS_TEST)));
@ -133,12 +135,29 @@ public class Target extends BuildObject implements ITarget {
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();
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];
if (targetElement.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
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);
}
}
@ -146,7 +165,7 @@ public class Target extends BuildObject implements ITarget {
}
/**
* Create target from project file
* Create target from project file.
*
* @param buildInfo
* @param element
@ -167,9 +186,6 @@ public class Target extends BuildObject implements ITarget {
// contain what the user entered in the UI).
artifactName = element.getAttribute(ARTIFACT_NAME);
// Get the ID of the binary parser
binaryParserId = element.getAttribute(BINARY_PARSER);
// Get the 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(IS_ABSTRACT, isAbstract ? "true" : "false");
element.setAttribute(ARTIFACT_NAME, getArtifactName());
element.setAttribute(BINARY_PARSER, getBinaryParserId());
element.setAttribute(DEFAULT_EXTENSION, getDefaultExtension());
element.setAttribute(IS_TEST, isTest ? "true" : "false");
element.setAttribute(CLEAN_COMMAND, getCleanCommand());
@ -277,6 +292,22 @@ public class Target extends BuildObject implements ITarget {
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)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getOwner()
*/
@ -285,25 +316,41 @@ public class Target extends BuildObject implements ITarget {
}
private int getNumTools() {
int n = (tools == null) ? 0 : tools.size();
int n = getToolList().size();
if (parent != null)
n += ((Target)parent).getNumTools();
return n;
}
private int addToolsToArray(ITool[] toolArray, int start) {
int n = start;
if (parent != null)
n = ((Target)parent).addToolsToArray(toolArray, start);
if (tools != null) {
for (int i = 0; i < tools.size(); ++i)
toolArray[n++] = (ITool)tools.get(i);
for (int i = 0; i < getToolList().size(); ++i) {
toolArray[n++] = (ITool)getToolList().get(i);
}
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)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getTools()
*/
@ -322,16 +369,19 @@ public class Target extends BuildObject implements ITarget {
/**
* @param id
* @return
* @return ITool
*/
public ITool getTool(String id) {
ITool result = null;
// 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 (result == null && parent != null) {
result = ((Target)parent).getTool(id);
}
return result;
}
@ -339,13 +389,8 @@ public class Target extends BuildObject implements ITarget {
* @param tool
*/
public void addTool(ITool tool) {
if (tools == null) {
tools = new ArrayList();
toolMap = new HashMap();
}
tools.add(tool);
toolMap.put(tool.getId(), tool);
getToolList().add(tool);
getToolMap().put(tool.getId(), tool);
}
/* (non-Javadoc)
@ -377,15 +422,33 @@ public class Target extends BuildObject implements ITarget {
* @see org.eclipse.cdt.core.build.managed.ITarget#getArtifactName()
*/
public String getArtifactName() {
// Return name or an empty string
return artifactName == null ? EMPTY_STRING : artifactName;
if (artifactName == null) {
// 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)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#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)

View file

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

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
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

View file

@ -22,7 +22,21 @@ OptionCategory.Debug=Debugging
OptionCategory.Warn=Warnings
OptionCategory.Misc=Miscellaneous
OptionCategory.Libs=Libraries
Option.Posix.PreprocOnly=Preprocess only (-E)
Option.Posix.Nostdinc=Do not search system directories (-nostdinc)
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.Libsearch=Library search path (-L)

View file

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

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;
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.ManagedBuilderUIPlugin;
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.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
@ -202,11 +204,15 @@ public class CProjectPlatformPage extends WizardPage {
// Get a list of platforms defined by plugins
ITarget[] allTargets = ManagedBuildManager.getDefinedTargets(null);
targets = new ArrayList();
String os = BootLoader.getOS();
// Add all of the concrete targets to the target list
for (int index = 0; index < allTargets.length; ++index) {
ITarget target = allTargets[index];
if (!target.isAbstract() && !target.isTestTarget()) {
targets.add(target);
List targetOSList = Arrays.asList(target.getTargetOSList());
if (targetOSList.contains(os)) {
targets.add(target);
}
}
}
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.ManagedBuildManager;
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.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
@ -156,7 +157,7 @@ public class ManagedBuildTests extends TestCase {
// These are the expected path settings
final String[] expectedPaths = new String[4];
// 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[2] = (new Path("/opt/gnome/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
IConfiguration[] configs = newTarget.getConfigurations();
assertEquals(3, configs.length);
assertEquals(4, configs.length);
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
IExtensionPoint extensionPoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("ScannerInfoProvider");
@ -275,6 +276,8 @@ public class ManagedBuildTests extends TestCase {
String rootName = "Root Config";
String overrideConfigId = "test.root.1.1";
String overrideName = "Root Override Config";
String completeOverrideConfigId = "test.root.1.2";
String completeOverrideName = "Complete Override Config";
// Open the test project
IProject project = createProject(projectName);
@ -284,16 +287,18 @@ public class ManagedBuildTests extends TestCase {
assertEquals(1, definedTargets.length);
ITarget rootTarget = definedTargets[0];
IConfiguration[] definedConfigs = rootTarget.getConfigurations();
assertEquals(2, definedConfigs.length);
assertEquals(3, definedConfigs.length);
IConfiguration baseConfig = definedConfigs[0];
assertEquals(definedConfigs[0].getId(), rootConfigId);
assertEquals(definedConfigs[0].getName(), rootName);
assertEquals(definedConfigs[1].getId(), overrideConfigId);
assertEquals(definedConfigs[1].getName(), overrideName);
assertEquals(definedConfigs[2].getId(), completeOverrideConfigId);
assertEquals(definedConfigs[2].getName(), completeOverrideName);
// Create a new configuration and test the rename function
IConfiguration newConfig = rootTarget.createConfiguration(baseConfig, testConfigId);
assertEquals(3, rootTarget.getConfigurations().length);
assertEquals(4, rootTarget.getConfigurations().length);
newConfig.setName(testConfigName);
assertEquals(newConfig.getId(), testConfigId);
assertEquals(newConfig.getName(), testConfigName);
@ -332,10 +337,10 @@ public class ManagedBuildTests extends TestCase {
assertEquals(1, definedTargets.length);
rootTarget = definedTargets[0];
definedConfigs = rootTarget.getConfigurations();
assertEquals(3, definedConfigs.length);
assertEquals(4, definedConfigs.length);
rootTarget.removeConfiguration(testConfigId);
definedConfigs = rootTarget.getConfigurations();
assertEquals(2, definedConfigs.length);
assertEquals(3, definedConfigs.length);
assertEquals(definedConfigs[0].getId(), rootConfigId);
assertEquals(definedConfigs[0].getName(), rootName);
assertEquals(definedConfigs[1].getId(), overrideConfigId);
@ -554,7 +559,7 @@ public class ManagedBuildTests extends TestCase {
// Now get the configs
IConfiguration[] definedConfigs = rootTarget.getConfigurations();
assertEquals(3, definedConfigs.length);
assertEquals(4, definedConfigs.length);
IConfiguration newConfig = rootTarget.getConfiguration(testConfigId);
assertNotNull(newConfig);
@ -603,11 +608,13 @@ public class ManagedBuildTests extends TestCase {
// Target stuff
String expectedCleanCmd = "del /myworld";
String expectedParserId = "org.eclipse.cdt.core.PE";
String[] expectedOSList = {"win32"};
assertTrue(target.isTestTarget());
assertEquals(target.getDefaultExtension(), rootExt);
assertEquals(expectedCleanCmd, target.getCleanCommand());
assertEquals("make", target.getMakeCommand());
assertEquals(expectedParserId, target.getBinaryParserId());
assertTrue(Arrays.equals(expectedOSList, target.getTargetOSList()));
// Tools
ITool[] tools = target.getTools();
@ -663,8 +670,10 @@ public class ManagedBuildTests extends TestCase {
assertEquals("String Option in Category", options[0].getName());
assertEquals("Enumerated Option in Category", options[1].getName());
// Configs
// There should be 3 defined configs
IConfiguration[] configs = target.getConfigurations();
assertEquals(3, configs.length);
// Root Config
IConfiguration rootConfig = configs[0];
assertEquals("Root Config", rootConfig.getName());
@ -679,7 +688,7 @@ public class ManagedBuildTests extends TestCase {
assertEquals("doIt", tools[0].getToolCommand());
assertEquals("", tools[0].getOutputPrefix());
// Root Override Config
// Partially Overriden Configuration
assertEquals("Root Override Config", configs[1].getName());
tools = configs[1].getTools();
assertEquals(1, tools.length);
@ -693,6 +702,8 @@ public class ManagedBuildTests extends TestCase {
assertEquals("a", valueList[0]);
assertEquals("b", valueList[1]);
assertEquals("Boolean Option in Top", options[1].getName());
assertEquals(true, options[1].getBooleanValue());
assertEquals("-b", options[1].getCommand());
categories = topCategory.getChildCategories();
options = categories[0].getOptions(configs[1]);
assertEquals(2, options.length);
@ -712,6 +723,41 @@ public class ManagedBuildTests extends TestCase {
assertTrue(tools[0].buildsFileType("bar"));
assertTrue(tools[0].producesFileType("toor"));
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());
// Make sure we get the proper binary parser
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());
// Make sure the binary parser is hard-coded and available
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
assertTrue(target.isTestTarget());
@ -791,15 +842,14 @@ public class ManagedBuildTests extends TestCase {
assertEquals("C:\\home\\tester/include", moreIncPath[0]);
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();
// Check inheritance
assertEquals(4, configs.length);
IConfiguration rootConfig = configs[0];
assertEquals("Root Config", rootConfig.getName());
assertEquals("Root Override Config", configs[1].getName());
// Check the defined config for target
IConfiguration subConfig = configs[2];
assertEquals("Sub Config", subConfig.getName());
assertEquals("Complete Override Config", configs[2].getName());
assertEquals("Sub Config", configs[3].getName());
}
/**

View file

@ -37,7 +37,8 @@
isAbstract="false"
makeCommand="make"
binaryParser="org.eclipse.cdt.core.PE"
makeFlags="-k">
makeFlags="-k"
osList="win32">
<tool
sources="foo,bar"
name="Root Tool"
@ -118,6 +119,28 @@
</optionReference>
</toolReference>
</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
name="Test Sub"
@ -128,7 +151,8 @@
isAbstract="false"
binaryParser="org.eclipse.cdt.core.PE"
makeFlags="-d"
parent="test.root">
parent="test.root"
osList="win32,linux,solaris">
<configuration
name="Sub Config"
id="sub.config">