Skip to main content
summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorJames Blackburn2010-06-01 09:48:09 -0400
committerJames Blackburn2010-06-01 09:48:09 -0400
commite09733c7548975de21cc84959db64be548015810 (patch)
tree2cec85ac80434daf4cac868238bafef1656a039e /build
parent587eb8061f811d2841c70814fcd756408f1d769a (diff)
downloadorg.eclipse.cdt-e09733c7548975de21cc84959db64be548015810.tar.gz
org.eclipse.cdt-e09733c7548975de21cc84959db64be548015810.tar.xz
org.eclipse.cdt-e09733c7548975de21cc84959db64be548015810.zip
Bug 315187 Unknown tool option silently breaks ManagedBuild tool command line generation
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java2
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java9
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties1
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java19
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/macros/BuildMacroProvider.java6
5 files changed, 23 insertions, 14 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
index ed2fdbb776..d8baa7c6af 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
@@ -211,7 +211,7 @@ public class ManagedBuilderCorePlugin extends Plugin {
e = ((InvocationTargetException) e).getTargetException();
IStatus status = null;
if (e instanceof CoreException)
- status = ((CoreException) e).getStatus();
+ status = new Status(((CoreException) e).getStatus().getSeverity(), getUniqueIdentifier(), e.getMessage(), e);
else
status = new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.OK, e.getMessage(), e);
log(status);
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
index 5b5a35a640..c6945ac5bc 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
@@ -168,9 +168,10 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
public Option(IHoldsOptions parent, String Id, String name, Option option){
this.holder = parent;
superClass = option.superClass;
- if (superClass != null) {
+ if (superClass != null)
superClassId = option.superClass.getId();
- }
+ else if (option.superClassId != null)
+ superClassId = option.superClassId;
setId(Id);
setName(name);
isExtensionOption = false;
@@ -708,7 +709,9 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
public void serialize(ICStorageElement element) throws BuildException {
if (superClass != null)
element.setAttribute(IProjectType.SUPERCLASS, superClass.getId());
-
+ else if (superClassId != null)
+ element.setAttribute(IProjectType.SUPERCLASS, superClassId);
+
element.setAttribute(IBuildObject.ID, id);
if (name != null) {
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
index cb4ff40b0b..cbc7764b07 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
@@ -100,6 +100,7 @@ GnuMakefileGenerator.message.postproc.dep.file=Verifying contents of dependency
# Tool strings
Tool.default.announcement=Invoking:
+Tool_Problem_Discovering_Args_For_Option=Problem discovering arguments for Tool option: {0} ({1})
#Environment loader messages
StorableEnvironmentLoader.storeOutputStream.wrong.arguments=Wrong arguments
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
index 65ba73dd57..1ea82abf00 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
@@ -12,6 +12,7 @@ package org.eclipse.cdt.managedbuilder.internal.core;
import java.net.MalformedURLException;
import java.net.URL;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -75,9 +76,11 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PluginVersionIdentifier;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.content.IContentTypeSettings;
import org.eclipse.core.runtime.preferences.IScopeContext;
@@ -2502,16 +2505,14 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
* @param outputFileLocation
* @param macroSubstitutor
* @return the command flags with the build macros resolved
- * @throws BuildException
*/
public String[] getToolCommandFlags(IPath inputFileLocation, IPath outputFileLocation,
SupplierBasedCdtVariableSubstitutor macroSubstitutor,
- IMacroContextInfoProvider provider) throws BuildException {
+ IMacroContextInfoProvider provider) {
IOption[] opts = getOptions();
ArrayList<String> flags = new ArrayList<String>();
StringBuilder sb = new StringBuilder();
- for (IOption op : opts) {
- IOption option = op;
+ for (IOption option : opts) {
if (option == null)
continue;
sb.setLength( 0 );
@@ -2626,8 +2627,16 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
if (sb.toString().trim().length() > 0)
flags.add(sb.toString().trim());
+
+ } catch (BuildException e) {
+ // Bug 315187 one broken option shouldn't cascade to all other options breaking the build...
+ Status s = new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), MessageFormat.format(ManagedMakeMessages.getString("Tool_Problem_Discovering_Args_For_Option"), option, //$NON-NLS-1$
+ option.getId()), e);
+ ManagedBuilderCorePlugin.log(new CoreException(s));
} catch (CdtVariableException e) {
-
+ Status s = new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), MessageFormat.format(ManagedMakeMessages.getString("Tool_Problem_Discovering_Args_For_Option"), option, //$NON-NLS-1$
+ option.getId()), e);
+ ManagedBuilderCorePlugin.log(new CoreException(s));
}
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/macros/BuildMacroProvider.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/macros/BuildMacroProvider.java
index 20b3eba1c1..7b7b92906b 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/macros/BuildMacroProvider.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/macros/BuildMacroProvider.java
@@ -18,7 +18,6 @@ import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
@@ -473,10 +472,7 @@ public class BuildMacroProvider implements IBuildMacroProvider, IMacroContextInf
if(tool instanceof Tool){
Tool t = (Tool)tool;
ExplicitFileMacroCollector collector = new ExplicitFileMacroCollector(null);
- try {
- t.getToolCommandFlags(null,null,collector, getDefault());
- } catch (BuildException e){
- }
+ t.getToolCommandFlags(null,null,collector, getDefault());
return collector.getExplicisFileMacros();
}
return new IBuildMacro[0];

Back to the top