diff options
author | Doug Schaefer | 2016-08-17 18:34:02 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-08-17 19:30:45 +0000 |
commit | 4afa9e24da257ab3ebbda71e1b8c1604991901eb (patch) | |
tree | 1bad1e4e8e4c149660eb694e8e34561093333a1d /build/org.eclipse.cdt.cmake.core | |
parent | cf0271a5edd706218978c49fa29a3473992424d7 (diff) | |
download | org.eclipse.cdt-4afa9e24da257ab3ebbda71e1b8c1604991901eb.tar.gz org.eclipse.cdt-4afa9e24da257ab3ebbda71e1b8c1604991901eb.tar.xz org.eclipse.cdt-4afa9e24da257ab3ebbda71e1b8c1604991901eb.zip |
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
Diffstat (limited to 'build/org.eclipse.cdt.cmake.core')
-rw-r--r-- | build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java index 755d19ad6fe..826c7521751 100644 --- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java +++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java @@ -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,28 +61,53 @@ public class CMakeBuildConfiguration extends CBuildConfiguration { 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 }; + } catch (IOException e) { + throw new CoreException(Activator.errorStatus(String.format("Building %s", project.getName()), e)); + } + } + + @Override + public void clean(IConsole console, IProgressMonitor monitor) throws CoreException { + 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"); //$NON-NLS-1$ + 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); - return new IProject[] { project }; } catch (IOException e) { - throw new CoreException(Activator.errorStatus(String.format("Building %s", project.getName()), e)); + throw new CoreException(Activator.errorStatus(String.format("Cleaning %s", project.getName()), e)); } } - - @Override - public void clean(IConsole console, IProgressMonitor monitor) throws CoreException { - // TODO Auto-generated method stub - - } @Override public IScannerInfo getScannerInformation(IResource resource) { |