[Discourse.ros.org] [Next Generation ROS] Execute something as part of local_setup.bash call

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Execute something as part of local_setup.bash call

Charles Fox via ros-users


With the present build system (ament), is there a way for me to specify some code that might get ran with the setup scripts? I just need to add some additional environment variables at the moment. In other words, I want to add a new package to my repos file that needs no real compile but simply adds additional environment variables set when sourcing in local_setup.bash.





---
[Visit Topic](https://discourse.ros.org/t/execute-something-as-part-of-local-setup-bash-call/2790/1) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Execute something as part of local_setup.bash call

Charles Fox via ros-users


You're looking for the `ament_environment_hooks` macro, which is similar to catkin's `catkin_add_env_hooks`:

https://github.com/ament/ament_cmake/blob/master/ament_cmake_core/cmake/environment_hooks/ament_environment_hooks.cmake





---
[Visit Topic](https://discourse.ros.org/t/execute-something-as-part-of-local-setup-bash-call/2790/2) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Execute something as part of local_setup.bash call

Charles Fox via ros-users
In reply to this post by Charles Fox via ros-users


An example usage could be the `.sh` / `.bat` files the [opensplice_cmake_module](https://github.com/ros2/rmw_opensplice/blob/b169ae45f855affb63403eca97703c3ebab9d014/opensplice_cmake_module/CMakeLists.txt#L18) package uses to set e.g. `OSPL_HOME`.





---
[Visit Topic](https://discourse.ros.org/t/execute-something-as-part-of-local-setup-bash-call/2790/3) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Execute something as part of local_setup.bash call

Charles Fox via ros-users
In reply to this post by Charles Fox via ros-users


This approach will work just fine for me. Thanks guys.





---
[Visit Topic](https://discourse.ros.org/t/execute-something-as-part-of-local-setup-bash-call/2790/4) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Execute something as part of local_setup.bash call

Charles Fox via ros-users
In reply to this post by Charles Fox via ros-users


One follow-up question: are environment variables exported through the ament_environment_hooks mechanism exported and available for dependent builds to utilize as part of a long build chain? Or are they only set when explicitly sourcing in the setup script files?





---
[Visit Topic](https://discourse.ros.org/t/execute-something-as-part-of-local-setup-bash-call/2790/5) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Execute something as part of local_setup.bash call

Charles Fox via ros-users
In reply to this post by Charles Fox via ros-users


They are available at build time and run time. There is an open issue to have the option to have a separate build and run time set of hooks:

https://github.com/ament/ament_tools/issues/76





---
[Visit Topic](https://discourse.ros.org/t/execute-something-as-part-of-local-setup-bash-call/2790/6) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Execute something as part of local_setup.bash call

Charles Fox via ros-users
In reply to this post by Charles Fox via ros-users


>They are available at build time...

To clarify one thing in that regard: it appears that data provided through environment hooks are available at build time only to packages explicitly specifying a build dependency in their package.xml upon the hook provider package.





---
[Visit Topic](https://discourse.ros.org/t/execute-something-as-part-of-local-setup-bash-call/2790/7) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Execute something as part of local_setup.bash call

Charles Fox via ros-users
In reply to this post by Charles Fox via ros-users


[quote="BrannonKing, post:7, topic:2790"]
To clarify one thing in that regard: it appears that data provided through environment hooks are available at build time only to packages explicitly specifying a build dependency in their package.xml upon the hook provider package.
[/quote]

Yes, that's intentional. It also happens transitively, so if A defines a hook, B depends on A, and C depends on just B, then C will still see the side effect of the hook in A despite not directly depending on A.





---
[Visit Topic](https://discourse.ros.org/t/execute-something-as-part-of-local-setup-bash-call/2790/8) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Execute something as part of local_setup.bash call

Charles Fox via ros-users
In reply to this post by Charles Fox via ros-users


I wasn't seeing the transitive behavior in my testing. I had expected that, but I don't think it works at the moment.





---
[Visit Topic](https://discourse.ros.org/t/execute-something-as-part-of-local-setup-bash-call/2790/9) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Execute something as part of local_setup.bash call

Charles Fox via ros-users
In reply to this post by Charles Fox via ros-users


In the environment used to `build` a package the following packages are being sourced before: the direct `build` dependencies and of those all recursive `build` | `build_export` | `buildtool_export` | `exec` dependencies.

A package specific local_setup file from the install space will source the following packages: all direct `run` and `test` dependencies are being sourced.





---
[Visit Topic](https://discourse.ros.org/t/execute-something-as-part-of-local-setup-bash-call/2790/10) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Execute something as part of local_setup.bash call

Charles Fox via ros-users
In reply to this post by Charles Fox via ros-users


Thanks. Adding a build_export node on my intermediate package appears to fix the issue I was seeing.





---
[Visit Topic](https://discourse.ros.org/t/execute-something-as-part-of-local-setup-bash-call/2790/11) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>