1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

display an error in case of Internal Builder failure

This commit is contained in:
Mikhail Sennikovsky 2007-06-07 13:07:52 +00:00
parent 6eede83893
commit bdc308c231
5 changed files with 97 additions and 17 deletions

View file

@ -51,6 +51,7 @@ import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.cdt.managedbuilder.internal.macros.FileContextData;
@ -76,7 +77,9 @@ import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
public class BuildDescription implements IBuildDescription {
private final static String DOT = "."; //$NON-NLS-1$
@ -154,13 +157,22 @@ public class BuildDescription implements IBuildDescription {
}
public boolean visit(IResourceProxy proxy) throws CoreException {
if(proxy.getType() == IResource.FILE){
doVisitFile(proxy.requestResource());
return false;
}
return !isGenerated(proxy.requestFullPath());
try {
if(proxy.getType() == IResource.FILE){
doVisitFile(proxy.requestResource());
return false;
}
return !isGenerated(proxy.requestFullPath());
} catch (CoreException e) {
throw e;
} catch (Exception e) {
String msg = e.getLocalizedMessage();
if(msg == null)
msg = ""; //$NON-NLS-1$
throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), msg, e));
}
}
protected boolean postProcessVisit(IResourceDelta delta){

View file

@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
* IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class BuildModelMessages {
private static final String BUNDLE_NAME = "org.eclipse.cdt.managedbuilder.internal.buildmodel.BuildModelMessages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
private BuildModelMessages() {
}
public static String getString(String key) {
return getResourceString(key);
}
public static String getResourceString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
} catch (MissingResourceException e) {
return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
public static String getFormattedString(String key, String arg) {
return MessageFormat.format(getResourceString(key), new String[] { arg });
}
public static String getFormattedString(String key, String[] args) {
return MessageFormat.format(getResourceString(key), args);
}
}

View file

@ -0,0 +1,12 @@
###############################################################################
# Copyright (c) 2007 Intel Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Intel Corporation - Initial API and implementation
###############################################################################
BuildResource.0=Generated resource conflict: \ntwo resources of the same name: {0} \ngenerated by different tools \ntool1: {1} \ntool2: {2}\n

View file

@ -117,11 +117,20 @@ public class BuildResource implements IBuildResource {
fProducerArg = arg;
} else {
String err = "ProducerArgument not null!!!\n"; //$NON-NLS-1$
String rcName = DbgUtil.resourceName(this);
String step1Name = DbgUtil.stepName(fProducerArg.getStep());
String step2Name = DbgUtil.stepName(arg.getStep());
String rcs[] = new String[]{rcName, step1Name, step2Name};
String externalizedErr = BuildModelMessages.getFormattedString("BuildResource.0", rcs); //$NON-NLS-1$
if(DbgUtil.DEBUG){
err = err + "curent producer: " + DbgUtil.dumpStep(fProducerArg.getStep()) + "\n producer attempt: " + DbgUtil.dumpStep(arg.getStep()); //$NON-NLS-1$ //$NON-NLS-2$
err = err + externalizedErr + "curent producer: " + DbgUtil.dumpStep(fProducerArg.getStep()) + "\n producer attempt: " + DbgUtil.dumpStep(arg.getStep()); //$NON-NLS-1$ //$NON-NLS-2$
}
throw new IllegalArgumentException(err);
throw new IllegalArgumentException(externalizedErr);
}
}
}

View file

@ -900,12 +900,6 @@ public class CommonBuilder extends ACBuilder {
boolean buildIncrementaly = delta != null;
IBuildDescription des = BuildDescriptionManager.createBuildDescription(cfg, cBS, delta, flags);
DescriptionBuilder dBuilder = null;
if (!isParallel)
dBuilder = new DescriptionBuilder(des, buildIncrementaly, resumeOnErr, cBS);
// Get a build console for the project
StringBuffer buf = new StringBuffer();
// console = CCorePlugin.getDefault().getConsole();
@ -935,7 +929,13 @@ public class CommonBuilder extends ACBuilder {
}
consoleOutStream.write(buf.toString().getBytes());
consoleOutStream.flush();
IBuildDescription des = BuildDescriptionManager.createBuildDescription(cfg, cBS, delta, flags);
DescriptionBuilder dBuilder = null;
if (!isParallel)
dBuilder = new DescriptionBuilder(des, buildIncrementaly, resumeOnErr, cBS);
if(isParallel || dBuilder.getNumCommands() > 0) {
// Remove all markers for this project
removeAllMarkers(currentProject);
@ -1014,14 +1014,13 @@ public class CommonBuilder extends ACBuilder {
}
} catch (Exception e) {
e.printStackTrace();
if(consoleOutStream != null){
StringBuffer buf = new StringBuffer();
String errorDesc = ManagedMakeMessages
.getResourceString(BUILD_ERROR);
buf.append(errorDesc);
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
buf.append("(").append(e.getLocalizedMessage()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
buf.append(e.getLocalizedMessage());
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
try {