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,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 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 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 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 diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java index f66e451b6f1..b49a689e3c9 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java @@ -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 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 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()); diff --git a/releng/org.eclipse.cdt.repo/category.xml b/releng/org.eclipse.cdt.repo/category.xml index f7112479b86..5dc66e39a90 100644 --- a/releng/org.eclipse.cdt.repo/category.xml +++ b/releng/org.eclipse.cdt.repo/category.xml @@ -89,10 +89,14 @@ - + + + + +