mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
Patch for Sean Evoy:
Use natures to help select what tools are available.
This commit is contained in:
parent
bc158cc0fb
commit
cc6084024d
17 changed files with 2229 additions and 80 deletions
|
@ -1,3 +1,30 @@
|
||||||
|
2003-10-01 Sean Evoy
|
||||||
|
Fix for bugs 43490 (trivial), 44020, and 43980.
|
||||||
|
Added a new field to the schema for a tool. The attribute manages a list of
|
||||||
|
project natures that the tool should be filtered against in the build model
|
||||||
|
and UI.
|
||||||
|
* schema/ManagedBuildTools.exsd
|
||||||
|
|
||||||
|
Updated the ITool interface and its mplementors to pay attention to this new
|
||||||
|
attribute when loading from a plugin file. Clients can querry for a numeric
|
||||||
|
constant indicating the filter.
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/core/ITool.java
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java
|
||||||
|
|
||||||
|
All the methods in managed build manager that access information stored in a tool
|
||||||
|
first check that the tool is valid for the project nature.
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
|
||||||
|
|
||||||
|
Put a safety check in the option reference constructor when reading one in from
|
||||||
|
a project file. I the option reference is to an option not managed by the build
|
||||||
|
model, the constructor does not add itself to the runtime representation of the
|
||||||
|
model.
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
|
||||||
|
|
||||||
|
In preparation for 44020, each new target created is assigned a truly random ID.
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
|
||||||
|
|
||||||
2003-09-30 Sean Evoy
|
2003-09-30 Sean Evoy
|
||||||
Fix for bug 41826.
|
Fix for bug 41826.
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,23 @@
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<attribute name="natureFilter" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Filter the display (and use) of the tool by the nature of the project. Selecting a value of 'cnature' insures that the tool will be displayed IFF there is a cnature associated with the project. A ccnature will filter this tool out. If 'ccnature' is selected, the tool will only be available for C++ projects. If 'both' is selected, the tool will be displayed when either nature is present.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
<simpleType>
|
||||||
|
<restriction base="string">
|
||||||
|
<enumeration value="cnature">
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="ccnature">
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="both">
|
||||||
|
</enumeration>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
</attribute>
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,9 @@ package org.eclipse.cdt.managedbuilder.core;
|
||||||
*/
|
*/
|
||||||
public interface ITool extends IBuildObject {
|
public interface ITool extends IBuildObject {
|
||||||
// Schema element names
|
// Schema element names
|
||||||
public static final String TOOL_ELEMENT_NAME = "tool"; //$NON-NLS-1$
|
|
||||||
public static final String COMMAND = "command"; //$NON-NLS-1$
|
public static final String COMMAND = "command"; //$NON-NLS-1$
|
||||||
|
public static final String INTERFACE_EXTS = "headerExtensions"; //$NON-NLS-1$
|
||||||
|
public static final String NATURE = "natureFilter"; //$NON-NLS-1$
|
||||||
public static final String OPTION = "option"; //$NON-NLS-1$
|
public static final String OPTION = "option"; //$NON-NLS-1$
|
||||||
public static final String OPTION_CAT = "optionCategory"; //$NON-NLS-1$
|
public static final String OPTION_CAT = "optionCategory"; //$NON-NLS-1$
|
||||||
public static final String OPTION_REF = "optionReference"; //$NON-NLS-1$
|
public static final String OPTION_REF = "optionReference"; //$NON-NLS-1$
|
||||||
|
@ -24,8 +25,12 @@ public interface ITool extends IBuildObject {
|
||||||
public static final String OUTPUT_PREFIX = "outputPrefix"; //$NON-NLS-1$
|
public static final String OUTPUT_PREFIX = "outputPrefix"; //$NON-NLS-1$
|
||||||
public static final String OUTPUTS = "outputs"; //$NON-NLS-1$
|
public static final String OUTPUTS = "outputs"; //$NON-NLS-1$
|
||||||
public static final String SOURCES = "sources"; //$NON-NLS-1$
|
public static final String SOURCES = "sources"; //$NON-NLS-1$
|
||||||
public static final String INTERFACE_EXTS = "headerExtensions"; //$NON-NLS-1$
|
public static final String TOOL_ELEMENT_NAME = "tool"; //$NON-NLS-1$
|
||||||
public static final String WHITE_SPACE = " "; //$NON-NLS-1$
|
public static final String WHITE_SPACE = " "; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static final int FILTER_C = 0;
|
||||||
|
public static final int FILTER_CC = 1;
|
||||||
|
public static final int FILTER_BOTH = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return <code>true</code> if the receiver builds files with the
|
* Return <code>true</code> if the receiver builds files with the
|
||||||
|
@ -35,6 +40,25 @@ public interface ITool extends IBuildObject {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean buildsFileType(String extension);
|
public boolean buildsFileType(String extension);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Answers a constant corresponding to the project nature the tool should be used
|
||||||
|
* for. Possible answers are:
|
||||||
|
*
|
||||||
|
* <dl>
|
||||||
|
* <dt>ITool.FILTER_C
|
||||||
|
* <dd>The tool should only be displayed for C projects. <i>Notes:</i> even
|
||||||
|
* though a C++ project has a C nature, this flag will mask the tool for C++
|
||||||
|
* projects.
|
||||||
|
* <dt>ITool.FILTER_CC
|
||||||
|
* <dd>The tool should only be displayed for C++ projects.
|
||||||
|
* <dt>ITool.FILTER_BOTH
|
||||||
|
* <dd>The tool should be displayed for projects with both natures.
|
||||||
|
* </dl>
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public int getNatureFilter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a particular option.
|
* Get a particular option.
|
||||||
|
|
|
@ -15,12 +15,16 @@ import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCProjectNature;
|
||||||
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITarget;
|
import org.eclipse.cdt.managedbuilder.core.ITarget;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -189,8 +193,50 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
? parent.getTools()
|
? parent.getTools()
|
||||||
: target.getTools();
|
: target.getTools();
|
||||||
|
|
||||||
|
// Validate that the tools correspond to the nature
|
||||||
|
IProject project = (IProject)target.getOwner();
|
||||||
|
if (project != null) {
|
||||||
|
List validTools = new ArrayList();
|
||||||
|
|
||||||
|
// The target is associated with a real project
|
||||||
|
for (int i = 0; i < tools.length; ++i) {
|
||||||
|
ITool tool = tools[i];
|
||||||
|
// Make sure the tool filter and project nature agree
|
||||||
|
switch (tool.getNatureFilter()) {
|
||||||
|
case ITool.FILTER_C:
|
||||||
|
try {
|
||||||
|
if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
validTools.add(tool);
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_CC:
|
||||||
|
try {
|
||||||
|
if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
validTools.add(tool);
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_BOTH:
|
||||||
|
validTools.add(tool);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Now put the valid tools back into the array
|
||||||
|
tools = (ITool[]) validTools.toArray(new ITool[validTools.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
// Replace tools with local overrides
|
// Replace tools with local overrides
|
||||||
for (int i = 0; i < tools.length; ++i) {
|
for (int i = 0; i < tools.length; ++i) {
|
||||||
|
ITool tool = tools[i];
|
||||||
|
if (tool == null) {
|
||||||
|
// May have been filtered out
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ToolReference ref = getToolReference(tools[i]);
|
ToolReference ref = getToolReference(tools[i]);
|
||||||
if (ref != null)
|
if (ref != null)
|
||||||
tools[i] = ref;
|
tools[i] = ref;
|
||||||
|
|
|
@ -25,8 +25,12 @@ import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITarget;
|
import org.eclipse.cdt.managedbuilder.core.ITarget;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.cdt.core.CCProjectNature;
|
||||||
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
@ -34,7 +38,8 @@ import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
|
|
||||||
|
// Local variables
|
||||||
private boolean isDirty;
|
private boolean isDirty;
|
||||||
private IResource owner;
|
private IResource owner;
|
||||||
private Map targetMap;
|
private Map targetMap;
|
||||||
|
@ -97,13 +102,32 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#buildsFileType(java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#buildsFileType(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public boolean buildsFileType(String srcExt) {
|
public boolean buildsFileType(String srcExt) {
|
||||||
|
// Make sure the owner is treated as a project for the duration
|
||||||
|
IProject project = (IProject)owner;
|
||||||
|
|
||||||
// Check to see if there is a rule to build a file with this extension
|
// Check to see if there is a rule to build a file with this extension
|
||||||
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
||||||
ITool[] tools = config.getTools();
|
ITool[] tools = config.getTools();
|
||||||
for (int index = 0; index < tools.length; index++) {
|
for (int index = 0; index < tools.length; index++) {
|
||||||
ITool tool = tools[index];
|
ITool tool = tools[index];
|
||||||
if (tool.buildsFileType(srcExt)) {
|
try {
|
||||||
return true;
|
// Make sure the tool is right for the project
|
||||||
|
switch (tool.getNatureFilter()) {
|
||||||
|
case ITool.FILTER_C:
|
||||||
|
if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
return tool.buildsFileType(srcExt);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_CC:
|
||||||
|
if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
return tool.buildsFileType(srcExt);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_BOTH:
|
||||||
|
return tool.buildsFileType(srcExt);
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -183,12 +207,33 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getDefinedSymbols()
|
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getDefinedSymbols()
|
||||||
*/
|
*/
|
||||||
public Map getDefinedSymbols() {
|
public Map getDefinedSymbols() {
|
||||||
|
IProject project = (IProject)owner;
|
||||||
// Return the defined symbols for the default configuration
|
// Return the defined symbols for the default configuration
|
||||||
HashMap symbols = new HashMap();
|
HashMap symbols = new HashMap();
|
||||||
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
||||||
ITool[] tools = config.getTools();
|
ITool[] tools = config.getTools();
|
||||||
for (int i = 0; i < tools.length; i++) {
|
for (int i = 0; i < tools.length; i++) {
|
||||||
ITool tool = tools[i];
|
ITool tool = tools[i];
|
||||||
|
try {
|
||||||
|
// Make sure the tool is right for the project
|
||||||
|
switch (tool.getNatureFilter()) {
|
||||||
|
case ITool.FILTER_C:
|
||||||
|
if (!project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_CC:
|
||||||
|
if (!project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_BOTH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Now extract the valid tool's options
|
||||||
IOption[] opts = tool.getOptions();
|
IOption[] opts = tool.getOptions();
|
||||||
for (int j = 0; j < opts.length; j++) {
|
for (int j = 0; j < opts.length; j++) {
|
||||||
IOption option = opts[j];
|
IOption option = opts[j];
|
||||||
|
@ -229,20 +274,36 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getFlagsForSource(java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getFlagsForSource(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public String getFlagsForSource(String extension) {
|
public String getFlagsForSource(String extension) {
|
||||||
|
IProject project = (IProject)owner;
|
||||||
|
|
||||||
// Get all the tools for the current config
|
// Get all the tools for the current config
|
||||||
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
||||||
ITool[] tools = config.getTools();
|
ITool[] tools = config.getTools();
|
||||||
for (int index = 0; index < tools.length; index++) {
|
for (int index = 0; index < tools.length; index++) {
|
||||||
ITool tool = tools[index];
|
ITool tool = tools[index];
|
||||||
if (tool.buildsFileType(extension)) {
|
if (tool.buildsFileType(extension)) {
|
||||||
String flags = new String();
|
|
||||||
try {
|
try {
|
||||||
flags = tool.getToolFlags();
|
// Make sure the tool is right for the project
|
||||||
|
switch (tool.getNatureFilter()) {
|
||||||
|
case ITool.FILTER_C:
|
||||||
|
if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
return tool.getToolFlags();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_CC:
|
||||||
|
if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
return tool.getToolFlags();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_BOTH:
|
||||||
|
return tool.getToolFlags();
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
} catch (BuildException e) {
|
} catch (BuildException e) {
|
||||||
// Give it your best shot with the next tool
|
// Give it your best shot with the next tool
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return flags;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -252,8 +313,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolFlags(java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolFlags(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public String getFlagsForTarget(String extension) {
|
public String getFlagsForTarget(String extension) {
|
||||||
|
IProject project = (IProject)owner;
|
||||||
// Treat null extensions as an empty string
|
// Treat null extensions as an empty string
|
||||||
String ext = extension == null ? new String() : extension;
|
String ext = extension == null ? new String() : extension;
|
||||||
|
|
||||||
// Get all the tools for the current config
|
// Get all the tools for the current config
|
||||||
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
||||||
|
@ -261,14 +323,28 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
for (int index = 0; index < tools.length; index++) {
|
for (int index = 0; index < tools.length; index++) {
|
||||||
ITool tool = tools[index];
|
ITool tool = tools[index];
|
||||||
if (tool.producesFileType(ext)) {
|
if (tool.producesFileType(ext)) {
|
||||||
String flags = new String();
|
|
||||||
try {
|
try {
|
||||||
flags = tool.getToolFlags();
|
// Make sure the tool is right for the project
|
||||||
|
switch (tool.getNatureFilter()) {
|
||||||
|
case ITool.FILTER_C:
|
||||||
|
if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
return tool.getToolFlags();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_CC:
|
||||||
|
if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
return tool.getToolFlags();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_BOTH:
|
||||||
|
return tool.getToolFlags();
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
} catch (BuildException e) {
|
} catch (BuildException e) {
|
||||||
// Somehow the model is out of sync for this item. Keep iterating
|
// Give it your best shot with the next tool
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return flags;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -278,6 +354,8 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
|
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
|
||||||
*/
|
*/
|
||||||
public String[] getIncludePaths() {
|
public String[] getIncludePaths() {
|
||||||
|
IProject project = (IProject)owner;
|
||||||
|
|
||||||
// Return the include paths for the default configuration
|
// Return the include paths for the default configuration
|
||||||
ArrayList paths = new ArrayList();
|
ArrayList paths = new ArrayList();
|
||||||
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
||||||
|
@ -285,6 +363,26 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
ITool[] tools = config.getTools();
|
ITool[] tools = config.getTools();
|
||||||
for (int i = 0; i < tools.length; i++) {
|
for (int i = 0; i < tools.length; i++) {
|
||||||
ITool tool = tools[i];
|
ITool tool = tools[i];
|
||||||
|
try {
|
||||||
|
// Make sure the tool is right for the project
|
||||||
|
switch (tool.getNatureFilter()) {
|
||||||
|
case ITool.FILTER_C:
|
||||||
|
if (!project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_CC:
|
||||||
|
if (!project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_BOTH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// The tool checks out for this project, get its options
|
||||||
IOption[] opts = tool.getOptions();
|
IOption[] opts = tool.getOptions();
|
||||||
for (int j = 0; j < opts.length; j++) {
|
for (int j = 0; j < opts.length; j++) {
|
||||||
IOption option = opts[j];
|
IOption option = opts[j];
|
||||||
|
@ -318,12 +416,34 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getLibsForTarget(java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getLibsForTarget(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public String[] getLibsForTarget(String extension) {
|
public String[] getLibsForTarget(String extension) {
|
||||||
|
IProject project = (IProject)owner;
|
||||||
|
|
||||||
ArrayList libs = new ArrayList();
|
ArrayList libs = new ArrayList();
|
||||||
// Get all the tools for the current config
|
// Get all the tools for the current config
|
||||||
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
||||||
ITool[] tools = config.getTools();
|
ITool[] tools = config.getTools();
|
||||||
for (int index = 0; index < tools.length; index++) {
|
for (int index = 0; index < tools.length; index++) {
|
||||||
ITool tool = tools[index];
|
ITool tool = tools[index];
|
||||||
|
try {
|
||||||
|
// Make sure the tool is right for the project
|
||||||
|
switch (tool.getNatureFilter()) {
|
||||||
|
case ITool.FILTER_C:
|
||||||
|
if (!project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_CC:
|
||||||
|
if (!project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_BOTH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// The tool is OK for this project nature
|
||||||
if (tool.producesFileType(extension)) {
|
if (tool.producesFileType(extension)) {
|
||||||
IOption[] opts = tool.getOptions();
|
IOption[] opts = tool.getOptions();
|
||||||
// Look for the lib option type
|
// Look for the lib option type
|
||||||
|
@ -398,14 +518,30 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputExtension(java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputExtension(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public String getOutputExtension(String resourceExtension) {
|
public String getOutputExtension(String resourceExtension) {
|
||||||
|
IProject project = (IProject)owner;
|
||||||
// Get all the tools for the current config
|
// Get all the tools for the current config
|
||||||
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
||||||
ITool[] tools = config.getTools();
|
ITool[] tools = config.getTools();
|
||||||
for (int index = 0; index < tools.length; index++) {
|
for (int index = 0; index < tools.length; index++) {
|
||||||
ITool tool = tools[index];
|
ITool tool = tools[index];
|
||||||
String output = tool.getOutputExtension(resourceExtension);
|
try {
|
||||||
if (output != null) {
|
// Make sure the tool is right for the project
|
||||||
return output;
|
switch (tool.getNatureFilter()) {
|
||||||
|
case ITool.FILTER_C:
|
||||||
|
if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
return tool.getOutputExtension(resourceExtension);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_CC:
|
||||||
|
if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
return tool.getOutputExtension(resourceExtension);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_BOTH:
|
||||||
|
return tool.getOutputExtension(resourceExtension);
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -415,6 +551,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputFlag()
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputFlag()
|
||||||
*/
|
*/
|
||||||
public String getOutputFlag(String outputExt) {
|
public String getOutputFlag(String outputExt) {
|
||||||
|
IProject project = (IProject)owner;
|
||||||
// Treat null extension as an empty string
|
// Treat null extension as an empty string
|
||||||
String ext = outputExt == null ? new String() : outputExt;
|
String ext = outputExt == null ? new String() : outputExt;
|
||||||
|
|
||||||
|
@ -424,6 +561,26 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
ITool[] tools = config.getTools();
|
ITool[] tools = config.getTools();
|
||||||
for (int index = 0; index < tools.length; index++) {
|
for (int index = 0; index < tools.length; index++) {
|
||||||
ITool tool = tools[index];
|
ITool tool = tools[index];
|
||||||
|
try {
|
||||||
|
// Make sure the tool is right for the project
|
||||||
|
switch (tool.getNatureFilter()) {
|
||||||
|
case ITool.FILTER_C:
|
||||||
|
if (!project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_CC:
|
||||||
|
if (!project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_BOTH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// It's OK
|
||||||
if (tool.producesFileType(ext)) {
|
if (tool.producesFileType(ext)) {
|
||||||
flags = tool.getOutputFlag();
|
flags = tool.getOutputFlag();
|
||||||
}
|
}
|
||||||
|
@ -435,6 +592,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputPrefix(java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputPrefix(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public String getOutputPrefix(String outputExtension) {
|
public String getOutputPrefix(String outputExtension) {
|
||||||
|
IProject project = (IProject)owner;
|
||||||
// Treat null extensions as empty string
|
// Treat null extensions as empty string
|
||||||
String ext = outputExtension == null ? new String() : outputExtension;
|
String ext = outputExtension == null ? new String() : outputExtension;
|
||||||
|
|
||||||
|
@ -444,6 +602,25 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
ITool[] tools = config.getTools();
|
ITool[] tools = config.getTools();
|
||||||
for (int index = 0; index < tools.length; index++) {
|
for (int index = 0; index < tools.length; index++) {
|
||||||
ITool tool = tools[index];
|
ITool tool = tools[index];
|
||||||
|
try {
|
||||||
|
// Make sure the tool is right for the project
|
||||||
|
switch (tool.getNatureFilter()) {
|
||||||
|
case ITool.FILTER_C:
|
||||||
|
if (!project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_CC:
|
||||||
|
if (!project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_BOTH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (tool.producesFileType(ext)) {
|
if (tool.producesFileType(ext)) {
|
||||||
flags = tool.getOutputPrefix();
|
flags = tool.getOutputPrefix();
|
||||||
}
|
}
|
||||||
|
@ -473,13 +650,33 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolForSource(java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolForSource(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public String getToolForSource(String extension) {
|
public String getToolForSource(String extension) {
|
||||||
|
IProject project = (IProject)owner;
|
||||||
|
|
||||||
// Get all the tools for the current config
|
// Get all the tools for the current config
|
||||||
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
||||||
ITool[] tools = config.getTools();
|
ITool[] tools = config.getTools();
|
||||||
for (int index = 0; index < tools.length; index++) {
|
for (int index = 0; index < tools.length; index++) {
|
||||||
ITool tool = tools[index];
|
ITool tool = tools[index];
|
||||||
if (tool.buildsFileType(extension)) {
|
if (tool.buildsFileType(extension)) {
|
||||||
return tool.getToolCommand();
|
try {
|
||||||
|
// Make sure the tool is right for the project
|
||||||
|
switch (tool.getNatureFilter()) {
|
||||||
|
case ITool.FILTER_C:
|
||||||
|
if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
return tool.getToolCommand();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_CC:
|
||||||
|
if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
return tool.getToolCommand();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_BOTH:
|
||||||
|
return tool.getToolCommand();
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -489,6 +686,8 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolInvocation(java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolInvocation(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public String getToolForTarget(String extension) {
|
public String getToolForTarget(String extension) {
|
||||||
|
IProject project = (IProject)owner;
|
||||||
|
|
||||||
// Treat a null argument as an empty string
|
// Treat a null argument as an empty string
|
||||||
String ext = extension == null ? new String() : extension;
|
String ext = extension == null ? new String() : extension;
|
||||||
// Get all the tools for the current config
|
// Get all the tools for the current config
|
||||||
|
@ -497,7 +696,25 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
for (int index = 0; index < tools.length; index++) {
|
for (int index = 0; index < tools.length; index++) {
|
||||||
ITool tool = tools[index];
|
ITool tool = tools[index];
|
||||||
if (tool.producesFileType(ext)) {
|
if (tool.producesFileType(ext)) {
|
||||||
return tool.getToolCommand();
|
try {
|
||||||
|
// Make sure the tool is right for the project
|
||||||
|
switch (tool.getNatureFilter()) {
|
||||||
|
case ITool.FILTER_C:
|
||||||
|
if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
return tool.getToolCommand();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_CC:
|
||||||
|
if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
return tool.getToolCommand();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_BOTH:
|
||||||
|
return tool.getToolCommand();
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -507,12 +724,33 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#getUserObjectsForTarget(java.lang.String)
|
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#getUserObjectsForTarget(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public String[] getUserObjectsForTarget(String extension) {
|
public String[] getUserObjectsForTarget(String extension) {
|
||||||
|
IProject project = (IProject)owner;
|
||||||
ArrayList objs = new ArrayList();
|
ArrayList objs = new ArrayList();
|
||||||
// Get all the tools for the current config
|
// Get all the tools for the current config
|
||||||
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
||||||
ITool[] tools = config.getTools();
|
ITool[] tools = config.getTools();
|
||||||
for (int index = 0; index < tools.length; index++) {
|
for (int index = 0; index < tools.length; index++) {
|
||||||
ITool tool = tools[index];
|
ITool tool = tools[index];
|
||||||
|
try {
|
||||||
|
// Make sure the tool is right for the project
|
||||||
|
switch (tool.getNatureFilter()) {
|
||||||
|
case ITool.FILTER_C:
|
||||||
|
if (!project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_CC:
|
||||||
|
if (!project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_BOTH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// The tool is OK for this project nature
|
||||||
if (tool.producesFileType(extension)) {
|
if (tool.producesFileType(extension)) {
|
||||||
IOption[] opts = tool.getOptions();
|
IOption[] opts = tool.getOptions();
|
||||||
// Look for the user object option type
|
// Look for the user object option type
|
||||||
|
@ -543,13 +781,31 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#isHeaderFile(java.lang.String)
|
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#isHeaderFile(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public boolean isHeaderFile(String ext) {
|
public boolean isHeaderFile(String ext) {
|
||||||
|
IProject project = (IProject)owner;
|
||||||
|
|
||||||
// Check to see if there is a rule to build a file with this extension
|
// Check to see if there is a rule to build a file with this extension
|
||||||
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
|
||||||
ITool[] tools = config.getTools();
|
ITool[] tools = config.getTools();
|
||||||
for (int index = 0; index < tools.length; index++) {
|
for (int index = 0; index < tools.length; index++) {
|
||||||
ITool tool = tools[index];
|
ITool tool = tools[index];
|
||||||
if (tool.isHeaderFile(ext)) {
|
try {
|
||||||
return true;
|
// Make sure the tool is right for the project
|
||||||
|
switch (tool.getNatureFilter()) {
|
||||||
|
case ITool.FILTER_C:
|
||||||
|
if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
return tool.isHeaderFile(ext);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_CC:
|
||||||
|
if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
return tool.isHeaderFile(ext);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITool.FILTER_BOTH:
|
||||||
|
return tool.isHeaderFile(ext);
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -120,6 +120,12 @@ public class OptionReference implements IOption {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
option = owner.getTool().getOption(element.getAttribute(ID));
|
option = owner.getTool().getOption(element.getAttribute(ID));
|
||||||
|
|
||||||
|
// Bail now if there's no option for the reference
|
||||||
|
if (option == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hook the reference up
|
||||||
owner.addOptionReference(this);
|
owner.addOptionReference(this);
|
||||||
|
|
||||||
// value
|
// value
|
||||||
|
|
|
@ -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.Random;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
@ -66,7 +67,13 @@ public class Target extends BuildObject implements ITarget {
|
||||||
|
|
||||||
// Copy the parent's identity
|
// Copy the parent's identity
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
setId(parent.getId() + ".1");
|
Random r = new Random();
|
||||||
|
r.setSeed(System.currentTimeMillis());
|
||||||
|
int id = r.nextInt();
|
||||||
|
if (id < 0) {
|
||||||
|
id *= -1;
|
||||||
|
}
|
||||||
|
setId(owner.getName() + "." + parent.getId() + "." + id);
|
||||||
setName(parent.getName());
|
setName(parent.getName());
|
||||||
this.artifactName = parent.getArtifactName();
|
this.artifactName = parent.getArtifactName();
|
||||||
this.binaryParserId = parent.getBinaryParserId();
|
this.binaryParserId = parent.getBinaryParserId();
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
private String command;
|
private String command;
|
||||||
private List inputExtensions;
|
private List inputExtensions;
|
||||||
private List interfaceExtensions;
|
private List interfaceExtensions;
|
||||||
|
private int natureFilter;
|
||||||
private Map optionMap;
|
private Map optionMap;
|
||||||
private List options;
|
private List options;
|
||||||
private String outputExtension;
|
private String outputExtension;
|
||||||
|
@ -71,6 +72,18 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
// name
|
// name
|
||||||
setName(element.getAttribute(ITool.NAME));
|
setName(element.getAttribute(ITool.NAME));
|
||||||
|
|
||||||
|
// Get the nature filter
|
||||||
|
String nature = element.getAttribute(NATURE);
|
||||||
|
if (nature == null || "both".equals(nature)) {
|
||||||
|
natureFilter = FILTER_BOTH;
|
||||||
|
} else if ("cnature".equals(nature)) {
|
||||||
|
natureFilter = FILTER_C;
|
||||||
|
} else if ("ccnature".equals(nature)) {
|
||||||
|
natureFilter = FILTER_CC;
|
||||||
|
} else {
|
||||||
|
natureFilter = FILTER_BOTH;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the supported input file extension
|
// Get the supported input file extension
|
||||||
String inputs = element.getAttribute(ITool.SOURCES) == null ?
|
String inputs = element.getAttribute(ITool.SOURCES) == null ?
|
||||||
new String() :
|
new String() :
|
||||||
|
@ -350,6 +363,13 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
return (IOption[])myOptions.toArray(new IOption[myOptions.size()]);
|
return (IOption[])myOptions.toArray(new IOption[myOptions.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.ITool#getNatureFilter()
|
||||||
|
*/
|
||||||
|
public int getNatureFilter() {
|
||||||
|
return natureFilter;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getOption(java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.ITool#getOption(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -232,6 +232,7 @@ public class ToolReference implements ITool {
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getOutputFlag()
|
* @see org.eclipse.cdt.core.build.managed.ITool#getOutputFlag()
|
||||||
*/
|
*/
|
||||||
public String getOutputFlag() {
|
public String getOutputFlag() {
|
||||||
|
// The tool reference does not override this value
|
||||||
return parent.getOutputFlag();
|
return parent.getOutputFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,6 +240,7 @@ public class ToolReference implements ITool {
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getOutputPrefix()
|
* @see org.eclipse.cdt.core.build.managed.ITool#getOutputPrefix()
|
||||||
*/
|
*/
|
||||||
public String getOutputPrefix() {
|
public String getOutputPrefix() {
|
||||||
|
// The tool reference does not override this value
|
||||||
return parent.getOutputPrefix();
|
return parent.getOutputPrefix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,6 +255,7 @@ public class ToolReference implements ITool {
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getTopOptionCategory()
|
* @see org.eclipse.cdt.core.build.managed.ITool#getTopOptionCategory()
|
||||||
*/
|
*/
|
||||||
public IOptionCategory getTopOptionCategory() {
|
public IOptionCategory getTopOptionCategory() {
|
||||||
|
// The tool reference does not override this value
|
||||||
return parent.getTopOptionCategory();
|
return parent.getTopOptionCategory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,6 +263,7 @@ public class ToolReference implements ITool {
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITool#isHeaderFile(java.lang.String)
|
* @see org.eclipse.cdt.managedbuilder.core.ITool#isHeaderFile(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public boolean isHeaderFile(String ext) {
|
public boolean isHeaderFile(String ext) {
|
||||||
|
// The tool reference does not override this value
|
||||||
return parent.isHeaderFile(ext);
|
return parent.isHeaderFile(ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,6 +271,7 @@ public class ToolReference implements ITool {
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#producesFileType(java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.ITool#producesFileType(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public boolean producesFileType(String outputExtension) {
|
public boolean producesFileType(String outputExtension) {
|
||||||
|
// The tool reference does not override this value
|
||||||
return parent.producesFileType(outputExtension);
|
return parent.producesFileType(outputExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,6 +284,7 @@ public class ToolReference implements ITool {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
|
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
|
||||||
*/
|
*/
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
// The tool reference does not override this value
|
||||||
return parent.getId();
|
return parent.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,23 +292,17 @@ public class ToolReference implements ITool {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
|
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
// The tool reference does not override this value
|
||||||
return parent.getName();
|
return parent.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
* @see org.eclipse.cdt.core.build.managed.IBuildObject#setId(java.lang.String)
|
* Answers <code>true</code> if the reference is a reference to the
|
||||||
|
* tool specified in the argument.
|
||||||
|
*
|
||||||
|
* @param target the tool that should be tested
|
||||||
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public void setId(String id) {
|
|
||||||
// Not allowed
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.build.managed.IBuildObject#setName(java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setName(String name) {
|
|
||||||
// Not allowed
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean references(ITool target) {
|
public boolean references(ITool target) {
|
||||||
if (equals(target)) {
|
if (equals(target)) {
|
||||||
// we are the target
|
// we are the target
|
||||||
|
@ -367,9 +367,18 @@ public class ToolReference implements ITool {
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#handlesFileType(java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.ITool#handlesFileType(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public boolean buildsFileType(String extension) {
|
public boolean buildsFileType(String extension) {
|
||||||
|
// The tool reference does not override this value
|
||||||
return parent.buildsFileType(extension);
|
return parent.buildsFileType(extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.ITool#getNatureFilter()
|
||||||
|
*/
|
||||||
|
public int getNatureFilter() {
|
||||||
|
// The tool reference does not override this value
|
||||||
|
return parent.getNatureFilter();
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getOption(java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.ITool#getOption(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@ -382,6 +391,7 @@ public class ToolReference implements ITool {
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getOutput(java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.ITool#getOutput(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public String getOutputExtension(String inputExtension) {
|
public String getOutputExtension(String inputExtension) {
|
||||||
|
// The tool reference does not override this value
|
||||||
return parent.getOutputExtension(inputExtension);
|
return parent.getOutputExtension(inputExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
2003-10-01 Sean Evoy
|
||||||
|
Fix for bugs 43490 (trivial), 44020, and 43980.
|
||||||
|
A massive change has occurred in the plugin file. I added new C tools that apply
|
||||||
|
only to projects with C natures. I also added option overrides in the default
|
||||||
|
configurations for these new tools. The trivial fix for the new C project wizard
|
||||||
|
involved changing the icon entry in the plugin file.
|
||||||
|
* plugin.xml
|
||||||
|
|
||||||
|
In preparation for 44020, each new configuration created is assigned a truly
|
||||||
|
random ID.
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java
|
||||||
|
|
||||||
|
Removed a tooltip that was not being populated properly.
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java
|
||||||
|
|
||||||
2003-09-30 Sean Evoy
|
2003-09-30 Sean Evoy
|
||||||
Fix for bug 41826.
|
Fix for bug 41826.
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,11 @@ MngCCWizard.description=Create a new C++ project and let Eclipse create and mana
|
||||||
ConfigName.Rel=Release
|
ConfigName.Rel=Release
|
||||||
ConfigName.Dbg=Debug
|
ConfigName.Dbg=Debug
|
||||||
ToolName.preprocessor = Preprocessor
|
ToolName.preprocessor = Preprocessor
|
||||||
ToolName.compiler = Compiler
|
ToolName.compiler.c = C Compiler
|
||||||
|
ToolName.compiler.cpp = C++ Compiler
|
||||||
ToolName.archiver = Archiver
|
ToolName.archiver = Archiver
|
||||||
ToolName.linker = Linker
|
ToolName.linker.c = C Linker
|
||||||
|
ToolName.linker.cpp = C++ Linker
|
||||||
OptionCategory.Preproc = Preprocessor
|
OptionCategory.Preproc = Preprocessor
|
||||||
OptionCategory.Dirs = Directories
|
OptionCategory.Dirs = Directories
|
||||||
OptionCategory.General = General
|
OptionCategory.General = General
|
||||||
|
@ -36,6 +38,7 @@ Option.Posix.Optimize.Most=Optimize most (-O3)
|
||||||
|
|
||||||
Option.Posix.Verbose=Verbose (-v)
|
Option.Posix.Verbose=Verbose (-v)
|
||||||
Option.OtherFlags=Other flags
|
Option.OtherFlags=Other flags
|
||||||
|
Option.Posix.Ansi=Support ANSI programs (-ansi)
|
||||||
|
|
||||||
Option.Posix.Linker.NoStartFiles=Do not use standard start files (-nostartfiles)
|
Option.Posix.Linker.NoStartFiles=Do not use standard start files (-nostartfiles)
|
||||||
Option.Posix.Linker.NoDefLibs=Do not use default libraries (-nodefaultlibs)
|
Option.Posix.Linker.NoDefLibs=Do not use default libraries (-nodefaultlibs)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -17,6 +17,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
|
|
||||||
|
@ -478,13 +479,17 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
|
||||||
SortedMap newConfigs = manageDialog.getNewConfigs();
|
SortedMap newConfigs = manageDialog.getNewConfigs();
|
||||||
Set keys = newConfigs.keySet();
|
Set keys = newConfigs.keySet();
|
||||||
Iterator keyIter = keys.iterator();
|
Iterator keyIter = keys.iterator();
|
||||||
int index = selectedTarget.getConfigurations().length;
|
Random r = new Random();
|
||||||
|
r.setSeed(System.currentTimeMillis());
|
||||||
while (keyIter.hasNext()) {
|
while (keyIter.hasNext()) {
|
||||||
String name = (String) keyIter.next();
|
String name = (String) keyIter.next();
|
||||||
IConfiguration parent = (IConfiguration) newConfigs.get(name);
|
IConfiguration parent = (IConfiguration) newConfigs.get(name);
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
++index;
|
int id = r.nextInt();
|
||||||
String newId = parent.getId() + "." + index;
|
if (id < 0) {
|
||||||
|
id *= -1;
|
||||||
|
}
|
||||||
|
String newId = parent.getId() + "." + id;
|
||||||
IConfiguration newConfig = selectedTarget.createConfiguration(parent, newId);
|
IConfiguration newConfig = selectedTarget.createConfiguration(parent, newId);
|
||||||
newConfig.setName(name);
|
newConfig.setName(name);
|
||||||
// Update the config lists
|
// Update the config lists
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class CProjectPlatformPage extends WizardPage {
|
||||||
platformLabel.setLayoutData(new GridData());
|
platformLabel.setLayoutData(new GridData());
|
||||||
|
|
||||||
platformSelection = ControlFactory.createSelectCombo(composite, targetNames, null);
|
platformSelection = ControlFactory.createSelectCombo(composite, targetNames, null);
|
||||||
platformSelection.setToolTipText(ManagedBuilderUIPlugin.getResourceString(PLATFORM_TIP));
|
// platformSelection.setToolTipText(ManagedBuilderUIPlugin.getResourceString(PLATFORM_TIP));
|
||||||
platformSelection.addListener(SWT.Selection, new Listener() {
|
platformSelection.addListener(SWT.Selection, new Listener() {
|
||||||
public void handleEvent(Event e) {
|
public void handleEvent(Event e) {
|
||||||
handleTargetSelection();
|
handleTargetSelection();
|
||||||
|
|
|
@ -11,6 +11,8 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
* **********************************************************************/
|
* **********************************************************************/
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.ICDescriptor;
|
import org.eclipse.cdt.core.ICDescriptor;
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
|
@ -108,14 +110,19 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
|
||||||
ITarget parent = targetConfigurationPage.getSelectedTarget();
|
ITarget parent = targetConfigurationPage.getSelectedTarget();
|
||||||
newTarget = ManagedBuildManager.createTarget(newProject, parent);
|
newTarget = ManagedBuildManager.createTarget(newProject, parent);
|
||||||
if (newTarget != null) {
|
if (newTarget != null) {
|
||||||
// TODO add name entry field to project
|
|
||||||
String artifactName = newProject.getName();
|
String artifactName = newProject.getName();
|
||||||
artifactName += parent.getDefaultExtension().length() == 0 ? "" : "." + parent.getDefaultExtension();
|
artifactName += parent.getDefaultExtension().length() == 0 ? "" : "." + parent.getDefaultExtension();
|
||||||
newTarget.setBuildArtifact(artifactName);
|
newTarget.setBuildArtifact(artifactName);
|
||||||
IConfiguration [] selectedConfigs = targetConfigurationPage.getSelectedConfigurations();
|
IConfiguration [] selectedConfigs = targetConfigurationPage.getSelectedConfigurations();
|
||||||
|
Random r = new Random();
|
||||||
|
r.setSeed(System.currentTimeMillis());
|
||||||
for (int i = 0; i < selectedConfigs.length; i++) {
|
for (int i = 0; i < selectedConfigs.length; i++) {
|
||||||
IConfiguration config = selectedConfigs[i];
|
IConfiguration config = selectedConfigs[i];
|
||||||
newTarget.createConfiguration(config, config.getId() + "." + i);
|
int id = r.nextInt();
|
||||||
|
if (id < 0) {
|
||||||
|
id *= -1;
|
||||||
|
}
|
||||||
|
newTarget.createConfiguration(config, config.getId() + "." + id);
|
||||||
}
|
}
|
||||||
// Now add the first config in the list as the default
|
// Now add the first config in the list as the default
|
||||||
IConfiguration[] newConfigs = newTarget.getConfigurations();
|
IConfiguration[] newConfigs = newTarget.getConfigurations();
|
||||||
|
|
|
@ -286,11 +286,8 @@ public class ManagedBuildTests extends TestCase {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void testConfigurations() throws CoreException, BuildException {
|
public void testConfigurations() throws CoreException, BuildException {
|
||||||
String rootConfigId = "test.root.1.0";
|
|
||||||
String rootName = "Root Config";
|
String rootName = "Root Config";
|
||||||
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";
|
String completeOverrideName = "Complete Override Config";
|
||||||
|
|
||||||
// Open the test project
|
// Open the test project
|
||||||
|
@ -303,11 +300,8 @@ public class ManagedBuildTests extends TestCase {
|
||||||
IConfiguration[] definedConfigs = rootTarget.getConfigurations();
|
IConfiguration[] definedConfigs = rootTarget.getConfigurations();
|
||||||
assertEquals(3, definedConfigs.length);
|
assertEquals(3, definedConfigs.length);
|
||||||
IConfiguration baseConfig = definedConfigs[0];
|
IConfiguration baseConfig = definedConfigs[0];
|
||||||
assertEquals(definedConfigs[0].getId(), rootConfigId);
|
|
||||||
assertEquals(definedConfigs[0].getName(), rootName);
|
assertEquals(definedConfigs[0].getName(), rootName);
|
||||||
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);
|
assertEquals(definedConfigs[2].getName(), completeOverrideName);
|
||||||
|
|
||||||
// Create a new configuration and test the rename function
|
// Create a new configuration and test the rename function
|
||||||
|
@ -355,9 +349,7 @@ public class ManagedBuildTests extends TestCase {
|
||||||
rootTarget.removeConfiguration(testConfigId);
|
rootTarget.removeConfiguration(testConfigId);
|
||||||
definedConfigs = rootTarget.getConfigurations();
|
definedConfigs = rootTarget.getConfigurations();
|
||||||
assertEquals(3, definedConfigs.length);
|
assertEquals(3, definedConfigs.length);
|
||||||
assertEquals(definedConfigs[0].getId(), rootConfigId);
|
|
||||||
assertEquals(definedConfigs[0].getName(), rootName);
|
assertEquals(definedConfigs[0].getName(), rootName);
|
||||||
assertEquals(definedConfigs[1].getId(), overrideConfigId);
|
|
||||||
assertEquals(definedConfigs[1].getName(), overrideName);
|
assertEquals(definedConfigs[1].getName(), overrideName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,10 +514,8 @@ public class ManagedBuildTests extends TestCase {
|
||||||
// There should be a default configuration defined for the project
|
// There should be a default configuration defined for the project
|
||||||
ITarget buildTarget = info.getDefaultTarget();
|
ITarget buildTarget = info.getDefaultTarget();
|
||||||
assertNotNull(buildTarget);
|
assertNotNull(buildTarget);
|
||||||
assertEquals(buildTarget.getId(), "test.root.1");
|
|
||||||
IConfiguration buildConfig = info.getDefaultConfiguration(buildTarget);
|
IConfiguration buildConfig = info.getDefaultConfiguration(buildTarget);
|
||||||
assertNotNull(buildConfig);
|
assertNotNull(buildConfig);
|
||||||
assertEquals(buildConfig.getId(), "test.root.1.0");
|
|
||||||
|
|
||||||
// The default target should be the same as the one-and-only target in the project
|
// The default target should be the same as the one-and-only target in the project
|
||||||
List targets = info.getTargets();
|
List targets = info.getTargets();
|
||||||
|
@ -705,7 +695,8 @@ public class ManagedBuildTests extends TestCase {
|
||||||
// The root tool defines one valid header file extension
|
// The root tool defines one valid header file extension
|
||||||
assertTrue(rootTool.isHeaderFile("baz"));
|
assertTrue(rootTool.isHeaderFile("baz"));
|
||||||
assertTrue(tools[0].isHeaderFile("baz"));
|
assertTrue(tools[0].isHeaderFile("baz"));
|
||||||
|
assertEquals(ITool.FILTER_C, rootTool.getNatureFilter());
|
||||||
|
|
||||||
// Partially Overriden Configuration
|
// 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();
|
||||||
|
@ -834,7 +825,8 @@ public class ManagedBuildTests extends TestCase {
|
||||||
assertEquals("lib", subTool.getOutputPrefix());
|
assertEquals("lib", subTool.getOutputPrefix());
|
||||||
assertTrue(subTool.isHeaderFile("arf"));
|
assertTrue(subTool.isHeaderFile("arf"));
|
||||||
assertTrue(subTool.isHeaderFile("barf"));
|
assertTrue(subTool.isHeaderFile("barf"));
|
||||||
|
assertEquals(ITool.FILTER_BOTH, subTool.getNatureFilter());
|
||||||
|
|
||||||
// Do a sanity check on the options
|
// Do a sanity check on the options
|
||||||
assertEquals("Include Paths", subOpts[0].getName());
|
assertEquals("Include Paths", subOpts[0].getName());
|
||||||
assertEquals(IOption.INCLUDE_PATH, subOpts[0].getValueType());
|
assertEquals(IOption.INCLUDE_PATH, subOpts[0].getValueType());
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
makeFlags="-k"
|
makeFlags="-k"
|
||||||
osList="win32">
|
osList="win32">
|
||||||
<tool
|
<tool
|
||||||
|
natureFilter="cnature"
|
||||||
sources="foo,bar"
|
sources="foo,bar"
|
||||||
name="Root Tool"
|
name="Root Tool"
|
||||||
headerExtensions="baz"
|
headerExtensions="baz"
|
||||||
|
@ -159,6 +160,7 @@
|
||||||
id="sub.config">
|
id="sub.config">
|
||||||
</configuration>
|
</configuration>
|
||||||
<tool
|
<tool
|
||||||
|
natureFilter="both"
|
||||||
sources="yarf"
|
sources="yarf"
|
||||||
name="Sub Tool"
|
name="Sub Tool"
|
||||||
headerExtensions="arf,barf"
|
headerExtensions="arf,barf"
|
||||||
|
@ -202,7 +204,7 @@
|
||||||
</listOptionValue>
|
</listOptionValue>
|
||||||
<listOptionValue
|
<listOptionValue
|
||||||
value=""../includes""
|
value=""../includes""
|
||||||
builIn="false">
|
builtIn="false">
|
||||||
</listOptionValue>
|
</listOptionValue>
|
||||||
</option>
|
</option>
|
||||||
<option
|
<option
|
||||||
|
|
Loading…
Add table
Reference in a new issue