From 51afa674196ef5e3b1ee09f263dffe1a5f0cdafe Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Fri, 1 Nov 2024 11:29:43 +0100 Subject: [PATCH 1/2] Use ruff-python-parser to compute Python imports The goal is to use ruff to replace Dominik's ad-hoc parser. This just adds the new code, I'll switch to using it and remove the old code in a followup. --- deps/rust/Cargo.lock | 326 +++++++++++++++++- deps/rust/cargo.bzl | 2 + deps/rust/crates/BUILD.Inflector-0.11.4.bazel | 44 +++ .../crates/BUILD.aho-corasick-1.1.3.bazel | 52 +++ deps/rust/crates/BUILD.bazel | 20 +- deps/rust/crates/BUILD.bstr-1.10.0.bazel | 54 +++ deps/rust/crates/BUILD.castaway-0.2.3.bazel | 50 +++ .../rust/crates/BUILD.compact_str-0.8.0.bazel | 58 ++++ deps/rust/crates/BUILD.either-1.13.0.bazel | 47 +++ deps/rust/crates/BUILD.getopts-0.2.21.bazel | 47 +++ deps/rust/crates/BUILD.getrandom-0.2.15.bazel | 64 ++++ deps/rust/crates/BUILD.is-macro-0.3.6.bazel | 50 +++ deps/rust/crates/BUILD.itertools-0.13.0.bazel | 52 +++ deps/rust/crates/BUILD.phf-0.11.2.bazel | 47 +++ .../crates/BUILD.phf_codegen-0.11.2.bazel | 48 +++ .../crates/BUILD.phf_generator-0.11.2.bazel | 90 +++++ .../rust/crates/BUILD.phf_shared-0.11.2.bazel | 51 +++ deps/rust/crates/BUILD.rand-0.8.5.bazel | 72 ++++ .../rust/crates/BUILD.rand_chacha-0.3.1.bazel | 51 +++ deps/rust/crates/BUILD.rand_core-0.6.4.bazel | 52 +++ .../crates/BUILD.regex-automata-0.4.8.bazel | 47 +++ .../crates/BUILD.ruff_python_ast-0.0.0.bazel | 58 ++++ .../BUILD.ruff_python_parser-0.0.0.bazel | 58 ++++ .../BUILD.ruff_python_trivia-0.0.0.bazel | 50 +++ .../crates/BUILD.ruff_source_file-0.0.0.bazel | 49 +++ .../crates/BUILD.ruff_text_size-0.0.0.bazel | 44 +++ .../crates/BUILD.rustversion-1.0.18.bazel | 103 ++++++ .../BUILD.static_assertions-1.1.0.bazel | 44 +++ deps/rust/crates/BUILD.syn-2.0.87.bazel | 1 + deps/rust/crates/BUILD.tinyvec-1.8.0.bazel | 52 +++ .../crates/BUILD.tinyvec_macros-0.1.1.bazel | 44 +++ .../BUILD.unicode-normalization-0.1.24.bazel | 51 +++ .../crates/BUILD.unicode_names2-1.3.0.bazel | 113 ++++++ ...BUILD.unicode_names2_generator-1.3.0.bazel | 53 +++ deps/rust/crates/defs.bzl | 304 ++++++++++++++++ src/rust/python-parser/BUILD | 19 + src/rust/python-parser/import_parsing.c++ | 200 +++++++++++ src/rust/python-parser/lib.rs | 40 +++ 38 files changed, 2589 insertions(+), 18 deletions(-) create mode 100644 deps/rust/crates/BUILD.Inflector-0.11.4.bazel create mode 100644 deps/rust/crates/BUILD.aho-corasick-1.1.3.bazel create mode 100644 deps/rust/crates/BUILD.bstr-1.10.0.bazel create mode 100644 deps/rust/crates/BUILD.castaway-0.2.3.bazel create mode 100644 deps/rust/crates/BUILD.compact_str-0.8.0.bazel create mode 100644 deps/rust/crates/BUILD.either-1.13.0.bazel create mode 100644 deps/rust/crates/BUILD.getopts-0.2.21.bazel create mode 100644 deps/rust/crates/BUILD.getrandom-0.2.15.bazel create mode 100644 deps/rust/crates/BUILD.is-macro-0.3.6.bazel create mode 100644 deps/rust/crates/BUILD.itertools-0.13.0.bazel create mode 100644 deps/rust/crates/BUILD.phf-0.11.2.bazel create mode 100644 deps/rust/crates/BUILD.phf_codegen-0.11.2.bazel create mode 100644 deps/rust/crates/BUILD.phf_generator-0.11.2.bazel create mode 100644 deps/rust/crates/BUILD.phf_shared-0.11.2.bazel create mode 100644 deps/rust/crates/BUILD.rand-0.8.5.bazel create mode 100644 deps/rust/crates/BUILD.rand_chacha-0.3.1.bazel create mode 100644 deps/rust/crates/BUILD.rand_core-0.6.4.bazel create mode 100644 deps/rust/crates/BUILD.regex-automata-0.4.8.bazel create mode 100644 deps/rust/crates/BUILD.ruff_python_ast-0.0.0.bazel create mode 100644 deps/rust/crates/BUILD.ruff_python_parser-0.0.0.bazel create mode 100644 deps/rust/crates/BUILD.ruff_python_trivia-0.0.0.bazel create mode 100644 deps/rust/crates/BUILD.ruff_source_file-0.0.0.bazel create mode 100644 deps/rust/crates/BUILD.ruff_text_size-0.0.0.bazel create mode 100644 deps/rust/crates/BUILD.rustversion-1.0.18.bazel create mode 100644 deps/rust/crates/BUILD.static_assertions-1.1.0.bazel create mode 100644 deps/rust/crates/BUILD.tinyvec-1.8.0.bazel create mode 100644 deps/rust/crates/BUILD.tinyvec_macros-0.1.1.bazel create mode 100644 deps/rust/crates/BUILD.unicode-normalization-0.1.24.bazel create mode 100644 deps/rust/crates/BUILD.unicode_names2-1.3.0.bazel create mode 100644 deps/rust/crates/BUILD.unicode_names2_generator-1.3.0.bazel create mode 100644 src/rust/python-parser/BUILD create mode 100644 src/rust/python-parser/import_parsing.c++ create mode 100644 src/rust/python-parser/lib.rs diff --git a/deps/rust/Cargo.lock b/deps/rust/Cargo.lock index 595de8309c9..f7283437d1a 100644 --- a/deps/rust/Cargo.lock +++ b/deps/rust/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" + [[package]] name = "addr2line" version = "0.24.2" @@ -29,6 +35,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "anstream" version = "0.6.18" @@ -111,6 +126,17 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +[[package]] +name = "bstr" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" +dependencies = [ + "memchr", + "regex-automata", + "serde", +] + [[package]] name = "byteorder" version = "1.5.0" @@ -141,6 +167,15 @@ dependencies = [ "capnp", ] +[[package]] +name = "castaway" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0abae9be0aaf9ea96a3b1b8b1b55c602ca751eba1b1500220cea4ecbafe7c0d5" +dependencies = [ + "rustversion", +] + [[package]] name = "cc" version = "1.1.37" @@ -228,6 +263,20 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +[[package]] +name = "compact_str" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644" +dependencies = [ + "castaway", + "cfg-if", + "itoa 1.0.11", + "rustversion", + "ryu", + "static_assertions", +] + [[package]] name = "convert_case" version = "0.4.0" @@ -253,7 +302,7 @@ dependencies = [ "dtoa-short", "itoa 0.4.8", "matches", - "phf", + "phf 0.8.0", "proc-macro2", "quote", "smallvec", @@ -343,6 +392,8 @@ dependencies = [ "pico-args", "proc-macro2", "quote", + "ruff_python_ast", + "ruff_python_parser", "serde", "serde_json", "syn 2.0.87", @@ -365,6 +416,12 @@ dependencies = [ "dtoa", ] +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + [[package]] name = "embedded-io" version = "0.6.1" @@ -399,6 +456,15 @@ dependencies = [ "byteorder", ] +[[package]] +name = "getopts" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +dependencies = [ + "unicode-width", +] + [[package]] name = "getrandom" version = "0.1.16" @@ -410,6 +476,17 @@ dependencies = [ "wasi 0.9.0+wasi-snapshot-preview1", ] +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + [[package]] name = "gimli" version = "0.31.1" @@ -437,12 +514,33 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +[[package]] +name = "is-macro" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2069faacbe981460232f880d26bf3c7634e322d49053aa48c27e3ae642f728f1" +dependencies = [ + "Inflector", + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "is_terminal_polyfill" version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "0.4.8" @@ -597,18 +695,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" dependencies = [ "phf_macros", - "phf_shared", + "phf_shared 0.8.0", "proc-macro-hack", ] +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_shared 0.11.2", +] + [[package]] name = "phf_codegen" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.8.0", + "phf_shared 0.8.0", +] + +[[package]] +name = "phf_codegen" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" +dependencies = [ + "phf_generator 0.11.2", + "phf_shared 0.11.2", ] [[package]] @@ -617,8 +734,18 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" dependencies = [ - "phf_shared", - "rand", + "phf_shared 0.8.0", + "rand 0.7.3", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared 0.11.2", + "rand 0.8.5", ] [[package]] @@ -627,8 +754,8 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.8.0", + "phf_shared 0.8.0", "proc-macro-hack", "proc-macro2", "quote", @@ -644,6 +771,15 @@ dependencies = [ "siphasher", ] +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + [[package]] name = "pico-args" version = "0.5.0" @@ -701,14 +837,25 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", + "getrandom 0.1.16", "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.2.2", + "rand_core 0.5.1", "rand_hc", "rand_pcg", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + [[package]] name = "rand_chacha" version = "0.2.2" @@ -716,7 +863,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", ] [[package]] @@ -725,7 +882,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.15", ] [[package]] @@ -734,7 +900,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core", + "rand_core 0.5.1", ] [[package]] @@ -743,9 +909,77 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "regex-automata" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" + +[[package]] +name = "ruff_python_ast" +version = "0.0.0" +source = "git+https://github.com/astral-sh/ruff.git?tag=0.7.0#5e6de4e0c69660e8ca8608d1ac965216197756ce" +dependencies = [ + "aho-corasick", + "bitflags 2.6.0", + "compact_str", + "is-macro", + "itertools", + "once_cell", + "ruff_python_trivia", + "ruff_source_file", + "ruff_text_size", + "rustc-hash", +] + +[[package]] +name = "ruff_python_parser" +version = "0.0.0" +source = "git+https://github.com/astral-sh/ruff.git?tag=0.7.0#5e6de4e0c69660e8ca8608d1ac965216197756ce" +dependencies = [ + "bitflags 2.6.0", + "bstr", + "compact_str", + "memchr", + "ruff_python_ast", + "ruff_python_trivia", + "ruff_text_size", + "rustc-hash", + "static_assertions", + "unicode-ident", + "unicode-normalization", + "unicode_names2", ] +[[package]] +name = "ruff_python_trivia" +version = "0.0.0" +source = "git+https://github.com/astral-sh/ruff.git?tag=0.7.0#5e6de4e0c69660e8ca8608d1ac965216197756ce" +dependencies = [ + "itertools", + "ruff_source_file", + "ruff_text_size", + "unicode-ident", +] + +[[package]] +name = "ruff_source_file" +version = "0.0.0" +source = "git+https://github.com/astral-sh/ruff.git?tag=0.7.0#5e6de4e0c69660e8ca8608d1ac965216197756ce" +dependencies = [ + "memchr", + "once_cell", + "ruff_text_size", +] + +[[package]] +name = "ruff_text_size" +version = "0.0.0" +source = "git+https://github.com/astral-sh/ruff.git?tag=0.7.0#5e6de4e0c69660e8ca8608d1ac965216197756ce" + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -767,6 +1001,12 @@ dependencies = [ "semver", ] +[[package]] +name = "rustversion" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" + [[package]] name = "ryu" version = "1.0.18" @@ -785,8 +1025,8 @@ dependencies = [ "fxhash", "log", "matches", - "phf", - "phf_codegen", + "phf 0.8.0", + "phf_codegen 0.8.0", "precomputed-hash", "servo_arc", "smallvec", @@ -884,6 +1124,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strsim" version = "0.11.1" @@ -947,6 +1193,21 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" version = "1.41.1" @@ -988,12 +1249,43 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-width" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +[[package]] +name = "unicode_names2" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1673eca9782c84de5f81b82e4109dcfb3611c8ba0d52930ec4a9478f547b2dd" +dependencies = [ + "phf 0.11.2", + "unicode_names2_generator", +] + +[[package]] +name = "unicode_names2_generator" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91e5b84611016120197efd7dc93ef76774f4e084cd73c9fb3ea4a86c570c56e" +dependencies = [ + "getopts", + "log", + "phf_codegen 0.11.2", + "rand 0.8.5", +] + [[package]] name = "utf8parse" version = "0.2.2" diff --git a/deps/rust/cargo.bzl b/deps/rust/cargo.bzl index 79db95f965b..61f37898d19 100644 --- a/deps/rust/cargo.bzl +++ b/deps/rust/cargo.bzl @@ -21,6 +21,8 @@ PACKAGES = { "pico-args": crate.spec(version = "0"), "proc-macro2": crate.spec(version = "1"), "quote": crate.spec(version = "1"), + "ruff_python_ast": crate.spec(git = "https://github.com/astral-sh/ruff.git", tag = "0.7.0"), + "ruff_python_parser": crate.spec(git = "https://github.com/astral-sh/ruff.git", tag = "0.7.0"), "serde_json": crate.spec(version = "1"), "serde": crate.spec(version = "1", features = ["derive"]), "syn": crate.spec(version = "2"), diff --git a/deps/rust/crates/BUILD.Inflector-0.11.4.bazel b/deps/rust/crates/BUILD.Inflector-0.11.4.bazel new file mode 100644 index 00000000000..7e280332691 --- /dev/null +++ b/deps/rust/crates/BUILD.Inflector-0.11.4.bazel @@ -0,0 +1,44 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "inflector", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=Inflector", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.11.4", +) diff --git a/deps/rust/crates/BUILD.aho-corasick-1.1.3.bazel b/deps/rust/crates/BUILD.aho-corasick-1.1.3.bazel new file mode 100644 index 00000000000..77d6503a6be --- /dev/null +++ b/deps/rust/crates/BUILD.aho-corasick-1.1.3.bazel @@ -0,0 +1,52 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "aho_corasick", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "default", + "perf-literal", + "std", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=aho-corasick", + "manual", + "noclippy", + "norustfmt", + ], + version = "1.1.3", + deps = [ + "@crates_vendor__memchr-2.7.4//:memchr", + ], +) diff --git a/deps/rust/crates/BUILD.bazel b/deps/rust/crates/BUILD.bazel index 0f5a1d7b18e..bb08777fe2d 100644 --- a/deps/rust/crates/BUILD.bazel +++ b/deps/rust/crates/BUILD.bazel @@ -115,6 +115,18 @@ alias( tags = ["manual"], ) +alias( + name = "ruff_python_ast", + actual = "@crates_vendor__ruff_python_ast-0.0.0//:ruff_python_ast", + tags = ["manual"], +) + +alias( + name = "ruff_python_parser", + actual = "@crates_vendor__ruff_python_parser-0.0.0//:ruff_python_parser", + tags = ["manual"], +) + alias( name = "serde", actual = "@crates_vendor__serde-1.0.214//:serde", @@ -171,7 +183,13 @@ alias( ) alias( - name = "phf_generator__gen_hash_test", + name = "phf_generator-0.8.0__gen_hash_test", actual = "@crates_vendor__phf_generator-0.8.0//:gen_hash_test__bin", tags = ["manual"], ) + +alias( + name = "phf_generator-0.11.2__gen_hash_test", + actual = "@crates_vendor__phf_generator-0.11.2//:gen_hash_test__bin", + tags = ["manual"], +) diff --git a/deps/rust/crates/BUILD.bstr-1.10.0.bazel b/deps/rust/crates/BUILD.bstr-1.10.0.bazel new file mode 100644 index 00000000000..c65529146c8 --- /dev/null +++ b/deps/rust/crates/BUILD.bstr-1.10.0.bazel @@ -0,0 +1,54 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "bstr", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "alloc", + "default", + "std", + "unicode", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=bstr", + "manual", + "noclippy", + "norustfmt", + ], + version = "1.10.0", + deps = [ + "@crates_vendor__memchr-2.7.4//:memchr", + "@crates_vendor__regex-automata-0.4.8//:regex_automata", + ], +) diff --git a/deps/rust/crates/BUILD.castaway-0.2.3.bazel b/deps/rust/crates/BUILD.castaway-0.2.3.bazel new file mode 100644 index 00000000000..66fc632f7c6 --- /dev/null +++ b/deps/rust/crates/BUILD.castaway-0.2.3.bazel @@ -0,0 +1,50 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "castaway", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "alloc", + ], + crate_root = "src/lib.rs", + edition = "2018", + proc_macro_deps = [ + "@crates_vendor__rustversion-1.0.18//:rustversion", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=castaway", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.2.3", +) diff --git a/deps/rust/crates/BUILD.compact_str-0.8.0.bazel b/deps/rust/crates/BUILD.compact_str-0.8.0.bazel new file mode 100644 index 00000000000..23be8b4e2c1 --- /dev/null +++ b/deps/rust/crates/BUILD.compact_str-0.8.0.bazel @@ -0,0 +1,58 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "compact_str", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "default", + "std", + ], + crate_root = "src/lib.rs", + edition = "2021", + proc_macro_deps = [ + "@crates_vendor__rustversion-1.0.18//:rustversion", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=compact_str", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.8.0", + deps = [ + "@crates_vendor__castaway-0.2.3//:castaway", + "@crates_vendor__cfg-if-1.0.0//:cfg_if", + "@crates_vendor__itoa-1.0.11//:itoa", + "@crates_vendor__ryu-1.0.18//:ryu", + "@crates_vendor__static_assertions-1.1.0//:static_assertions", + ], +) diff --git a/deps/rust/crates/BUILD.either-1.13.0.bazel b/deps/rust/crates/BUILD.either-1.13.0.bazel new file mode 100644 index 00000000000..eac1c16c662 --- /dev/null +++ b/deps/rust/crates/BUILD.either-1.13.0.bazel @@ -0,0 +1,47 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "either", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "use_std", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=either", + "manual", + "noclippy", + "norustfmt", + ], + version = "1.13.0", +) diff --git a/deps/rust/crates/BUILD.getopts-0.2.21.bazel b/deps/rust/crates/BUILD.getopts-0.2.21.bazel new file mode 100644 index 00000000000..b0b09b5e613 --- /dev/null +++ b/deps/rust/crates/BUILD.getopts-0.2.21.bazel @@ -0,0 +1,47 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "getopts", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=getopts", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.2.21", + deps = [ + "@crates_vendor__unicode-width-0.1.14//:unicode_width", + ], +) diff --git a/deps/rust/crates/BUILD.getrandom-0.2.15.bazel b/deps/rust/crates/BUILD.getrandom-0.2.15.bazel new file mode 100644 index 00000000000..69aae691eeb --- /dev/null +++ b/deps/rust/crates/BUILD.getrandom-0.2.15.bazel @@ -0,0 +1,64 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "getrandom", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "std", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=getrandom", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.2.15", + deps = [ + "@crates_vendor__cfg-if-1.0.0//:cfg_if", + ] + select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [ + "@crates_vendor__libc-0.2.162//:libc", # cfg(unix) + ], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [ + "@crates_vendor__libc-0.2.162//:libc", # cfg(unix) + ], + "@rules_rust//rust/platform:x86_64-apple-darwin": [ + "@crates_vendor__libc-0.2.162//:libc", # cfg(unix) + ], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [ + "@crates_vendor__libc-0.2.162//:libc", # cfg(unix) + ], + "//conditions:default": [], + }), +) diff --git a/deps/rust/crates/BUILD.is-macro-0.3.6.bazel b/deps/rust/crates/BUILD.is-macro-0.3.6.bazel new file mode 100644 index 00000000000..3c7ef5a0be0 --- /dev/null +++ b/deps/rust/crates/BUILD.is-macro-0.3.6.bazel @@ -0,0 +1,50 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_proc_macro") + +package(default_visibility = ["//visibility:public"]) + +rust_proc_macro( + name = "is_macro", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=is-macro", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.3.6", + deps = [ + "@crates_vendor__Inflector-0.11.4//:inflector", + "@crates_vendor__proc-macro2-1.0.89//:proc_macro2", + "@crates_vendor__quote-1.0.37//:quote", + "@crates_vendor__syn-2.0.87//:syn", + ], +) diff --git a/deps/rust/crates/BUILD.itertools-0.13.0.bazel b/deps/rust/crates/BUILD.itertools-0.13.0.bazel new file mode 100644 index 00000000000..a68b3e426cb --- /dev/null +++ b/deps/rust/crates/BUILD.itertools-0.13.0.bazel @@ -0,0 +1,52 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "itertools", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "default", + "use_alloc", + "use_std", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=itertools", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.13.0", + deps = [ + "@crates_vendor__either-1.13.0//:either", + ], +) diff --git a/deps/rust/crates/BUILD.phf-0.11.2.bazel b/deps/rust/crates/BUILD.phf-0.11.2.bazel new file mode 100644 index 00000000000..55999b99f65 --- /dev/null +++ b/deps/rust/crates/BUILD.phf-0.11.2.bazel @@ -0,0 +1,47 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "phf", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=phf", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.11.2", + deps = [ + "@crates_vendor__phf_shared-0.11.2//:phf_shared", + ], +) diff --git a/deps/rust/crates/BUILD.phf_codegen-0.11.2.bazel b/deps/rust/crates/BUILD.phf_codegen-0.11.2.bazel new file mode 100644 index 00000000000..a7b32470bb9 --- /dev/null +++ b/deps/rust/crates/BUILD.phf_codegen-0.11.2.bazel @@ -0,0 +1,48 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "phf_codegen", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=phf_codegen", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.11.2", + deps = [ + "@crates_vendor__phf_generator-0.11.2//:phf_generator", + "@crates_vendor__phf_shared-0.11.2//:phf_shared", + ], +) diff --git a/deps/rust/crates/BUILD.phf_generator-0.11.2.bazel b/deps/rust/crates/BUILD.phf_generator-0.11.2.bazel new file mode 100644 index 00000000000..e0d0f38cafb --- /dev/null +++ b/deps/rust/crates/BUILD.phf_generator-0.11.2.bazel @@ -0,0 +1,90 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load( + "@rules_rust//rust:defs.bzl", + "rust_binary", + "rust_library", +) + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "phf_generator", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=phf_generator", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.11.2", + deps = [ + "@crates_vendor__phf_shared-0.11.2//:phf_shared", + "@crates_vendor__rand-0.8.5//:rand", + ], +) + +rust_binary( + name = "gen_hash_test__bin", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/bin/gen_hash_test.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=phf_generator", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.11.2", + deps = [ + ":phf_generator", + "@crates_vendor__phf_shared-0.11.2//:phf_shared", + "@crates_vendor__rand-0.8.5//:rand", + ], +) diff --git a/deps/rust/crates/BUILD.phf_shared-0.11.2.bazel b/deps/rust/crates/BUILD.phf_shared-0.11.2.bazel new file mode 100644 index 00000000000..731fc459373 --- /dev/null +++ b/deps/rust/crates/BUILD.phf_shared-0.11.2.bazel @@ -0,0 +1,51 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "phf_shared", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "default", + "std", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=phf_shared", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.11.2", + deps = [ + "@crates_vendor__siphasher-0.3.11//:siphasher", + ], +) diff --git a/deps/rust/crates/BUILD.rand-0.8.5.bazel b/deps/rust/crates/BUILD.rand-0.8.5.bazel new file mode 100644 index 00000000000..20cbfb38494 --- /dev/null +++ b/deps/rust/crates/BUILD.rand-0.8.5.bazel @@ -0,0 +1,72 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "rand", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "alloc", + "default", + "getrandom", + "libc", + "rand_chacha", + "small_rng", + "std", + "std_rng", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=rand", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.8.5", + deps = [ + "@crates_vendor__rand_chacha-0.3.1//:rand_chacha", + "@crates_vendor__rand_core-0.6.4//:rand_core", + ] + select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [ + "@crates_vendor__libc-0.2.162//:libc", # aarch64-apple-darwin + ], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [ + "@crates_vendor__libc-0.2.162//:libc", # aarch64-unknown-linux-gnu + ], + "@rules_rust//rust/platform:x86_64-apple-darwin": [ + "@crates_vendor__libc-0.2.162//:libc", # x86_64-apple-darwin + ], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [ + "@crates_vendor__libc-0.2.162//:libc", # x86_64-unknown-linux-gnu + ], + "//conditions:default": [], + }), +) diff --git a/deps/rust/crates/BUILD.rand_chacha-0.3.1.bazel b/deps/rust/crates/BUILD.rand_chacha-0.3.1.bazel new file mode 100644 index 00000000000..2c101f826b2 --- /dev/null +++ b/deps/rust/crates/BUILD.rand_chacha-0.3.1.bazel @@ -0,0 +1,51 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "rand_chacha", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "std", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=rand_chacha", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.3.1", + deps = [ + "@crates_vendor__ppv-lite86-0.2.20//:ppv_lite86", + "@crates_vendor__rand_core-0.6.4//:rand_core", + ], +) diff --git a/deps/rust/crates/BUILD.rand_core-0.6.4.bazel b/deps/rust/crates/BUILD.rand_core-0.6.4.bazel new file mode 100644 index 00000000000..e708958470f --- /dev/null +++ b/deps/rust/crates/BUILD.rand_core-0.6.4.bazel @@ -0,0 +1,52 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "rand_core", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "alloc", + "getrandom", + "std", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=rand_core", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.6.4", + deps = [ + "@crates_vendor__getrandom-0.2.15//:getrandom", + ], +) diff --git a/deps/rust/crates/BUILD.regex-automata-0.4.8.bazel b/deps/rust/crates/BUILD.regex-automata-0.4.8.bazel new file mode 100644 index 00000000000..8f559a525a4 --- /dev/null +++ b/deps/rust/crates/BUILD.regex-automata-0.4.8.bazel @@ -0,0 +1,47 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "regex_automata", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "dfa-search", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=regex-automata", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.4.8", +) diff --git a/deps/rust/crates/BUILD.ruff_python_ast-0.0.0.bazel b/deps/rust/crates/BUILD.ruff_python_ast-0.0.0.bazel new file mode 100644 index 00000000000..389c7a70b6b --- /dev/null +++ b/deps/rust/crates/BUILD.ruff_python_ast-0.0.0.bazel @@ -0,0 +1,58 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "ruff_python_ast", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2021", + proc_macro_deps = [ + "@crates_vendor__is-macro-0.3.6//:is_macro", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=ruff_python_ast", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.0.0", + deps = [ + "@crates_vendor__aho-corasick-1.1.3//:aho_corasick", + "@crates_vendor__bitflags-2.6.0//:bitflags", + "@crates_vendor__compact_str-0.8.0//:compact_str", + "@crates_vendor__itertools-0.13.0//:itertools", + "@crates_vendor__once_cell-1.20.2//:once_cell", + "@crates_vendor__ruff_python_trivia-0.0.0//:ruff_python_trivia", + "@crates_vendor__ruff_source_file-0.0.0//:ruff_source_file", + "@crates_vendor__ruff_text_size-0.0.0//:ruff_text_size", + "@crates_vendor__rustc-hash-2.0.0//:rustc_hash", + ], +) diff --git a/deps/rust/crates/BUILD.ruff_python_parser-0.0.0.bazel b/deps/rust/crates/BUILD.ruff_python_parser-0.0.0.bazel new file mode 100644 index 00000000000..a9cead6997f --- /dev/null +++ b/deps/rust/crates/BUILD.ruff_python_parser-0.0.0.bazel @@ -0,0 +1,58 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "ruff_python_parser", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=ruff_python_parser", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.0.0", + deps = [ + "@crates_vendor__bitflags-2.6.0//:bitflags", + "@crates_vendor__bstr-1.10.0//:bstr", + "@crates_vendor__compact_str-0.8.0//:compact_str", + "@crates_vendor__memchr-2.7.4//:memchr", + "@crates_vendor__ruff_python_ast-0.0.0//:ruff_python_ast", + "@crates_vendor__ruff_python_trivia-0.0.0//:ruff_python_trivia", + "@crates_vendor__ruff_text_size-0.0.0//:ruff_text_size", + "@crates_vendor__rustc-hash-2.0.0//:rustc_hash", + "@crates_vendor__static_assertions-1.1.0//:static_assertions", + "@crates_vendor__unicode-ident-1.0.13//:unicode_ident", + "@crates_vendor__unicode-normalization-0.1.24//:unicode_normalization", + "@crates_vendor__unicode_names2-1.3.0//:unicode_names2", + ], +) diff --git a/deps/rust/crates/BUILD.ruff_python_trivia-0.0.0.bazel b/deps/rust/crates/BUILD.ruff_python_trivia-0.0.0.bazel new file mode 100644 index 00000000000..c14a431f8f8 --- /dev/null +++ b/deps/rust/crates/BUILD.ruff_python_trivia-0.0.0.bazel @@ -0,0 +1,50 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "ruff_python_trivia", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=ruff_python_trivia", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.0.0", + deps = [ + "@crates_vendor__itertools-0.13.0//:itertools", + "@crates_vendor__ruff_source_file-0.0.0//:ruff_source_file", + "@crates_vendor__ruff_text_size-0.0.0//:ruff_text_size", + "@crates_vendor__unicode-ident-1.0.13//:unicode_ident", + ], +) diff --git a/deps/rust/crates/BUILD.ruff_source_file-0.0.0.bazel b/deps/rust/crates/BUILD.ruff_source_file-0.0.0.bazel new file mode 100644 index 00000000000..434764ffbe5 --- /dev/null +++ b/deps/rust/crates/BUILD.ruff_source_file-0.0.0.bazel @@ -0,0 +1,49 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "ruff_source_file", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=ruff_source_file", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.0.0", + deps = [ + "@crates_vendor__memchr-2.7.4//:memchr", + "@crates_vendor__once_cell-1.20.2//:once_cell", + "@crates_vendor__ruff_text_size-0.0.0//:ruff_text_size", + ], +) diff --git a/deps/rust/crates/BUILD.ruff_text_size-0.0.0.bazel b/deps/rust/crates/BUILD.ruff_text_size-0.0.0.bazel new file mode 100644 index 00000000000..6b1a6fa310f --- /dev/null +++ b/deps/rust/crates/BUILD.ruff_text_size-0.0.0.bazel @@ -0,0 +1,44 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "ruff_text_size", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=ruff_text_size", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.0.0", +) diff --git a/deps/rust/crates/BUILD.rustversion-1.0.18.bazel b/deps/rust/crates/BUILD.rustversion-1.0.18.bazel new file mode 100644 index 00000000000..c7e9352c0f7 --- /dev/null +++ b/deps/rust/crates/BUILD.rustversion-1.0.18.bazel @@ -0,0 +1,103 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//cargo:defs.bzl", "cargo_build_script") +load("@rules_rust//rust:defs.bzl", "rust_proc_macro") + +package(default_visibility = ["//visibility:public"]) + +rust_proc_macro( + name = "rustversion", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=rustversion", + "manual", + "noclippy", + "norustfmt", + ], + version = "1.0.18", + deps = [ + "@crates_vendor__rustversion-1.0.18//:build_script_build", + ], +) + +cargo_build_script( + name = "_bs", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + "**/*.rs", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_name = "build_script_build", + crate_root = "build/build.rs", + data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + edition = "2018", + pkg_name = "rustversion", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=rustversion", + "manual", + "noclippy", + "norustfmt", + ], + version = "1.0.18", + visibility = ["//visibility:private"], +) + +alias( + name = "build_script_build", + actual = ":_bs", + tags = ["manual"], +) diff --git a/deps/rust/crates/BUILD.static_assertions-1.1.0.bazel b/deps/rust/crates/BUILD.static_assertions-1.1.0.bazel new file mode 100644 index 00000000000..161a87cfc8e --- /dev/null +++ b/deps/rust/crates/BUILD.static_assertions-1.1.0.bazel @@ -0,0 +1,44 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "static_assertions", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=static_assertions", + "manual", + "noclippy", + "norustfmt", + ], + version = "1.1.0", +) diff --git a/deps/rust/crates/BUILD.syn-2.0.87.bazel b/deps/rust/crates/BUILD.syn-2.0.87.bazel index a20b41496d1..c09026aa1a2 100644 --- a/deps/rust/crates/BUILD.syn-2.0.87.bazel +++ b/deps/rust/crates/BUILD.syn-2.0.87.bazel @@ -33,6 +33,7 @@ rust_library( "default", "derive", "extra-traits", + "fold", "full", "parsing", "printing", diff --git a/deps/rust/crates/BUILD.tinyvec-1.8.0.bazel b/deps/rust/crates/BUILD.tinyvec-1.8.0.bazel new file mode 100644 index 00000000000..f6c0c54f923 --- /dev/null +++ b/deps/rust/crates/BUILD.tinyvec-1.8.0.bazel @@ -0,0 +1,52 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "tinyvec", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "alloc", + "default", + "tinyvec_macros", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=tinyvec", + "manual", + "noclippy", + "norustfmt", + ], + version = "1.8.0", + deps = [ + "@crates_vendor__tinyvec_macros-0.1.1//:tinyvec_macros", + ], +) diff --git a/deps/rust/crates/BUILD.tinyvec_macros-0.1.1.bazel b/deps/rust/crates/BUILD.tinyvec_macros-0.1.1.bazel new file mode 100644 index 00000000000..a39fdf92cba --- /dev/null +++ b/deps/rust/crates/BUILD.tinyvec_macros-0.1.1.bazel @@ -0,0 +1,44 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "tinyvec_macros", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=tinyvec_macros", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.1.1", +) diff --git a/deps/rust/crates/BUILD.unicode-normalization-0.1.24.bazel b/deps/rust/crates/BUILD.unicode-normalization-0.1.24.bazel new file mode 100644 index 00000000000..c7bab24e033 --- /dev/null +++ b/deps/rust/crates/BUILD.unicode-normalization-0.1.24.bazel @@ -0,0 +1,51 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "unicode_normalization", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "default", + "std", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=unicode-normalization", + "manual", + "noclippy", + "norustfmt", + ], + version = "0.1.24", + deps = [ + "@crates_vendor__tinyvec-1.8.0//:tinyvec", + ], +) diff --git a/deps/rust/crates/BUILD.unicode_names2-1.3.0.bazel b/deps/rust/crates/BUILD.unicode_names2-1.3.0.bazel new file mode 100644 index 00000000000..143e28cf63a --- /dev/null +++ b/deps/rust/crates/BUILD.unicode_names2-1.3.0.bazel @@ -0,0 +1,113 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//cargo:defs.bzl", "cargo_build_script") +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "unicode_names2", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "default", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=unicode_names2", + "manual", + "noclippy", + "norustfmt", + ], + version = "1.3.0", + deps = [ + "@crates_vendor__phf-0.11.2//:phf", + "@crates_vendor__unicode_names2-1.3.0//:build_script_build", + ], +) + +cargo_build_script( + name = "_bs", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + "**/*.rs", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "default", + ], + crate_name = "build_script_build", + crate_root = "build.rs", + data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + edition = "2018", + pkg_name = "unicode_names2", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=unicode_names2", + "manual", + "noclippy", + "norustfmt", + ], + version = "1.3.0", + visibility = ["//visibility:private"], + deps = [ + "@crates_vendor__unicode_names2_generator-1.3.0//:unicode_names2_generator", + ], +) + +alias( + name = "build_script_build", + actual = ":_bs", + tags = ["manual"], +) diff --git a/deps/rust/crates/BUILD.unicode_names2_generator-1.3.0.bazel b/deps/rust/crates/BUILD.unicode_names2_generator-1.3.0.bazel new file mode 100644 index 00000000000..f32df90986c --- /dev/null +++ b/deps/rust/crates/BUILD.unicode_names2_generator-1.3.0.bazel @@ -0,0 +1,53 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @//deps/rust:crates_vendor +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "unicode_names2_generator", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_features = [ + "default", + ], + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=unicode_names2_generator", + "manual", + "noclippy", + "norustfmt", + ], + version = "1.3.0", + deps = [ + "@crates_vendor__getopts-0.2.21//:getopts", + "@crates_vendor__log-0.4.22//:log", + "@crates_vendor__phf_codegen-0.11.2//:phf_codegen", + "@crates_vendor__rand-0.8.5//:rand", + ], +) diff --git a/deps/rust/crates/defs.bzl b/deps/rust/crates/defs.bzl index 35c2a98e127..0d7c3485e78 100644 --- a/deps/rust/crates/defs.bzl +++ b/deps/rust/crates/defs.bzl @@ -309,6 +309,8 @@ _NORMAL_DEPENDENCIES = { "pico-args": Label("@crates_vendor__pico-args-0.5.0//:pico_args"), "proc-macro2": Label("@crates_vendor__proc-macro2-1.0.89//:proc_macro2"), "quote": Label("@crates_vendor__quote-1.0.37//:quote"), + "ruff_python_ast": Label("@crates_vendor__ruff_python_ast-0.0.0//:ruff_python_ast"), + "ruff_python_parser": Label("@crates_vendor__ruff_python_parser-0.0.0//:ruff_python_parser"), "serde": Label("@crates_vendor__serde-1.0.214//:serde"), "serde_json": Label("@crates_vendor__serde_json-1.0.132//:serde_json"), "syn": Label("@crates_vendor__syn-2.0.87//:syn"), @@ -408,6 +410,16 @@ def crate_repositories(): Returns: A list of repos visible to the module through the module extension. """ + maybe( + http_archive, + name = "crates_vendor__Inflector-0.11.4", + sha256 = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3", + type = "tar.gz", + urls = ["https://static.crates.io/crates/Inflector/0.11.4/download"], + strip_prefix = "Inflector-0.11.4", + build_file = Label("@workerd//deps/rust/crates:BUILD.Inflector-0.11.4.bazel"), + ) + maybe( http_archive, name = "crates_vendor__addr2line-0.24.2", @@ -438,6 +450,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.ahash-0.8.11.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__aho-corasick-1.1.3", + sha256 = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916", + type = "tar.gz", + urls = ["https://static.crates.io/crates/aho-corasick/1.1.3/download"], + strip_prefix = "aho-corasick-1.1.3", + build_file = Label("@workerd//deps/rust/crates:BUILD.aho-corasick-1.1.3.bazel"), + ) + maybe( http_archive, name = "crates_vendor__anstream-0.6.18", @@ -528,6 +550,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.bitflags-2.6.0.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__bstr-1.10.0", + sha256 = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c", + type = "tar.gz", + urls = ["https://static.crates.io/crates/bstr/1.10.0/download"], + strip_prefix = "bstr-1.10.0", + build_file = Label("@workerd//deps/rust/crates:BUILD.bstr-1.10.0.bazel"), + ) + maybe( http_archive, name = "crates_vendor__byteorder-1.5.0", @@ -568,6 +600,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.capnpc-0.20.0.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__castaway-0.2.3", + sha256 = "0abae9be0aaf9ea96a3b1b8b1b55c602ca751eba1b1500220cea4ecbafe7c0d5", + type = "tar.gz", + urls = ["https://static.crates.io/crates/castaway/0.2.3/download"], + strip_prefix = "castaway-0.2.3", + build_file = Label("@workerd//deps/rust/crates:BUILD.castaway-0.2.3.bazel"), + ) + maybe( http_archive, name = "crates_vendor__cc-1.1.37", @@ -668,6 +710,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.colorchoice-1.0.3.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__compact_str-0.8.0", + sha256 = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644", + type = "tar.gz", + urls = ["https://static.crates.io/crates/compact_str/0.8.0/download"], + strip_prefix = "compact_str-0.8.0", + build_file = Label("@workerd//deps/rust/crates:BUILD.compact_str-0.8.0.bazel"), + ) + maybe( http_archive, name = "crates_vendor__convert_case-0.4.0", @@ -768,6 +820,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.dtoa-short-0.3.5.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__either-1.13.0", + sha256 = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0", + type = "tar.gz", + urls = ["https://static.crates.io/crates/either/1.13.0/download"], + strip_prefix = "either-1.13.0", + build_file = Label("@workerd//deps/rust/crates:BUILD.either-1.13.0.bazel"), + ) + maybe( http_archive, name = "crates_vendor__embedded-io-0.6.1", @@ -808,6 +870,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.fxhash-0.2.1.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__getopts-0.2.21", + sha256 = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5", + type = "tar.gz", + urls = ["https://static.crates.io/crates/getopts/0.2.21/download"], + strip_prefix = "getopts-0.2.21", + build_file = Label("@workerd//deps/rust/crates:BUILD.getopts-0.2.21.bazel"), + ) + maybe( http_archive, name = "crates_vendor__getrandom-0.1.16", @@ -818,6 +890,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.getrandom-0.1.16.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__getrandom-0.2.15", + sha256 = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7", + type = "tar.gz", + urls = ["https://static.crates.io/crates/getrandom/0.2.15/download"], + strip_prefix = "getrandom-0.2.15", + build_file = Label("@workerd//deps/rust/crates:BUILD.getrandom-0.2.15.bazel"), + ) + maybe( http_archive, name = "crates_vendor__gimli-0.31.1", @@ -858,6 +940,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.hermit-abi-0.3.9.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__is-macro-0.3.6", + sha256 = "2069faacbe981460232f880d26bf3c7634e322d49053aa48c27e3ae642f728f1", + type = "tar.gz", + urls = ["https://static.crates.io/crates/is-macro/0.3.6/download"], + strip_prefix = "is-macro-0.3.6", + build_file = Label("@workerd//deps/rust/crates:BUILD.is-macro-0.3.6.bazel"), + ) + maybe( http_archive, name = "crates_vendor__is_terminal_polyfill-1.70.1", @@ -868,6 +960,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.is_terminal_polyfill-1.70.1.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__itertools-0.13.0", + sha256 = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186", + type = "tar.gz", + urls = ["https://static.crates.io/crates/itertools/0.13.0/download"], + strip_prefix = "itertools-0.13.0", + build_file = Label("@workerd//deps/rust/crates:BUILD.itertools-0.13.0.bazel"), + ) + maybe( http_archive, name = "crates_vendor__itoa-0.4.8", @@ -1047,6 +1149,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.once_cell-1.20.2.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__phf-0.11.2", + sha256 = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc", + type = "tar.gz", + urls = ["https://static.crates.io/crates/phf/0.11.2/download"], + strip_prefix = "phf-0.11.2", + build_file = Label("@workerd//deps/rust/crates:BUILD.phf-0.11.2.bazel"), + ) + maybe( http_archive, name = "crates_vendor__phf-0.8.0", @@ -1057,6 +1169,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.phf-0.8.0.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__phf_codegen-0.11.2", + sha256 = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a", + type = "tar.gz", + urls = ["https://static.crates.io/crates/phf_codegen/0.11.2/download"], + strip_prefix = "phf_codegen-0.11.2", + build_file = Label("@workerd//deps/rust/crates:BUILD.phf_codegen-0.11.2.bazel"), + ) + maybe( http_archive, name = "crates_vendor__phf_codegen-0.8.0", @@ -1067,6 +1189,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.phf_codegen-0.8.0.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__phf_generator-0.11.2", + sha256 = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0", + type = "tar.gz", + urls = ["https://static.crates.io/crates/phf_generator/0.11.2/download"], + strip_prefix = "phf_generator-0.11.2", + build_file = Label("@workerd//deps/rust/crates:BUILD.phf_generator-0.11.2.bazel"), + ) + maybe( http_archive, name = "crates_vendor__phf_generator-0.8.0", @@ -1087,6 +1219,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.phf_macros-0.8.0.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__phf_shared-0.11.2", + sha256 = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b", + type = "tar.gz", + urls = ["https://static.crates.io/crates/phf_shared/0.11.2/download"], + strip_prefix = "phf_shared-0.11.2", + build_file = Label("@workerd//deps/rust/crates:BUILD.phf_shared-0.11.2.bazel"), + ) + maybe( http_archive, name = "crates_vendor__phf_shared-0.8.0", @@ -1177,6 +1319,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.rand-0.7.3.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__rand-0.8.5", + sha256 = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404", + type = "tar.gz", + urls = ["https://static.crates.io/crates/rand/0.8.5/download"], + strip_prefix = "rand-0.8.5", + build_file = Label("@workerd//deps/rust/crates:BUILD.rand-0.8.5.bazel"), + ) + maybe( http_archive, name = "crates_vendor__rand_chacha-0.2.2", @@ -1187,6 +1339,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.rand_chacha-0.2.2.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__rand_chacha-0.3.1", + sha256 = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88", + type = "tar.gz", + urls = ["https://static.crates.io/crates/rand_chacha/0.3.1/download"], + strip_prefix = "rand_chacha-0.3.1", + build_file = Label("@workerd//deps/rust/crates:BUILD.rand_chacha-0.3.1.bazel"), + ) + maybe( http_archive, name = "crates_vendor__rand_core-0.5.1", @@ -1197,6 +1359,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.rand_core-0.5.1.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__rand_core-0.6.4", + sha256 = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c", + type = "tar.gz", + urls = ["https://static.crates.io/crates/rand_core/0.6.4/download"], + strip_prefix = "rand_core-0.6.4", + build_file = Label("@workerd//deps/rust/crates:BUILD.rand_core-0.6.4.bazel"), + ) + maybe( http_archive, name = "crates_vendor__rand_hc-0.2.0", @@ -1217,6 +1389,66 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.rand_pcg-0.2.1.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__regex-automata-0.4.8", + sha256 = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3", + type = "tar.gz", + urls = ["https://static.crates.io/crates/regex-automata/0.4.8/download"], + strip_prefix = "regex-automata-0.4.8", + build_file = Label("@workerd//deps/rust/crates:BUILD.regex-automata-0.4.8.bazel"), + ) + + maybe( + new_git_repository, + name = "crates_vendor__ruff_python_ast-0.0.0", + commit = "5e6de4e0c69660e8ca8608d1ac965216197756ce", + init_submodules = True, + remote = "https://github.com/astral-sh/ruff.git", + build_file = Label("@workerd//deps/rust/crates:BUILD.ruff_python_ast-0.0.0.bazel"), + strip_prefix = "crates/ruff_python_ast", + ) + + maybe( + new_git_repository, + name = "crates_vendor__ruff_python_parser-0.0.0", + commit = "5e6de4e0c69660e8ca8608d1ac965216197756ce", + init_submodules = True, + remote = "https://github.com/astral-sh/ruff.git", + build_file = Label("@workerd//deps/rust/crates:BUILD.ruff_python_parser-0.0.0.bazel"), + strip_prefix = "crates/ruff_python_parser", + ) + + maybe( + new_git_repository, + name = "crates_vendor__ruff_python_trivia-0.0.0", + commit = "5e6de4e0c69660e8ca8608d1ac965216197756ce", + init_submodules = True, + remote = "https://github.com/astral-sh/ruff.git", + build_file = Label("@workerd//deps/rust/crates:BUILD.ruff_python_trivia-0.0.0.bazel"), + strip_prefix = "crates/ruff_python_trivia", + ) + + maybe( + new_git_repository, + name = "crates_vendor__ruff_source_file-0.0.0", + commit = "5e6de4e0c69660e8ca8608d1ac965216197756ce", + init_submodules = True, + remote = "https://github.com/astral-sh/ruff.git", + build_file = Label("@workerd//deps/rust/crates:BUILD.ruff_source_file-0.0.0.bazel"), + strip_prefix = "crates/ruff_source_file", + ) + + maybe( + new_git_repository, + name = "crates_vendor__ruff_text_size-0.0.0", + commit = "5e6de4e0c69660e8ca8608d1ac965216197756ce", + init_submodules = True, + remote = "https://github.com/astral-sh/ruff.git", + build_file = Label("@workerd//deps/rust/crates:BUILD.ruff_text_size-0.0.0.bazel"), + strip_prefix = "crates/ruff_text_size", + ) + maybe( http_archive, name = "crates_vendor__rustc-demangle-0.1.24", @@ -1247,6 +1479,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.rustc_version-0.4.1.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__rustversion-1.0.18", + sha256 = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248", + type = "tar.gz", + urls = ["https://static.crates.io/crates/rustversion/1.0.18/download"], + strip_prefix = "rustversion-1.0.18", + build_file = Label("@workerd//deps/rust/crates:BUILD.rustversion-1.0.18.bazel"), + ) + maybe( http_archive, name = "crates_vendor__ryu-1.0.18", @@ -1377,6 +1619,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.stable_deref_trait-1.2.0.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__static_assertions-1.1.0", + sha256 = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f", + type = "tar.gz", + urls = ["https://static.crates.io/crates/static_assertions/1.1.0/download"], + strip_prefix = "static_assertions-1.1.0", + build_file = Label("@workerd//deps/rust/crates:BUILD.static_assertions-1.1.0.bazel"), + ) + maybe( http_archive, name = "crates_vendor__strsim-0.11.1", @@ -1447,6 +1699,26 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.thiserror-impl-1.0.68.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__tinyvec-1.8.0", + sha256 = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938", + type = "tar.gz", + urls = ["https://static.crates.io/crates/tinyvec/1.8.0/download"], + strip_prefix = "tinyvec-1.8.0", + build_file = Label("@workerd//deps/rust/crates:BUILD.tinyvec-1.8.0.bazel"), + ) + + maybe( + http_archive, + name = "crates_vendor__tinyvec_macros-0.1.1", + sha256 = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20", + type = "tar.gz", + urls = ["https://static.crates.io/crates/tinyvec_macros/0.1.1/download"], + strip_prefix = "tinyvec_macros-0.1.1", + build_file = Label("@workerd//deps/rust/crates:BUILD.tinyvec_macros-0.1.1.bazel"), + ) + maybe( http_archive, name = "crates_vendor__tokio-1.41.1", @@ -1487,6 +1759,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.unicode-ident-1.0.13.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__unicode-normalization-0.1.24", + sha256 = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956", + type = "tar.gz", + urls = ["https://static.crates.io/crates/unicode-normalization/0.1.24/download"], + strip_prefix = "unicode-normalization-0.1.24", + build_file = Label("@workerd//deps/rust/crates:BUILD.unicode-normalization-0.1.24.bazel"), + ) + maybe( http_archive, name = "crates_vendor__unicode-width-0.1.14", @@ -1497,6 +1779,26 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.unicode-width-0.1.14.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__unicode_names2-1.3.0", + sha256 = "d1673eca9782c84de5f81b82e4109dcfb3611c8ba0d52930ec4a9478f547b2dd", + type = "tar.gz", + urls = ["https://static.crates.io/crates/unicode_names2/1.3.0/download"], + strip_prefix = "unicode_names2-1.3.0", + build_file = Label("@workerd//deps/rust/crates:BUILD.unicode_names2-1.3.0.bazel"), + ) + + maybe( + http_archive, + name = "crates_vendor__unicode_names2_generator-1.3.0", + sha256 = "b91e5b84611016120197efd7dc93ef76774f4e084cd73c9fb3ea4a86c570c56e", + type = "tar.gz", + urls = ["https://static.crates.io/crates/unicode_names2_generator/1.3.0/download"], + strip_prefix = "unicode_names2_generator-1.3.0", + build_file = Label("@workerd//deps/rust/crates:BUILD.unicode_names2_generator-1.3.0.bazel"), + ) + maybe( http_archive, name = "crates_vendor__utf8parse-0.2.2", @@ -1691,6 +1993,8 @@ def crate_repositories(): struct(repo = "crates_vendor__pico-args-0.5.0", is_dev_dep = False), struct(repo = "crates_vendor__proc-macro2-1.0.89", is_dev_dep = False), struct(repo = "crates_vendor__quote-1.0.37", is_dev_dep = False), + struct(repo = "crates_vendor__ruff_python_ast-0.0.0", is_dev_dep = False), + struct(repo = "crates_vendor__ruff_python_parser-0.0.0", is_dev_dep = False), struct(repo = "crates_vendor__serde-1.0.214", is_dev_dep = False), struct(repo = "crates_vendor__serde_json-1.0.132", is_dev_dep = False), struct(repo = "crates_vendor__syn-2.0.87", is_dev_dep = False), diff --git a/src/rust/python-parser/BUILD b/src/rust/python-parser/BUILD new file mode 100644 index 00000000000..2e9201274e2 --- /dev/null +++ b/src/rust/python-parser/BUILD @@ -0,0 +1,19 @@ +load("//:build/kj_test.bzl", "kj_test") +load("//:build/wd_rust_crate.bzl", "rust_cxx_include", "wd_rust_crate") + +wd_rust_crate( + name = "python-parser", + cxx_bridge_src = "lib.rs", + visibility = ["//visibility:public"], + deps = [ + "@crates_vendor//:ruff_python_ast", + "@crates_vendor//:ruff_python_parser", + ], +) + +kj_test( + src = "import_parsing.c++", + deps = [ + ":python-parser", + ], +) diff --git a/src/rust/python-parser/import_parsing.c++ b/src/rust/python-parser/import_parsing.c++ new file mode 100644 index 00000000000..8d89f58b4bc --- /dev/null +++ b/src/rust/python-parser/import_parsing.c++ @@ -0,0 +1,200 @@ +// Copyright (c) 2017-2022 Cloudflare, Inc. +// Licensed under the Apache 2.0 license found in the LICENSE file or at: +// https://opensource.org/licenses/Apache-2.0 + +#include + +#include + +using ::edgeworker::rust::python_parser::get_imports; + +kj::Array parseImports(kj::Array cpp_modules) { + ::rust::Vec<::rust::String> rust_modules; + rust_modules.reserve(cpp_modules.size()); + for (auto& entry: cpp_modules) { + rust_modules.push_back(entry.cStr()); + } + auto rust_result = get_imports(rust_modules); + auto cpp_result = kj::heapArrayBuilder(rust_result.size()); + for (auto& entry: rust_result) { + cpp_result.add(kj::str(entry.c_str())); + } + return cpp_result.finish(); +} + +namespace workerd::api { +namespace { + +KJ_TEST("basic `import` tests") { + auto files = kj::heapArrayBuilder(2); + files.add(kj::str("import a\nimport z")); + files.add(kj::str("import b")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 3); + KJ_REQUIRE(result[0] == "a"); + KJ_REQUIRE(result[1] == "b"); + KJ_REQUIRE(result[2] == "z"); +} + +KJ_TEST("supports whitespace") { + auto files = kj::heapArrayBuilder(1); + files.add(kj::str("import a\nimport \\\n\tz")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 2); + KJ_REQUIRE(result[0] == "a"); + KJ_REQUIRE(result[1] == "z"); +} + +KJ_TEST("supports windows newlines") { + auto files = kj::heapArrayBuilder(1); + files.add(kj::str("import a\r\nimport \\\r\n\tz")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 2); + KJ_REQUIRE(result[0] == "a"); + KJ_REQUIRE(result[1] == "z"); +} + +KJ_TEST("basic `from` test") { + auto files = kj::heapArrayBuilder(1); + files.add(kj::str("from x import a,b\nfrom z import y")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 2); + KJ_REQUIRE(result[0] == "x"); + KJ_REQUIRE(result[1] == "z"); +} + +KJ_TEST("ignores indented blocks") { + auto files = kj::heapArrayBuilder(1); + files.add(kj::str("import a\nif True:\n import x\nimport y")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 2); + KJ_REQUIRE(result[0] == "a"); + KJ_REQUIRE(result[1] == "y"); +} + +KJ_TEST("supports nested imports") { + auto files = kj::heapArrayBuilder(1); + files.add(kj::str("import a.b\nimport z.x.y.i")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 2); + KJ_REQUIRE(result[0] == "a.b"); + KJ_REQUIRE(result[1] == "z.x.y.i"); +} + +KJ_TEST("nested `from` test") { + auto files = kj::heapArrayBuilder(1); + files.add(kj::str("from x.y.z import a,b\nfrom z import y")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 2); + KJ_REQUIRE(result[0] == "x.y.z"); + KJ_REQUIRE(result[1] == "z"); +} + +KJ_TEST("ignores trailing period") { + auto files = kj::heapArrayBuilder(1); + files.add(kj::str("import a.b.\nimport z.x.y.i.")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 0); +} + +KJ_TEST("ignores relative import") { + // This is where we diverge from the old AST-based approach. It would have returned `y` in the + // input below. + auto files = kj::heapArrayBuilder(1); + files.add(kj::str("import .a.b\nimport ..z.x\nfrom .y import x")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 0); +} + +KJ_TEST("supports commas") { + auto files = kj::heapArrayBuilder(1); + files.add(kj::str("import a,b")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 2); + KJ_REQUIRE(result[0] == "a"); + KJ_REQUIRE(result[1] == "b"); +} + +KJ_TEST("supports backslash") { + auto files = kj::heapArrayBuilder(4); + files.add(kj::str("import a\\\n,b")); + files.add(kj::str("import\\\n q,w")); + files.add(kj::str("from \\\nx import y")); + files.add(kj::str("from \\\n c import y")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 6); + KJ_REQUIRE(result[0] == "a"); + KJ_REQUIRE(result[1] == "b"); + KJ_REQUIRE(result[2] == "c"); + KJ_REQUIRE(result[3] == "q"); + KJ_REQUIRE(result[4] == "w"); + KJ_REQUIRE(result[5] == "x"); +} + +KJ_TEST("multiline-strings ignored") { + auto files = kj::heapArrayBuilder(4); + files.add(kj::str(R"SCRIPT( +FOO=""" +import x +from y import z +""" +)SCRIPT")); + files.add(kj::str(R"SCRIPT( +FOO=''' +import f +from g import z +''' +)SCRIPT")); + files.add(kj::str(R"SCRIPT(FOO = "\ +import b \ +")SCRIPT")); + files.add(kj::str("FOO=\"\"\" \n", R"SCRIPT(import x +from y import z +""")SCRIPT")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 0); +} + +KJ_TEST("multiline-strings with imports in-between") { + auto files = kj::heapArrayBuilder(1); + files.add(kj::str( + R"SCRIPT(FOO=""" +import x +from y import z +""" +import q +import w +BAR=""" +import e +""" +from t import u)SCRIPT")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 3); + KJ_REQUIRE(result[0] == "q"); + KJ_REQUIRE(result[1] == "t"); + KJ_REQUIRE(result[2] == "w"); +} + +KJ_TEST("import after string literal") { + auto files = kj::heapArrayBuilder(1); + files.add(kj::str(R"SCRIPT(import a +"import b")SCRIPT")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 1); + KJ_REQUIRE(result[0] == "a"); +} + +KJ_TEST("langchain import") { + auto files = kj::heapArrayBuilder(1); + files.add(kj::str(R"SCRIPT(from js import Response, console, URL +from langchain.chat_models import ChatOpenAI +import openai)SCRIPT")); + auto result = parseImports(files.finish()); + KJ_REQUIRE(result.size() == 3); + KJ_REQUIRE(result[0] == "js"); + KJ_REQUIRE(result[1] == "langchain.chat_models"); + KJ_REQUIRE(result[2] == "openai"); +} + +} // namespace +} // namespace workerd::api diff --git a/src/rust/python-parser/lib.rs b/src/rust/python-parser/lib.rs new file mode 100644 index 00000000000..de0a3ed54fd --- /dev/null +++ b/src/rust/python-parser/lib.rs @@ -0,0 +1,40 @@ +use std::collections::HashSet; + +use ruff_python_ast::{Stmt, StmtImportFrom}; +use ruff_python_parser::parse_module; + +#[cxx::bridge(namespace = "edgeworker::rust::python_parser")] +mod ffi { + + extern "Rust" { + fn get_imports(sources: &Vec) -> Vec; + } +} + +#[must_use] +pub fn get_imports(sources: &Vec) -> Vec { + let mut names: HashSet = HashSet::new(); + for src in sources { + // Just skip it if it doesn't parse. + if let Ok(module) = parse_module(src) { + for stmt in &module.syntax().body { + match stmt { + Stmt::Import(s) => { + names.extend(s.names.iter().map(|x| x.name.id.as_str().into())); + } + Stmt::ImportFrom(StmtImportFrom { + module: Some(module), + level: 0, + .. + }) => { + names.insert(module.id.as_str().into()); + } + _ => {} + } + } + } + } + let mut result: Vec<_> = names.drain().collect(); + result.sort(); + result +} From 225d6dc5d96077ec959d4b748ba07b2dc1f1d1ed Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Wed, 13 Nov 2024 21:53:03 +0100 Subject: [PATCH 2/2] Apply some of mikea's review comments --- deps/rust/cargo.bzl | 4 +- src/rust/cxx-integration/cxx-bridge.h | 8 ++ src/rust/python-parser/BUILD | 1 + src/rust/python-parser/import_parsing.c++ | 111 ++++++++-------------- src/rust/python-parser/lib.rs | 33 +++---- 5 files changed, 70 insertions(+), 87 deletions(-) diff --git a/deps/rust/cargo.bzl b/deps/rust/cargo.bzl index 61f37898d19..60f4356e7d1 100644 --- a/deps/rust/cargo.bzl +++ b/deps/rust/cargo.bzl @@ -21,8 +21,8 @@ PACKAGES = { "pico-args": crate.spec(version = "0"), "proc-macro2": crate.spec(version = "1"), "quote": crate.spec(version = "1"), - "ruff_python_ast": crate.spec(git = "https://github.com/astral-sh/ruff.git", tag = "0.7.0"), - "ruff_python_parser": crate.spec(git = "https://github.com/astral-sh/ruff.git", tag = "0.7.0"), + "ruff_python_ast": crate.spec(git = "https://github.com/astral-sh/ruff.git", tag = "0"), + "ruff_python_parser": crate.spec(git = "https://github.com/astral-sh/ruff.git", tag = "0"), "serde_json": crate.spec(version = "1"), "serde": crate.spec(version = "1", features = ["derive"]), "syn": crate.spec(version = "2"), diff --git a/src/rust/cxx-integration/cxx-bridge.h b/src/rust/cxx-integration/cxx-bridge.h index 5753fa7d222..9d07dcbe209 100644 --- a/src/rust/cxx-integration/cxx-bridge.h +++ b/src/rust/cxx-integration/cxx-bridge.h @@ -49,6 +49,14 @@ inline kj::ArrayPtr fromRust(const ::rust::Str& str) { return kj::ArrayPtr(str.data(), str.size()); } +inline kj::Array fromRust(::rust::Vec<::rust::String> vec) { + auto res = kj::heapArrayBuilder(vec.size()); + for (auto& entry: vec) { + res.add(kj::str(entry.c_str())); + } + return res.finish(); +} + struct Rust { template static ::rust::Slice from(const kj::ArrayPtr* arr) { diff --git a/src/rust/python-parser/BUILD b/src/rust/python-parser/BUILD index 2e9201274e2..efb1b677cc7 100644 --- a/src/rust/python-parser/BUILD +++ b/src/rust/python-parser/BUILD @@ -15,5 +15,6 @@ kj_test( src = "import_parsing.c++", deps = [ ":python-parser", + "//src/rust/cxx-integration", ], ) diff --git a/src/rust/python-parser/import_parsing.c++ b/src/rust/python-parser/import_parsing.c++ index 8d89f58b4bc..d0ba59b43b6 100644 --- a/src/rust/python-parser/import_parsing.c++ +++ b/src/rust/python-parser/import_parsing.c++ @@ -3,33 +3,27 @@ // https://opensource.org/licenses/Apache-2.0 #include +#include "workerd/rust/cxx-integration/lib.rs.h" #include using ::edgeworker::rust::python_parser::get_imports; -kj::Array parseImports(kj::Array cpp_modules) { - ::rust::Vec<::rust::String> rust_modules; - rust_modules.reserve(cpp_modules.size()); +kj::Array parseImports(kj::ArrayPtr cpp_modules) { + auto rust_modules = kj::heapArrayBuilder<::rust::Str const>(cpp_modules.size()); for (auto& entry: cpp_modules) { - rust_modules.push_back(entry.cStr()); + rust_modules.add(entry.cStr()); } - auto rust_result = get_imports(rust_modules); - auto cpp_result = kj::heapArrayBuilder(rust_result.size()); - for (auto& entry: rust_result) { - cpp_result.add(kj::str(entry.c_str())); - } - return cpp_result.finish(); + ::rust::Slice<::rust::Str const> rust_slice(rust_modules.begin(), rust_modules.size()); + auto rust_result = get_imports(rust_slice); + return workerd::fromRust(rust_result); } namespace workerd::api { namespace { KJ_TEST("basic `import` tests") { - auto files = kj::heapArrayBuilder(2); - files.add(kj::str("import a\nimport z")); - files.add(kj::str("import b")); - auto result = parseImports(files.finish()); + auto result = parseImports(kj::arr("import a\nimport z"_kj, "import b"_kj)); KJ_REQUIRE(result.size() == 3); KJ_REQUIRE(result[0] == "a"); KJ_REQUIRE(result[1] == "b"); @@ -37,91 +31,73 @@ KJ_TEST("basic `import` tests") { } KJ_TEST("supports whitespace") { - auto files = kj::heapArrayBuilder(1); - files.add(kj::str("import a\nimport \\\n\tz")); - auto result = parseImports(files.finish()); + auto result = parseImports(kj::arr("import a\nimport \\\n\tz"_kj)); KJ_REQUIRE(result.size() == 2); KJ_REQUIRE(result[0] == "a"); KJ_REQUIRE(result[1] == "z"); } KJ_TEST("supports windows newlines") { - auto files = kj::heapArrayBuilder(1); - files.add(kj::str("import a\r\nimport \\\r\n\tz")); - auto result = parseImports(files.finish()); + auto result = parseImports(kj::arr("import a\r\nimport \\\r\n\tz"_kj)); KJ_REQUIRE(result.size() == 2); KJ_REQUIRE(result[0] == "a"); KJ_REQUIRE(result[1] == "z"); } KJ_TEST("basic `from` test") { - auto files = kj::heapArrayBuilder(1); - files.add(kj::str("from x import a,b\nfrom z import y")); - auto result = parseImports(files.finish()); + auto result = parseImports(kj::arr("from x import a,b\nfrom z import y"_kj)); KJ_REQUIRE(result.size() == 2); KJ_REQUIRE(result[0] == "x"); KJ_REQUIRE(result[1] == "z"); } KJ_TEST("ignores indented blocks") { - auto files = kj::heapArrayBuilder(1); - files.add(kj::str("import a\nif True:\n import x\nimport y")); - auto result = parseImports(files.finish()); + auto result = parseImports(kj::arr("import a\nif True:\n import x\nimport y"_kj)); KJ_REQUIRE(result.size() == 2); KJ_REQUIRE(result[0] == "a"); KJ_REQUIRE(result[1] == "y"); } KJ_TEST("supports nested imports") { - auto files = kj::heapArrayBuilder(1); - files.add(kj::str("import a.b\nimport z.x.y.i")); - auto result = parseImports(files.finish()); + auto result = parseImports(kj::arr("import a.b\nimport z.x.y.i"_kj)); KJ_REQUIRE(result.size() == 2); KJ_REQUIRE(result[0] == "a.b"); KJ_REQUIRE(result[1] == "z.x.y.i"); } KJ_TEST("nested `from` test") { - auto files = kj::heapArrayBuilder(1); - files.add(kj::str("from x.y.z import a,b\nfrom z import y")); - auto result = parseImports(files.finish()); + auto result = parseImports(kj::arr("from x.y.z import a,b\nfrom z import y"_kj)); KJ_REQUIRE(result.size() == 2); KJ_REQUIRE(result[0] == "x.y.z"); KJ_REQUIRE(result[1] == "z"); } KJ_TEST("ignores trailing period") { - auto files = kj::heapArrayBuilder(1); - files.add(kj::str("import a.b.\nimport z.x.y.i.")); - auto result = parseImports(files.finish()); + auto result = parseImports(kj::arr("import a.b.\nimport z.x.y.i."_kj)); KJ_REQUIRE(result.size() == 0); } KJ_TEST("ignores relative import") { // This is where we diverge from the old AST-based approach. It would have returned `y` in the // input below. - auto files = kj::heapArrayBuilder(1); - files.add(kj::str("import .a.b\nimport ..z.x\nfrom .y import x")); - auto result = parseImports(files.finish()); + auto result = parseImports(kj::arr("import .a.b\nimport ..z.x\nfrom .y import x"_kj)); KJ_REQUIRE(result.size() == 0); } KJ_TEST("supports commas") { - auto files = kj::heapArrayBuilder(1); - files.add(kj::str("import a,b")); - auto result = parseImports(files.finish()); + auto result = parseImports(kj::arr("import a,b"_kj)); KJ_REQUIRE(result.size() == 2); KJ_REQUIRE(result[0] == "a"); KJ_REQUIRE(result[1] == "b"); } KJ_TEST("supports backslash") { - auto files = kj::heapArrayBuilder(4); - files.add(kj::str("import a\\\n,b")); - files.add(kj::str("import\\\n q,w")); - files.add(kj::str("from \\\nx import y")); - files.add(kj::str("from \\\n c import y")); - auto result = parseImports(files.finish()); + auto result = parseImports(kj::arr( + "import a\\\n,b"_kj, + "import\\\n q,w"_kj, + "from \\\nx import y"_kj, + "from \\\n c import y"_kj + )); KJ_REQUIRE(result.size() == 6); KJ_REQUIRE(result[0] == "a"); KJ_REQUIRE(result[1] == "b"); @@ -132,32 +108,31 @@ KJ_TEST("supports backslash") { } KJ_TEST("multiline-strings ignored") { - auto files = kj::heapArrayBuilder(4); - files.add(kj::str(R"SCRIPT( + auto files = kj::arr(R"SCRIPT( FOO=""" import x from y import z """ -)SCRIPT")); - files.add(kj::str(R"SCRIPT( +)SCRIPT"_kj, +R"SCRIPT( FOO=''' import f from g import z ''' -)SCRIPT")); - files.add(kj::str(R"SCRIPT(FOO = "\ +)SCRIPT"_kj, +R"SCRIPT(FOO = "\ import b \ -")SCRIPT")); - files.add(kj::str("FOO=\"\"\" \n", R"SCRIPT(import x +")SCRIPT"_kj, +"FOO=\"\"\" \n"_kj, +R"SCRIPT(import x from y import z -""")SCRIPT")); - auto result = parseImports(files.finish()); +""")SCRIPT"_kj); + auto result = parseImports(files); KJ_REQUIRE(result.size() == 0); } KJ_TEST("multiline-strings with imports in-between") { - auto files = kj::heapArrayBuilder(1); - files.add(kj::str( + auto files = kj::arr( R"SCRIPT(FOO=""" import x from y import z @@ -167,8 +142,8 @@ import w BAR=""" import e """ -from t import u)SCRIPT")); - auto result = parseImports(files.finish()); +from t import u)SCRIPT"_kj); + auto result = parseImports(files); KJ_REQUIRE(result.size() == 3); KJ_REQUIRE(result[0] == "q"); KJ_REQUIRE(result[1] == "t"); @@ -176,20 +151,18 @@ from t import u)SCRIPT")); } KJ_TEST("import after string literal") { - auto files = kj::heapArrayBuilder(1); - files.add(kj::str(R"SCRIPT(import a -"import b")SCRIPT")); - auto result = parseImports(files.finish()); + auto files = kj::arr(R"SCRIPT(import a +"import b")SCRIPT"_kj); + auto result = parseImports(files); KJ_REQUIRE(result.size() == 1); KJ_REQUIRE(result[0] == "a"); } KJ_TEST("langchain import") { - auto files = kj::heapArrayBuilder(1); - files.add(kj::str(R"SCRIPT(from js import Response, console, URL + auto files = kj::arr(R"SCRIPT(from js import Response, console, URL from langchain.chat_models import ChatOpenAI -import openai)SCRIPT")); - auto result = parseImports(files.finish()); +import openai)SCRIPT"_kj); + auto result = parseImports(files); KJ_REQUIRE(result.size() == 3); KJ_REQUIRE(result[0] == "js"); KJ_REQUIRE(result[1] == "langchain.chat_models"); diff --git a/src/rust/python-parser/lib.rs b/src/rust/python-parser/lib.rs index de0a3ed54fd..363f2e49f78 100644 --- a/src/rust/python-parser/lib.rs +++ b/src/rust/python-parser/lib.rs @@ -7,30 +7,31 @@ use ruff_python_parser::parse_module; mod ffi { extern "Rust" { - fn get_imports(sources: &Vec) -> Vec; + fn get_imports(sources: &[&str]) -> Vec; } } #[must_use] -pub fn get_imports(sources: &Vec) -> Vec { +pub fn get_imports(sources: &[&str]) -> Vec { let mut names: HashSet = HashSet::new(); for src in sources { // Just skip it if it doesn't parse. - if let Ok(module) = parse_module(src) { - for stmt in &module.syntax().body { - match stmt { - Stmt::Import(s) => { - names.extend(s.names.iter().map(|x| x.name.id.as_str().into())); - } - Stmt::ImportFrom(StmtImportFrom { - module: Some(module), - level: 0, - .. - }) => { - names.insert(module.id.as_str().into()); - } - _ => {} + let Ok(module) = parse_module(src) else { + continue; + }; + for stmt in &module.syntax().body { + match stmt { + Stmt::Import(s) => { + names.extend(s.names.iter().map(|x| x.name.id.as_str().to_owned())); } + Stmt::ImportFrom(StmtImportFrom { + module: Some(module), + level: 0, + .. + }) => { + names.insert(module.id.as_str().to_owned()); + } + _ => {} } } }