Skip to content

Commit

Permalink
Update how West is invoked
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dcpleung authored and nashif committed Sep 16, 2020
1 parent 019e726 commit 53b177d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,16 @@ public Process runWest(IProject project,
}

ArrayList<String> cmds = new ArrayList<String>();
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,16 @@ public Process runWest(IProject project,
}

ArrayList<String> cmds = new ArrayList<String>();
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,16 @@ public Process runWest(IProject project,
}

ArrayList<String> cmds = new ArrayList<String>();
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);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 Intel Corporation
* Copyright (c) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: EPL-2.0
*/
Expand Down Expand Up @@ -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$
}

/**
Expand Down Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 53b177d

Please sign in to comment.