From 8ef8a07883faa2c7a2ec8eab407a76f56e5f6e8d Mon Sep 17 00:00:00 2001 From: Mark Karpov Date: Wed, 1 Feb 2023 17:38:03 +0100 Subject: [PATCH] Update the Rust toolchain example Update `rules_rust` to 0.17.0. --- examples/toolchains/rust/Cargo.lock | 147 +++++++ examples/toolchains/rust/README.md | 6 +- examples/toolchains/rust/WORKSPACE | 13 +- ...Cargo.Bazel.lock => cargo-bazel-lock.json} | 404 ++++++++---------- examples/toolchains/rust/nixpkgs.json | 6 +- .../001-rules-rust-crate-universe.patch | 56 +-- 6 files changed, 362 insertions(+), 270 deletions(-) create mode 100644 examples/toolchains/rust/Cargo.lock rename examples/toolchains/rust/{Cargo.Bazel.lock => cargo-bazel-lock.json} (71%) diff --git a/examples/toolchains/rust/Cargo.lock b/examples/toolchains/rust/Cargo.lock new file mode 100644 index 000000000..f586e793d --- /dev/null +++ b/examples/toolchains/rust/Cargo.lock @@ -0,0 +1,147 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "direct-cargo-bazel-deps" +version = "0.0.1" +dependencies = [ + "openssl", +] + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "libc" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "once_cell" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" + +[[package]] +name = "openssl" +version = "0.10.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-sys" +version = "0.9.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "pkg-config" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" + +[[package]] +name = "proc-macro2" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "syn" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" diff --git a/examples/toolchains/rust/README.md b/examples/toolchains/rust/README.md index 60be33926..af722d17c 100644 --- a/examples/toolchains/rust/README.md +++ b/examples/toolchains/rust/README.md @@ -2,14 +2,14 @@ Rust Toolchain Example ====================== This is an example Rust project that uses `rules_rust`. -It showcases the integration nix, giving concrete example of how to approach project compilation with dependency on OpenSSL library. +It showcases the integration nix, giving concrete example of how to approach project compilation with dependency on OpenSSL library. -If the Nix package manager is present in the build environment, this example will use Nix to provide the Rust toolchain. +If the Nix package manager is present in the build environment, this example will use Nix to provide the Rust toolchain. Otherwise, it will fail (it is possible to make the example run without nix, however it greatly obfuscates the core of the matter). # Usage To run the example with Nix, issue the following command: ``` -nix-shell --command 'bazel run --config=nix :hello' +nix-shell --command 'bazel run --config=nix //:hello' ``` diff --git a/examples/toolchains/rust/WORKSPACE b/examples/toolchains/rust/WORKSPACE index 0d5b8f6c8..6c27780f2 100644 --- a/examples/toolchains/rust/WORKSPACE +++ b/examples/toolchains/rust/WORKSPACE @@ -9,12 +9,12 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # https://bazelbuild.github.io/rules_rust/#setup http_archive( name = "rules_rust", - sha256 = "73580f341f251f2fc633b73cdf74910f4da64d06a44c063cbf5c01b1de753ec1", + sha256 = "d125fb75432dc3b20e9b5a19347b45ec607fabe75f98c6c4ba9badaab9c193ce", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_rust/releases/download/0.5.0/rules_rust-v0.5.0.tar.gz", - "https://github.com/bazelbuild/rules_rust/releases/download/0.5.0/rules_rust-v0.5.0.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/rules_rust/releases/download/0.17.0/rules_rust-v0.17.0.tar.gz", + "https://github.com/bazelbuild/rules_rust/releases/download/0.17.0/rules_rust-v0.17.0.tar.gz", ], - # rules_rust 0.5.0 does not yet support direct + # rules_rust 0.17.0 does not yet support direct # overriding toolchain used for build of cargo-bazel # binary. # On non-standard systems (viz. NixOS), that approach @@ -22,7 +22,7 @@ http_archive( # cannot build cargo bazel. # This patch fixes the issue, allowing for toolchain # specification. - # + # # Note: This should be removed as soon as # issue in rules_rust is resolved. patches = [ @@ -118,7 +118,8 @@ crates_repository( OPENSSL_CRATE_ANNOTATION ], }, - lockfile = "//:Cargo.Bazel.lock", + cargo_lockfile = "//:Cargo.lock", + lockfile = "//:cargo-bazel-lock.json", packages = { "openssl": crate.spec( version = "0.10.40", diff --git a/examples/toolchains/rust/Cargo.Bazel.lock b/examples/toolchains/rust/cargo-bazel-lock.json similarity index 71% rename from examples/toolchains/rust/Cargo.Bazel.lock rename to examples/toolchains/rust/cargo-bazel-lock.json index 818a893bb..e316aa32a 100644 --- a/examples/toolchains/rust/Cargo.Bazel.lock +++ b/examples/toolchains/rust/cargo-bazel-lock.json @@ -1,5 +1,5 @@ { - "checksum": "fbf2ac86afdf1deebf0077180cb043f3c9742938b2a2b555b819d895b0528f4a", + "checksum": "59ace66e05f26b5ab71bdc99a930d8b1bafdb232f70f60ad13c15599bc4a49a4", "crates": { "autocfg 1.1.0": { "name": "autocfg", @@ -15,12 +15,9 @@ "Library": { "crate_name": "autocfg", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -48,12 +45,9 @@ "Library": { "crate_name": "bitflags", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -70,13 +64,13 @@ }, "license": "MIT/Apache-2.0" }, - "cc 1.0.73": { + "cc 1.0.79": { "name": "cc", - "version": "1.0.73", + "version": "1.0.79", "repository": { "Http": { - "url": "https://crates.io/api/v1/crates/cc/1.0.73/download", - "sha256": "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" + "url": "https://crates.io/api/v1/crates/cc/1.0.79/download", + "sha256": "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" } }, "targets": [ @@ -84,24 +78,9 @@ "Library": { "crate_name": "cc", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } - } - }, - { - "Binary": { - "crate_name": "gcc-shim", - "crate_root": "src/bin/gcc-shim.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -111,9 +90,9 @@ "**" ], "edition": "2018", - "version": "1.0.73" + "version": "1.0.79" }, - "license": "MIT/Apache-2.0" + "license": "MIT OR Apache-2.0" }, "cfg-if 1.0.0": { "name": "cfg-if", @@ -129,12 +108,9 @@ "Library": { "crate_name": "cfg_if", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -157,12 +133,9 @@ "Library": { "crate_name": "direct_cargo_bazel_deps", "crate_root": ".direct_cargo_bazel_deps.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -174,7 +147,7 @@ "deps": { "common": [ { - "id": "openssl 0.10.40", + "id": "openssl 0.10.45", "target": "openssl" } ], @@ -199,12 +172,9 @@ "Library": { "crate_name": "foreign_types", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -241,12 +211,9 @@ "Library": { "crate_name": "foreign_types_shared", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -260,13 +227,13 @@ }, "license": "MIT/Apache-2.0" }, - "libc 0.2.126": { + "libc 0.2.139": { "name": "libc", - "version": "0.2.126", + "version": "0.2.139", "repository": { "Http": { - "url": "https://crates.io/api/v1/crates/libc/0.2.126/download", - "sha256": "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" + "url": "https://crates.io/api/v1/crates/libc/0.2.139/download", + "sha256": "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" } }, "targets": [ @@ -274,24 +241,18 @@ "Library": { "crate_name": "libc", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } }, { "BuildScript": { "crate_name": "build_script_build", "crate_root": "build.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -307,14 +268,14 @@ "deps": { "common": [ { - "id": "libc 0.2.126", + "id": "libc 0.2.139", "target": "build_script_build" } ], "selects": {} }, "edition": "2015", - "version": "0.2.126" + "version": "0.2.139" }, "build_script_attrs": { "data_glob": [ @@ -323,13 +284,13 @@ }, "license": "MIT OR Apache-2.0" }, - "once_cell 1.12.0": { + "once_cell 1.17.0": { "name": "once_cell", - "version": "1.12.0", + "version": "1.17.0", "repository": { "Http": { - "url": "https://crates.io/api/v1/crates/once_cell/1.12.0/download", - "sha256": "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" + "url": "https://crates.io/api/v1/crates/once_cell/1.17.0/download", + "sha256": "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" } }, "targets": [ @@ -337,12 +298,9 @@ "Library": { "crate_name": "once_cell", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -357,18 +315,18 @@ "race", "std" ], - "edition": "2018", - "version": "1.12.0" + "edition": "2021", + "version": "1.17.0" }, "license": "MIT OR Apache-2.0" }, - "openssl 0.10.40": { + "openssl 0.10.45": { "name": "openssl", - "version": "0.10.40", + "version": "0.10.45", "repository": { "Http": { - "url": "https://crates.io/api/v1/crates/openssl/0.10.40/download", - "sha256": "fb81a6430ac911acb25fe5ac8f1d2af1b4ea8a4fdfda0f1ee4292af2e2d8eb0e" + "url": "https://crates.io/api/v1/crates/openssl/0.10.45/download", + "sha256": "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" } }, "targets": [ @@ -376,24 +334,18 @@ "Library": { "crate_name": "openssl", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } }, { "BuildScript": { "crate_name": "build_script_build", "crate_root": "build.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -402,6 +354,9 @@ "compile_data_glob": [ "**" ], + "crate_features": [ + "default" + ], "deps": { "common": [ { @@ -417,19 +372,19 @@ "target": "foreign_types" }, { - "id": "libc 0.2.126", + "id": "libc 0.2.139", "target": "libc" }, { - "id": "once_cell 1.12.0", + "id": "once_cell 1.17.0", "target": "once_cell" }, { - "id": "openssl 0.10.40", + "id": "openssl 0.10.45", "target": "build_script_build" }, { - "id": "openssl-sys 0.9.74", + "id": "openssl-sys 0.9.80", "target": "openssl_sys", "alias": "ffi" } @@ -446,7 +401,7 @@ ], "selects": {} }, - "version": "0.10.40" + "version": "0.10.45" }, "build_script_attrs": { "data_glob": [ @@ -455,7 +410,7 @@ "deps": { "common": [ { - "id": "openssl-sys 0.9.74", + "id": "openssl-sys 0.9.80", "target": "openssl_sys", "alias": "ffi" } @@ -479,12 +434,9 @@ "ProcMacro": { "crate_name": "openssl_macros", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -496,15 +448,15 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.39", + "id": "proc-macro2 1.0.50", "target": "proc_macro2" }, { - "id": "quote 1.0.18", + "id": "quote 1.0.23", "target": "quote" }, { - "id": "syn 1.0.96", + "id": "syn 1.0.107", "target": "syn" } ], @@ -515,13 +467,13 @@ }, "license": "MIT/Apache-2.0" }, - "openssl-sys 0.9.74": { + "openssl-sys 0.9.80": { "name": "openssl-sys", - "version": "0.9.74", + "version": "0.9.80", "repository": { "Http": { - "url": "https://crates.io/api/v1/crates/openssl-sys/0.9.74/download", - "sha256": "835363342df5fba8354c5b453325b110ffd54044e588c539cf2f20a8014e4cb1" + "url": "https://crates.io/api/v1/crates/openssl-sys/0.9.80/download", + "sha256": "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" } }, "targets": [ @@ -529,24 +481,18 @@ "Library": { "crate_name": "openssl_sys", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } }, { "BuildScript": { "crate_name": "build_script_main", "crate_root": "build/main.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -564,24 +510,21 @@ "deps": { "common": [ { - "id": "libc 0.2.126", + "id": "libc 0.2.139", "target": "libc" }, { - "id": "openssl-sys 0.9.74", + "id": "openssl-sys 0.9.80", "target": "build_script_main" } ], "selects": {} }, "edition": "2015", - "rustc_flags": { - "common": [ - "-Lexternal/openssl-static/lib" - ], - "selects": {} - }, - "version": "0.9.74" + "rustc_flags": [ + "-Lexternal/openssl-static/lib" + ], + "version": "0.9.80" }, "build_script_attrs": { "data": { @@ -601,11 +544,11 @@ "target": "autocfg" }, { - "id": "cc 1.0.73", + "id": "cc 1.0.79", "target": "cc" }, { - "id": "pkg-config 0.3.25", + "id": "pkg-config 0.3.26", "target": "pkg_config" } ], @@ -630,13 +573,13 @@ }, "license": "MIT" }, - "pkg-config 0.3.25": { + "pkg-config 0.3.26": { "name": "pkg-config", - "version": "0.3.25", + "version": "0.3.26", "repository": { "Http": { - "url": "https://crates.io/api/v1/crates/pkg-config/0.3.25/download", - "sha256": "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" + "url": "https://crates.io/api/v1/crates/pkg-config/0.3.26/download", + "sha256": "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" } }, "targets": [ @@ -644,12 +587,9 @@ "Library": { "crate_name": "pkg_config", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -659,17 +599,17 @@ "**" ], "edition": "2015", - "version": "0.3.25" + "version": "0.3.26" }, "license": "MIT OR Apache-2.0" }, - "proc-macro2 1.0.39": { + "proc-macro2 1.0.50": { "name": "proc-macro2", - "version": "1.0.39", + "version": "1.0.50", "repository": { "Http": { - "url": "https://crates.io/api/v1/crates/proc-macro2/1.0.39/download", - "sha256": "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" + "url": "https://crates.io/api/v1/crates/proc-macro2/1.0.50/download", + "sha256": "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" } }, "targets": [ @@ -677,24 +617,18 @@ "Library": { "crate_name": "proc_macro2", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } }, { "BuildScript": { "crate_name": "build_script_build", "crate_root": "build.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -710,18 +644,18 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.39", + "id": "proc-macro2 1.0.50", "target": "build_script_build" }, { - "id": "unicode-ident 1.0.0", + "id": "unicode-ident 1.0.6", "target": "unicode_ident" } ], "selects": {} }, "edition": "2018", - "version": "1.0.39" + "version": "1.0.50" }, "build_script_attrs": { "data_glob": [ @@ -730,13 +664,13 @@ }, "license": "MIT OR Apache-2.0" }, - "quote 1.0.18": { + "quote 1.0.23": { "name": "quote", - "version": "1.0.18", + "version": "1.0.23", "repository": { "Http": { - "url": "https://crates.io/api/v1/crates/quote/1.0.18/download", - "sha256": "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" + "url": "https://crates.io/api/v1/crates/quote/1.0.23/download", + "sha256": "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" } }, "targets": [ @@ -744,12 +678,18 @@ "Library": { "crate_name": "quote", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] + } + }, + { + "BuildScript": { + "crate_name": "build_script_build", + "crate_root": "build.rs", + "srcs": [ + "**/*.rs" + ] } } ], @@ -765,24 +705,33 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.39", + "id": "proc-macro2 1.0.50", "target": "proc_macro2" + }, + { + "id": "quote 1.0.23", + "target": "build_script_build" } ], "selects": {} }, "edition": "2018", - "version": "1.0.18" + "version": "1.0.23" + }, + "build_script_attrs": { + "data_glob": [ + "**" + ] }, "license": "MIT OR Apache-2.0" }, - "syn 1.0.96": { + "syn 1.0.107": { "name": "syn", - "version": "1.0.96", + "version": "1.0.107", "repository": { "Http": { - "url": "https://crates.io/api/v1/crates/syn/1.0.96/download", - "sha256": "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" + "url": "https://crates.io/api/v1/crates/syn/1.0.107/download", + "sha256": "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" } }, "targets": [ @@ -790,24 +739,18 @@ "Library": { "crate_name": "syn", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } }, { "BuildScript": { "crate_name": "build_script_build", "crate_root": "build.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -829,26 +772,26 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.39", + "id": "proc-macro2 1.0.50", "target": "proc_macro2" }, { - "id": "quote 1.0.18", + "id": "quote 1.0.23", "target": "quote" }, { - "id": "syn 1.0.96", + "id": "syn 1.0.107", "target": "build_script_build" }, { - "id": "unicode-ident 1.0.0", + "id": "unicode-ident 1.0.6", "target": "unicode_ident" } ], "selects": {} }, "edition": "2018", - "version": "1.0.96" + "version": "1.0.107" }, "build_script_attrs": { "data_glob": [ @@ -857,13 +800,13 @@ }, "license": "MIT OR Apache-2.0" }, - "unicode-ident 1.0.0": { + "unicode-ident 1.0.6": { "name": "unicode-ident", - "version": "1.0.0", + "version": "1.0.6", "repository": { "Http": { - "url": "https://crates.io/api/v1/crates/unicode-ident/1.0.0/download", - "sha256": "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" + "url": "https://crates.io/api/v1/crates/unicode-ident/1.0.6/download", + "sha256": "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" } }, "targets": [ @@ -871,12 +814,9 @@ "Library": { "crate_name": "unicode_ident", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -886,9 +826,9 @@ "**" ], "edition": "2018", - "version": "1.0.0" + "version": "1.0.6" }, - "license": "MIT OR Apache-2.0" + "license": "(MIT OR Apache-2.0) AND Unicode-DFS-2016" }, "vcpkg 0.2.15": { "name": "vcpkg", @@ -904,12 +844,9 @@ "Library": { "crate_name": "vcpkg", "crate_root": "src/lib.rs", - "srcs": { - "include": [ - "**/*.rs" - ], - "exclude": [] - } + "srcs": [ + "**/*.rs" + ] } } ], @@ -924,14 +861,13 @@ "license": "MIT/Apache-2.0" } }, - "binary_crates": [ - "cc 1.0.73" - ], + "binary_crates": [], "workspace_members": { "direct-cargo-bazel-deps 0.0.1": "" }, "conditions": { "cfg(target_env = \"msvc\")": [ + "aarch64-pc-windows-msvc", "i686-pc-windows-msvc", "x86_64-pc-windows-msvc" ] diff --git a/examples/toolchains/rust/nixpkgs.json b/examples/toolchains/rust/nixpkgs.json index 524887447..2542221a5 100644 --- a/examples/toolchains/rust/nixpkgs.json +++ b/examples/toolchains/rust/nixpkgs.json @@ -1,7 +1,7 @@ { "owner": "NixOS", "repo": "nixpkgs", - "branch": "22.05", - "rev": "ce6aa13369b667ac2542593170993504932eb836", - "sha256": "0d643wp3l77hv2pmg2fi7vyxn4rwy0iyr8djcw1h5x72315ck9ik" + "branch": "22.11", + "rev": "f413457e0dd7a42adefdbcea4391dd9751509025", + "sha256": "sha256-F7/F65ZFWbq7cKSiV3K2acxCv64jKaZZ/K0A3VNT2kA=" } diff --git a/examples/toolchains/rust/patches/001-rules-rust-crate-universe.patch b/examples/toolchains/rust/patches/001-rules-rust-crate-universe.patch index c7efda127..04c41bba6 100644 --- a/examples/toolchains/rust/patches/001-rules-rust-crate-universe.patch +++ b/examples/toolchains/rust/patches/001-rules-rust-crate-universe.patch @@ -1,22 +1,29 @@ diff --git crate_universe/deps_bootstrap.bzl crate_universe/deps_bootstrap.bzl -index 28f6d14..a2eeb3a 100644 +index 28f6d14b..6a930dff 100644 --- crate_universe/deps_bootstrap.bzl +++ crate_universe/deps_bootstrap.bzl -@@ -6,7 +6,12 @@ load("//crate_universe/private:srcs.bzl", "CARGO_BAZEL_SRCS") +@@ -6,12 +6,19 @@ load("//crate_universe/private:srcs.bzl", "CARGO_BAZEL_SRCS") # buildifier: disable=bzl-visibility load("//rust/private:common.bzl", "rust_common") -def cargo_bazel_bootstrap(name = "cargo_bazel_bootstrap", rust_version = rust_common.default_version): +def cargo_bazel_bootstrap( -+ name = "cargo_bazel_bootstrap", -+ rust_version = rust_common.default_version, -+ rust_toolchain_cargo_template = "@rust_{system}_{arch}//:bin/{tool}", -+ rust_toolchain_rustc_template = "@rust_{system}_{arch}//:bin/{tool}", ++ name = "cargo_bazel_bootstrap", ++ rust_version = rust_common.default_version, ++ rust_toolchain_cargo_template = "@rust_{system}_{arch}//:bin/{tool}", ++ rust_toolchain_rustc_template = "@rust_{system}_{arch}//:bin/{tool}", + ): """An optional repository which bootstraps `cargo-bazel` for use with `crates_repository` Args: -@@ -22,4 +27,6 @@ def cargo_bazel_bootstrap(name = "cargo_bazel_bootstrap", rust_version = rust_co + name (str, optional): The name of the `cargo_bootstrap_repository`. + rust_version (str, optional): The rust version to use. Defaults to the default of `cargo_bootstrap_repository`. ++ rust_toolchain_cargo_template (str, optional): The template to use for finding the host `cargo` binary. ++ rust_toolchain_rustc_template (str, optional): The template to use for finding the host `rustc` binary. + """ + cargo_bootstrap_repository( + name = name, +@@ -22,4 +29,6 @@ def cargo_bazel_bootstrap(name = "cargo_bazel_bootstrap", rust_version = rust_co version = rust_version, # The increased timeout helps avoid flakes in CI timeout = 900, @@ -24,20 +31,20 @@ index 28f6d14..a2eeb3a 100644 + rust_toolchain_rustc_template = rust_toolchain_rustc_template, ) diff --git crate_universe/repositories.bzl crate_universe/repositories.bzl -index 0dded9b..fefc00a 100644 +index c06e06d9..7b7f3f9e 100644 --- crate_universe/repositories.bzl +++ crate_universe/repositories.bzl -@@ -31,16 +31,27 @@ _MANIFESTS = [ - "@rules_rust//crate_universe/tools/urls_generator:Cargo.toml", - ] +@@ -7,17 +7,28 @@ load("//crate_universe/3rdparty/crates:crates.bzl", _vendor_crate_repositories = + load("//crate_universe/private:vendor_utils.bzl", "crates_vendor_deps") + load("//crate_universe/tools/cross_installer:cross_installer_deps.bzl", "cross_installer_deps") -def crate_universe_dependencies(rust_version = rust_common.default_version, bootstrap = False): +def crate_universe_dependencies( -+ rust_version = rust_common.default_version, -+ bootstrap = False, -+ rust_toolchain_cargo_template = "@rust_{system}_{arch}//:bin/{tool}", -+ rust_toolchain_rustc_template = "@rust_{system}_{arch}//:bin/{tool}", -+ ): ++ rust_version = rust_common.default_version, ++ bootstrap = False, ++ rust_toolchain_cargo_template = "@rust_{system}_{arch}//:bin/{tool}", ++ rust_toolchain_rustc_template = "@rust_{system}_{arch}//:bin/{tool}", ++): """Define dependencies of the `cargo-bazel` Rust target Args: @@ -48,12 +55,13 @@ index 0dded9b..fefc00a 100644 """ third_party_deps() -- cargo_bazel_bootstrap(rust_version = rust_version) -+ cargo_bazel_bootstrap( -+ rust_version = rust_version, -+ rust_toolchain_cargo_template = rust_toolchain_cargo_template, -+ rust_toolchain_rustc_template = rust_toolchain_rustc_template, -+ ) + if bootstrap: +- cargo_bazel_bootstrap(rust_version = rust_version) ++ cargo_bazel_bootstrap( ++ rust_version = rust_version, ++ rust_toolchain_cargo_template = rust_toolchain_cargo_template, ++ rust_toolchain_rustc_template = rust_toolchain_rustc_template, ++ ) + + _vendor_crate_repositories() - if USE_CRATES_REPOSITORY: - crates_repository(