Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Camelon2003-09-11 10:46:18 -0400
committerJohn Camelon2003-09-11 10:46:18 -0400
commit64911fc1866b9c6b6e225e0b5a4a474e69208f7c (patch)
treefb89bc3d0dcf0a5e4d768a98b957fb0ffe6cbd05 /core/org.eclipse.cdt.core/build
parent86bd34cb790a8516af8ce4671864d5e3620871e8 (diff)
downloadorg.eclipse.cdt-64911fc1866b9c6b6e225e0b5a4a474e69208f7c.tar.gz
org.eclipse.cdt-64911fc1866b9c6b6e225e0b5a4a474e69208f7c.tar.xz
org.eclipse.cdt-64911fc1866b9c6b6e225e0b5a4a474e69208f7c.zip
Patch for Sean Evoy
Hi All, Details are in the change log, but this patch contains work that partially implements incremental build. There are 2 major use cases not implemented: full rebuild on project settings change and properly handling header file changes. Both problems require build model work, so I will deliver that functionality in another patch. There are also fixes for bugs 41412 and 42735. As always, I have run the JUnit tests on Solaris (Motif) and Linux (Gtk).
Diffstat (limited to 'core/org.eclipse.cdt.core/build')
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java12
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IManagedBuildInfo.java8
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java1
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java19
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java59
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java55
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java13
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java6
8 files changed, 137 insertions, 36 deletions
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java
index 84cf2f187c..f61c914313 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java
@@ -14,8 +14,9 @@ import org.eclipse.core.resources.IResource;
public interface IConfiguration extends IBuildObject {
// Schema element names
- public static final String TOOL_REF = "toolReference";
- public static final String PARENT = "parent";
+ public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
+ public static final String TOOL_REF = "toolReference"; //$NON-NLS-1$
+ public static final String PARENT = "parent"; //$NON-NLS-1$
/**
* Returns the target for this configuration.
@@ -31,6 +32,13 @@ public interface IConfiguration extends IBuildObject {
public IResource getOwner();
/**
+ * Answers the configuration that the receiver is based on.
+ *
+ * @return
+ */
+ public IConfiguration getParent();
+
+ /**
* Returns the tools that are used in this configuration.
*
* @return
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IManagedBuildInfo.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IManagedBuildInfo.java
index dd3640b0d6..c60e45474e 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IManagedBuildInfo.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IManagedBuildInfo.java
@@ -52,6 +52,14 @@ public interface IManagedBuildInfo {
* @return
*/
public String getConfigurationName();
+
+ /**
+ * Answers a <code>String</code> array containing the names of all the configurations
+ * defined for the project's current target.
+ *
+ * @return
+ */
+ public String[] getConfigurationNames();
/**
* Get the default configuration associated with the receiver
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 163d2d9cc1..d22f5a5610 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
@@ -17,6 +17,7 @@ import org.eclipse.core.resources.IResource;
* is some type of resource built using a given collection of tools.
*/
public interface ITarget extends IBuildObject {
+ public static final String TARGET_ELEMENT_NAME = "target"; //$NON-NLS-1$
/**
* Creates a configuration for the target populated with the tools and
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java
index d700296520..85f0be6c3d 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java
@@ -15,15 +15,16 @@ package org.eclipse.cdt.core.build.managed;
*/
public interface ITool extends IBuildObject {
// Schema element names
- public static final String COMMAND = "command";
- public static final String OPTION = "option";
- public static final String OPTION_CAT = "optionCategory";
- public static final String OPTION_REF = "optionReference";
- public static final String OUTPUT_FLAG = "outputFlag";
- public static final String OUTPUT_PREFIX = "outputPrefix";
- public static final String OUTPUTS = "outputs";
- public static final String SOURCES = "sources";
- public static final String WHITE_SPACE = " ";
+ public static final String TOOL_ELEMENT_NAME = "tool"; //$NON-NLS-1$
+ public static final String COMMAND = "command"; //$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_REF = "optionReference"; //$NON-NLS-1$
+ public static final String OUTPUT_FLAG = "outputFlag"; //$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 SOURCES = "sources"; //$NON-NLS-1$
+ public static final String WHITE_SPACE = " "; //$NON-NLS-1$
/**
* Return <code>true</code> if the receiver builds files with the
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 89f72cddd6..c99e26dde3 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
@@ -31,6 +31,7 @@ import org.apache.xml.serialize.SerializerFactory;
import org.eclipse.cdt.core.AbstractCExtension;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.parser.*;
+import org.eclipse.cdt.internal.core.build.managed.Configuration;
import org.eclipse.cdt.internal.core.build.managed.ManagedBuildInfo;
import org.eclipse.cdt.internal.core.build.managed.Target;
import org.eclipse.core.resources.IFile;
@@ -52,11 +53,12 @@ import org.w3c.dom.Node;
public class ManagedBuildManager extends AbstractCExtension implements IScannerInfoProvider {
private static final QualifiedName buildInfoProperty = new QualifiedName(CCorePlugin.PLUGIN_ID, "managedBuildInfo");
- private static final String ROOT_ELEM_NAME = "ManagedProjectBuildInfo";
- private static final String FILE_NAME = ".cdtbuild";
+ private static final String ROOT_ELEM_NAME = "ManagedProjectBuildInfo"; //$NON-NLS-1$
+ private static final String FILE_NAME = ".cdtbuild"; //$NON-NLS-1$
private static final ITarget[] emptyTargets = new ITarget[0];
- public static final String INTERFACE_IDENTITY = CCorePlugin.PLUGIN_ID + "." + "ManagedBuildManager";
-
+ public static final String INTERFACE_IDENTITY = CCorePlugin.PLUGIN_ID + "." + "ManagedBuildManager"; //$NON-NLS-1$
+ public static final String EXTENSION_POINT_ID = "ManagedBuildInfo"; //$NON-NLS-1$
+
// Targets defined by extensions (i.e., not associated with a resource)
private static boolean extensionTargetsLoaded = false;
private static List extensionTargets;
@@ -311,12 +313,56 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
}
}
+ /**
+ * @param resource
+ */
public static void removeBuildInfo(IResource resource) {
try {
resource.setSessionProperty(buildInfoProperty, null);
} catch (CoreException e) {
}
}
+
+ /**
+ * Resets the build information for the project and configuration specified in the arguments.
+ * The build information will contain the settings defined in the plugin manifest.
+ *
+ * @param project
+ * @param configuration
+ */
+ public static void resetConfiguration(IProject project, IConfiguration configuration) {
+ // Make sure the extensions are loaded
+ loadExtensions();
+
+ // Find out the parent of the configuration
+ IConfiguration parentConfig = configuration.getParent();
+ // Find the parent target the configuration
+ ITarget parentTarget = parentConfig.getTarget();
+
+ // Get the extension point information
+ IExtensionPoint extensionPoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint(EXTENSION_POINT_ID);
+ IExtension[] extensions = extensionPoint.getExtensions();
+ for (int i = 0; i < extensions.length; ++i) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for (int j = 0; j < elements.length; ++j) {
+ IConfigurationElement element = elements[j];
+ if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME) &&
+ element.getAttribute(ITarget.ID).equals(parentTarget.getId())) {
+ // We have the parent target so get the definition for the parent config
+ IConfigurationElement[] targetElements = element.getChildren();
+ for (int k = 0; k < targetElements.length; ++k) {
+ IConfigurationElement targetElement = targetElements[k];
+ if (targetElement.getName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME) &&
+ targetElement.getAttribute(IConfiguration.ID).equals(parentConfig.getId())) {
+ // We now have the plugin element the target was originally based on
+ ((Configuration)configuration).reset(targetElement);
+ }
+ }
+ }
+ }
+ }
+ }
// Private stuff
@@ -356,14 +402,14 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
return;
extensionTargetsLoaded = true;
- IExtensionPoint extensionPoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("ManagedBuildInfo");
+ IExtensionPoint extensionPoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint(EXTENSION_POINT_ID);
IExtension[] extensions = extensionPoint.getExtensions();
for (int i = 0; i < extensions.length; ++i) {
IExtension extension = extensions[i];
IConfigurationElement[] elements = extension.getConfigurationElements();
for (int j = 0; j < elements.length; ++j) {
IConfigurationElement element = elements[j];
- if (element.getName().equals("target")) {
+ if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME)) {
new Target(element);
}
}
@@ -516,4 +562,5 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
map.put(project, list);
}
}
+
}
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 7ce09b7912..a4ce7cccb1 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
@@ -147,13 +147,12 @@ public class Configuration extends BuildObject implements IConfiguration {
if (parent != null)
element.setAttribute(IConfiguration.PARENT, parent.getId());
- if (toolReferences != null)
- for (int i = 0; i < toolReferences.size(); ++i) {
- ToolReference toolRef = (ToolReference)toolReferences.get(i);
- Element toolRefElement = doc.createElement(IConfiguration.TOOL_REF);
- element.appendChild(toolRefElement);
- toolRef.serialize(doc, toolRefElement);
- }
+ for (int i = 0; i < getToolReferences().size(); ++i) {
+ ToolReference toolRef = (ToolReference)getToolReferences().get(i);
+ Element toolRefElement = doc.createElement(IConfiguration.TOOL_REF);
+ element.appendChild(toolRefElement);
+ toolRef.serialize(doc, toolRefElement);
+ }
}
/* (non-Javadoc)
@@ -163,6 +162,16 @@ public class Configuration extends BuildObject implements IConfiguration {
return (name == null && parent != null) ? parent.getName() : name;
}
+ /*
+ * @return
+ */
+ private List getToolReferences() {
+ if (toolReferences == null) {
+ toolReferences = new ArrayList();
+ }
+ return toolReferences;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getTools()
*/
@@ -181,6 +190,21 @@ public class Configuration extends BuildObject implements IConfiguration {
return tools;
}
+ /**
+ * @param targetElement
+ */
+ public void reset(IConfigurationElement element) {
+ // I just need to reset the tool references
+ getToolReferences().clear();
+ IConfigurationElement[] configElements = element.getChildren();
+ for (int l = 0; l < configElements.length; ++l) {
+ IConfigurationElement configElement = configElements[l];
+ if (configElement.getName().equals(IConfiguration.TOOL_REF)) {
+ new ToolReference(this, configElement);
+ }
+ }
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getParent()
*/
@@ -209,19 +233,16 @@ public class Configuration extends BuildObject implements IConfiguration {
* @return
*/
private ToolReference getToolReference(ITool tool) {
- if (toolReferences != null)
- for (int i = 0; i < toolReferences.size(); ++i) {
- ToolReference toolRef = (ToolReference)toolReferences.get(i);
- if (toolRef.references(tool))
- return toolRef;
- }
+ for (int i = 0; i < getToolReferences().size(); ++i) {
+ ToolReference toolRef = (ToolReference)getToolReferences().get(i);
+ if (toolRef.references(tool))
+ return toolRef;
+ }
return null;
}
public void addToolReference(ToolReference toolRef) {
- if (toolReferences == null)
- toolReferences = new ArrayList();
- toolReferences.add(toolRef);
+ getToolReferences().add(toolRef);
}
public OptionReference createOptionReference(IOption option) {
@@ -293,4 +314,6 @@ public class Configuration extends BuildObject implements IConfiguration {
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/ManagedBuildInfo.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java
index 66a70cff94..382a65e3c6 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java
@@ -134,6 +134,19 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getConfigurationNames()
+ */
+ public String[] getConfigurationNames() {
+ ArrayList configNames = new ArrayList();
+ IConfiguration[] configs = getDefaultTarget().getConfigurations();
+ for (int i = 0; i < configs.length; i++) {
+ IConfiguration configuration = configs[i];
+ configNames.add(configuration.getName());
+ }
+ return (String[])configNames.toArray(new String[configNames.size()]);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getDefaultConfiguration()
*/
public IConfiguration getDefaultConfiguration(ITarget target) {
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 4c13d741c8..520242ef36 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
@@ -132,9 +132,9 @@ public class Target extends BuildObject implements ITarget {
IConfigurationElement[] targetElements = element.getChildren();
for (int k = 0; k < targetElements.length; ++k) {
IConfigurationElement targetElement = targetElements[k];
- if (targetElement.getName().equals("tool")) {
+ if (targetElement.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
new Tool(this, targetElement);
- } else if (targetElement.getName().equals("configuration")) {
+ } else if (targetElement.getName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
new Configuration(this, targetElement);
}
}
@@ -186,7 +186,7 @@ public class Target extends BuildObject implements ITarget {
Node child = element.getFirstChild();
while (child != null) {
- if (child.getNodeName().equals("configuration")) {
+ if (child.getNodeName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
new Configuration(this, (Element)child);
}
child = child.getNextSibling();

Back to the top