Skip to content

Commit 076b0ae

Browse files
Remove ppackage name from ros_launch rule
1 parent f4a794e commit 076b0ae

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

bazel_ros2_rules/lib/ament_index.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ def _ament_index_files_impl(ctx):
6060
for src in ctx.attr.srcs:
6161
if ctx.attr.subdirectory == "lib":
6262
exe_file = src.files_to_run.executable
63+
if exe_file == None:
64+
continue
6365
symlink_path = paths.join(
6466
ctx.attr.prefix,
6567
"lib",

bazel_ros2_rules/lib/private/ros_py.bzl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,6 @@ def ros_launch(
202202
# runfiles.py to use "this repository" in a way that doesn't require
203203
# bespoke information.
204204
workspace_name = None,
205-
# Optional ROS 2 package name. When set, an ament_index_executables
206-
# target is created from the data= labels, enabling
207-
# launch_ros.actions.Node(package=..., executable=...) to find
208-
# Bazel-built binaries without a colcon install space.
209-
package_name = None,
210205
**kwargs):
211206
main = "{}_roslaunch_main.py".format(name)
212207
launch_respath = _make_respath(launch_file, workspace_name)
@@ -228,11 +223,11 @@ def ros_launch(
228223
],
229224
)
230225

231-
if package_name:
226+
if data:
232227
index_target = "_{}_ament_index".format(name)
233228
ament_index_executables(
234229
name = index_target,
235-
package_name = package_name,
230+
package_name = native.package_name(),
236231
srcs = data,
237232
visibility = ["//visibility:private"],
238233
)

ros2_example_bazel_installed/ros2_example_apps/BUILD.bazel

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,10 @@ ros_launch(
258258
workspace_name = workspace_name,
259259
)
260260

261-
# Uses launch_ros.actions.Node, the natural ROS 2 pattern, by registering
262-
# the Bazel-built binaries in a fake ament prefix via package_name=.
261+
# Uses launch_ros.actions.Nodethe natural ROS 2 pattern. The ament resource
262+
# index is built automatically from data= using the Bazel package name.
263263
ros_launch(
264264
name = "eg_launch_with_action_node",
265-
package_name = "ros2_example_apps",
266265
data = [
267266
":eg_listener",
268267
":eg_talker",

0 commit comments

Comments
 (0)