rust-lang / rust-lang/cargo

Allow a build script (build.rs) in a virtual manifest Cargo.toml

Open
#8,732 9 comments 25 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-build-scripts A-workspaces C-feature-request S-needs-info
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Describe the problem you are trying to solve

I have a package with several crates and "virtual" Cargo.toml (virtual manifest). I would like to execute some code before building this package or any containing crate. Currently it isn't allowed to have build.rs in the virtual manifest.

Describe the solution you'd like

Allow the build field to appear in the virtual manifest.

Notes

As a workaround I have created an empty crate with build.rs and made all other crates depend on it.

Contributor guide

Open the contributing guide

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 reproducing the rejection of a build field in a workspace's virtual Cargo.toml, then trace the manifest validation and build-script handling involved. Done means a virtual manifest can declare build.rs and the requested pre-build behavior works for the package and containing crate without requiring an empty helper crate.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.