diff --git a/.github/workflows/bindgen.yml b/.github/workflows/bindgen.yml index d1a11712d0..836052a5a6 100644 --- a/.github/workflows/bindgen.yml +++ b/.github/workflows/bindgen.yml @@ -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 diff --git a/Cargo.toml b/Cargo.toml index 31c386bc26..87b464aa50 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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] diff --git a/bindgen-cli/Cargo.toml b/bindgen-cli/Cargo.toml index d6ab1b06e2..09a3f554f7 100644 --- a/bindgen-cli/Cargo.toml +++ b/bindgen-cli/Cargo.toml @@ -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"] @@ -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 diff --git a/bindgen-integration/Cargo.toml b/bindgen-integration/Cargo.toml index 38b52322cc..13bbcd094d 100644 --- a/bindgen-integration/Cargo.toml +++ b/bindgen-integration/Cargo.toml @@ -4,12 +4,13 @@ description = "A package to test various bindgen features" version = "0.1.0" authors = ["Emilio Cobos Álvarez "] 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"] diff --git a/bindgen-tests/Cargo.toml b/bindgen-tests/Cargo.toml index b9547bb1ad..346be51cd7 100644 --- a/bindgen-tests/Cargo.toml +++ b/bindgen-tests/Cargo.toml @@ -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"] diff --git a/bindgen-tests/tests/expectations/Cargo.toml b/bindgen-tests/tests/expectations/Cargo.toml index e720636062..c2c39a94ec 100644 --- a/bindgen-tests/tests/expectations/Cargo.toml +++ b/bindgen-tests/tests/expectations/Cargo.toml @@ -7,13 +7,14 @@ authors = [ "Emilio Cobos Álvarez ", "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, diff --git a/bindgen-tests/tests/quickchecking/Cargo.toml b/bindgen-tests/tests/quickchecking/Cargo.toml index 998643bbf4..ca36eb1c37 100644 --- a/bindgen-tests/tests/quickchecking/Cargo.toml +++ b/bindgen-tests/tests/quickchecking/Cargo.toml @@ -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" @@ -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. diff --git a/bindgen/Cargo.toml b/bindgen/Cargo.toml index 47462e1788..dd4166de95 100644 --- a/bindgen/Cargo.toml +++ b/bindgen/Cargo.toml @@ -1,9 +1,9 @@ [package] authors = [ - "Jyun-Yan You ", - "Emilio Cobos Álvarez ", - "Nick Fitzgerald ", - "The Servo project developers", + "Jyun-Yan You ", + "Emilio Cobos Álvarez ", + "Nick Fitzgerald ", + "The Servo project developers", ] description = "Automatically generates Rust FFI bindings to C and C++ libraries." keywords = ["bindings", "ffi", "code-generation"] @@ -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"] }