Skip to content

Consolidate dependency version management #3008

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 3 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/bindgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,25 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Read crate metadata
id: metadata
run: echo "rust-version=$(sed -ne 's/rust-version *= *\"\(.*\)\"/\1/p' Cargo.toml)" >> $GITHUB_OUTPUT

- name: Install msrv for lib
uses: dtolnay/rust-toolchain@master
with:
# MSRV below is documented in Cargo.toml and README.md, please update those if you
# change this.
toolchain: 1.70.0
toolchain: ${{ steps.metadata.outputs.rust-version }}

- name: Test lib with msrv
run: cargo +1.70.0 test --package bindgen
run: cargo +${{ steps.metadata.outputs.rust-version }} test --package bindgen

- name: Install msrv for cli
uses: dtolnay/rust-toolchain@master
with:
# MSRV below is documented in Cargo.toml and README.md, please update those if you
# change this.
toolchain: 1.70.0
toolchain: ${{ steps.metadata.outputs.rust-version }}

- name: Test cli with msrv
run: cargo +1.70.0 build --package bindgen-cli
run: cargo +${{ steps.metadata.outputs.rust-version }} build --package bindgen-cli

minimal:
runs-on: ubuntu-latest
Expand Down
33 changes: 30 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,38 @@ default-members = [
"bindgen-tests",
]

# Dependencies shared between crates
[workspace.package]
# If you change this, also update README.md
rust-version = "1.70.0"
edition = "2021"

# All dependency version management is centralized here
[workspace.dependencies]
annotate-snippets = "0.11.4"
bindgen = { path = "./bindgen", default-features = false }
bitflags = "2.2.1"
block = "0.1"
cc = "1.0"
cexpr = "0.6"
clang-sys = "1"
clap = "4"
clap_complete = "4"
env_logger = "0.10.0"
itertools = { version = ">=0.10,<0.14", default-features = false }
libloading = "0.7"
log = "0.4"
objc = "0.2"
owo-colors = "3.5.0"
prettyplease = "0.2.7"
proc-macro2 = "1"
quickcheck = "1.0"
quote = { version = "1", default-features = false }
regex = { version = "1.5.3", default-features = false }
rustc-hash = "1.0.1"
shlex = "1"
syn = "2.0"
proc-macro2 = { version = "1", default-features = false }
similar = "2.2.1"
syn = "2.0"
tempfile = "3"

# Config for 'cargo dist'
[workspace.metadata.dist]
Expand Down
13 changes: 6 additions & 7 deletions bindgen-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = [
"The rust-bindgen project contributors",
"The rust-bindgen project contributors",
]
description = "Automatically generates Rust FFI bindings to C and C++ libraries."
keywords = ["bindings", "ffi", "code-generation"]
Expand All @@ -12,18 +12,17 @@ repository = "https://github.com/rust-lang/rust-bindgen"
documentation = "https://docs.rs/bindgen"
homepage = "https://rust-lang.github.io/rust-bindgen/"
version = "0.70.1"
edition = "2021"
rust-version = "1.70.0"
rust-version.workspace = true
edition.workspace = true

[[bin]]
path = "main.rs"
name = "bindgen"

[dependencies]
bindgen = { path = "../bindgen", version = "=0.70.1", default-features = false, features = ["__cli", "experimental", "prettyplease"] }
env_logger = { version = "0.10.0", optional = true }
log = { version = "0.4", optional = true }

bindgen = { workspace = true, features = ["__cli", "experimental", "prettyplease"] }
env_logger = { workspace = true, optional = true }
log = { workspace = true, optional = true }
proc-macro2.workspace = true
shlex.workspace = true

Expand Down
7 changes: 4 additions & 3 deletions bindgen-integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ description = "A package to test various bindgen features"
version = "0.1.0"
authors = ["Emilio Cobos Álvarez <[email protected]>"]
publish = false
edition = "2021"
build = "build.rs"
rust-version.workspace = true
edition.workspace = true

[build-dependencies]
bindgen = { path = "../bindgen", features = ["experimental"] }
cc = "1.0"
bindgen = { workspace = true, default-features = true, features = ["experimental"] }
cc.workspace = true

[features]
static = ["bindgen/static"]
Expand Down
14 changes: 7 additions & 7 deletions bindgen-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[package]
name = "bindgen-tests"
edition = "2021"
version = "0.1.0"
publish = false
rust-version.workspace = true
edition.workspace = true

