1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

CMake updates. Clean, error parsers, add to category.xml.

Make CMake public with the change to category.xml. It's getting close
to being usable in 9.1.

Change-Id: If3e80aa5d5314cb42bbf0d253157d7ecb7d13046
This commit is contained in:
Doug Schaefer 2016-08-17 14:34:02 -04:00 committed by Gerrit Code Review @ Eclipse.org
parent cf0271a5ed
commit 4afa9e24da
3 changed files with 72 additions and 41 deletions

View file

@ -16,6 +16,7 @@ import java.util.List;
import java.util.Map;
import org.eclipse.cdt.core.ConsoleOutputStream;
import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.core.IConsoleParser;
import org.eclipse.cdt.core.build.CBuildConfiguration;
import org.eclipse.cdt.core.build.IToolChain;
@ -60,15 +61,15 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
watchProcess(process, new IConsoleParser[0], console);
}
// TODO need to figure out which builder to call. Hardcoding to make
// for now.
List<String> command = Arrays.asList("make"); //$NON-NLS-1$
ProcessBuilder processBuilder = new ProcessBuilder(command).directory(buildDir.toFile());
Process process = processBuilder.start();
outStream.write(String.join(" ", command) + '\n'); //$NON-NLS-1$
// TODO error parsers
watchProcess(process, new IConsoleParser[0], console);
try (ErrorParserManager epm = new ErrorParserManager(project, getBuildDirectoryURI(), this,
getToolChain().getErrorParserIds())) {
// TODO need to figure out which builder to call. Hardcoding to make for now.
List<String> command = Arrays.asList("make"); //$NON-NLS-1$
ProcessBuilder processBuilder = new ProcessBuilder(command).directory(buildDir.toFile());
Process process = processBuilder.start();
outStream.write(String.join(" ", command) + '\n'); //$NON-NLS-1$
watchProcess(process, new IConsoleParser[] { epm }, console);
}
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
return new IProject[] { project };
@ -79,8 +80,33 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
@Override
public void clean(IConsole console, IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
IProject project = getProject();
try {
project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
ConsoleOutputStream outStream = console.getOutputStream();
Path buildDir = getBuildDirectory();
if (!Files.exists(buildDir.resolve("Makefile"))) { //$NON-NLS-1$
outStream.write("Makefile not found. Assuming clean");
return;
}
// TODO need to figure out which builder to call. Hardcoding to make
// for now.
List<String> command = Arrays.asList("make", "clean"); //$NON-NLS-1$
ProcessBuilder processBuilder = new ProcessBuilder(command).directory(buildDir.toFile());
Process process = processBuilder.start();
outStream.write(String.join(" ", command) + '\n'); //$NON-NLS-1$
// TODO error parsers
watchProcess(process, new IConsoleParser[0], console);
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
} catch (IOException e) {
throw new CoreException(Activator.errorStatus(String.format("Cleaning %s", project.getName()), e));
}
}
@Override

View file

@ -274,39 +274,40 @@ public class QtBuildConfiguration extends CBuildConfiguration implements ICBuild
return null;
}
try (ErrorParserManager epm = new ErrorParserManager(project, getBuildDirectoryURI(), this,
getToolChain().getErrorParserIds())) {
Path buildDir = getBuildDirectory();
if (!buildDir.resolve("Makefile").toFile().exists()) { //$NON-NLS-1$
// Need to run qmake
List<String> command = new ArrayList<>();
command.add(getQmakeCommand().toString());
Path buildDir = getBuildDirectory();
String[] config = getQmakeConfig();
if (config != null) {
for (String str : config) {
command.add(str);
}
if (!buildDir.resolve("Makefile").toFile().exists()) { //$NON-NLS-1$
// Need to run qmake
List<String> command = new ArrayList<>();
command.add(getQmakeCommand().toString());
String[] config = getQmakeConfig();
if (config != null) {
for (String str : config) {
command.add(str);
}
IFile projectFile = project.getFile(project.getName() + ".pro"); //$NON-NLS-1$
command.add(projectFile.getLocation().toOSString());
ProcessBuilder processBuilder = new ProcessBuilder(command).directory(getBuildDirectory().toFile());
setBuildEnvironment(processBuilder.environment());
Process process = processBuilder.start();
StringBuffer msg = new StringBuffer();
for (String arg : command) {
msg.append(arg).append(' ');
}
msg.append('\n');
outStream.write(msg.toString());
// TODO qmake error parser
watchProcess(process, new IConsoleParser[0], console);
}
IFile projectFile = project.getFile(project.getName() + ".pro"); //$NON-NLS-1$
command.add(projectFile.getLocation().toOSString());
ProcessBuilder processBuilder = new ProcessBuilder(command).directory(getBuildDirectory().toFile());
setBuildEnvironment(processBuilder.environment());
Process process = processBuilder.start();
StringBuffer msg = new StringBuffer();
for (String arg : command) {
msg.append(arg).append(' ');
}
msg.append('\n');
outStream.write(msg.toString());
// TODO qmake error parser
watchProcess(process, new IConsoleParser[0], console);
}
try (ErrorParserManager epm = new ErrorParserManager(project, getBuildDirectoryURI(), this,
getToolChain().getErrorParserIds())) {
// run make
ProcessBuilder processBuilder = new ProcessBuilder(makeCommand.toString(), "all").directory(buildDir.toFile());
setBuildEnvironment(processBuilder.environment());

View file

@ -89,10 +89,14 @@
<feature url="features/org.eclipse.cdt.debug.standalone_0.0.0.qualifier.jar" id="org.eclipse.cdt.debug.standalone" version="0.0.0">
<category name="extra"/>
</feature>
<feature url="features/org.eclipse.cdt.debug.standalone.source_0.0.0.qualifier.jar" id="org.eclipse.cdt.debug.standalone.source" version="0.0.0">
<category name="extra"/>
<feature url="features/org.eclipse.cdt.debug.standalone.source_0.0.0.qualifier.jar" id="org.eclipse.cdt.debug.standalone.source" version="0.0.0">
</feature>
<category name="extra"/>
<feature id="org.eclipse.cdt.arduino">
</feature>
<category name="extra"/>
<feature id="org.eclipse.cdt.cmake">
</feature>
<iu id="com.google.gson" version="0.0.0"/>
<iu id="org.freemarker" version="0.0.0"/>