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

Future of ament_build_type_gradle #9

Open
jacobperron opened this issue Oct 9, 2019 · 5 comments
Open

Future of ament_build_type_gradle #9

jacobperron opened this issue Oct 9, 2019 · 5 comments

Comments

@jacobperron
Copy link
Contributor

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.

@esteve
Copy link
Member

esteve commented Oct 9, 2019

@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.

@jacobperron
Copy link
Contributor Author

@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:

https://github.com/esteve/ament_java/blob/e6e23fbf54c2027999afa234474a4126175617cd/ament_build_type_gradle/ament_build_type_gradle/__init__.py#L151-L176

https://github.com/esteve/ament_java/blob/e6e23fbf54c2027999afa234474a4126175617cd/ament_build_type_gradle/ament_build_type_gradle/__init__.py#L210-L225

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.

@nuclearsandwich
Copy link

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.

@jacobperron
Copy link
Contributor Author

jacobperron commented Feb 5, 2020

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.

@talregev
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants