Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2003-06-23 10:36:31 -0400
committerDoug Schaefer2003-06-23 10:36:31 -0400
commitb8059d7f27fb2f28cb77e7faa38ba6112d9a61cf (patch)
tree58ed23f5b36997e87d438cc49809d112f3cf2180 /core/org.eclipse.cdt.core/build
parent40e2cbf0b08aa51acdfaeeb48ef18cf83e1be6b3 (diff)
downloadorg.eclipse.cdt-b8059d7f27fb2f28cb77e7faa38ba6112d9a61cf.tar.gz
org.eclipse.cdt-b8059d7f27fb2f28cb77e7faa38ba6112d9a61cf.tar.xz
org.eclipse.cdt-b8059d7f27fb2f28cb77e7faa38ba6112d9a61cf.zip
Patch for Sean Evoy:
1. Fix for bug 38665 - Need to select platform before configurations become visible 2. Icon files that were not delivered in my last patch 3. A new interface for clients of the build model to extract include paths and defined symbols for managed projects. Unmanaged projects to follow soon.
Diffstat (limited to 'core/org.eclipse.cdt.core/build')
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IManagedBuildPathInfo.java32
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java59
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java43
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java16
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java85
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java55
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java59
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java22
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java18
9 files changed, 330 insertions, 59 deletions
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IManagedBuildPathInfo.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IManagedBuildPathInfo.java
new file mode 100644
index 0000000000..03fbcc20f1
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IManagedBuildPathInfo.java
@@ -0,0 +1,32 @@
+package org.eclipse.cdt.core.build.managed;
+
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+
+public interface IManagedBuildPathInfo {
+ /**
+ * Answers a <code>String</code> array containing all the defined
+ * preprocessor symbols. If there are no defined symbols, the receiver
+ * will return an empty array, never <code>null</code>
+ *
+ * @return
+ */
+ public String[] getDefinedSymbols();
+
+ /**
+ * Answers a <code>String</code> array containing all the known include
+ * search paths. If there are no paths defined, the receiver will
+ * return an empty array, never <code>null</code>
+ *
+ * @return
+ */
+ public String[] getIncludePaths();
+}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java
index 9543517ada..2e442ea3dd 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java
@@ -14,24 +14,28 @@ package org.eclipse.cdt.core.build.managed;
*
*/
public interface IOption extends IBuildObject {
-
// Type for the value of the option
public static final int BOOLEAN = 0;
public static final int ENUMERATED = 1;
public static final int STRING = 2;
public static final int STRING_LIST = 3;
+ public static final int INCLUDE_PATH = 4;
+ public static final int PREPROCESSOR_SYMBOLS = 5;
/**
* If this option is defined as an enumeration, this function returns
* the list of possible values for that enum.
*
- * If this option is not defined as an enumeration, it returns null.
+ * If this option is not defined as an enumeration, it returns <code>null</code>.
* @return
*/
public String [] getApplicableValues();
/**
- * @return the value for a boolean option.
+ * Answers the value for a boolean option.
+ *
+ * @return
+ * @throws BuildException
*/
public boolean getBooleanValue() throws BuildException;
@@ -43,45 +47,64 @@ public interface IOption extends IBuildObject {
public IOptionCategory getCategory();
/**
- * @return a String containing the actual command line option
- * associated with the <code>IOption</code>
+ * Answers a <code>String</code> containing the actual command line
+ * option associated with the option
+ *
+ * @return
*/
public String getCommand();
/**
- * @return <code>String</code> containing the command associated with the
- * enumeration name.
+ * @return
+ * @throws BuildException
*/
- public String getEnumCommand (String name);
-
+ public String[] getDefinedSymbols() throws BuildException;
+
/**
- * Returns the name of this option.
- *
- * @return
+ * Answers the command associated with the enumeration name. For
+ * example, if the enumeration name was 'Default' for the debug
+ * level option of the Gnu compiler, and the plugin manifest defined
+ * that as -g, then the return value would be a String containing "-g"
+ *
+ * @return
*/
- public String getName();
-
+ public String getEnumCommand (String name);
+
/**
- * Returns the current value for this option if it is a List of Strings.
+ * Answers an array of <code>String</code> containing the includes paths
+ * defined in the build model.
*
* @return
+ * @throws BuildException
*/
- public String [] getStringListValue() throws BuildException;
+ public String[] getIncludePaths() throws BuildException;
+
/**
- * @return a <code>String</code> containing the selected enumeration in an
+ * Answers a <code>String</code> containing the selected enumeration in an
* enumerated option. For an option that has not been changed by the user,
* the receiver will answer with the default defined in the plugin manifest.
* If the user has modified the selection, the receiver will answer with the
* overridden selection.
+ *
+ * @return
+ * @throws BuildException
*/
- public String getSelectedEnum ();
+ public String getSelectedEnum () throws BuildException;
+ /**
+ * Returns the current value for this option if it is a List of Strings.
+ *
+ * @return
+ * @throws BuildException
+ */
+ public String [] getStringListValue() throws BuildException;
/**
* Returns the current value for this option if it is a String
*
* @return
+ * @throws BuildException
*/
public String getStringValue() throws BuildException;
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java
index 7adb6cd147..8d261f0d54 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java
@@ -118,19 +118,28 @@ public class ManagedBuildManager {
}
}
-
+
+ /**
+ * Answers the result of a best-effort search to find a target with the
+ * specified ID, or <code>null</code> if one is not found.
+ *
+ * @param resource
+ * @param id
+ * @return
+ */
public static ITarget getTarget(IResource resource, String id) {
+ ITarget target = null;
+ // Check if the target is spec'd in the build info for the resource
if (resource != null) {
IResourceBuildInfo buildInfo = getBuildInfo(resource);
if (buildInfo != null)
- return buildInfo.getTarget(id);
+ target = buildInfo.getTarget(id);
}
-
- ITarget target = (ITarget)getExtensionTargetMap().get(id);
- if (target != null)
- return target;
-
- return null;
+ // OK, check the extension map
+ if (target == null) {
+ target = (ITarget)getExtensionTargetMap().get(id);
+ }
+ return target;
}
/**
@@ -329,7 +338,7 @@ public class ManagedBuildManager {
return buildInfo;
}
- public static IResourceBuildInfo getBuildInfo(IResource resource, boolean create) {
+ private static ResourceBuildInfo findBuildInfo(IResource resource, boolean create) {
// Make sure the extension information is loaded first
loadExtensions();
ResourceBuildInfo buildInfo = null;
@@ -354,9 +363,23 @@ public class ManagedBuildManager {
return buildInfo;
}
+ public static IResourceBuildInfo getBuildInfo(IResource resource, boolean create) {
+ return (IResourceBuildInfo) findBuildInfo(resource, create);
+ }
+
public static IResourceBuildInfo getBuildInfo(IResource resource) {
- return getBuildInfo(resource, false);
+ return (IResourceBuildInfo) findBuildInfo(resource, false);
}
+ /**
+ * Answers with an interface to the parse information that has been
+ * associated with the resource specified in the argument.
+ *
+ * @param resource
+ * @return
+ */
+ public static IManagedBuildPathInfo getBuildPathInfo(IResource resource) {
+ return (IManagedBuildPathInfo) getBuildInfo(resource, false);
+ }
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java
index 1369bb6a94..45af3a8f52 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java
@@ -272,7 +272,21 @@ public class Configuration extends BuildObject implements IConfiguration {
*/
public void setOption(IOption option, String[] value) throws BuildException {
// Is there a delta
- String[] oldValue = option.getStringListValue();
+ String[] oldValue;
+ switch (option.getValueType()) {
+ case IOption.STRING_LIST :
+ oldValue = option.getStringListValue();
+ break;
+ case IOption.INCLUDE_PATH :
+ oldValue = option.getIncludePaths();
+ break;
+ case IOption.PREPROCESSOR_SYMBOLS :
+ oldValue = option.getDefinedSymbols();
+ break;
+ default :
+ oldValue = new String[0];
+ break;
+ }
if(!Arrays.equals(value, oldValue))
createOptionReference(option).setValue(value);
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java
index ccc5876d10..d9209a9c2a 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java
@@ -36,7 +36,7 @@ public class Option extends BuildObject implements IOption {
private String defaultEnumName;
private String command;
- private static final String[] emptyStrings = new String[0];
+ private static final String[] EMPTY_STRING_ARRAY = new String[0];
private static final String EMPTY_STRING = new String();
public Option(ITool tool) {
@@ -46,24 +46,24 @@ public class Option extends BuildObject implements IOption {
public Option(Tool tool, IConfigurationElement element) {
this(tool);
- // id
+ // Get the unique id of the option
setId(element.getAttribute("id"));
- // hook me up
+ // Hook me up to a tool
tool.addOption(this);
- // name
+ // Get the option Name (this is what the user will see in the UI)
setName(element.getAttribute("name"));
- // category
+ // Options can be grouped into categories
String categoryId = element.getAttribute("category");
if (categoryId != null)
setCategory(tool.getOptionCategory(categoryId));
- // command
+ // Get the command defined for the option
command = element.getAttribute("command");
- // valueType
+ // Options hold different types of values
String valueTypeStr = element.getAttribute("valueType");
if (valueTypeStr == null)
valueType = -1;
@@ -73,10 +73,14 @@ public class Option extends BuildObject implements IOption {
valueType = IOption.STRING_LIST;
else if (valueTypeStr.equals("boolean"))
valueType = IOption.BOOLEAN;
- else
+ else if (valueTypeStr.equals("enumerated"))
valueType = IOption.ENUMERATED;
+ else if (valueTypeStr.equals("includePath"))
+ valueType = IOption.INCLUDE_PATH;
+ else
+ valueType = IOption.PREPROCESSOR_SYMBOLS;
- // value
+ // Now get the actual value
enumCommands = new HashMap();
switch (valueType) {
case IOption.BOOLEAN:
@@ -103,6 +107,8 @@ public class Option extends BuildObject implements IOption {
value = enumList;
break;
case IOption.STRING_LIST:
+ case IOption.INCLUDE_PATH:
+ case IOption.PREPROCESSOR_SYMBOLS:
List valueList = new ArrayList();
IConfigurationElement[] valueElements = element.getChildren("optionValue");
for (int i = 0; i < valueElements.length; ++i) {
@@ -122,7 +128,7 @@ public class Option extends BuildObject implements IOption {
List enumValues = (List)value;
return enumValues != null
? (String[])enumValues.toArray(new String[enumValues.size()])
- : emptyStrings;
+ : EMPTY_STRING_ARRAY;
}
public boolean getBooleanValue() {
@@ -145,36 +151,70 @@ public class Option extends BuildObject implements IOption {
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getDefinedSymbols()
+ */
+ public String[] getDefinedSymbols() throws BuildException {
+ if (valueType != IOption.PREPROCESSOR_SYMBOLS) {
+ throw new BuildException("bad value type");
+ }
+ List v = (List)value;
+ return v != null
+ ? (String[])v.toArray(new String[v.size()])
+ : EMPTY_STRING_ARRAY;
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getEnumCommand(java.lang.String)
*/
public String getEnumCommand(String name) {
String cmd = (String) enumCommands.get(name);
- return (cmd == null ? new String() : cmd);
+ return cmd == null ? EMPTY_STRING : cmd;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getIncludePaths()
+ */
+ public String[] getIncludePaths() throws BuildException {
+ if (valueType != IOption.INCLUDE_PATH) {
+ throw new BuildException("bad value type");
+ }
+ List v = (List)value;
+ return v != null
+ ? (String[])v.toArray(new String[v.size()])
+ : EMPTY_STRING_ARRAY;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
*/
- public String getSelectedEnum() {
- return defaultEnumName;
+ public String getSelectedEnum() throws BuildException {
+ if (valueType != IOption.ENUMERATED) {
+ throw new BuildException("bad value type");
+ }
+ return defaultEnumName == null ? EMPTY_STRING : defaultEnumName;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getStringListValue()
*/
- public String[] getStringListValue() {
+ public String[] getStringListValue() throws BuildException {
+ if (valueType != IOption.STRING_LIST) {
+ throw new BuildException("bad value type");
+ }
List v = (List)value;
return v != null
? (String[])v.toArray(new String[v.size()])
- : emptyStrings;
+ : EMPTY_STRING_ARRAY;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getStringValue()
*/
- public String getStringValue() {
- String v = (String) value;
- return value == null ? EMPTY_STRING : v;
+ public String getStringValue() throws BuildException {
+ if (valueType != IOption.STRING) {
+ throw new BuildException("bad value type");
+ }
+ return value == null ? EMPTY_STRING : (String)value;
}
/* (non-Javadoc)
@@ -204,16 +244,15 @@ public class Option extends BuildObject implements IOption {
public IOption setValue(IConfiguration config, String value)
throws BuildException
{
- if (valueType != IOption.STRING)
+ if (valueType != IOption.STRING
+ || valueType != IOption.ENUMERATED)
throw new BuildException("Bad value for type");
if (config == null) {
this.value = value;
return this;
} else {
-
// Magic time
-
return null;
}
}
@@ -224,7 +263,9 @@ public class Option extends BuildObject implements IOption {
public IOption setValue(IConfiguration config, String[] value)
throws BuildException
{
- if (valueType != IOption.STRING_LIST)
+ if (valueType != IOption.STRING_LIST
+ || valueType != IOption.INCLUDE_PATH
+ || valueType != IOption.PREPROCESSOR_SYMBOLS)
throw new BuildException("Bad value for type");
if (config == null) {
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
index 66abdfc2df..0228a7408d 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
@@ -53,7 +53,7 @@ public class OptionReference implements IOption {
}
/**
- * Created from extension.
+ * Created from extension point.
*
* @param owner
* @param element
@@ -73,9 +73,15 @@ public class OptionReference implements IOption {
value = element.getAttribute("defaultValue");
break;
case IOption.ENUMERATED:
- value = option.getSelectedEnum();
+ try {
+ value = option.getSelectedEnum();
+ } catch (BuildException e) {
+ value = new String();
+ }
break;
case IOption.STRING_LIST:
+ case IOption.INCLUDE_PATH:
+ case IOption.PREPROCESSOR_SYMBOLS:
List valueList = new ArrayList();
IConfigurationElement[] valueElements = element.getChildren("optionValue");
for (int i = 0; i < valueElements.length; ++i) {
@@ -108,6 +114,8 @@ public class OptionReference implements IOption {
value = (String) element.getAttribute("defaultValue");
break;
case IOption.STRING_LIST:
+ case IOption.INCLUDE_PATH:
+ case IOption.PREPROCESSOR_SYMBOLS:
List valueList = new ArrayList();
NodeList nodes = element.getElementsByTagName("optionValue");
for (int i = 0; i < nodes.getLength(); ++i) {
@@ -141,6 +149,8 @@ public class OptionReference implements IOption {
element.setAttribute("defaultValue", (String)value);
break;
case IOption.STRING_LIST:
+ case IOption.INCLUDE_PATH:
+ case IOption.PREPROCESSOR_SYMBOLS:
ArrayList stringList = (ArrayList)value;
ListIterator iter = stringList.listIterator();
while (iter.hasNext()) {
@@ -174,6 +184,20 @@ public class OptionReference implements IOption {
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getDefinedSymbols()
+ */
+ public String[] getDefinedSymbols() throws BuildException {
+ if (value == null)
+ return option.getDefinedSymbols();
+ else if (getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
+ ArrayList list = (ArrayList)value;
+ return (String[]) list.toArray(new String[list.size()]);
+ }
+ else
+ throw new BuildException("bad value type");
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getEnumCommand(java.lang.String)
*/
public String getEnumCommand(String name) {
@@ -184,13 +208,29 @@ public class OptionReference implements IOption {
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
*/
public String getId() {
+ // A reference has the same id as the option it references
return option.getId();
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getIncludePaths()
+ */
+ public String[] getIncludePaths() throws BuildException {
+ if (value == null)
+ return option.getIncludePaths();
+ else if (getValueType() == IOption.INCLUDE_PATH) {
+ ArrayList list = (ArrayList)value;
+ return (String[]) list.toArray(new String[list.size()]);
+ }
+ else
+ throw new BuildException("bad value type");
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
*/
public String getName() {
+ // A reference has the same name as the option it references
return option.getName();
}
@@ -212,13 +252,15 @@ public class OptionReference implements IOption {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
*/
- public String getSelectedEnum() {
+ public String getSelectedEnum() throws BuildException {
if (value == null) {
// Return the default defined for the enumeration in the manifest.
return option.getSelectedEnum();
- } else {
+ } else if (getValueType() == IOption.ENUMERATED) {
// Value will contain the human-readable name of the enum
return (String) value;
+ } else {
+ throw new BuildException("bad value type");
}
}
@@ -302,11 +344,14 @@ public class OptionReference implements IOption {
* @throws BuildException
*/
public void setValue(String [] value) throws BuildException {
- if (getValueType() == IOption.STRING_LIST) {
+ if (getValueType() == IOption.STRING_LIST
+ || getValueType() == IOption.INCLUDE_PATH
+ || getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
// Just replace what the option reference is holding onto
this.value = new ArrayList(Arrays.asList(value));
}
else
throw new BuildException("bad value type");
}
+
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java
index 82e3627c50..8cd236cbad 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java
@@ -12,13 +12,16 @@ package org.eclipse.cdt.internal.core.build.managed;
* **********************************************************************/
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import org.eclipse.cdt.core.build.managed.BuildException;
+import org.eclipse.cdt.core.build.managed.IManagedBuildPathInfo;
import org.eclipse.cdt.core.build.managed.IConfiguration;
+import org.eclipse.cdt.core.build.managed.IOption;
import org.eclipse.cdt.core.build.managed.IResourceBuildInfo;
import org.eclipse.cdt.core.build.managed.ITarget;
import org.eclipse.cdt.core.build.managed.ITool;
@@ -27,7 +30,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-public class ResourceBuildInfo implements IResourceBuildInfo {
+public class ResourceBuildInfo implements IResourceBuildInfo, IManagedBuildPathInfo {
private IResource owner;
private Map targetMap;
@@ -273,4 +276,58 @@ public class ResourceBuildInfo implements IResourceBuildInfo {
defaultTarget = target;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuildParseInfo#getDefinedSymbols()
+ */
+ public String[] getDefinedSymbols() {
+ // Return the include paths for the default configuration
+ ArrayList paths = new ArrayList();
+ IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+ ITool[] tools = config.getTools();
+ for (int i = 0; i < tools.length; i++) {
+ ITool tool = tools[i];
+ IOption[] opts = tool.getOptions();
+ for (int j = 0; j < opts.length; j++) {
+ IOption option = opts[j];
+ if (option.getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
+ try {
+ paths.addAll(Arrays.asList(option.getDefinedSymbols()));
+ } catch (BuildException e) {
+ // we should never get here
+ continue;
+ }
+ }
+ }
+ }
+ paths.trimToSize();
+ return (String[])paths.toArray(new String[paths.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuildParseInfo#getIncludePaths()
+ */
+ public String[] getIncludePaths() {
+ // Return the include paths for the default configuration
+ ArrayList paths = new ArrayList();
+ IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+ ITool[] tools = config.getTools();
+ for (int i = 0; i < tools.length; i++) {
+ ITool tool = tools[i];
+ IOption[] opts = tool.getOptions();
+ for (int j = 0; j < opts.length; j++) {
+ IOption option = opts[j];
+ if (option.getValueType() == IOption.INCLUDE_PATH) {
+ try {
+ paths.addAll(Arrays.asList(option.getIncludePaths()));
+ } catch (BuildException e) {
+ // we should never get here
+ continue;
+ }
+ }
+ }
+ }
+ paths.trimToSize();
+ return (String[])paths.toArray(new String[paths.size()]);
+ }
+
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java
index 713663b02e..38144dee07 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java
@@ -233,14 +233,32 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
break;
case IOption.STRING_LIST :
- String cmd = option.getCommand();
+ String listCmd = option.getCommand();
String[] list = option.getStringListValue();
for (int j = 0; j < list.length; j++) {
String temp = list[j];
- buf.append(cmd + temp + WHITE_SPACE);
+ buf.append(listCmd + temp + WHITE_SPACE);
}
break;
+ case IOption.INCLUDE_PATH :
+ String incCmd = option.getCommand();
+ String[] paths = option.getIncludePaths();
+ for (int j = 0; j < paths.length; j++) {
+ String temp = paths[j];
+ buf.append(incCmd + temp + WHITE_SPACE);
+ }
+ break;
+
+ case IOption.PREPROCESSOR_SYMBOLS :
+ String defCmd = option.getCommand();
+ String[] symbols = option.getDefinedSymbols();
+ for (int j = 0; j < symbols.length; j++) {
+ String temp = symbols[j];
+ buf.append(defCmd + temp + WHITE_SPACE);
+ }
+ break;
+
default :
break;
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
index 57bbfb4808..c388d54088 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
@@ -168,6 +168,24 @@ public class ToolReference implements ITool {
}
break;
+ case IOption.INCLUDE_PATH :
+ String incCmd = option.getCommand();
+ String[] paths = option.getIncludePaths();
+ for (int j = 0; j < paths.length; j++) {
+ String temp = paths[j];
+ buf.append(incCmd + temp + WHITE_SPACE);
+ }
+ break;
+
+ case IOption.PREPROCESSOR_SYMBOLS :
+ String defCmd = option.getCommand();
+ String[] symbols = option.getDefinedSymbols();
+ for (int j = 0; j < symbols.length; j++) {
+ String temp = symbols[j];
+ buf.append(defCmd + temp + WHITE_SPACE);
+ }
+ break;
+
default :
break;
}

Back to the top