-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feel free to rebase on |
epage
reviewed
Jun 5, 2025
epage
reviewed
Jun 5, 2025
epage
reviewed
Jun 5, 2025
60fe887
to
f6bebc3
Compare
b7a6036
to
1d18b6b
Compare
epage
reviewed
Jun 9, 2025
epage
reviewed
Jun 9, 2025
epage
reviewed
Jun 9, 2025
epage
reviewed
Jun 9, 2025
epage
reviewed
Jun 9, 2025
epage
reviewed
Jun 9, 2025
epage
reviewed
Jun 9, 2025
0321144
to
6de78d5
Compare
21dbd79
to
902bd62
Compare
epage
reviewed
Jun 12, 2025
epage
reviewed
Jun 12, 2025
902bd62
to
98a9565
Compare
epage
reviewed
Jun 12, 2025
src/cargo/util/toml/targets.rs
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We'll need to loop over
- Do we need to make build script names more unique?
epage
reviewed
Jun 12, 2025
d419489
to
ce0aacd
Compare
99a459d
to
c01a8bd
Compare
epage
reviewed
Jun 20, 2025
a123df8
to
74b5190
Compare
74b5190
to
5c7f68f
Compare
epage
approved these changes
Jun 23, 2025
Thanks! |
7 tasks
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this pull request
Jun 25, 2025
Update cargo 2 commits in 84709f085062cbf3c51fa507527c1b2334015178..409fed7dc1553d49cb9a8c0637d12d65571346ce 2025-06-22 23:58:39 +0000 to 2025-06-23 15:55:04 +0000 - Fix potential deadlock in `CacheState::lock` (rust-lang/cargo#15698) - feat(toml): Parse support for multiple build scripts (rust-lang/cargo#15630)
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this pull request
Jun 25, 2025
Update cargo 2 commits in 84709f085062cbf3c51fa507527c1b2334015178..409fed7dc1553d49cb9a8c0637d12d65571346ce 2025-06-22 23:58:39 +0000 to 2025-06-23 15:55:04 +0000 - Fix potential deadlock in `CacheState::lock` (rust-lang/cargo#15698) - feat(toml): Parse support for multiple build scripts (rust-lang/cargo#15630)
rust-timer
added a commit
to rust-lang/rust
that referenced
this pull request
Jun 25, 2025
Rollup merge of #142993 - ehuss:update-cargo, r=ehuss Update cargo 2 commits in 84709f085062cbf3c51fa507527c1b2334015178..409fed7dc1553d49cb9a8c0637d12d65571346ce 2025-06-22 23:58:39 +0000 to 2025-06-23 15:55:04 +0000 - Fix potential deadlock in `CacheState::lock` (rust-lang/cargo#15698) - feat(toml): Parse support for multiple build scripts (rust-lang/cargo#15630)
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jul 9, 2025
Hi Everyone! This is PR for the implementation of the first milestone of [GSoC Project : Build Script Delegation](https://summerofcode.withgoogle.com/programs/2025/projects/nUt4PdAA) This will provide actual implementation for #15630 ### What does this PR try to resolve? Now, multiple build scripts are parsed, this PR aims to implement the functioning the feature. This PR will allow users to 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. Deferred - Accessing each build script's `OUT_DIR`: This will be handled in a follow up PR. For now, each build script writes to its own `OUT_DIR` and `OUT_DIR` for the regular build targets is set to the build script with the **lexicographically largest** name.. - User control over which build script wins in a conflict. This will be handled in a follow up PR. If two build scripts write to the same env variable, which gets applied to the binary? Currently, its the build script with the **lexicographically largest** name. This makes it deterministic. With some futzing, users can control this for now. However, with build script delegation, users won't be able to control this. We likely want it based off of the order the user assigns into the build script array. - Something about linking a C library is actually preferring **lexicographically smallest** name. We should handle conflicts consistently. We need to dig into what parts are doing it based on smallest and make sure that whatever priority scheme we use for env variables applies here as well. ### 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 ```toml cargo-features = ["multiple-build-scripts"] ``` Preferably on the top of the `Cargo.toml` and use nightly toolchain to use the feature
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Known Issues:
How to test and review this PR?
There is a feature gate
multiple-build-scripts
that can be passed viacargo-features
inCargo.toml
. So, you have to addPreferably on the top of the
Cargo.toml
and use nightly toolchain to use the featureThis PR is ready to be reviewed and merged