Future of ament_build_type_gradle
jacobperron opened this issue · 5 comments
As I understand it, ament_tools
is deprecated having been replaced by colcon
as the build tool for ROS distros newer than Bouncy. Further, ament_build_type_gradle
depends on ament_tools
. I'm opening this issue to start a discussion about how to proceed for later ROS releases (e.g. Dashing).
If I ignore ament_build_type_gradle
, I'm able to build ROS 2 Dashing with Java support, except some runtime environment information is missing for gradle packages (e.g. CLASSPATH
, AMENT_PREFIX_PATH
) and the packages are not registered with the ament index. My main question is where should these things be handled?
Should we keep the logic in ament_build_type_gradle
and refactor so it doesn't use ament_tools
?
Or perhaps we can move all of the functionality into ament_gradle_plugin?
It seems like what we want is a new package ament_index_java
(similar to the C++ and Python packages) that provides helpers for registering/querying entries in the ament index. Then this new Java API can be called from ament_gradle_plugin
or directly by the gradle package.
I'm new to gradle, so I'm still doing some reading and experimenting.
@jacobperron ament_build_type_gradle
depends on ament_tools
just because at the time ROS 2 was distributed only as a .repos file with ament_tools
being one of the repos. The dependency was there only to force ament_tools
to be built before building ament_build_type_gradle
.
In any case, there should be no need for ament_build_type_gradle
now that https://github.com/colcon/colcon-ros-gradle is part of the colcon
distribution. A good start would be to change the CI scripts to use colcon
and fix whatever break.
@esteve Thanks for the reply 🙂
In any case, there should be no need for ament_build_type_gradle now that https://github.com/colcon/colcon-ros-gradle is part of the colcon distribution.
From trying to run examples, it appears we're missing some logic for setting the environment (CLASSPATH
and AMENT_PREFIX_PATH
) and registering with the ament index.
This logic from ament_build_type_gradle
needs to go somewhere:
Even with colcon-ros-gradle
installed, I am not able to run examples without manually setting up the environment. Though, I'm not sure that colcon-ros-gradle
should be responsible for this, since I think we should be able to build an ament gradle package without colcon (e.g. gradle build
).
A good start would be to change the CI scripts to use colcon and fix whatever break.
I'll do this too.
I think that we'll likely want a support package suite analogous to ament_cmake, that contains common code for handling the installation of package.xml files and ament index registration. We don't have one in Python because the setuptools format doesn't allow us to depend on third-party libraries during the setup itself. Keeping the code central allows us to update it in only one place which is far preferable to the approach necessary in Python.
I've added a support package ament_index_java
that supports both ament index queries as well as registering new resources (like packages). Currently, registering a package only installs a marker file, though it might make sense to expand on this to also install a package.xml and/or provide shell rules for configuring your environment.
Can you try to compile with colcon?
https://github.com/colcon/colcon-gradle
https://github.com/colcon/colcon-ros-gradle
I added them to pr
I add a repo change that you could compile your ament java with colcon.
I try it on windows with vs2019 and dashing. It compile.
https://github.com/ros2-java/ament_java/pull/13/files
Please try and let me know.