Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2003-04-21 15:37:47 -0400
committerDoug Schaefer2003-04-21 15:37:47 -0400
commitae94fe795569deff28066b26f829ea18f29fb6e5 (patch)
treebac17550db38073267330e78fd4c363b3ad7e45e /core/org.eclipse.cdt.core/build
parenteaf3aacd4e3d8f3a8cf9d61dbcdfcb0d824bad16 (diff)
downloadorg.eclipse.cdt-ae94fe795569deff28066b26f829ea18f29fb6e5.tar.gz
org.eclipse.cdt-ae94fe795569deff28066b26f829ea18f29fb6e5.tar.xz
org.eclipse.cdt-ae94fe795569deff28066b26f829ea18f29fb6e5.zip
- Fixed the test failures that arose because the targets don't
automatically copy over their configs (however now they do for targets defined at the extension point). - Config elements and attributes are now saved in the cdtbuild file, but not any children.
Diffstat (limited to 'core/org.eclipse.cdt.core/build')
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java8
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java22
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java4
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java35
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java8
5 files changed, 63 insertions, 14 deletions
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java
index c1afcc8a8e..2527dcfbe9 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java
@@ -46,6 +46,14 @@ public interface ITarget extends IBuildObject {
public IConfiguration[] getConfigurations();
/**
+ * Returns the configuration with the given id, or null if not found.
+ *
+ * @param id
+ * @return
+ */
+ public IConfiguration getConfiguration(String id);
+
+ /**
* Creates a new configuration for the target. It is populated with
* the tools defined for that target and options set at their defaults.
*
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 5978512cef..6ed0d47ee6 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
@@ -73,9 +73,29 @@ public class Configuration extends BuildObject implements IConfiguration {
}
}
+ public Configuration(Target target, Element element) {
+ this.target = target;
+
+ // id
+ setId(element.getAttribute("id"));
+
+ // hook me up
+ target.addConfiguration(this);
+
+ // name
+ if (element.hasAttribute("name"))
+ setName(element.getAttribute("name"));
+
+ if (element.hasAttribute("parent"))
+ parent = target.getParent().getConfiguration(element.getAttribute("parent"));
+ }
+
public void serealize(Document doc, Element element) {
element.setAttribute("id", id);
- element.setAttribute("name", name);
+
+ if (name != null)
+ element.setAttribute("name", name);
+
if (parent != null)
element.setAttribute("parent", parent.getId());
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 9043afcb52..cfbb3f8c9e 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
@@ -48,7 +48,7 @@ public class OptionReference implements IOption {
*/
public OptionReference(ToolReference owner, IConfigurationElement element) {
this.owner = owner;
- option = owner.getOption(element.getAttribute("id"));
+ option = owner.getTool().getOption(element.getAttribute("id"));
owner.addOptionReference(this);
}
@@ -61,7 +61,7 @@ public class OptionReference implements IOption {
*/
public OptionReference(ToolReference owner, Element element) {
this.owner = owner;
- option = owner.getOption(element.getAttribute("id"));
+ option = owner.getTool().getOption(element.getAttribute("id"));
owner.addOptionReference(this);
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java
index 4799b0dc6d..82c307135b 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java
@@ -23,6 +23,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IConfigurationElement;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
*
@@ -34,6 +35,7 @@ public class Target extends BuildObject implements ITarget {
private List tools;
private Map toolMap;
private List configurations;
+ private Map configMap;
private boolean isAbstract = false;
private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
@@ -78,8 +80,13 @@ public class Target extends BuildObject implements ITarget {
// parent
String parentId = element.getAttribute("parent");
- if (parentId != null)
+ if (parentId != null) {
parent = ManagedBuildManager.getTarget(null, parentId);
+ // copy over the parents configs
+ IConfiguration[] parentConfigs = parent.getConfigurations();
+ for (int i = 0; i < parentConfigs.length; ++i)
+ addConfiguration(parentConfigs[i]);
+ }
// isAbstract
if ("true".equals(element.getAttribute("isAbstract")))
@@ -123,6 +130,16 @@ public class Target extends BuildObject implements ITarget {
// isAbstract
if ("true".equals(element.getAttribute("isAbstract")))
isAbstract = true;
+
+ Node child = element.getFirstChild();
+ while (child != null) {
+ if (child.getNodeName().equals("configuration")) {
+ new Configuration(this, (Element)child);
+ }
+
+ child = child.getNextSibling();
+ }
+
}
@@ -137,6 +154,7 @@ public class Target extends BuildObject implements ITarget {
for (int i = 0; i < configurations.size(); ++i) {
Configuration config = (Configuration)configurations.get(i);
Element configElement = doc.createElement("configuration");
+ element.appendChild(configElement);
config.serealize(doc, configElement);
}
}
@@ -200,16 +218,17 @@ public class Target extends BuildObject implements ITarget {
return emptyConfigs;
}
- public void addConfiguration(IConfiguration configuration) {
- if (configurations == null)
- configurations = new ArrayList();
- configurations.add(configuration);
+ public IConfiguration getConfiguration(String id) {
+ return (IConfiguration)configMap.get(id);
}
-
- private void addLocalConfiguration(IConfiguration configuration) {
- if (configurations == null)
+
+ public void addConfiguration(IConfiguration configuration) {
+ if (configurations == null) {
configurations = new ArrayList();
+ configMap = new HashMap();
+ }
configurations.add(configuration);
+ configMap.put(configuration.getId(), configuration);
}
/* (non-Javadoc)
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 7020c24d0e..320f6b5061 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
@@ -96,9 +96,12 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
}
public void addOption(Option option) {
- if (options == null)
+ if (options == null) {
options = new ArrayList();
+ optionMap = new HashMap();
+ }
options.add(option);
+ optionMap.put(option.getId(), option);
}
public IOptionCategory getTopOptionCategory() {
@@ -177,8 +180,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
* @see org.eclipse.cdt.core.build.managed.ITool#getOption(java.lang.String)
*/
public IOption getOption(String id) {
- // TODO Auto-generated method stub
- return null;
+ return (IOption)optionMap.get(id);
}
}

Back to the top