From 179d347250c06ebb08fe58db3b998d26a0b52982 Mon Sep 17 00:00:00 2001 From: Johannes Meyer <johannes@intermodalics.eu> Date: Thu, 30 Nov 2017 21:46:16 +0100 Subject: [PATCH] Fix for genjava ignoring most packages in standalone mode The genjava_message_artifacts tool in package genjava calls rosjava_build_tools.catkin.index_message_package_dependencies_from_local_environment() to generate a list of all message packages and their dependencies in topological order from the list of package names given in the command line. Especially in cases where ROS_PACKAGE_PATH lists the package paths for each individual package separately, which is the case in isolated builds using catkin_make_isolated or catkin_tools, the relative path returned by catkin_pkg.packages.find_packages() is only `.`. In general, the relative package path is not unique, but it is used as key of a dictionary when passed to topological_order_packages a few lines below. As a consequence, all packages but one of each group that have the same relative package path were missing in the returned list and hence no artifacts were generated by genjava_message_artifacts. This patch adds a line that transforms the relative to the absolute package path, avoiding the above problem. --- src/rosjava_build_tools/catkin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rosjava_build_tools/catkin.py b/src/rosjava_build_tools/catkin.py index 553d534..1630e77 100644 --- a/src/rosjava_build_tools/catkin.py +++ b/src/rosjava_build_tools/catkin.py @@ -53,6 +53,8 @@ def index_message_package_dependencies_from_local_environment(package_name_list= # i.e. no duplicates! for path in reversed(package_paths): for package_path, package in catkin_pkg.packages.find_packages(path).items(): + # resolve and normalize absolute path because it is used as a key below + package_path = os.path.normpath(os.path.join(path, package_path)) all_packages[package.name] = (package_path, package) if has_build_depend_on_message_generation(package) or package.name in message_package_whitelist: if package_name_list: -- GitLab