From 4485b1865316b26eed9fa64e95450df09765c5ba Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Tue, 31 Dec 2024 15:29:22 +0100 Subject: [PATCH] Use ruff-python-parser to compute Python imports (#3103) 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. --- .github/workflows/_bazel.yml | 3 +- .github/workflows/release.yml | 3 +- deps/rust/Cargo.lock | 295 +++++++++++++++++- deps/rust/cargo.bzl | 2 + .../crates/BUILD.aho-corasick-1.1.3.bazel | 52 +++ deps/rust/crates/BUILD.bazel | 20 +- deps/rust/crates/BUILD.bstr-1.11.1.bazel | 54 ++++ 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.7.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.9.bazel | 47 +++ .../crates/BUILD.ruff_python_ast-0.0.0.bazel | 57 ++++ .../BUILD.ruff_python_parser-0.0.0.bazel | 57 ++++ .../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 +++ deps/rust/crates/BUILD.rustc-hash-1.1.0.bazel | 48 +++ .../BUILD.static_assertions-1.1.0.bazel | 44 +++ deps/rust/crates/BUILD.syn-2.0.90.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 | 274 ++++++++++++++++ src/rust/cxx-integration/cxx-bridge.h | 8 + src/rust/python-parser/BUILD | 21 ++ src/rust/python-parser/import_parsing.c++ | 173 ++++++++++ src/rust/python-parser/lib.rs | 41 +++ 38 files changed, 2307 insertions(+), 20 deletions(-) create mode 100644 deps/rust/crates/BUILD.aho-corasick-1.1.3.bazel create mode 100644 deps/rust/crates/BUILD.bstr-1.11.1.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.7.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.9.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.rustc-hash-1.1.0.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/.github/workflows/_bazel.yml b/.github/workflows/_bazel.yml index 9e9c70b19f9..bd722455ca1 100644 --- a/.github/workflows/_bazel.yml +++ b/.github/workflows/_bazel.yml @@ -67,7 +67,8 @@ jobs: run: | git config --global core.symlinks true git config --show-scope --show-origin core.symlinks - [System.IO.File]::WriteAllLines((Join-Path -Path $env:USERPROFILE -ChildPath '.bazelrc'), 'startup --output_user_root=C:/tmp') + git config --system core.longpaths true + [System.IO.File]::WriteAllLines((Join-Path -Path $env:USERPROFILE -ChildPath '.bazelrc'), 'startup --output_user_root=\\\\?\\C:\\tmp') - name: Configure download mirrors shell: bash run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e2e17147b0c..8848d5ccdab 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -114,9 +114,10 @@ jobs: if: runner.os == 'Windows' run: | git config --global core.symlinks true + git config --system core.longpaths true git config --show-scope --show-origin core.symlinks # Set a custom output root directory to avoid long file name issues. - [System.IO.File]::WriteAllLines((Join-Path -Path $env:USERPROFILE -ChildPath '.bazelrc'), 'startup --output_user_root=C:/tmp') + [System.IO.File]::WriteAllLines((Join-Path -Path $env:USERPROFILE -ChildPath '.bazelrc'), 'startup --output_user_root=\\\\?\\C:\\tmp') - name: Configure download mirrors shell: bash run: | diff --git a/deps/rust/Cargo.lock b/deps/rust/Cargo.lock index 05a47db5c81..778835acebe 100644 --- a/deps/rust/Cargo.lock +++ b/deps/rust/Cargo.lock @@ -17,6 +17,15 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "allocator-api2" version = "0.2.21" @@ -62,6 +71,17 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +[[package]] +name = "bstr" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8" +dependencies = [ + "memchr", + "regex-automata", + "serde", +] + [[package]] name = "byteorder" version = "1.5.0" @@ -191,7 +211,7 @@ dependencies = [ "dtoa-short", "itoa 0.4.8", "matches", - "phf", + "phf 0.8.0", "proc-macro2", "quote", "smallvec", @@ -284,6 +304,8 @@ dependencies = [ "pico-args", "proc-macro2", "quote", + "ruff_python_ast", + "ruff_python_parser", "serde", "serde_json", "syn 2.0.90", @@ -307,6 +329,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" @@ -353,6 +381,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" @@ -364,6 +401,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" @@ -387,6 +435,27 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "is-macro" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d57a3e447e24c22647738e4607f1df1e0ec6f72e16182c4cd199f647cdfb0e4" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[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" @@ -539,18 +608,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]] @@ -559,8 +647,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]] @@ -569,8 +667,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", @@ -586,6 +684,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" @@ -643,14 +750,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" @@ -658,7 +776,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]] @@ -667,7 +795,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]] @@ -676,7 +813,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]] @@ -685,15 +822,87 @@ 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.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" + +[[package]] +name = "ruff_python_ast" +version = "0.0.0" +source = "git+https://github.com/astral-sh/ruff.git?tag=v0.4.10#b54922fd7394c36cdc390fd21aaee99206ebc361" +dependencies = [ + "aho-corasick", + "bitflags 2.6.0", + "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=v0.4.10#b54922fd7394c36cdc390fd21aaee99206ebc361" +dependencies = [ + "bitflags 2.6.0", + "bstr", + "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=v0.4.10#b54922fd7394c36cdc390fd21aaee99206ebc361" +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=v0.4.10#b54922fd7394c36cdc390fd21aaee99206ebc361" +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=v0.4.10#b54922fd7394c36cdc390fd21aaee99206ebc361" + [[package]] name = "rustc-demangle" version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.1" @@ -727,8 +936,8 @@ dependencies = [ "fxhash", "log", "matches", - "phf", - "phf_codegen", + "phf 0.8.0", + "phf_codegen 0.8.0", "precomputed-hash", "servo_arc", "smallvec", @@ -817,6 +1026,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" @@ -900,6 +1115,21 @@ dependencies = [ "syn 2.0.90", ] +[[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.42.0" @@ -939,12 +1169,43 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +[[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 = "wasi" version = "0.9.0+wasi-snapshot-preview1" diff --git a/deps/rust/cargo.bzl b/deps/rust/cargo.bzl index 9663082e84b..0d3fb541a6a 100644 --- a/deps/rust/cargo.bzl +++ b/deps/rust/cargo.bzl @@ -24,6 +24,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 = "v0.4.10"), + "ruff_python_parser": crate.spec(git = "https://github.com/astral-sh/ruff.git", tag = "v0.4.10"), "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.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 85577e8cccb..e82a29bd2dc 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.215//:serde", @@ -177,7 +189,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.11.1.bazel b/deps/rust/crates/BUILD.bstr-1.11.1.bazel new file mode 100644 index 00000000000..7dcbe6ecf6b --- /dev/null +++ b/deps/rust/crates/BUILD.bstr-1.11.1.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.11.1", + deps = [ + "@crates_vendor__memchr-2.7.4//:memchr", + "@crates_vendor__regex-automata-0.4.9//:regex_automata", + ], +) 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..918dd771d7f --- /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.168//:libc", # cfg(unix) + ], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [ + "@crates_vendor__libc-0.2.168//:libc", # cfg(unix) + ], + "@rules_rust//rust/platform:x86_64-apple-darwin": [ + "@crates_vendor__libc-0.2.168//:libc", # cfg(unix) + ], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [ + "@crates_vendor__libc-0.2.168//:libc", # cfg(unix) + ], + "//conditions:default": [], + }), +) diff --git a/deps/rust/crates/BUILD.is-macro-0.3.7.bazel b/deps/rust/crates/BUILD.is-macro-0.3.7.bazel new file mode 100644 index 00000000000..87a9fc27899 --- /dev/null +++ b/deps/rust/crates/BUILD.is-macro-0.3.7.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.7", + deps = [ + "@crates_vendor__heck-0.5.0//:heck", + "@crates_vendor__proc-macro2-1.0.92//:proc_macro2", + "@crates_vendor__quote-1.0.37//:quote", + "@crates_vendor__syn-2.0.90//: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..17455f99b0d --- /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.168//:libc", # aarch64-apple-darwin + ], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [ + "@crates_vendor__libc-0.2.168//:libc", # aarch64-unknown-linux-gnu + ], + "@rules_rust//rust/platform:x86_64-apple-darwin": [ + "@crates_vendor__libc-0.2.168//:libc", # x86_64-apple-darwin + ], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [ + "@crates_vendor__libc-0.2.168//: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.9.bazel b/deps/rust/crates/BUILD.regex-automata-0.4.9.bazel new file mode 100644 index 00000000000..5637a970bf2 --- /dev/null +++ b/deps/rust/crates/BUILD.regex-automata-0.4.9.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.9", +) 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..fdc13e87307 --- /dev/null +++ b/deps/rust/crates/BUILD.ruff_python_ast-0.0.0.bazel @@ -0,0 +1,57 @@ +############################################################################### +# @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.7//: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__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-1.1.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..4fbc6c1fb5a --- /dev/null +++ b/deps/rust/crates/BUILD.ruff_python_parser-0.0.0.bazel @@ -0,0 +1,57 @@ +############################################################################### +# @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.11.1//:bstr", + "@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-1.1.0//:rustc_hash", + "@crates_vendor__static_assertions-1.1.0//:static_assertions", + "@crates_vendor__unicode-ident-1.0.14//: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..f3371e195c0 --- /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.14//: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.rustc-hash-1.1.0.bazel b/deps/rust/crates/BUILD.rustc-hash-1.1.0.bazel new file mode 100644 index 00000000000..4eff2d4467b --- /dev/null +++ b/deps/rust/crates/BUILD.rustc-hash-1.1.0.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 = "rustc_hash", + 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 = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=rustc-hash", + "manual", + "noclippy", + "norustfmt", + ], + version = "1.1.0", +) 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.90.bazel b/deps/rust/crates/BUILD.syn-2.0.90.bazel index 7a6603f473c..762e26a0572 100644 --- a/deps/rust/crates/BUILD.syn-2.0.90.bazel +++ b/deps/rust/crates/BUILD.syn-2.0.90.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 279f9bcb298..9b7574745b7 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.92//: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.215//:serde"), "serde_json": Label("@crates_vendor__serde_json-1.0.133//:serde_json"), "syn": Label("@crates_vendor__syn-2.0.90//:syn"), @@ -428,6 +430,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.adler2-2.0.0.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__allocator-api2-0.2.21", @@ -488,6 +500,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.11.1", + sha256 = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8", + type = "tar.gz", + urls = ["https://static.crates.io/crates/bstr/1.11.1/download"], + strip_prefix = "bstr-1.11.1", + build_file = Label("@workerd//deps/rust/crates:BUILD.bstr-1.11.1.bazel"), + ) + maybe( http_archive, name = "crates_vendor__byteorder-1.5.0", @@ -708,6 +730,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", @@ -768,6 +800,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", @@ -778,6 +820,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", @@ -808,6 +860,26 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.heck-0.5.0.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__is-macro-0.3.7", + sha256 = "1d57a3e447e24c22647738e4607f1df1e0ec6f72e16182c4cd199f647cdfb0e4", + type = "tar.gz", + urls = ["https://static.crates.io/crates/is-macro/0.3.7/download"], + strip_prefix = "is-macro-0.3.7", + build_file = Label("@workerd//deps/rust/crates:BUILD.is-macro-0.3.7.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", @@ -987,6 +1059,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", @@ -997,6 +1079,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", @@ -1007,6 +1099,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", @@ -1027,6 +1129,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", @@ -1117,6 +1229,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", @@ -1127,6 +1249,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", @@ -1137,6 +1269,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", @@ -1157,6 +1299,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.9", + sha256 = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908", + type = "tar.gz", + urls = ["https://static.crates.io/crates/regex-automata/0.4.9/download"], + strip_prefix = "regex-automata-0.4.9", + build_file = Label("@workerd//deps/rust/crates:BUILD.regex-automata-0.4.9.bazel"), + ) + + maybe( + new_git_repository, + name = "crates_vendor__ruff_python_ast-0.0.0", + commit = "b54922fd7394c36cdc390fd21aaee99206ebc361", + 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 = "b54922fd7394c36cdc390fd21aaee99206ebc361", + 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 = "b54922fd7394c36cdc390fd21aaee99206ebc361", + 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 = "b54922fd7394c36cdc390fd21aaee99206ebc361", + 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 = "b54922fd7394c36cdc390fd21aaee99206ebc361", + 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", @@ -1167,6 +1369,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.rustc-demangle-0.1.24.bazel"), ) + maybe( + http_archive, + name = "crates_vendor__rustc-hash-1.1.0", + sha256 = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2", + type = "tar.gz", + urls = ["https://static.crates.io/crates/rustc-hash/1.1.0/download"], + strip_prefix = "rustc-hash-1.1.0", + build_file = Label("@workerd//deps/rust/crates:BUILD.rustc-hash-1.1.0.bazel"), + ) + maybe( http_archive, name = "crates_vendor__rustc_version-0.4.1", @@ -1307,6 +1519,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", @@ -1397,6 +1619,26 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.thiserror-impl-2.0.6.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.42.0", @@ -1437,6 +1679,16 @@ def crate_repositories(): build_file = Label("@workerd//deps/rust/crates:BUILD.unicode-ident-1.0.14.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", @@ -1447,6 +1699,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__wasi-0.11.0-wasi-snapshot-preview1", @@ -1621,6 +1893,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.92", 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.215", is_dev_dep = False), struct(repo = "crates_vendor__serde_json-1.0.133", is_dev_dep = False), struct(repo = "crates_vendor__syn-2.0.90", is_dev_dep = False), 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 new file mode 100644 index 00000000000..b06bbf822ca --- /dev/null +++ b/src/rust/python-parser/BUILD @@ -0,0 +1,21 @@ +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", + "//deps/rust:runtime", + "//src/rust/cxx-integration", + ], +) diff --git a/src/rust/python-parser/import_parsing.c++ b/src/rust/python-parser/import_parsing.c++ new file mode 100644 index 00000000000..d0ba59b43b6 --- /dev/null +++ b/src/rust/python-parser/import_parsing.c++ @@ -0,0 +1,173 @@ +// 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 "workerd/rust/cxx-integration/lib.rs.h" + +#include + +using ::edgeworker::rust::python_parser::get_imports; + +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.add(entry.cStr()); + } + ::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 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"); + KJ_REQUIRE(result[2] == "z"); +} + +KJ_TEST("supports whitespace") { + 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 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 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 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 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 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 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 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 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 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"); + 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::arr(R"SCRIPT( +FOO=""" +import x +from y import z +""" +)SCRIPT"_kj, +R"SCRIPT( +FOO=''' +import f +from g import z +''' +)SCRIPT"_kj, +R"SCRIPT(FOO = "\ +import b \ +")SCRIPT"_kj, +"FOO=\"\"\" \n"_kj, +R"SCRIPT(import x +from y import z +""")SCRIPT"_kj); + auto result = parseImports(files); + KJ_REQUIRE(result.size() == 0); +} + +KJ_TEST("multiline-strings with imports in-between") { + auto files = kj::arr( + R"SCRIPT(FOO=""" +import x +from y import z +""" +import q +import w +BAR=""" +import e +""" +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"); + KJ_REQUIRE(result[2] == "w"); +} + +KJ_TEST("import after string literal") { + 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::arr(R"SCRIPT(from js import Response, console, URL +from langchain.chat_models import ChatOpenAI +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"); + 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..363f2e49f78 --- /dev/null +++ b/src/rust/python-parser/lib.rs @@ -0,0 +1,41 @@ +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: &[&str]) -> Vec; + } +} + +#[must_use] +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. + 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()); + } + _ => {} + } + } + } + let mut result: Vec<_> = names.drain().collect(); + result.sort(); + result +}