LukeMathWalker / LukeMathWalker/cargo-chef

Workspace with Multiple interdependent crates

Open
#314 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
2.7k
Forks
146
PR merge metrics
No merged PRs in 30d

Description

We have a workspace that has a few crates we use as libraries. I.e, a layout like so:

  • library1/lib.rs
  • library2/lib.rs <-- depends on library1
  • binary/main.rs <-- depends on library1 & library2

With cargo chef cook & prepare, both the libraries and binary are all skeleton files, so we can never cache library1 & library2, they are built each time.

One possible solution is to layer it, so we run cargo chef cook a couple of times to build up the cache layers. However, we'd need an option to ensure that cargo chef does not create/overwrite skeleton files for certain crates within the workspace.

I.e, you could imagine:

  • prepare
  • copy over the recipe.json
  • copy over just library1
  • cook, but exclude skeletons for library1
  • copy over library2
  • cook, but exclude skeletons for library1 & library2
  • full build

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the workspace handling in cargo chef prepare and cook, using recipe.json and the skeleton crate files described in the issue as the behavior to follow. Determine how selected crates can be copied in stages without having their skeleton files created or overwritten, then verify that dependent libraries and the binary can be cached across the proposed layered workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, rust
Domain
build-system, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.