From 3603986d0b2c5d51171a24e3a82cc50cc766fb8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Godin?= Date: Wed, 1 Aug 2018 19:05:24 -0400 Subject: [PATCH] Bug 537118 - CMake and Meson integration now working on Windows. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The commands are launched directly instead of using the shell (/bin/sh) which is not available on Windows. Change-Id: I5f8d99a04da1c860bcd37d138103a1bd4e501547 Signed-off-by: François Godin (cherry picked from commit 0b2053dcb20968508c1e48283582579eef23eefb) --- .../cdt/cmake/ui/properties/CMakePropertyPage.java | 12 +++--------- .../cdt/meson/ui/properties/MesonPropertyPage.java | 14 ++++---------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/properties/CMakePropertyPage.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/properties/CMakePropertyPage.java index 0a8b174de7e..17f33686d68 100644 --- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/properties/CMakePropertyPage.java +++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/properties/CMakePropertyPage.java @@ -92,7 +92,7 @@ public class CMakePropertyPage extends PropertyPage { ((ICBuildCommandLauncher)launcher).setBuildConfiguration(cconfig); } IPath buildPath = project.getLocation().append("build").append(((CBuildConfiguration)cconfig).getName()); - Process p = launcher.execute(new Path("/bin/sh"), new String[] { "-c", "cmake -LAH ."}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + Process p = launcher.execute(new Path("cmake"), new String[] { "-LAH", "."}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ new String[0], buildPath, new NullProgressMonitor()); if (p != null) { ByteArrayOutputStream stdout = new ByteArrayOutputStream(); @@ -144,7 +144,6 @@ public class CMakePropertyPage extends PropertyPage { @Override public boolean performOk() { List args = new ArrayList<>(); - args.add("cmake"); //$NON-NLS-1$ args.add("-LAH"); //$NON-NLS-1$ for (ICMakePropertyPageControl control : componentList) { if (control.isValueChanged()) { @@ -164,13 +163,8 @@ public class CMakePropertyPage extends PropertyPage { if (launcher instanceof ICBuildCommandLauncher) { ((ICBuildCommandLauncher)launcher).setBuildConfiguration(buildConfig); } - StringBuilder b = new StringBuilder(); - for (String arg : args) { - b.append(arg); - b.append(" "); //$NON-NLS-1$ - } - b.append("."); - Process p = launcher.execute(new Path("/bin/sh"), new String[] { "-c", b.toString() }, new String[0], buildDir, new NullProgressMonitor()); //$NON-NLS-1$ //$NON-NLS-2$ + args.add("."); + Process p = launcher.execute(new Path("cmake"), args.toArray(new String[0]), new String[0], buildDir, new NullProgressMonitor()); //$NON-NLS-1$ int rc = -1; IConsole console = CCorePlugin.getDefault().getConsole(); console.start(project); diff --git a/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/MesonPropertyPage.java b/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/MesonPropertyPage.java index 35cc5d9e310..a7ba446c885 100644 --- a/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/MesonPropertyPage.java +++ b/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/MesonPropertyPage.java @@ -90,7 +90,7 @@ public class MesonPropertyPage extends PropertyPage { if (launcher instanceof ICBuildCommandLauncher) { ((ICBuildCommandLauncher)launcher).setBuildConfiguration(buildConfig); } - Process p = launcher.execute(new Path("/bin/sh"), new String[] { "-c", "meson configure " + buildDir}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + Process p = launcher.execute(new Path("meson"), new String[] { "configure", buildDir}, //$NON-NLS-1$ //$NON-NLS-2$ new String[0], sourceDir, new NullProgressMonitor()); if (p != null) { ByteArrayOutputStream stdout = new ByteArrayOutputStream(); @@ -114,7 +114,7 @@ public class MesonPropertyPage extends PropertyPage { if (launcher instanceof ICBuildCommandLauncher) { ((ICBuildCommandLauncher)launcher).setBuildConfiguration(buildConfig); } - Process p = launcher.execute(new Path("/bin/sh"), new String[] { "-c", "meson -h"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + Process p = launcher.execute(new Path("meson"), new String[] { "-h"}, //$NON-NLS-1$ //$NON-NLS-2$ new String[0], sourceDir, new NullProgressMonitor()); if (p == null) { return null; @@ -240,7 +240,6 @@ public class MesonPropertyPage extends PropertyPage { public boolean performOk() { List args = new ArrayList<>(); if (configured) { - args.add("meson"); //$NON-NLS-1$ args.add("configure"); //$NON-NLS-1$ for (IMesonPropertyPageControl control : componentList) { if (control.isValueChanged()) { @@ -259,13 +258,8 @@ public class MesonPropertyPage extends PropertyPage { if (launcher instanceof ICBuildCommandLauncher) { ((ICBuildCommandLauncher)launcher).setBuildConfiguration(buildConfig); } - StringBuilder b = new StringBuilder(); - for (String arg : args) { - b.append(arg); - b.append(" "); //$NON-NLS-1$ - } - b.append(buildDir); - Process p = launcher.execute(new Path("/bin/sh"), new String[] { "-c", b.toString() }, new String[0], sourceDir, new NullProgressMonitor()); //$NON-NLS-1$ //$NON-NLS-2$ + args.add(buildDir); + Process p = launcher.execute(new Path("meson"), args.toArray(new String[0]), new String[0], sourceDir, new NullProgressMonitor()); //$NON-NLS-1$ //$NON-NLS-2$ int rc = -1; IConsole console = CCorePlugin.getDefault().getConsole(); console.start(project);