[eclipse-yocto] [PATCH 1/2] o.y.cmake.managedbuilder: resolve absolute path to cmake executable

Tim Orling ticotimo at gmail.com
Thu Aug 9 07:49:26 PDT 2018


merged to oxygen-master and oxygen-sumo. Thank you.

On Fri, May 18, 2018 at 1:07 AM Chin Huat Ang <chin.huat.ang at intel.com>
wrote:

> The cmake project appears to always use host cmake unless an absolute
> path to the executable in SDK or build directory is specified in project
> settings, this is likely caused by a misunderstanding in how the Java
> ProcessBuilder works, where setting the PATH environment variable to
> include path to SDK or build directory would not help to resolve the
> location of the cmake executable.
>
> With this fix, the cmake process would be executed using absolute path
> resolved from the latest value PATH environment variable, and in the
> event that SDK or build directory paths are not set, this would fallback
> to use the original PATH value to resolve host cmake.
>
> Signed-off-by: Chin Huat Ang <chin.huat.ang at intel.com>
> ---
>  .../yocto/cmake/managedbuilder/util/SystemProcess.java    | 15
> +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git
> a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java
> b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java
> index 9fe0ce1..65c7847 100644
> ---
> a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java
> +++
> b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java
> @@ -17,6 +17,9 @@ import java.io.OutputStream;
>  import java.util.LinkedList;
>  import java.util.Map;
>
> +import org.eclipse.cdt.utils.PathUtil;
> +import org.eclipse.core.runtime.IPath;
> +
>  public class SystemProcess {
>
>         private LinkedList<String> command = new LinkedList<String>();
> @@ -37,6 +40,18 @@ public class SystemProcess {
>         public SystemProcess(LinkedList<String> command, File directory,
> Map<String, String> additionalEnvironmentVariables) {
>                 super();
>                 this.command = command;
> +
> +               // ProcessBuilder does not use the new PATH environment
> value for resolving
> +               // the executable's path, so here we need to manually
> resolve the absolute
> +               // path to executable.
> +               if
> (additionalEnvironmentVariables.keySet().contains("PATH")) {
> +                       String executable = this.command.get(0);
> +                       IPath programLocation =
> PathUtil.findProgramLocation(executable,
> additionalEnvironmentVariables.get("PATH"));
> +                       if (programLocation != null) {
> +                               this.command.set(0,
> programLocation.toOSString());
> +                       }
> +               }
> +
>                 if (directory != null) {
>                         this.workingDirectory = directory;
>                 }
> --
> 2.7.4
>
> _______________________________________________
> eclipse-yocto mailing list
> eclipse-yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/eclipse-yocto
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/eclipse-yocto/attachments/20180809/1dce9601/attachment.html>


More information about the eclipse-yocto mailing list