Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/org.eclipse.cdt.cmake.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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: 2.0.200.qualifier
Bundle-Version: 2.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.cmake.core.internal.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.34.0,4.0.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.eclipse.cdt.cmake.core.properties.CMakePropertiesFactory;
import org.eclipse.cdt.cmake.core.properties.ICMakeGenerator;
import org.eclipse.cdt.cmake.core.properties.ICMakeProperties;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CommandLauncherManager;
import org.eclipse.cdt.core.ConsoleOutputStream;
import org.eclipse.cdt.core.ErrorParserManager;
Expand Down Expand Up @@ -60,8 +61,11 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.launchbar.core.target.ILaunchTarget;
Expand Down Expand Up @@ -195,45 +199,10 @@ public IProject[] build(int kind, Map<String, String> args, IConsole console, IP
}
CommandDescriptorBuilder cmdBuilder = new CommandDescriptorBuilder(cmakeProperties);
if (runCMake) {
CMakeBuildConfiguration.deleteCMakeErrorMarkers(project);

infoStream.write(String.format(Messages.CMakeBuildConfiguration_Configuring, buildDir));
CommandDescriptor command = cmdBuilder
.makeCMakeCommandline(toolChainFile != null ? toolChainFile.getPath() : null);
// tell cmake where its script is located..
IContainer srcFolder = project;
command.getArguments().add(new File(srcFolder.getLocationURI()).getAbsolutePath());

infoStream.write(String.join(" ", command.getArguments()) + '\n'); //$NON-NLS-1$

org.eclipse.core.runtime.Path workingDir = new org.eclipse.core.runtime.Path(
getBuildDirectory().toString());
// hook in cmake error parsing
try (CMakeErrorParser errorParser = new CMakeErrorParser(new CMakeExecutionMarkerFactory(srcFolder))) {
ParsingConsoleOutputStream errStream = new ParsingConsoleOutputStream(console.getErrorStream(),
errorParser);
IConsole errConsole = new CMakeConsoleWrapper(console, errStream);
Process p = startBuildProcess(command.getArguments(), new IEnvironmentVariable[0], workingDir,
errConsole, monitor);
String arg0 = command.getArguments().get(0);
if (p == null) {
// 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;
}

// check cmake exit status
final int exitValue = watchProcess(errConsole, monitor);
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;
}
IStatus result = configureCMakeBuildFiles(cmdBuilder, console, infoStream, monitor);
Comment thread
betamaxbandit marked this conversation as resolved.
if (!result.isOK()) {
return null;
}
cmakeListsModified = false;
}

// parse compile_commands.json file
Expand Down Expand Up @@ -296,6 +265,65 @@ public IProject[] build(int kind, Map<String, String> args, IConsole console, IP
}
}

/**
* @since 2.1
*/
Comment thread
betamaxbandit marked this conversation as resolved.
protected IStatus configureCMakeBuildFiles(IProgressMonitor monitor) throws CoreException, IOException {
Comment thread
betamaxbandit marked this conversation as resolved.
Outdated
IProject project = getProject();
project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
Comment thread
betamaxbandit marked this conversation as resolved.
Outdated
// Setup console
IConsole console = CCorePlugin.getDefault().getConsole();
console.start(project);
ICMakeProperties cmakeProperties = getCMakeProperties();
CommandDescriptorBuilder cmdBuilder = new CommandDescriptorBuilder(cmakeProperties);
return configureCMakeBuildFiles(cmdBuilder, console, console.getInfoStream(), monitor);
}

private IStatus configureCMakeBuildFiles(CommandDescriptorBuilder cmdBuilder, IConsole console,
ConsoleOutputStream infoStream, IProgressMonitor monitor) throws CoreException, IOException {
SubMonitor subMonitor = SubMonitor.convert(monitor, 4);
CMakeBuildConfiguration.deleteCMakeErrorMarkers(getProject());
infoStream.write(String.format(Messages.CMakeBuildConfiguration_Configuring, getBuildDirectory()));
CommandDescriptor command = cmdBuilder
.makeCMakeCommandline(toolChainFile != null ? toolChainFile.getPath() : null);
// tell cmake where its script is located..
IContainer srcFolder = getProject();
command.getArguments().add(new File(srcFolder.getLocationURI()).getAbsolutePath());

infoStream.write(String.join(" ", command.getArguments()) + '\n'); //$NON-NLS-1$

org.eclipse.core.runtime.Path workingDir = new org.eclipse.core.runtime.Path(getBuildDirectory().toString());
// hook in cmake error parsing
try (CMakeErrorParser errorParser = new CMakeErrorParser(new CMakeExecutionMarkerFactory(srcFolder))) {
ParsingConsoleOutputStream errStream = new ParsingConsoleOutputStream(console.getErrorStream(),
errorParser);
IConsole errConsole = new CMakeConsoleWrapper(console, errStream);
Process p = startBuildProcess(command.getArguments(), new IEnvironmentVariable[0], workingDir, errConsole,
subMonitor.split(1));
String arg0 = command.getArguments().get(0);
if (p == null) {
// process start failed
String msg = String.format(Messages.CMakeBuildConfiguration_Failure, ""); //$NON-NLS-1$
Comment thread
betamaxbandit marked this conversation as resolved.
Outdated
addMarker(new ProblemMarkerInfo(srcFolder.getProject(), -1, msg, IMarkerGenerator.SEVERITY_ERROR_BUILD,
null, new org.eclipse.core.runtime.Path(arg0)));
return Status.error(msg);
}
// check cmake exit status
final int exitValue = watchProcess(errConsole, subMonitor.split(1));
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 Status.error(msg);
}
}
cmakeListsModified = false;
// parse compile_commands.json file
getCompileCommandsFile().refreshLocal(IResource.DEPTH_ZERO, subMonitor.split(1));
processCompileCommandsFile(console, subMonitor.split(1));
return Status.OK_STATUS;
}

@Override
public void clean(IConsole console, IProgressMonitor monitor) throws CoreException {
IProject project = getProject();
Expand Down