Skip to content

Commit 7973083

Browse files
committed
Add feature gate for multiple build scripts
1 parent 93fd488 commit 7973083

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/cargo/core/features.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,9 @@ features! {
577577

578578
/// Allows use of editions that are not yet stable.
579579
(unstable, unstable_editions, "", "reference/unstable.html#unstable-editions"),
580+
581+
/// Allows use of multiple build scripts.
582+
(unstable, multiple_build_scripts, "", "reference/unstable.html#multiple-build-scripts"),
580583
}
581584

582585
/// Status and metadata for a single unstable feature.

src/doc/src/reference/unstable.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Each new feature described below should explain how to use it.
6666
* [-Z allow-features](#allow-features) --- Provides a way to restrict which unstable features are used.
6767
* Build scripts and linking
6868
* [Metabuild](#metabuild) --- Provides declarative build scripts.
69+
* [Multiple Build Scripts](#multiple-build-scripts) --- Allows use of multiple build scripts.
6970
* Resolver and features
7071
* [no-index-update](#no-index-update) --- Prevents cargo from updating the index cache.
7172
* [avoid-dev-deps](#avoid-dev-deps) --- Prevents the resolver from including dev-dependencies during resolution.
@@ -332,6 +333,24 @@ extra-info = "qwerty"
332333
Metabuild packages should have a public function called `metabuild` that
333334
performs the same actions as a regular `build.rs` script would perform.
334335

336+
## Multiple Build Scripts
337+
* Tracking Issue: [#14903](https://github.com/rust-lang/cargo/issues/14903)
338+
* Original Pull Request: [#15630](https://github.com/rust-lang/cargo/pull/15630)
339+
340+
Multiple Build Scripts feature allows you to have multiple build scripts in your package.
341+
342+
Include `cargo-features` at the top of `Cargo.toml` and add `multiple-build-scripts` to enable feature.
343+
Add the paths of the build scripts as an array in `package.build`. For example:
344+
345+
```toml
346+
cargo-features = ["multiple-build-scripts"]
347+
348+
[package]
349+
name = "mypackage"
350+
version = "0.0.1"
351+
build = ["foo.rs", "bar.rs"]
352+
```
353+
335354
## public-dependency
336355
* Tracking Issue: [#44663](https://github.com/rust-lang/rust/issues/44663)
337356

0 commit comments

Comments
 (0)