From 53b177d9e7b5e19ce74b65313fc8fc2e8f6c2eeb Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 1 Sep 2020 13:35:46 -0700 Subject: [PATCH] Update how West is invoked Zephyr has changed how West is being invoked, and now West can be invoked by running Python directly instead of the west executable. This needs some tweaking on how West is invoked in the plugin. Signed-off-by: Daniel Leung --- .../launch/java11/ZephyrLaunchHelpers.java | 11 ++++++- .../launch/linux/ZephyrLaunchHelpers.java | 11 ++++++- .../launch/macosx/ZephyrLaunchHelpers.java | 11 ++++++- .../core/internal/build/CMakeCache.java | 29 +++++++++++++++++-- 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/plugins/org.zephyrproject.ide.eclipse.core.java11/src/org/zephyrproject/ide/eclipse/core/internal/launch/java11/ZephyrLaunchHelpers.java b/plugins/org.zephyrproject.ide.eclipse.core.java11/src/org/zephyrproject/ide/eclipse/core/internal/launch/java11/ZephyrLaunchHelpers.java index e4f7458..f19096c 100644 --- a/plugins/org.zephyrproject.ide.eclipse.core.java11/src/org/zephyrproject/ide/eclipse/core/internal/launch/java11/ZephyrLaunchHelpers.java +++ b/plugins/org.zephyrproject.ide.eclipse.core.java11/src/org/zephyrproject/ide/eclipse/core/internal/launch/java11/ZephyrLaunchHelpers.java @@ -106,7 +106,16 @@ public Process runWest(IProject project, } ArrayList cmds = new ArrayList(); - cmds.add(westPath); + + if (westPath.indexOf(';') == -1) { + cmds.add(westPath); + } else { + String[] westPathBits = westPath.split(";"); + for (String s : westPathBits) { + cmds.add(s); + } + } + cmds.add(action); if (args != null) { cmds.addAll(ZephyrHelpers.parseWestArguments(args)); diff --git a/plugins/org.zephyrproject.ide.eclipse.core.linux/src/org/zephyrproject/ide/eclipse/core/internal/launch/linux/ZephyrLaunchHelpers.java b/plugins/org.zephyrproject.ide.eclipse.core.linux/src/org/zephyrproject/ide/eclipse/core/internal/launch/linux/ZephyrLaunchHelpers.java index 167c655..11605ab 100644 --- a/plugins/org.zephyrproject.ide.eclipse.core.linux/src/org/zephyrproject/ide/eclipse/core/internal/launch/linux/ZephyrLaunchHelpers.java +++ b/plugins/org.zephyrproject.ide.eclipse.core.linux/src/org/zephyrproject/ide/eclipse/core/internal/launch/linux/ZephyrLaunchHelpers.java @@ -98,7 +98,16 @@ public Process runWest(IProject project, } ArrayList cmds = new ArrayList(); - cmds.add(westPath); + + if (westPath.indexOf(';') == -1) { + cmds.add(westPath); + } else { + String[] westPathBits = westPath.split(";"); + for (String s : westPathBits) { + cmds.add(s); + } + } + cmds.add(action); if (args != null) { cmds.add(args); diff --git a/plugins/org.zephyrproject.ide.eclipse.core.macosx/src/org/zephyrproject/ide/eclipse/core/internal/launch/macosx/ZephyrLaunchHelpers.java b/plugins/org.zephyrproject.ide.eclipse.core.macosx/src/org/zephyrproject/ide/eclipse/core/internal/launch/macosx/ZephyrLaunchHelpers.java index d815c2d..3f99648 100644 --- a/plugins/org.zephyrproject.ide.eclipse.core.macosx/src/org/zephyrproject/ide/eclipse/core/internal/launch/macosx/ZephyrLaunchHelpers.java +++ b/plugins/org.zephyrproject.ide.eclipse.core.macosx/src/org/zephyrproject/ide/eclipse/core/internal/launch/macosx/ZephyrLaunchHelpers.java @@ -98,7 +98,16 @@ public Process runWest(IProject project, } ArrayList cmds = new ArrayList(); - cmds.add(westPath); + + if (westPath.indexOf(';') == -1) { + cmds.add(westPath); + } else { + String[] westPathBits = westPath.split(";"); + for (String s : westPathBits) { + cmds.add(s); + } + } + cmds.add(action); if (args != null) { cmds.add(args); diff --git a/plugins/org.zephyrproject.ide.eclipse.core/src/org/zephyrproject/ide/eclipse/core/internal/build/CMakeCache.java b/plugins/org.zephyrproject.ide.eclipse.core/src/org/zephyrproject/ide/eclipse/core/internal/build/CMakeCache.java index 59d9226..a68b638 100644 --- a/plugins/org.zephyrproject.ide.eclipse.core/src/org/zephyrproject/ide/eclipse/core/internal/build/CMakeCache.java +++ b/plugins/org.zephyrproject.ide.eclipse.core/src/org/zephyrproject/ide/eclipse/core/internal/build/CMakeCache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Intel Corporation + * Copyright (c) 2019-2020 Intel Corporation * * SPDX-License-Identifier: EPL-2.0 */ @@ -83,7 +83,22 @@ public String getString(String name) { * not of type FILEPATH */ public String getFilePath(String name) { - return getTypedValue("FILEPATH=", name); //$NON-NLS-1$ + String val = getTypedValue("FILEPATH=", name); //$NON-NLS-1$ + + if ((val != null) && (val.indexOf("-NOTFOUND") != -1)) { + return null; + } + + return val; + } + + /** + * @param name Name of cached variable with type INTERNAL + * @return The INTERNAL value or {@code null} if variable does not exist or + * not of type INTERNAL + */ + public String getInternal(String name) { + return getTypedValue("INTERNAL=", name); //$NON-NLS-1$ } /** @@ -118,7 +133,15 @@ public String getGdb() { * @return Path to West as discovered by CMake */ public String getWest() { - return getFilePath(WEST); + /* WEST can appear as FILEPATH or INTERNAL. */ + + String val = getFilePath(WEST); + + if (val == null) { + val = getInternal(WEST); + } + + return val; } /**