Skip to content

Allow sharing of cargo target directory between builds#71

Open
cottsay wants to merge 1 commit intomainfrom
cottsay/shared-target-dir
Open

Allow sharing of cargo target directory between builds#71
cottsay wants to merge 1 commit intomainfrom
cottsay/shared-target-dir

Conversation

@cottsay
Copy link
Member

@cottsay cottsay commented Feb 24, 2026

This flag will cause all colcon-cargo invocations of the 'cargo' executable to use a shared target directory, thereby sharing build artifacts between builds.

I don't yet understand all of the nuances of this change and what dragons be yet lurking, so for now the change is hidden behind the colcon feature flag 'shared_cargo_target_dir'.

To avoid breaking the _build_cmd and _install_cmd signatures with colcon-ros-cargo, I saved the build directory as an attribute. We may need to untangle that relationship in the future.

This flag will cause all colcon-cargo invocations of the 'cargo'
executable to use a shared target directory, thereby sharing build
artifacts between builds.

I don't yet understand all of the nuances of this change and what
dragons be yet lurking, so for now the change is hidden behind the
colcon feature flag 'shared_cargo_target_dir'.
@codecov-commenter
Copy link

codecov-commenter commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 18.18182% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.63%. Comparing base (518a4f9) to head (5ae3fa3).

Files with missing lines Patch % Lines
colcon_cargo/task/cargo/build.py 18.18% 7 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #71      +/-   ##
==========================================
- Coverage   72.46%   71.63%   -0.84%     
==========================================
  Files           9        9              
  Lines         345      349       +4     
  Branches       60       62       +2     
==========================================
  Hits          250      250              
- Misses         61       64       +3     
- Partials       34       35       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cottsay cottsay requested a review from Blast545 February 25, 2026 03:44
@cottsay cottsay self-assigned this Feb 25, 2026
Copy link

@Blast545 Blast545 left a comment

Choose a reason for hiding this comment

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

LGTM since it's a feature flag, the nuances are not clear to me either, but I'm ok with the opt-in behavior.

@esteve
Copy link
Contributor

esteve commented Mar 2, 2026

@cottsay doesn't this break the assumption that package builds are isolated? e.g. if we build them in a chroot a la Debian. Not actually against it, but it'd be good to document it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants