Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove dependency on rmw_implementation #102

Merged
merged 2 commits into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

find_package(rmw_implementation_cmake REQUIRED)
find_package(rmw REQUIRED)
find_package(rosidl_runtime_c REQUIRED)
find_package(rosidl_typesupport_c REQUIRED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

macro(accumulate_typesupports)
set(_typesupport_impl "")
if(${rmw_implementation}_FOUND)
get_rmw_typesupport(_typesupport_impl ${rmw_implementation} LANGUAGE "C")
list_append_unique(_typesupport_impls ${_typesupport_impl})
endif()
endmacro()

macro(rosidl_generator_py_get_typesupports TYPESUPPORT_IMPLS)
set(TYPESUPPORT_IMPLS "")
set(_typesupport_impls "")
call_for_each_rmw_implementation(accumulate_typesupports)
foreach(_typesupport_impl ${_typesupport_impls})
list_append_unique(TYPESUPPORT_IMPLS ${_typesupport_impl})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous logic was broken. The variable which name is passed in TYPESUPPORT_IMPLS is never set by the macro. This only happened to work if the caller expected the result in _typesupport_impls. 🤯

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, cmake macros are really tricky.

set(${TYPESUPPORT_IMPLS} "")
ament_index_get_resources(${TYPESUPPORT_IMPLS} "rosidl_typesupport_c")
list(APPEND ${TYPESUPPORT_IMPLS} "rosidl_typesupport_c")
foreach(_typesupport ${${TYPESUPPORT_IMPLS}})
find_package(${_typesupport} QUIET)
if(NOT ${_typesupport}_FOUND)
list(REMOVE_ITEM ${TYPESUPPORT_IMPLS} "${_typesupport}")
endif()
endforeach()
endmacro()
5 changes: 1 addition & 4 deletions rosidl_generator_py/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
<buildtool_export_depend>rosidl_typesupport_interface</buildtool_export_depend>

<exec_depend>python3-numpy</exec_depend>
<exec_depend>rmw_implementation</exec_depend>
<exec_depend>rmw_implementation_cmake</exec_depend>
<exec_depend>rosidl_generator_c</exec_depend>
<exec_depend>rosidl_parser</exec_depend>
<exec_depend>rosidl_runtime_c</exec_depend>

Expand All @@ -36,8 +35,6 @@
<test_depend>python3-pytest</test_depend>
<test_depend>python_cmake_module</test_depend>
<test_depend>rmw</test_depend>
<test_depend>rmw_implementation</test_depend>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this change led to a failure on the binary job. We're generating messages for tests, but there's no C typesupport available (previously transitively brought in by rmw_implementation).

Here is a proposed fix: #110

<test_depend>rmw_implementation_cmake</test_depend>
<test_depend>rosidl_cmake</test_depend>
<test_depend>rosidl_generator_c</test_depend>
<test_depend>rosidl_generator_cpp</test_depend>
Expand Down