Skip to content

Commit

Permalink
Add colcon install bin dir to PATH to workaround ament_cmake issue (#27)
Browse files Browse the repository at this point in the history
Fix #26

Signed-off-by: Thomas Moulard <tmoulard@amazon.com>
  • Loading branch information
Thomas Moulard authored Nov 6, 2019
1 parent ce49db6 commit 091e547
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/action-ros2-ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 16 additions & 0 deletions src/action-ros2-ci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 091e547

Please sign in to comment.