Skip to content

feat(toml): Parse support for multiple build scripts #15630

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

namanlp
Copy link
Contributor

@namanlp namanlp commented Jun 4, 2025

Hi Everyone!

This is PR for the manifest parsing of the first milestone of GSoC Project : Build Script Delegation

What does this PR try to resolve?

Currently, just a single build script is allowed for each package. This PR will allow users to create and use multiple build scripts, and is backward compatible with single script as well as boolean values.

Motivation : This will help users to maintain separate smaller and cleaner build scripts instead of one large build script. This is also necessary for build script delegation.

Open questions:

  • What should the build script target names be?
    • Currently they use the file stem of the build script which could run into conflicts

Known Issues:

  • This is just parsing support, and currently, only the first build script of the array is actually executed.

How to test and review this PR?

There is a feature gate multiple-build-scripts that can be passed via cargo-features in Cargo.toml. So, you have to add

cargo-features = ["multiple-build-scripts"]

Preferably on the top of the Cargo.toml and use nightly toolchain to use the feature

This PR is ready to be reviewed and merged

@rustbot rustbot added the A-unstable Area: nightly unstable support label Jun 4, 2025
@epage
Copy link
Contributor

epage commented Jun 4, 2025

Feel free to rebase on master, rather than merge it.

@rustbot rustbot added A-manifest Area: Cargo.toml issues Command-vendor labels Jun 5, 2025
@namanlp namanlp closed this Jun 6, 2025
@namanlp namanlp force-pushed the multiple-build-scripts-1 branch from 60fe887 to f6bebc3 Compare June 6, 2025 21:16
@namanlp namanlp reopened this Jun 6, 2025
@namanlp namanlp force-pushed the multiple-build-scripts-1 branch 2 times, most recently from b7a6036 to 1d18b6b Compare June 8, 2025 22:09
@namanlp namanlp force-pushed the multiple-build-scripts-1 branch from 0321144 to 6de78d5 Compare June 10, 2025 22:39
@rustbot rustbot added the A-documenting-cargo-itself Area: Cargo's documentation label Jun 10, 2025
@namanlp namanlp force-pushed the multiple-build-scripts-1 branch 3 times, most recently from 21dbd79 to 902bd62 Compare June 11, 2025 23:22
@namanlp namanlp force-pushed the multiple-build-scripts-1 branch from 902bd62 to 98a9565 Compare June 12, 2025 19:29
Comment on lines 108 to 114
if custom_build.len() > 1 {
anyhow::bail!("multiple build scripts feature is not implemented yet! ")
}
let custom_build = Path::new(&custom_build[0]);
let name = format!(
"build-script-{}",
custom_build
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. We'll need to loop over
  2. Do we need to make build script names more unique?

@namanlp namanlp force-pushed the multiple-build-scripts-1 branch from d419489 to ce0aacd Compare June 13, 2025 20:47
@namanlp namanlp force-pushed the multiple-build-scripts-1 branch 3 times, most recently from 94004f8 to 0febd42 Compare June 19, 2025 18:42
@namanlp namanlp force-pushed the multiple-build-scripts-1 branch 3 times, most recently from 951888c to 6dd2227 Compare June 19, 2025 21:40
@namanlp namanlp marked this pull request as ready for review June 19, 2025 21:51
@rustbot
Copy link
Collaborator

rustbot commented Jun 19, 2025

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 19, 2025
@namanlp
Copy link
Contributor Author

namanlp commented Jun 19, 2025

r? @epage

@rustbot rustbot assigned epage and unassigned ehuss Jun 19, 2025
@epage epage changed the title [WIP] feat: Multiple build scripts feat(toml): Parse support for multiple build scripts Jun 19, 2025
@namanlp namanlp force-pushed the multiple-build-scripts-1 branch from 99a459d to c01a8bd Compare June 19, 2025 21:58
Comment on lines 335 to 338
## Multiple Build Scripts
* Original Pull Request: [#15630](https://github.com/rust-lang/cargo/pull/15630)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use #14903 as the tracking issue. Please link to it from here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I also mention about GSoC?

@namanlp namanlp force-pushed the multiple-build-scripts-1 branch from c01a8bd to a123df8 Compare June 21, 2025 18:04
@namanlp namanlp force-pushed the multiple-build-scripts-1 branch from a123df8 to 74b5190 Compare June 22, 2025 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation A-manifest Area: Cargo.toml issues A-unstable Area: nightly unstable support Command-vendor S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants