mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
bug 308042: Spawner messages are too cryptic to be useful to a user
This commit is contained in:
parent
178f37860c
commit
570df24c33
2 changed files with 40 additions and 7 deletions
|
@ -200,14 +200,15 @@ public class ExternalBuildRunner implements IBuildRunner {
|
||||||
// Launching failed, trying to figure out possible cause
|
// Launching failed, trying to figure out possible cause
|
||||||
String errorPrefix = ManagedMakeMessages.getResourceString("ManagedMakeBuilder.error.prefix"); //$NON-NLS-1$
|
String errorPrefix = ManagedMakeMessages.getResourceString("ManagedMakeBuilder.error.prefix"); //$NON-NLS-1$
|
||||||
String buildCommandStr = buildCommand.toString();
|
String buildCommandStr = buildCommand.toString();
|
||||||
if (PathUtil.findProgramLocation(buildCommandStr)==null) {
|
String envPath = envMap.get(PATH);
|
||||||
|
if (envPath==null) {
|
||||||
|
envPath = System.getenv(PATH);
|
||||||
|
}
|
||||||
|
if (PathUtil.findProgramLocation(buildCommandStr, envPath)==null) {
|
||||||
buf.append(errMsg).append(NEWLINE);
|
buf.append(errMsg).append(NEWLINE);
|
||||||
errMsg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.program.not.in.path", buildCommandStr); //$NON-NLS-1$
|
errMsg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.program.not.in.path", buildCommandStr); //$NON-NLS-1$
|
||||||
buf.append(errorPrefix).append(errMsg).append(NEWLINE);
|
buf.append(errorPrefix).append(errMsg).append(NEWLINE);
|
||||||
buf.append(NEWLINE);
|
buf.append(NEWLINE);
|
||||||
String envPath = envMap.get(PATH);
|
|
||||||
if (envPath==null)
|
|
||||||
envPath = System.getenv(PATH);
|
|
||||||
buf.append(PATH+"=["+envPath+"]").append(NEWLINE); //$NON-NLS-1$//$NON-NLS-2$
|
buf.append(PATH+"=["+envPath+"]").append(NEWLINE); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
} else {
|
} else {
|
||||||
buf.append(errorPrefix).append(errMsg).append(NEWLINE);
|
buf.append(errorPrefix).append(errMsg).append(NEWLINE);
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.core.CommandLauncher;
|
||||||
import org.eclipse.cdt.core.ICommandLauncher;
|
import org.eclipse.cdt.core.ICommandLauncher;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildCommand;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildCommand;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
|
||||||
|
import org.eclipse.cdt.utils.PathUtil;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
@ -210,7 +211,19 @@ public class CommandBuilder implements IBuildModelBuilder {
|
||||||
if(DbgUtil.DEBUG)
|
if(DbgUtil.DEBUG)
|
||||||
DbgUtil.trace("error launching the command: " + fErrMsg); //$NON-NLS-1$
|
DbgUtil.trace("error launching the command: " + fErrMsg); //$NON-NLS-1$
|
||||||
|
|
||||||
|
String program = fCmd.getCommand().toOSString();
|
||||||
|
String envPath = fCmd.getEnvironment().get(PATH_ENV);
|
||||||
|
if (envPath==null) {
|
||||||
|
envPath = System.getenv(PATH_ENV);
|
||||||
|
}
|
||||||
|
if (PathUtil.findProgramLocation(program, envPath)==null) {
|
||||||
printMessage(fErrMsg, out);
|
printMessage(fErrMsg, out);
|
||||||
|
String errMsg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.program.not.in.path", program); //$NON-NLS-1$
|
||||||
|
printErrorMessage(errMsg + LINE_SEPARATOR, out);
|
||||||
|
printMessage(null, PATH_ENV+"=["+envPath+"]", out); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
|
} else {
|
||||||
|
printErrorMessage(fErrMsg, out);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,9 +255,12 @@ public class CommandBuilder implements IBuildModelBuilder {
|
||||||
return list.toArray(new String[list.size()]);
|
return list.toArray(new String[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void printMessage(String msg, OutputStream os){
|
private void printMessage(String prefix, String msg, OutputStream os){
|
||||||
if (os != null) {
|
if (os != null) {
|
||||||
msg = ManagedMakeMessages.getFormattedString(BUILDER_MSG_HEADER, msg) + LINE_SEPARATOR;
|
if (prefix==null) {
|
||||||
|
prefix=""; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
msg = prefix + msg + LINE_SEPARATOR;
|
||||||
try {
|
try {
|
||||||
os.write(msg.getBytes());
|
os.write(msg.getBytes());
|
||||||
os.flush();
|
os.flush();
|
||||||
|
@ -255,6 +271,22 @@ public class CommandBuilder implements IBuildModelBuilder {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void printMessage(String msg, OutputStream os){
|
||||||
|
if (os != null) {
|
||||||
|
msg = ManagedMakeMessages.getFormattedString(BUILDER_MSG_HEADER, msg);
|
||||||
|
printMessage(null, msg, os);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printErrorMessage(String msg, OutputStream os){
|
||||||
|
if (os != null) {
|
||||||
|
String errorPrefix = ManagedMakeMessages.getResourceString("ManagedMakeBuilder.error.prefix"); //$NON-NLS-1$
|
||||||
|
printMessage(errorPrefix, msg, os);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public int getNumCommands() {
|
public int getNumCommands() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue