mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +02:00
show markers in problem view instead of printing to build console
Change-Id: Ic487adc11153fac206183a3ceb943d05c6d36066 Signed-off-by: Martin Weber <fifteenknots505@gmail.com>
This commit is contained in:
parent
0748cd24c6
commit
f9ce4f03e3
5 changed files with 41 additions and 7 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.cdt.cmake.core;singleton:=true
|
||||
Bundle-Version: 1.4.100.qualifier
|
||||
Bundle-Version: 1.4.200.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.cmake.core.internal.Activator
|
||||
Bundle-Vendor: %providerName
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
|
|
|
@ -38,6 +38,8 @@ import org.eclipse.cdt.core.CommandLauncherManager;
|
|||
import org.eclipse.cdt.core.ConsoleOutputStream;
|
||||
import org.eclipse.cdt.core.ErrorParserManager;
|
||||
import org.eclipse.cdt.core.IConsoleParser;
|
||||
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||
import org.eclipse.cdt.core.ProblemMarkerInfo;
|
||||
import org.eclipse.cdt.core.build.CBuildConfiguration;
|
||||
import org.eclipse.cdt.core.build.IToolChain;
|
||||
import org.eclipse.cdt.core.envvar.EnvironmentVariable;
|
||||
|
@ -178,12 +180,23 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
|||
// in order to run builds in a container.
|
||||
Process p = startBuildProcess(command.getArguments(), new IEnvironmentVariable[0], workingDir,
|
||||
errConsole, monitor);
|
||||
String arg0 = command.getArguments().get(0);
|
||||
if (p == null) {
|
||||
console.getErrorStream().write(String.format(Messages.CMakeBuildConfiguration_Failure, "")); //$NON-NLS-1$
|
||||
// process start failed
|
||||
String msg = String.format(Messages.CMakeBuildConfiguration_Failure, ""); //$NON-NLS-1$
|
||||
addMarker(new ProblemMarkerInfo(srcFolder.getProject(), -1, msg,
|
||||
IMarkerGenerator.SEVERITY_ERROR_BUILD, null, new org.eclipse.core.runtime.Path(arg0)));
|
||||
return null;
|
||||
}
|
||||
|
||||
watchProcess(p, errConsole);
|
||||
// check cmake exit status
|
||||
final int exitValue = watchProcess(p, errConsole);
|
||||
if (exitValue != 0) {
|
||||
// cmake had errors...
|
||||
String msg = String.format(Messages.CMakeBuildConfiguration_ExitFailure, arg0, exitValue);
|
||||
addMarker(srcFolder.getProject(), -1, msg, IMarkerGenerator.SEVERITY_ERROR_BUILD, null);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
cmakeListsModified = false;
|
||||
}
|
||||
|
@ -227,7 +240,14 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
|||
return null;
|
||||
}
|
||||
|
||||
watchProcess(p, new IConsoleParser[] { epm });
|
||||
// check exit status
|
||||
final int exitValue = watchProcess(p, new IConsoleParser[] { epm });
|
||||
if (exitValue != 0) {
|
||||
// had errors...
|
||||
String msg2 = String.format(Messages.CMakeBuildConfiguration_ExitFailure, command.get(0),
|
||||
exitValue);
|
||||
addMarker(project, -1, msg2, IMarkerGenerator.SEVERITY_ERROR_BUILD, null);
|
||||
}
|
||||
|
||||
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||
|
||||
|
@ -271,11 +291,21 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
|||
Process p = startBuildProcess(command.getArguments(), new IEnvironmentVariable[0], workingDir, console,
|
||||
monitor);
|
||||
if (p == null) {
|
||||
console.getErrorStream().write(String.format(Messages.CMakeBuildConfiguration_Failure, "")); //$NON-NLS-1$
|
||||
// process start failed
|
||||
String msg = String.format(Messages.CMakeBuildConfiguration_Failure, ""); //$NON-NLS-1$
|
||||
addMarker(new ProblemMarkerInfo(project, -1, msg, IMarkerGenerator.SEVERITY_ERROR_BUILD, null,
|
||||
new org.eclipse.core.runtime.Path(command.getArguments().get(0))));
|
||||
return;
|
||||
}
|
||||
|
||||
watchProcess(p, console);
|
||||
// check exit status
|
||||
final int exitValue = watchProcess(p, console);
|
||||
if (exitValue != 0) {
|
||||
// had errors...
|
||||
String msg = String.format(Messages.CMakeBuildConfiguration_ExitFailure, command.getArguments().get(0),
|
||||
exitValue);
|
||||
addMarker(project, -1, msg, IMarkerGenerator.SEVERITY_ERROR_BUILD, null);
|
||||
}
|
||||
|
||||
outStream.write(Messages.CMakeBuildConfiguration_BuildComplete);
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ class CommandDescriptorBuilder {
|
|||
}
|
||||
|
||||
/**
|
||||
* Command-lin arguments and additional environment variables to be used to run a process.
|
||||
* Command-line arguments and additional environment variables to be used to run a process.
|
||||
* @author Martin Weber
|
||||
*/
|
||||
static final class CommandDescriptor {
|
||||
|
@ -185,6 +185,8 @@ class CommandDescriptorBuilder {
|
|||
|
||||
/**
|
||||
* Gets the command-line arguments for the process.
|
||||
*
|
||||
* @return a non-empty list containing at least the name of the command to invoke.
|
||||
*/
|
||||
public List<String> getArguments() {
|
||||
return arguments;
|
||||
|
|
|
@ -20,6 +20,7 @@ public class Messages extends NLS {
|
|||
public static String CMakeBuildConfiguration_BuildComplete;
|
||||
public static String CMakeBuildConfiguration_Cleaning;
|
||||
public static String CMakeBuildConfiguration_Configuring;
|
||||
public static String CMakeBuildConfiguration_ExitFailure;
|
||||
public static String CMakeBuildConfiguration_NotFound;
|
||||
public static String CMakeBuildConfiguration_ProcCompCmds;
|
||||
public static String CMakeBuildConfiguration_ProcCompJson;
|
||||
|
|
|
@ -14,6 +14,7 @@ CMakeBuildConfiguration_BuildingComplete=Build complete (%d errors, %d warnings)
|
|||
CMakeBuildConfiguration_BuildComplete=Build complete\n
|
||||
CMakeBuildConfiguration_Configuring=Configuring in: %s\n
|
||||
CMakeBuildConfiguration_Cleaning=Cleaning %s
|
||||
CMakeBuildConfiguration_ExitFailure=%1$s exited with status %2$d. See CDT build console for details.
|
||||
CMakeBuildConfiguration_NotFound=CMakeFiles not found. Assuming clean.
|
||||
CMakeBuildConfiguration_ProcCompCmds=Processing compile commands %s
|
||||
CMakeBuildConfiguration_ProcCompJson=Processing compile_commands.json
|
||||
|
|
Loading…
Add table
Reference in a new issue