[dev-dependencies]
bindgen = { path = "../bindgen", features = ["__cli", "experimental"] }
owo-colors = "3.5.0"
prettyplease = { version = "0.2.7", features = ["verbatim"] }
similar = { version = "2.2.1", features = ["inline"] }
tempfile = "3"

bindgen = { workspace = true, default-features = true, features = ["__cli", "experimental"] }
owo-colors.workspace = true
prettyplease = { workspace = true, features = ["verbatim"] }
proc-macro2.workspace = true
shlex.workspace = true
similar = { workspace = true, features = ["inline"] }
syn.workspace = true
tempfile.workspace = true

[features]
logging = ["bindgen/logging"]
Expand Down
9 changes: 5 additions & 4 deletions bindgen-tests/tests/expectations/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ authors = [
"Emilio Cobos Álvarez <[email protected]>",
"The Servo project developers",
]
edition = "2021"
publish = false
rust-version.workspace = true
edition.workspace = true

[dependencies]
block = "0.1"
libloading = "0.7"
objc = "0.2"
block.workspace = true
libloading.workspace = true
objc.workspace = true

[lints.rust]
### FIXME: these might need to be fixed,
Expand Down
10 changes: 5 additions & 5 deletions bindgen-tests/tests/quickchecking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name = "quickchecking"
description = "Bindgen property tests with quickcheck. Generate random valid C code and pass it to the csmith/predicate.py script"
version = "0.0.0"
publish = false
rust-version = "1.70"
edition = "2021"
rust-version.workspace = true
edition.workspace = true

[lib]
name = "quickchecking"
Expand All @@ -15,9 +15,9 @@ name = "quickchecking"
path = "src/bin.rs"

[dependencies]
clap = "4"
quickcheck = "1.0"
tempfile = "3"
clap.workspace = true
quickcheck.workspace = true
tempfile.workspace = true

[features]
# No features by default.
Expand Down
38 changes: 18 additions & 20 deletions bindgen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
authors = [
"Jyun-Yan You <[email protected]>",
"Emilio Cobos Álvarez <[email protected]>",
"Nick Fitzgerald <[email protected]>",
"The Servo project developers",
"Jyun-Yan You <[email protected]>",
"Emilio Cobos Álvarez <[email protected]>",
"Nick Fitzgerald <[email protected]>",
"The Servo project developers",
]
description = "Automatically generates Rust FFI bindings to C and C++ libraries."
keywords = ["bindings", "ffi", "code-generation"]
Expand All @@ -15,30 +15,28 @@ repository = "https://github.com/rust-lang/rust-bindgen"
documentation = "https://docs.rs/bindgen"
homepage = "https://rust-lang.github.io/rust-bindgen/"
version = "0.70.1"
edition = "2021"
build = "build.rs"
# If you change this, also update README.md and msrv in .github/workflows/bindgen.yml
rust-version = "1.70.0"
rust-version.workspace = true
edition.workspace = true

[lib]
name = "bindgen"
path = "lib.rs"

[dependencies]
annotate-snippets = { version = "0.11.4", optional = true }
bitflags = "2.2.1"
cexpr = "0.6"
clang-sys = { version = "1", features = ["clang_11_0"] }
clap = { version = "4", features = ["derive"], optional = true }
clap_complete = { version = "4", optional = true}
itertools = { version = ">=0.10,<0.14", default-features = false }
log = { version = "0.4", optional = true }
prettyplease = { version = "0.2.7", optional = true, features = ["verbatim"] }
quote = { version = "1", default-features = false }
regex = { version = "1.5.3", default-features = false, features = ["std", "unicode-perl"] }
rustc-hash = "1.0.1"

annotate-snippets = { workspace = true, optional = true }
bitflags.workspace = true
cexpr.workspace = true
clang-sys = { workspace = true, features = ["clang_11_0"] }
clap = { workspace = true, features = ["derive"], optional = true }
clap_complete = { workspace = true, optional = true }
itertools = { workspace = true }
log = { workspace = true, optional = true }
prettyplease = { workspace = true, optional = true, features = ["verbatim"] }
proc-macro2.workspace = true
quote.workspace = true
regex = { workspace = true, features = ["std", "unicode-perl"] }
rustc-hash.workspace = true
shlex.workspace = true
syn = { workspace = true, features = ["full", "extra-traits", "visit-mut"] }

Expand Down
Loading