Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

namanlp
Copy link
Contributor

@namanlp namanlp commented Jun 25, 2025

Hi Everyone!

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

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

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

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

@rustbot rustbot added A-build-execution Area: anything dealing with executing the compiler A-build-scripts Area: build.rs scripts A-dep-info Area: dep-info, .d files Command-run Command-test labels Jun 25, 2025
@epage
Copy link
Contributor

epage commented Jun 26, 2025

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

Bad copy/paste?

@namanlp namanlp force-pushed the multiple-build-scripts-2 branch 2 times, most recently from 2042b1c to 96ca257 Compare June 26, 2025 19:53
@namanlp namanlp force-pushed the multiple-build-scripts-2 branch 4 times, most recently from 4b8bdec to 934c3b2 Compare June 27, 2025 20:10
@namanlp
Copy link
Contributor Author

namanlp commented Jun 30, 2025

I am marking this PR Ready for Review. Please do let me know if I have missed anything

@namanlp namanlp marked this pull request as ready for review June 30, 2025 19:44
@rustbot
Copy link
Collaborator

rustbot commented Jun 30, 2025

r? @weihanglo

rustbot has assigned @weihanglo.
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 30, 2025
@namanlp namanlp changed the title WIP: Implementation for multiple build scripts feat: Implementation and tests for multiple-build-scripts Jun 30, 2025
@namanlp
Copy link
Contributor Author

namanlp commented Jun 30, 2025

r? @epage

@rustbot rustbot assigned epage and unassigned weihanglo Jun 30, 2025
@epage
Copy link
Contributor

epage commented Jul 1, 2025

Also, another case we need to handle is OUT_DIR. That could be a follow up PR.

@namanlp namanlp force-pushed the multiple-build-scripts-2 branch 2 times, most recently from d6e4d74 to c2005a3 Compare July 8, 2025 21:03
@namanlp namanlp force-pushed the multiple-build-scripts-2 branch from c2005a3 to aba8535 Compare July 8, 2025 21:09
@namanlp namanlp force-pushed the multiple-build-scripts-2 branch 2 times, most recently from bfb7089 to 4442a85 Compare July 9, 2025 20:54
@namanlp namanlp force-pushed the multiple-build-scripts-2 branch from 4442a85 to bfb8697 Compare July 9, 2025 21:37
Copy link
Contributor

@epage epage left a comment

Choose a reason for hiding this comment

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

Thanks!

@epage epage enabled auto-merge July 9, 2025 22:05
@epage epage added this pull request to the merge queue Jul 9, 2025
Merged via the queue into rust-lang:master with commit eabb4cd Jul 9, 2025
24 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 9, 2025
bors added a commit to rust-lang/rust that referenced this pull request Jul 12, 2025
Update cargo

14 commits in 930b4f62cfcd1f0eabdb30a56d91bf6844b739bf..eabb4cd923deb73e714f7ad3f5234d68ca284dbe
2025-06-28 14:58:43 +0000 to 2025-07-09 22:07:55 +0000
- feat: Implementation and tests for `multiple-build-scripts` (rust-lang/cargo#15704)
- perf: Speed up TOML parsing by upgrading toml (rust-lang/cargo#15736)
- Mark cachelock tests that rely on interprocess blocking behaviour as unsupported on AIX. (rust-lang/cargo#15734)
- feat(publish): Stabilize multi-package publishing (rust-lang/cargo#15636)
- Update to Rust 2024 (rust-lang/cargo#15732)
- Clarify package ID specifications in SBOMs are fully qualified (rust-lang/cargo#15731)
- chore(deps): update cargo-semver-checks to v0.42.0 (rust-lang/cargo#15730)
- test: Switch config tests to use snapshots (rust-lang/cargo#15729)
- implement package feature unification (rust-lang/cargo#15684)
- chore: Upgrade dependencies (rust-lang/cargo#15722)
- Report valid file name when we can't find a build target for `name = "foo.rs"` (rust-lang/cargo#15707)
- chore(release): Publish build-rs on release (rust-lang/cargo#15708)
- Override `Cargo.lock` checksums when doing a dry-run `publish` (rust-lang/cargo#15711)
- test(rustfix): Update for nightly (rust-lang/cargo#15717)

r? ghost
@rustbot rustbot added this to the 1.90.0 milestone Jul 12, 2025
github-merge-queue bot pushed a commit that referenced this pull request Aug 6, 2025
)

Hi Everyone!

This PR is aimed to have some improvements over #15704

### What does this PR try to resolve?

Now, multiple build scripts are built correctly. But there are some
underlying issues, that this PR is targeting.

- Preserving the order of the build scripts: Earlier the build scripts
were sorted by default, but now, the order will be preserved.

### 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-build-execution Area: anything dealing with executing the compiler A-build-scripts Area: build.rs scripts A-dep-info Area: dep-info, .d files Command-run Command-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants