Skip to content

Commit

Permalink
Migrate build-rs to the Cargo repo
Browse files Browse the repository at this point in the history
This pulls in https://github.com/cad97/build-rs at eb389d1 with the following changes:
- `Cargo.toml` metadata
- Removal of `.github`, `.gitignore`, `Cargo.lock`

We'll need to integrate `test-lib` into our processes but that seemeed
more invasive, so I wanted to leave that for a future PR.

Infra changes are being coordinated in https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/Transfering.20.60build-rs.60.20crate.20to.20rust-lang/near/480779960

Context: per [Cargo's charter](https://doc.crates.io/contrib/team.html#decision-process), we approved this transfer in an [FCP](rust-lang#12432 (comment)).

Fixes rust-lang#12432
  • Loading branch information
epage committed Nov 5, 2024
1 parent 91809c4 commit e4912ce
Show file tree
Hide file tree
Showing 10 changed files with 801 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions crates/build-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "build-rs"
version = "0.2.0"
rust-version.workspace = true
edition.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
description = "API for writing Cargo `build.rs` files"

[features]
unstable = []

[lints]
workspace = true
17 changes: 17 additions & 0 deletions crates/build-rs/src/allow_use.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use std::sync::OnceLock;

fn rust_version_minor() -> u32 {
static VERSION_MINOR: OnceLock<u32> = OnceLock::new();
*VERSION_MINOR.get_or_init(|| {
crate::input::cargo_pkg_rust_version()
.split('.')
.nth(1)
.unwrap_or("70")
.parse()
.unwrap()
})
}

pub(crate) fn double_colon_directives() -> bool {
rust_version_minor() >= 77
}
Loading

0 comments on commit e4912ce

Please sign in to comment.