From 43160b4501c97cb4b63a39c0f076583f55e02e66 Mon Sep 17 00:00:00 2001 From: Ali Abbas Date: Thu, 18 Apr 2024 14:09:34 -0400 Subject: [PATCH] support extra deps for rosidl msg generation --- bazel_ros2_rules/ros2/rosidl.bzl | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/bazel_ros2_rules/ros2/rosidl.bzl b/bazel_ros2_rules/ros2/rosidl.bzl index d432e4b7..94e77bbb 100644 --- a/bazel_ros2_rules/ros2/rosidl.bzl +++ b/bazel_ros2_rules/ros2/rosidl.bzl @@ -1138,6 +1138,7 @@ def rosidl_cc_support( interfaces, data, deps, + extra_deps, group = None, cc_binary_rule = native.cc_binary, cc_library_rule = native.cc_library, @@ -1165,7 +1166,7 @@ def rosidl_cc_support( group = group or name, interfaces = interfaces, includes = [_make_public_label(dep, "_defs") for dep in deps], - deps = [_make_public_label(dep, "_cc") for dep in deps], + deps = [_make_public_label(dep, "_cc") for dep in deps] + extra_deps, cc_library_rule = cc_library_rule, **kwargs ) @@ -1188,7 +1189,7 @@ def rosidl_cc_support( deps = [_make_private_label(name, "__rosidl_cpp")] + [ _make_public_label(dep, "_cc") for dep in deps - ], + ] + extra_deps, cc_binary_rule = cc_binary_rule, cc_library_rule = cc_library_rule, **kwargs @@ -1222,7 +1223,7 @@ def rosidl_cc_support( deps = [_make_private_label(name, "__rosidl_cpp")] + [ _make_public_label(dep, "_cc") for dep in deps - ], + ] + extra_deps, cc_binary_rule = cc_binary_rule, cc_library_rule = cc_library_rule, **kwargs @@ -1253,7 +1254,7 @@ def rosidl_cc_support( deps = [_make_private_label(name, "__rosidl_cpp")] + [ _make_public_label(dep, "_cc") for dep in deps - ], + ] + extra_deps, cc_binary_rule = cc_binary_rule, **kwargs ) @@ -1278,7 +1279,7 @@ def rosidl_cc_support( _make_public_label(name, "__rosidl_typesupport_cpp"), ] + typesupports.values(), data = data, - deps = [_make_private_label(name, "__rosidl_cpp")], + deps = [_make_private_label(name, "__rosidl_cpp")] + extra_deps, linkstatic = True, **kwargs ) @@ -1288,6 +1289,7 @@ def rosidl_py_support( interfaces, data, deps, + extra_deps, group = None, cc_binary_rule = native.cc_binary, cc_library_rule = native.cc_library, @@ -1317,7 +1319,7 @@ def rosidl_py_support( group = group or name, interfaces = interfaces, includes = [_make_public_label(dep, "_defs") for dep in deps], - deps = [_make_public_label(dep, "_c") for dep in deps], + deps = [_make_public_label(dep, "_c") for dep in deps] + extra_deps, cc_library_rule = cc_library_rule, **kwargs ) @@ -1340,7 +1342,7 @@ def rosidl_py_support( deps = [_make_private_label(name, "__rosidl_c")] + [ _make_public_label(dep, "_c") for dep in deps - ], + ] + extra_deps, cc_binary_rule = cc_binary_rule, cc_library_rule = cc_library_rule, **kwargs @@ -1374,7 +1376,7 @@ def rosidl_py_support( deps = [_make_private_label(name, "__rosidl_c")] + [ _make_public_label(dep, "_c") for dep in deps - ], + ] + extra_deps, cc_binary_rule = cc_binary_rule, cc_library_rule = cc_library_rule, **kwargs @@ -1405,7 +1407,7 @@ def rosidl_py_support( deps = [_make_private_label(name, "__rosidl_c")] + [ _make_public_label(dep, "_c") for dep in deps - ], + ] + extra_deps, cc_binary_rule = cc_binary_rule, **kwargs ) @@ -1431,7 +1433,7 @@ def rosidl_py_support( srcs = typesupports.values(), deps = [ _make_private_label(name, "__rosidl_c"), - ] + typesupports.values(), + ] + typesupports.values() + extra_deps, linkstatic = True, **kwargs ) @@ -1447,7 +1449,7 @@ def rosidl_py_support( c_deps = [_make_public_label(name, "_c")] + [ _make_public_label(dep, "_c") for dep in deps - ], + ] + extra_deps, cc_binary_rule = cc_binary_rule, cc_library_rule = cc_library_rule, py_library_rule = py_library_rule, @@ -1459,6 +1461,7 @@ def rosidl_interfaces_group( interfaces, data = [], deps = [], + extra_deps = [], group = None, cc_binary_rule = native.cc_binary, cc_library_rule = native.cc_library, @@ -1515,6 +1518,7 @@ def rosidl_interfaces_group( interfaces = interfaces, data = data, deps = deps, + extra_deps = extra_deps, group = group, cc_binary_rule = cc_binary_rule, cc_library_rule = cc_library_rule, @@ -1528,6 +1532,7 @@ def rosidl_interfaces_group( # Add the C++ target so that we can support `ros2 bag record`. data = data + [cc_name], deps = deps, + extra_deps = extra_deps, group = group, cc_binary_rule = cc_binary_rule, cc_library_rule = cc_library_rule,