From 5e2f4fa4eee73efd48ca7b4cba27e5c08e51f1a3 Mon Sep 17 00:00:00 2001 From: Hong Shin Date: Mon, 16 Oct 2023 10:53:16 -0700 Subject: [PATCH] Add crates_repository support for top-level protobuf WORKSPACE We're adding googletest-rust as a dependency for our rust tests, so let's ensure that our opensource build has access to the same crates. PiperOrigin-RevId: 573863399 --- Cargo.bazel.lock | 772 +++++++++++++++++++++++++++++++++++++++++++++++ Cargo.lock | 133 ++++++++ WORKSPACE | 15 + 3 files changed, 920 insertions(+) create mode 100644 Cargo.bazel.lock create mode 100644 Cargo.lock diff --git a/Cargo.bazel.lock b/Cargo.bazel.lock new file mode 100644 index 0000000000000..80674909ca38c --- /dev/null +++ b/Cargo.bazel.lock @@ -0,0 +1,772 @@ +{ + "checksum": "8bc2d235f612e77f4dca1b6886cc8bd14df348168fea27a687805ed9518a8f1a", + "crates": { + "aho-corasick 1.1.2": { + "name": "aho-corasick", + "version": "1.1.2", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/aho-corasick/1.1.2/download", + "sha256": "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" + } + }, + "targets": [ + { + "Library": { + "crate_name": "aho_corasick", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "aho_corasick", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "default", + "perf-literal", + "std" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "memchr 2.6.4", + "target": "memchr" + } + ], + "selects": {} + }, + "edition": "2021", + "version": "1.1.2" + }, + "license": "Unlicense OR MIT" + }, + "autocfg 1.1.0": { + "name": "autocfg", + "version": "1.1.0", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/autocfg/1.1.0/download", + "sha256": "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + } + }, + "targets": [ + { + "Library": { + "crate_name": "autocfg", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "autocfg", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "edition": "2015", + "version": "1.1.0" + }, + "license": "Apache-2.0 OR MIT" + }, + "direct-cargo-bazel-deps 0.0.1": { + "name": "direct-cargo-bazel-deps", + "version": "0.0.1", + "repository": null, + "targets": [ + { + "Library": { + "crate_name": "direct_cargo_bazel_deps", + "crate_root": ".direct_cargo_bazel_deps.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "direct_cargo_bazel_deps", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "googletest 0.10.0", + "target": "googletest" + } + ], + "selects": {} + }, + "edition": "2018", + "version": "0.0.1" + }, + "license": null + }, + "googletest 0.10.0": { + "name": "googletest", + "version": "0.10.0", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/googletest/0.10.0/download", + "sha256": "09213705c85aa0e4b4fff44a3a826a556979a34a266df6bcda703a49c69fb61e" + } + }, + "targets": [ + { + "Library": { + "crate_name": "googletest", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "googletest", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "num-traits 0.2.17", + "target": "num_traits" + }, + { + "id": "regex 1.10.0", + "target": "regex" + } + ], + "selects": {} + }, + "edition": "2021", + "proc_macro_deps": { + "common": [ + { + "id": "googletest_macro 0.10.0", + "target": "googletest_macro" + }, + { + "id": "rustversion 1.0.14", + "target": "rustversion" + } + ], + "selects": {} + }, + "version": "0.10.0" + }, + "license": "Apache-2.0" + }, + "googletest_macro 0.10.0": { + "name": "googletest_macro", + "version": "0.10.0", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/googletest_macro/0.10.0/download", + "sha256": "005e4cb962c56efd249bdeeb4ac232b11e1c45a2e49793bba2b2982dcc3f2e9d" + } + }, + "targets": [ + { + "ProcMacro": { + "crate_name": "googletest_macro", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "googletest_macro", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "quote 1.0.33", + "target": "quote" + }, + { + "id": "syn 2.0.38", + "target": "syn" + } + ], + "selects": {} + }, + "edition": "2021", + "version": "0.10.0" + }, + "license": "Apache-2.0" + }, + "memchr 2.6.4": { + "name": "memchr", + "version": "2.6.4", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/memchr/2.6.4/download", + "sha256": "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + } + }, + "targets": [ + { + "Library": { + "crate_name": "memchr", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "memchr", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "alloc", + "default", + "std" + ], + "selects": {} + }, + "edition": "2021", + "version": "2.6.4" + }, + "license": "Unlicense OR MIT" + }, + "num-traits 0.2.17": { + "name": "num-traits", + "version": "0.2.17", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/num-traits/0.2.17/download", + "sha256": "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" + } + }, + "targets": [ + { + "Library": { + "crate_name": "num_traits", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + }, + { + "BuildScript": { + "crate_name": "build_script_build", + "crate_root": "build.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "num_traits", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "default", + "std" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "num-traits 0.2.17", + "target": "build_script_build" + } + ], + "selects": {} + }, + "edition": "2018", + "version": "0.2.17" + }, + "build_script_attrs": { + "data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "autocfg 1.1.0", + "target": "autocfg" + } + ], + "selects": {} + } + }, + "license": "MIT OR Apache-2.0" + }, + "proc-macro2 1.0.69": { + "name": "proc-macro2", + "version": "1.0.69", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/proc-macro2/1.0.69/download", + "sha256": "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" + } + }, + "targets": [ + { + "Library": { + "crate_name": "proc_macro2", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + }, + { + "BuildScript": { + "crate_name": "build_script_build", + "crate_root": "build.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "proc_macro2", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "proc-macro" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "proc-macro2 1.0.69", + "target": "build_script_build" + }, + { + "id": "unicode-ident 1.0.12", + "target": "unicode_ident" + } + ], + "selects": {} + }, + "edition": "2021", + "version": "1.0.69" + }, + "build_script_attrs": { + "data_glob": [ + "**" + ] + }, + "license": "MIT OR Apache-2.0" + }, + "quote 1.0.33": { + "name": "quote", + "version": "1.0.33", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/quote/1.0.33/download", + "sha256": "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" + } + }, + "targets": [ + { + "Library": { + "crate_name": "quote", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "quote", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "default", + "proc-macro" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "proc-macro2 1.0.69", + "target": "proc_macro2" + } + ], + "selects": {} + }, + "edition": "2018", + "version": "1.0.33" + }, + "license": "MIT OR Apache-2.0" + }, + "regex 1.10.0": { + "name": "regex", + "version": "1.10.0", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/regex/1.10.0/download", + "sha256": "d119d7c7ca818f8a53c300863d4f87566aac09943aef5b355bb83969dae75d87" + } + }, + "targets": [ + { + "Library": { + "crate_name": "regex", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "regex", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "default", + "perf", + "perf-backtrack", + "perf-cache", + "perf-dfa", + "perf-inline", + "perf-literal", + "perf-onepass", + "std", + "unicode", + "unicode-age", + "unicode-bool", + "unicode-case", + "unicode-gencat", + "unicode-perl", + "unicode-script", + "unicode-segment" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "aho-corasick 1.1.2", + "target": "aho_corasick" + }, + { + "id": "memchr 2.6.4", + "target": "memchr" + }, + { + "id": "regex-automata 0.4.1", + "target": "regex_automata" + }, + { + "id": "regex-syntax 0.8.1", + "target": "regex_syntax" + } + ], + "selects": {} + }, + "edition": "2021", + "version": "1.10.0" + }, + "license": "MIT OR Apache-2.0" + }, + "regex-automata 0.4.1": { + "name": "regex-automata", + "version": "0.4.1", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/regex-automata/0.4.1/download", + "sha256": "465c6fc0621e4abc4187a2bda0937bfd4f722c2730b29562e19689ea796c9a4b" + } + }, + "targets": [ + { + "Library": { + "crate_name": "regex_automata", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "regex_automata", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "alloc", + "dfa-onepass", + "hybrid", + "meta", + "nfa-backtrack", + "nfa-pikevm", + "nfa-thompson", + "perf-inline", + "perf-literal", + "perf-literal-multisubstring", + "perf-literal-substring", + "std", + "syntax", + "unicode", + "unicode-age", + "unicode-bool", + "unicode-case", + "unicode-gencat", + "unicode-perl", + "unicode-script", + "unicode-segment", + "unicode-word-boundary" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "aho-corasick 1.1.2", + "target": "aho_corasick" + }, + { + "id": "memchr 2.6.4", + "target": "memchr" + }, + { + "id": "regex-syntax 0.8.1", + "target": "regex_syntax" + } + ], + "selects": {} + }, + "edition": "2021", + "version": "0.4.1" + }, + "license": "MIT OR Apache-2.0" + }, + "regex-syntax 0.8.1": { + "name": "regex-syntax", + "version": "0.8.1", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/regex-syntax/0.8.1/download", + "sha256": "56d84fdd47036b038fc80dd333d10b6aab10d5d31f4a366e20014def75328d33" + } + }, + "targets": [ + { + "Library": { + "crate_name": "regex_syntax", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "regex_syntax", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "default", + "std", + "unicode", + "unicode-age", + "unicode-bool", + "unicode-case", + "unicode-gencat", + "unicode-perl", + "unicode-script", + "unicode-segment" + ], + "selects": {} + }, + "edition": "2021", + "version": "0.8.1" + }, + "license": "MIT OR Apache-2.0" + }, + "rustversion 1.0.14": { + "name": "rustversion", + "version": "1.0.14", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/rustversion/1.0.14/download", + "sha256": "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + } + }, + "targets": [ + { + "ProcMacro": { + "crate_name": "rustversion", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + }, + { + "BuildScript": { + "crate_name": "build_script_build", + "crate_root": "build/build.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "rustversion", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "rustversion 1.0.14", + "target": "build_script_build" + } + ], + "selects": {} + }, + "edition": "2018", + "version": "1.0.14" + }, + "build_script_attrs": { + "data_glob": [ + "**" + ] + }, + "license": "MIT OR Apache-2.0" + }, + "syn 2.0.38": { + "name": "syn", + "version": "2.0.38", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/syn/2.0.38/download", + "sha256": "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" + } + }, + "targets": [ + { + "Library": { + "crate_name": "syn", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "syn", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "clone-impls", + "default", + "derive", + "full", + "parsing", + "printing", + "proc-macro", + "quote" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "proc-macro2 1.0.69", + "target": "proc_macro2" + }, + { + "id": "quote 1.0.33", + "target": "quote" + }, + { + "id": "unicode-ident 1.0.12", + "target": "unicode_ident" + } + ], + "selects": {} + }, + "edition": "2021", + "version": "2.0.38" + }, + "license": "MIT OR Apache-2.0" + }, + "unicode-ident 1.0.12": { + "name": "unicode-ident", + "version": "1.0.12", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/unicode-ident/1.0.12/download", + "sha256": "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + } + }, + "targets": [ + { + "Library": { + "crate_name": "unicode_ident", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "unicode_ident", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "edition": "2018", + "version": "1.0.12" + }, + "license": "(MIT OR Apache-2.0) AND Unicode-DFS-2016" + } + }, + "binary_crates": [], + "workspace_members": { + "direct-cargo-bazel-deps 0.0.1": "" + }, + "conditions": {} +} + diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000000000..e075e9722c519 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,133 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "direct-cargo-bazel-deps" +version = "0.0.1" +dependencies = [ + "googletest", +] + +[[package]] +name = "googletest" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09213705c85aa0e4b4fff44a3a826a556979a34a266df6bcda703a49c69fb61e" +dependencies = [ + "googletest_macro", + "num-traits", + "regex", + "rustversion", +] + +[[package]] +name = "googletest_macro" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "005e4cb962c56efd249bdeeb4ac232b11e1c45a2e49793bba2b2982dcc3f2e9d" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d119d7c7ca818f8a53c300863d4f87566aac09943aef5b355bb83969dae75d87" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465c6fc0621e4abc4187a2bda0937bfd4f722c2730b29562e19689ea796c9a4b" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56d84fdd47036b038fc80dd333d10b6aab10d5d31f4a366e20014def75328d33" + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "syn" +version = "2.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + diff --git a/WORKSPACE b/WORKSPACE index 08152679d9464..2c665be1a88db 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -183,3 +183,18 @@ load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_regi rules_rust_dependencies() rust_register_toolchains(edition = "2021") +load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_repository") +# to repin, invoke `CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index` +crates_repository( + name = "crate_index", + cargo_lockfile = "//:Cargo.lock", + lockfile = "//:Cargo.bazel.lock", + packages = { + "googletest": crate.spec( + version = ">0.0.0", + ), + }, +) + +load("@crate_index//:defs.bzl", "crate_repositories") +crate_repositories()