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 | |
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
3 files changed, 69 insertions, 38 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) { 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<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()); + Path buildDir = getBuildDirectory(); - ProcessBuilder processBuilder = new ProcessBuilder(command).directory(getBuildDirectory().toFile()); - setBuildEnvironment(processBuilder.environment()); - Process process = processBuilder.start(); + if (!buildDir.resolve("Makefile").toFile().exists()) { //$NON-NLS-1$ + // Need to run qmake + List<String> command = new ArrayList<>(); + command.add(getQmakeCommand().toString()); - StringBuffer msg = new StringBuffer(); - for (String arg : command) { - msg.append(arg).append(' '); + String[] config = getQmakeConfig(); + if (config != null) { + for (String str : config) { + command.add(str); } - msg.append('\n'); - outStream.write(msg.toString()); + } + + IFile projectFile = project.getFile(project.getName() + ".pro"); //$NON-NLS-1$ + command.add(projectFile.getLocation().toOSString()); - // TODO qmake error parser - watchProcess(process, new IConsoleParser[0], console); + 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,11 +89,15 @@ <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"/> <iu id="org.eclipse.tools.templates.core" version="0.0.0"/> |