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

Package identification & build tasks for colcon-ros-cargo #1

Merged
merged 1 commit into from
Feb 18, 2022
Merged

Conversation

nnmm
Copy link
Collaborator

@nnmm nnmm commented Feb 10, 2022

This includes cargo-ros-install, a wrapper around cargo build which installs files into the correct places for ROS 2 tools to find them.

@nnmm
Copy link
Collaborator Author

nnmm commented Feb 10, 2022

@esteve @mxgrey I cleaned this up – feel free to do a first review iteration.

@nnmm nnmm requested a review from esteve February 10, 2022 21:02
@nnmm
Copy link
Collaborator Author

nnmm commented Feb 12, 2022

@esteve @mxgrey There is no rush, but do you know roughly when you'll be able to review this?

I know it's a lot of code. If I can do anything to make reviewing easier (more comments, video call, splitting it up, etc.), let me know.

cargo-ros-install/package.xml Outdated Show resolved Hide resolved
@esteve
Copy link
Collaborator

esteve commented Feb 13, 2022

@nnmm thank you so much for working on this!

One question, though, how does this compare to rust-lang/cargo#6100 ? It seems to me that --out-dir does a similar job.

I will test this later, but wanted to ask, does the Cargo plugin modify the source space of a package in any way? Or does everything happen in the build space?

@nnmm
Copy link
Collaborator Author

nnmm commented Feb 13, 2022

One question, though, how does this compare to rust-lang/cargo#6100 ? It seems to me that --out-dir does a similar job.

Yes, --out-dir does a very similar job as cargo-ros-install in that both put the binaries in the specified location. However, (1) --out-dir is unstable and (2) this is only a part of what cargo-ros-install does: It also creates package markers and copies sources.

I will test this later, but wanted to ask, does the Cargo plugin modify the source space of a package in any way? Or does everything happen in the build space?

It does not modify the source space of a package in any way. The colcon-ros-cargo plugin creates .cargo/config.toml but that's it.


def add_arguments(self, *, parser): # noqa: D102
parser.add_argument(
'--lookup-only-install',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I followed the decision made by the people in the chat: To resolve to the source space by default. However, I wanted to point out a few things I realized in working on colcon-ros-cargo:

  • We need to copy sources to the install directory anyway, not only to make messages work, but also for depending on another workspace, like mentioned yesterday. But the performance impact of that is totally negligible. Even if we're worried, copying could be done in parallel to building.
  • I can empirically confirm that scanning the source space takes upwards of 1 second for a workspace like AutowareAuto.

So the cost matrix looks like this (x is the use case, y is the design decision):

                      ┌─────────────────────┬────────────────────────┐
                      │ build cargo         │ generate a config.toml │
                      │ packages with       │ and not use colcon     │
                      │ colcon (frequency:  │ afterwards (frequency: │
                      │ high)               │ low)                   │
┌─────────────────────┼─────────────────────┼────────────────────────┤
│ Searching workspace │ Needless workspace  │ No cost                │
│ plus install space  │ scan (1s+) or pass  │                        │
│ is the default      │ in --no-search-ws   │                        │
├─────────────────────┼─────────────────────┼────────────────────────┤
│ Searching only the  │ No cost             │ Need to pass in        │
│ install space is    │                     │ --search-ws            │
│ the default         │                     │                        │
└─────────────────────┴─────────────────────┴────────────────────────┘

Since generating a config.toml basically needs to be done only once, I think the left half should be weighted stronger. That's why I thought it would be better to switch the default around, so that it uses searches the install space by default.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm understanding this correctly. I think it should only search the install space, like what happens with every other package in a colcon workspace, that's why I asked in the chat if the source space was accessed in any way a few days ago. The source spaces of other packages are never accessed with the other build types, only the install spaces.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I think this was a bit unfortunate: The two of us discussed this once in the past before some of the other people joined, and agreed that dependencies should point to the install space. Later, the topic was brought up again and people voted in favor of dependencies pointing to the source space by default, and I couldn't reach you for comment.

I changed the default now to searching only the install space. It's not a big deal since depending on the source space is still possible with the flag.

I also noticed that the README got lost at some point and added it back.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem! That's what PR are for 🙂

@esteve esteve merged commit a569821 into main Feb 18, 2022
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

Successfully merging this pull request may close these issues.

2 participants