From 091e547aaf36de239db5e78e5cbf93d70b5e74fe Mon Sep 17 00:00:00 2001 From: Thomas Moulard Date: Wed, 6 Nov 2019 10:17:28 -0800 Subject: [PATCH] Add colcon install bin dir to PATH to workaround ament_cmake issue (#27) Fix #26 Signed-off-by: Thomas Moulard --- lib/action-ros2-ci.js | 14 ++++++++++++++ src/action-ros2-ci.ts | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/lib/action-ros2-ci.js b/lib/action-ros2-ci.js index 5c6a9c025..6a805fde2 100644 --- a/lib/action-ros2-ci.js +++ b/lib/action-ros2-ci.js @@ -74,6 +74,20 @@ EOF`], options); if (colconMixinName !== "") { extra_options.concat(["--mixin", colconMixinName]); } + // Add the future install bin directory to PATH. + // This enables cmake find_package to find packages installed in the + // colcon install directory, even if local_setup.sh has not been sourced. + // + // From the find_package doc: + // https://cmake.org/cmake/help/latest/command/find_package.html + // 5. Search the standard system environment variables. + // Path entries ending in /bin or /sbin are automatically converted to + // their parent directories: + // PATH + // + // ament_cmake should handle this automatically, but we are seeing cases + // where this does not happen. See issue #26 for relevant CI logs. + core.addPath(path.join(ros2WorkspaceDir, "install", "bin")); yield exec.exec("colcon", ["build", "--event-handlers", "console_cohesion+", "--packages-up-to", packageName, "--symlink-install"].concat(extra_options), options); yield exec.exec("colcon", ["test", "--event-handlers", "console_cohesion+", "--pytest-args", diff --git a/src/action-ros2-ci.ts b/src/action-ros2-ci.ts index 022041308..3f64f76c1 100644 --- a/src/action-ros2-ci.ts +++ b/src/action-ros2-ci.ts @@ -79,6 +79,22 @@ EOF`], options); if (colconMixinName !== "") { extra_options.concat(["--mixin", colconMixinName]); } + + // Add the future install bin directory to PATH. + // This enables cmake find_package to find packages installed in the + // colcon install directory, even if local_setup.sh has not been sourced. + // + // From the find_package doc: + // https://cmake.org/cmake/help/latest/command/find_package.html + // 5. Search the standard system environment variables. + // Path entries ending in /bin or /sbin are automatically converted to + // their parent directories: + // PATH + // + // ament_cmake should handle this automatically, but we are seeing cases + // where this does not happen. See issue #26 for relevant CI logs. + core.addPath(path.join(ros2WorkspaceDir, "install", "bin")); + await exec.exec( "colcon", ["build", "--event-handlers", "console_cohesion+", "--packages-up-to",