diff --git a/Cargo.lock b/Cargo.lock index 7267065be985..9e30973bcb6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -436,6 +436,7 @@ dependencies = [ "serde_json", "serde_with", "stderrlog", + "toml", "triomphe", ] @@ -2094,6 +2095,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + [[package]] name = "serde_with" version = "3.12.0" @@ -2303,6 +2313,40 @@ dependencies = [ "time-core", ] +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap 2.7.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "tracing" version = "0.1.41" @@ -2754,6 +2798,15 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winnow" +version = "0.6.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a" +dependencies = [ + "memchr", +] + [[package]] name = "yansi" version = "1.0.1" diff --git a/MODULE.bazel b/MODULE.bazel index 0481eb7a0bb8..73f8271fb63e 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -125,6 +125,7 @@ use_repo( "vendor__serde_with-3.12.0", "vendor__stderrlog-0.6.0", "vendor__syn-2.0.96", + "vendor__toml-0.8.19", "vendor__tracing-0.1.41", "vendor__tracing-subscriber-0.3.19", "vendor__tree-sitter-0.24.6", diff --git a/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.bazel b/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.bazel index 92b287c801cf..de5a5384509d 100644 --- a/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.bazel +++ b/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.bazel @@ -283,6 +283,12 @@ alias( tags = ["manual"], ) +alias( + name = "toml", + actual = "@vendor__toml-0.8.19//:toml", + tags = ["manual"], +) + alias( name = "tracing", actual = "@vendor__tracing-0.1.41//:tracing", diff --git a/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.serde_spanned-0.6.8.bazel b/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.serde_spanned-0.6.8.bazel new file mode 100644 index 000000000000..637213b7916d --- /dev/null +++ b/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.serde_spanned-0.6.8.bazel @@ -0,0 +1,87 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @@//misc/bazel/3rdparty:vendor_tree_sitter_extractors +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "serde_spanned", + 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 = [ + "serde", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=serde_spanned", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-fuchsia": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-fuchsia": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "0.6.8", + deps = [ + "@vendor__serde-1.0.217//:serde", + ], +) diff --git a/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.toml-0.8.19.bazel b/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.toml-0.8.19.bazel new file mode 100644 index 000000000000..dad1d24c6226 --- /dev/null +++ b/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.toml-0.8.19.bazel @@ -0,0 +1,92 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @@//misc/bazel/3rdparty:vendor_tree_sitter_extractors +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "toml", + 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", + "display", + "parse", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=toml", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-fuchsia": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-fuchsia": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "0.8.19", + deps = [ + "@vendor__serde-1.0.217//:serde", + "@vendor__serde_spanned-0.6.8//:serde_spanned", + "@vendor__toml_datetime-0.6.8//:toml_datetime", + "@vendor__toml_edit-0.22.22//:toml_edit", + ], +) diff --git a/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.toml_datetime-0.6.8.bazel b/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.toml_datetime-0.6.8.bazel new file mode 100644 index 000000000000..f703efd62d84 --- /dev/null +++ b/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.toml_datetime-0.6.8.bazel @@ -0,0 +1,87 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @@//misc/bazel/3rdparty:vendor_tree_sitter_extractors +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "toml_datetime", + 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 = [ + "serde", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=toml_datetime", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-fuchsia": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-fuchsia": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "0.6.8", + deps = [ + "@vendor__serde-1.0.217//:serde", + ], +) diff --git a/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.toml_edit-0.22.22.bazel b/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.toml_edit-0.22.22.bazel new file mode 100644 index 000000000000..b2cb3e6f5919 --- /dev/null +++ b/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.toml_edit-0.22.22.bazel @@ -0,0 +1,93 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @@//misc/bazel/3rdparty:vendor_tree_sitter_extractors +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "toml_edit", + 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 = [ + "display", + "parse", + "serde", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=toml_edit", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-fuchsia": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-fuchsia": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "0.22.22", + deps = [ + "@vendor__indexmap-2.7.0//:indexmap", + "@vendor__serde-1.0.217//:serde", + "@vendor__serde_spanned-0.6.8//:serde_spanned", + "@vendor__toml_datetime-0.6.8//:toml_datetime", + "@vendor__winnow-0.6.24//:winnow", + ], +) diff --git a/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.winnow-0.6.24.bazel b/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.winnow-0.6.24.bazel new file mode 100644 index 000000000000..282e6bc20571 --- /dev/null +++ b/misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.winnow-0.6.24.bazel @@ -0,0 +1,86 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @@//misc/bazel/3rdparty:vendor_tree_sitter_extractors +############################################################################### + +load("@rules_rust//rust:defs.bzl", "rust_library") + +package(default_visibility = ["//visibility:public"]) + +rust_library( + name = "winnow", + 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", + ], + crate_root = "src/lib.rs", + edition = "2021", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=winnow", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-fuchsia": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-fuchsia": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "0.6.24", +) diff --git a/misc/bazel/3rdparty/tree_sitter_extractors_deps/defs.bzl b/misc/bazel/3rdparty/tree_sitter_extractors_deps/defs.bzl index 74874b1b5ab6..a4be23b9edad 100644 --- a/misc/bazel/3rdparty/tree_sitter_extractors_deps/defs.bzl +++ b/misc/bazel/3rdparty/tree_sitter_extractors_deps/defs.bzl @@ -353,6 +353,7 @@ _NORMAL_DEPENDENCIES = { "serde_json": Label("@vendor__serde_json-1.0.135//:serde_json"), "serde_with": Label("@vendor__serde_with-3.12.0//:serde_with"), "stderrlog": Label("@vendor__stderrlog-0.6.0//:stderrlog"), + "toml": Label("@vendor__toml-0.8.19//:toml"), "triomphe": Label("@vendor__triomphe-0.1.14//:triomphe"), }, }, @@ -2599,6 +2600,16 @@ def crate_repositories(): build_file = Label("//misc/bazel/3rdparty/tree_sitter_extractors_deps:BUILD.serde_json-1.0.135.bazel"), ) + maybe( + http_archive, + name = "vendor__serde_spanned-0.6.8", + sha256 = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1", + type = "tar.gz", + urls = ["https://static.crates.io/crates/serde_spanned/0.6.8/download"], + strip_prefix = "serde_spanned-0.6.8", + build_file = Label("//misc/bazel/3rdparty/tree_sitter_extractors_deps:BUILD.serde_spanned-0.6.8.bazel"), + ) + maybe( http_archive, name = "vendor__serde_with-3.12.0", @@ -2819,6 +2830,36 @@ def crate_repositories(): build_file = Label("//misc/bazel/3rdparty/tree_sitter_extractors_deps:BUILD.time-macros-0.2.19.bazel"), ) + maybe( + http_archive, + name = "vendor__toml-0.8.19", + sha256 = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e", + type = "tar.gz", + urls = ["https://static.crates.io/crates/toml/0.8.19/download"], + strip_prefix = "toml-0.8.19", + build_file = Label("//misc/bazel/3rdparty/tree_sitter_extractors_deps:BUILD.toml-0.8.19.bazel"), + ) + + maybe( + http_archive, + name = "vendor__toml_datetime-0.6.8", + sha256 = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41", + type = "tar.gz", + urls = ["https://static.crates.io/crates/toml_datetime/0.6.8/download"], + strip_prefix = "toml_datetime-0.6.8", + build_file = Label("//misc/bazel/3rdparty/tree_sitter_extractors_deps:BUILD.toml_datetime-0.6.8.bazel"), + ) + + maybe( + http_archive, + name = "vendor__toml_edit-0.22.22", + sha256 = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5", + type = "tar.gz", + urls = ["https://static.crates.io/crates/toml_edit/0.22.22/download"], + strip_prefix = "toml_edit-0.22.22", + build_file = Label("//misc/bazel/3rdparty/tree_sitter_extractors_deps:BUILD.toml_edit-0.22.22.bazel"), + ) + maybe( http_archive, name = "vendor__tracing-0.1.41", @@ -3359,6 +3400,16 @@ def crate_repositories(): build_file = Label("//misc/bazel/3rdparty/tree_sitter_extractors_deps:BUILD.windows_x86_64_msvc-0.52.6.bazel"), ) + maybe( + http_archive, + name = "vendor__winnow-0.6.24", + sha256 = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a", + type = "tar.gz", + urls = ["https://static.crates.io/crates/winnow/0.6.24/download"], + strip_prefix = "winnow-0.6.24", + build_file = Label("//misc/bazel/3rdparty/tree_sitter_extractors_deps:BUILD.winnow-0.6.24.bazel"), + ) + maybe( http_archive, name = "vendor__yansi-1.0.1", @@ -3431,6 +3482,7 @@ def crate_repositories(): struct(repo = "vendor__serde_with-3.12.0", is_dev_dep = False), struct(repo = "vendor__stderrlog-0.6.0", is_dev_dep = False), struct(repo = "vendor__syn-2.0.96", is_dev_dep = False), + struct(repo = "vendor__toml-0.8.19", is_dev_dep = False), struct(repo = "vendor__tracing-0.1.41", is_dev_dep = False), struct(repo = "vendor__tracing-subscriber-0.3.19", is_dev_dep = False), struct(repo = "vendor__tree-sitter-0.24.6", is_dev_dep = False), diff --git a/rust/extractor/Cargo.toml b/rust/extractor/Cargo.toml index cc99db538bb9..310ffefb7784 100644 --- a/rust/extractor/Cargo.toml +++ b/rust/extractor/Cargo.toml @@ -36,3 +36,4 @@ glob = "0.3.2" chrono = { version = "0.4.39", features = ["serde"] } serde_json = "1.0.135" dunce = "1.0.5" +toml = "0.8.19" diff --git a/rust/extractor/src/diagnostics.rs b/rust/extractor/src/diagnostics.rs index 92743a923d4a..0e202e95bbd0 100644 --- a/rust/extractor/src/diagnostics.rs +++ b/rust/extractor/src/diagnostics.rs @@ -79,6 +79,7 @@ pub struct Diagnostics { pub enum ExtractionStepKind { #[default] LoadManifest, + FindManifests, LoadSource, Parse, Extract, @@ -88,12 +89,12 @@ pub enum ExtractionStepKind { #[serde(rename_all = "camelCase")] pub struct ExtractionStep { pub action: ExtractionStepKind, - pub file: PathBuf, + pub file: Option, pub ms: u128, } impl ExtractionStep { - fn new(start: Instant, action: ExtractionStepKind, file: PathBuf) -> Self { + fn new(start: Instant, action: ExtractionStepKind, file: Option) -> Self { let ret = ExtractionStep { action, file, @@ -107,20 +108,36 @@ impl ExtractionStep { Self::new( start, ExtractionStepKind::LoadManifest, - PathBuf::from(target.manifest_path()), + Some(PathBuf::from(target.manifest_path())), ) } pub fn parse(start: Instant, target: &Path) -> Self { - Self::new(start, ExtractionStepKind::Parse, PathBuf::from(target)) + Self::new( + start, + ExtractionStepKind::Parse, + Some(PathBuf::from(target)), + ) } pub fn extract(start: Instant, target: &Path) -> Self { - Self::new(start, ExtractionStepKind::Extract, PathBuf::from(target)) + Self::new( + start, + ExtractionStepKind::Extract, + Some(PathBuf::from(target)), + ) } pub fn load_source(start: Instant, target: &Path) -> Self { - Self::new(start, ExtractionStepKind::LoadSource, PathBuf::from(target)) + Self::new( + start, + ExtractionStepKind::LoadSource, + Some(PathBuf::from(target)), + ) + } + + pub fn find_manifests(start: Instant) -> Self { + Self::new(start, ExtractionStepKind::FindManifests, None) } } diff --git a/rust/extractor/src/generated/.generated.list b/rust/extractor/src/generated/.generated.list index 531f5146cf85..ed3819821738 100644 --- a/rust/extractor/src/generated/.generated.list +++ b/rust/extractor/src/generated/.generated.list @@ -1,2 +1,2 @@ mod.rs 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7 -top.rs f042175b9f2dc4092ed04dde2073735560a9c3050a2f07ee79193c492e91cabc f042175b9f2dc4092ed04dde2073735560a9c3050a2f07ee79193c492e91cabc +top.rs 97b9c3c5485196cc7949ec1b67c5844b7ff7af67bc2339276adbdafb03789ac0 97b9c3c5485196cc7949ec1b67c5844b7ff7af67bc2339276adbdafb03789ac0 diff --git a/rust/extractor/src/generated/top.rs b/rust/extractor/src/generated/top.rs index bd125a07df2e..5e962ad77ea6 100644 --- a/rust/extractor/src/generated/top.rs +++ b/rust/extractor/src/generated/top.rs @@ -26,7 +26,7 @@ impl trap::TrapClass for Element { pub struct ExtractorStep { pub id: trap::TrapId, pub action: String, - pub file: trap::Label, + pub file: Option>, pub duration_ms: usize, } @@ -36,7 +36,10 @@ impl trap::TrapEntry for ExtractorStep { } fn emit(self, id: trap::Label, out: &mut trap::Writer) { - out.add_tuple("extractor_steps", vec![id.into(), self.action.into(), self.file.into(), self.duration_ms.into()]); + out.add_tuple("extractor_steps", vec![id.into(), self.action.into(), self.duration_ms.into()]); + if let Some(v) = self.file { + out.add_tuple("extractor_step_files", vec![id.into(), v.into()]); + } } } diff --git a/rust/extractor/src/main.rs b/rust/extractor/src/main.rs index d721ea2c6bd9..1b5ec515d0e7 100644 --- a/rust/extractor/src/main.rs +++ b/rust/extractor/src/main.rs @@ -145,7 +145,7 @@ impl<'a> Extractor<'a> { emit_extraction_diagnostics(start, cfg, &self.steps)?; let mut trap = self.traps.create("diagnostics", "extraction"); for step in self.steps { - let file = trap.emit_file(&step.file); + let file = step.file.as_ref().map(|f| trap.emit_file(f)); let duration_ms = usize::try_from(step.ms).unwrap_or_else(|_e| { warn!("extraction step duration overflowed ({step:?})"); i32::MAX as usize @@ -160,6 +160,13 @@ impl<'a> Extractor<'a> { trap.commit()?; Ok(()) } + + pub fn find_manifests(&mut self, files: &[PathBuf]) -> anyhow::Result> { + let before = Instant::now(); + let ret = rust_analyzer::find_project_manifests(files); + self.steps.push(ExtractionStep::find_manifests(before)); + ret + } } fn cwd() -> anyhow::Result { @@ -199,7 +206,7 @@ fn main() -> anyhow::Result<()> { dunce::canonicalize(&file).unwrap_or(file) }) .collect(); - let manifests = rust_analyzer::find_project_manifests(&files)?; + let manifests = extractor.find_manifests(&files)?; let mut map: HashMap<&Path, (&ProjectManifest, Vec<&Path>)> = manifests .iter() .map(|x| (x.manifest_path().parent().as_ref(), (x, Vec::new()))) diff --git a/rust/extractor/src/rust_analyzer.rs b/rust/extractor/src/rust_analyzer.rs index 735bacb27c12..5d03bcc156db 100644 --- a/rust/extractor/src/rust_analyzer.rs +++ b/rust/extractor/src/rust_analyzer.rs @@ -1,12 +1,12 @@ use itertools::Itertools; -use log::{debug, info}; +use log::{debug, error, info, warn}; use ra_ap_base_db::SourceDatabase; use ra_ap_hir::Semantics; use ra_ap_ide_db::RootDatabase; use ra_ap_load_cargo::{load_workspace_at, LoadCargoConfig, ProcMacroServerChoice}; use ra_ap_paths::Utf8PathBuf; -use ra_ap_project_model::CargoConfig; use ra_ap_project_model::ProjectManifest; +use ra_ap_project_model::{CargoConfig, ManifestPath}; use ra_ap_span::Edition; use ra_ap_span::EditionedFileId; use ra_ap_span::TextRange; @@ -16,8 +16,12 @@ use ra_ap_syntax::SyntaxError; use ra_ap_vfs::Vfs; use ra_ap_vfs::VfsPath; use ra_ap_vfs::{AbsPathBuf, FileId}; +use serde::Deserialize; use std::borrow::Cow; +use std::collections::{HashMap, HashSet}; +use std::fs; use std::path::{Path, PathBuf}; +use std::rc::Rc; use triomphe::Arc; pub enum RustAnalyzer<'a> { @@ -128,6 +132,91 @@ impl<'a> RustAnalyzer<'a> { } } +#[derive(Deserialize)] +struct CargoManifestMembersSlice { + #[serde(default)] + members: Vec, +} + +#[derive(Deserialize)] +struct CargoManifestSlice { + workspace: Option, +} + +struct TomlReader { + cache: HashMap>, +} + +impl TomlReader { + fn new() -> Self { + Self { + cache: HashMap::new(), + } + } + + fn read(&mut self, manifest: &ManifestPath) -> anyhow::Result> { + if let Some(table) = self.cache.get(manifest) { + return Ok(table.clone()); + } + let content = fs::read_to_string(manifest).map_err(|e| { + error!("failed to read {} ({e})", manifest.as_str()); + e + })?; + let table = Rc::::new(toml::from_str(&content).map_err(|e| { + error!("failed to parse {} ({e})", manifest.as_str()); + e + })?); + self.cache.insert(manifest.clone(), table.clone()); + Ok(table) + } +} + +fn find_workspace(reader: &mut TomlReader, manifest: &ProjectManifest) -> Option { + let ProjectManifest::CargoToml(cargo) = manifest else { + return None; + }; + let parsed_cargo = reader.read(cargo).ok()?; + if parsed_cargo.workspace.is_some() { + debug!("{cargo} is a workspace"); + return Some(manifest.clone()); + } + let Some(parent_dir) = cargo.parent().parent() else { + warn!("no parent dir for {cargo}"); + return None; + }; + let discovered = ProjectManifest::discover(parent_dir) + .map_err(|e| { + error!( + "encountered error while searching for manifests under {}: {e}", + parent_dir.as_str() + ); + e + }) + .ok()?; + discovered + .iter() + .find_map(|it| match it { + ProjectManifest::CargoToml(other) + if cargo.starts_with(other.parent()) + && reader.read(other).is_ok_and(|it| { + it.workspace.as_ref().is_some_and(|w| { + w.members + .iter() + .any(|m| other.parent().join(m) == cargo.parent()) + }) + }) => + { + debug!("found workspace {other} containing {cargo}"); + Some(it.clone()) + } + _ => None, + }) + .or_else(|| { + debug!("no workspace found for {cargo}"); + None + }) +} + pub fn find_project_manifests( files: &[PathBuf], ) -> anyhow::Result> { @@ -136,7 +225,13 @@ pub fn find_project_manifests( .iter() .map(|path| AbsPathBuf::assert_utf8(current.join(path))) .collect(); - let ret = ra_ap_project_model::ProjectManifest::discover_all(&abs_files); + let discovered = ra_ap_project_model::ProjectManifest::discover_all(&abs_files); + let mut ret = HashSet::new(); + let mut reader = TomlReader::new(); + for manifest in discovered { + let workspace = find_workspace(&mut reader, &manifest).unwrap_or(manifest); + ret.insert(workspace); + } let iter = || ret.iter().map(|m| format!(" {m}")); const LOG_LIMIT: usize = 10; if ret.len() <= LOG_LIMIT { @@ -152,8 +247,9 @@ pub fn find_project_manifests( iter().dropping(LOG_LIMIT).join("\n") ); } - Ok(ret) + Ok(ret.into_iter().collect()) } + fn from_utf8_lossy(v: &[u8]) -> (Cow<'_, str>, Option) { let mut iter = v.utf8_chunks(); let (first_valid, first_invalid) = if let Some(chunk) = iter.next() { diff --git a/rust/ql/.generated.list b/rust/ql/.generated.list index e1e6b655a316..8d1f4d244d56 100644 --- a/rust/ql/.generated.list +++ b/rust/ql/.generated.list @@ -515,7 +515,7 @@ lib/codeql/rust/elements/internal/generated/ExternBlock.qll c292d804a1f8d2cf6a44 lib/codeql/rust/elements/internal/generated/ExternCrate.qll 35fea4e810a896c1656adb4682c4c3bc20283768073e26ae064189ce310433c8 fc504dff79ba758d89b10cd5049539fbc766ee9862ff495066cea26abf0b5e0b lib/codeql/rust/elements/internal/generated/ExternItem.qll 749b064ad60f32197d5b85e25929afe18e56e12f567b73e21e43e2fdf4c447e3 e2c2d423876675cf2dae399ca442aef7b2860319da9bfadeff29f2c6946f8de7 lib/codeql/rust/elements/internal/generated/ExternItemList.qll 6bc97fdae6c411cab5c501129c1d6c2321c1011cccb119515d75d07dc55c253b 6b5aa808025c0a4270cac540c07ba6faede1b3c70b8db5fd89ec5d46df9041b2 -lib/codeql/rust/elements/internal/generated/ExtractorStep.qll b83ce7f18009bdd36374260652c2a8a5cd5a9b5404a1c147bbec49ad251e43f3 e6e55595300126f9c5a6fd7bde5321b2a0026b491326114d16fcc2395a1fc483 +lib/codeql/rust/elements/internal/generated/ExtractorStep.qll 61cd504a1aab98b1c977ee8cff661258351d11ca1fec77038c0a17d359f5810e 5e57b50f3e8e3114a55159fb11a524c6944363f5f8a380abccc8b220dedc70ca lib/codeql/rust/elements/internal/generated/FieldExpr.qll 3e506b5cb93793ec30f56bb637a600db869fcba6181b068516a671d55c362739 7bbf953696d763ad6b210f378f487ba85b875fa115b22c0c0508599a63633502 lib/codeql/rust/elements/internal/generated/FieldList.qll 43c13c6e3c9ba75a7a4cb870fc4f18752001584d48b9df0734055a6ebb789331 7c51b0b13eb02f1286d3365e53a976ba2655c4dbd8e735bc11c8b205c829e1ee lib/codeql/rust/elements/internal/generated/FnPtrTypeRepr.qll d490ab9f2e3654d9abde18a06e534abd99ca62f518ca08670b696a97e9d5c592 01500319820f66cb4bbda6fe7c26270f76ea934efff4bb3cbf88e9b1e07e8be2 @@ -594,7 +594,7 @@ lib/codeql/rust/elements/internal/generated/PtrTypeRepr.qll 51d1e9e683fc79dddbff lib/codeql/rust/elements/internal/generated/PureSynthConstructors.qll e5b8e69519012bbaae29dcb82d53f7f7ecce368c0358ec27ef6180b228a0057f e5b8e69519012bbaae29dcb82d53f7f7ecce368c0358ec27ef6180b228a0057f lib/codeql/rust/elements/internal/generated/RangeExpr.qll 23cca03bf43535f33b22a38894f70d669787be4e4f5b8fe5c8f7b964d30e9027 18624cef6c6b679eeace2a98737e472432e0ead354cca02192b4d45330f047c9 lib/codeql/rust/elements/internal/generated/RangePat.qll 80826a6a6868a803aa2372e31c52a03e1811a3f1f2abdb469f91ca0bfdd9ecb6 34ee1e208c1690cba505dff2c588837c0cd91e185e2a87d1fe673191962276a9 -lib/codeql/rust/elements/internal/generated/Raw.qll db71278eea846cffd8748f1650493822d95108609a5c055bfaed7af4f42011c1 fabbf440a40ff5b1e9da26a95d20db89fbe7d33717bbc4f02ef518fc9dfd1e54 +lib/codeql/rust/elements/internal/generated/Raw.qll c75c7811d041897c2d6aae1e0e55b46af6182565e1d0dd624062c5ca499e9325 79e6ded808f14dd622076b75d8e4985c7b90f2d5e964d0750519b510463b47ba lib/codeql/rust/elements/internal/generated/RecordExpr.qll 2131b2cb336caa76170082e69776011bf02576bbfdd34ba68ca84af24209250a 39a2e3ec32352b594c43cc1295e0e8b3f9808173322d3d73cb7d48ef969d5565 lib/codeql/rust/elements/internal/generated/RecordExprField.qll 7e9f8663d3b74ebbc9603b10c9912f082febba6bd73d344b100bbd3edf837802 fbe6b578e7fd5d5a6f21bbb8c388957ab7210a6a249ec71510a50fb35b319ea1 lib/codeql/rust/elements/internal/generated/RecordExprFieldList.qll 179a97211fe7aa6265085d4d54115cdbc0e1cd7c9b2135591e8f36d6432f13d3 dd44bbbc1e83a1ed3a587afb729d7debf7aeb7b63245de181726af13090e50c0 diff --git a/rust/ql/integration-tests/hello-project/diagnostics.expected b/rust/ql/integration-tests/hello-project/diagnostics.expected index f938b5b8ab5b..5455d51f2797 100644 --- a/rust/ql/integration-tests/hello-project/diagnostics.expected +++ b/rust/ql/integration-tests/hello-project/diagnostics.expected @@ -5,6 +5,10 @@ "ms": "__REDACTED__", "pretty": "__REDACTED__" }, + "findManifests": { + "ms": "__REDACTED__", + "pretty": "__REDACTED__" + }, "loadManifest": { "ms": "__REDACTED__", "pretty": "__REDACTED__" diff --git a/rust/ql/integration-tests/hello-project/steps.cargo.expected b/rust/ql/integration-tests/hello-project/steps.cargo.expected index 61987aa564bb..958079845eb5 100644 --- a/rust/ql/integration-tests/hello-project/steps.cargo.expected +++ b/rust/ql/integration-tests/hello-project/steps.cargo.expected @@ -1,4 +1,5 @@ | Cargo.toml:0:0:0:0 | LoadManifest(Cargo.toml) | +| file://:0:0:0:0 | FindManifests | | src/directory_module/mod.rs:0:0:0:0 | Extract(src/directory_module/mod.rs) | | src/directory_module/mod.rs:0:0:0:0 | LoadSource(src/directory_module/mod.rs) | | src/directory_module/mod.rs:0:0:0:0 | Parse(src/directory_module/mod.rs) | diff --git a/rust/ql/integration-tests/hello-project/steps.rust-project.expected b/rust/ql/integration-tests/hello-project/steps.rust-project.expected index d1d2e9ddee3f..3ebf60a82de0 100644 --- a/rust/ql/integration-tests/hello-project/steps.rust-project.expected +++ b/rust/ql/integration-tests/hello-project/steps.rust-project.expected @@ -1,3 +1,4 @@ +| file://:0:0:0:0 | FindManifests | | rust-project.json:0:0:0:0 | LoadManifest(rust-project.json) | | src/directory_module/mod.rs:0:0:0:0 | Extract(src/directory_module/mod.rs) | | src/directory_module/mod.rs:0:0:0:0 | LoadSource(src/directory_module/mod.rs) | diff --git a/rust/ql/integration-tests/hello-project/summary.expected b/rust/ql/integration-tests/hello-project/summary.expected index 07c48c7a5b75..4b584a4c7953 100644 --- a/rust/ql/integration-tests/hello-project/summary.expected +++ b/rust/ql/integration-tests/hello-project/summary.expected @@ -1,4 +1,4 @@ -| Elements extracted | 65 | +| Elements extracted | 66 | | Elements unextracted | 0 | | Extraction errors | 0 | | Extraction warnings | 1 | diff --git a/rust/ql/integration-tests/hello-workspace/diagnostics.cargo.expected b/rust/ql/integration-tests/hello-workspace/diagnostics.cargo.expected index 7d44256db5a4..af11fd2f2e8e 100644 --- a/rust/ql/integration-tests/hello-workspace/diagnostics.cargo.expected +++ b/rust/ql/integration-tests/hello-workspace/diagnostics.cargo.expected @@ -5,6 +5,10 @@ "ms": "__REDACTED__", "pretty": "__REDACTED__" }, + "findManifests": { + "ms": "__REDACTED__", + "pretty": "__REDACTED__" + }, "loadManifest": { "ms": "__REDACTED__", "pretty": "__REDACTED__" @@ -23,7 +27,7 @@ } }, "numberOfFiles": 4, - "numberOfManifests": 2 + "numberOfManifests": 1 }, "severity": "note", "source": { diff --git a/rust/ql/integration-tests/hello-workspace/diagnostics.rust-project.expected b/rust/ql/integration-tests/hello-workspace/diagnostics.rust-project.expected index 4c5dbc75d84b..af11fd2f2e8e 100644 --- a/rust/ql/integration-tests/hello-workspace/diagnostics.rust-project.expected +++ b/rust/ql/integration-tests/hello-workspace/diagnostics.rust-project.expected @@ -5,6 +5,10 @@ "ms": "__REDACTED__", "pretty": "__REDACTED__" }, + "findManifests": { + "ms": "__REDACTED__", + "pretty": "__REDACTED__" + }, "loadManifest": { "ms": "__REDACTED__", "pretty": "__REDACTED__" diff --git a/rust/ql/integration-tests/hello-workspace/steps.cargo.expected b/rust/ql/integration-tests/hello-workspace/steps.cargo.expected index 138bd77b690d..a2f125948098 100644 --- a/rust/ql/integration-tests/hello-workspace/steps.cargo.expected +++ b/rust/ql/integration-tests/hello-workspace/steps.cargo.expected @@ -1,11 +1,11 @@ -| exe/Cargo.toml:0:0:0:0 | LoadManifest(exe/Cargo.toml) | +| Cargo.toml:0:0:0:0 | LoadManifest(Cargo.toml) | | exe/src/a_module.rs:0:0:0:0 | Extract(exe/src/a_module.rs) | | exe/src/a_module.rs:0:0:0:0 | LoadSource(exe/src/a_module.rs) | | exe/src/a_module.rs:0:0:0:0 | Parse(exe/src/a_module.rs) | | exe/src/main.rs:0:0:0:0 | Extract(exe/src/main.rs) | | exe/src/main.rs:0:0:0:0 | LoadSource(exe/src/main.rs) | | exe/src/main.rs:0:0:0:0 | Parse(exe/src/main.rs) | -| lib/Cargo.toml:0:0:0:0 | LoadManifest(lib/Cargo.toml) | +| file://:0:0:0:0 | FindManifests | | lib/src/a_module/mod.rs:0:0:0:0 | Extract(lib/src/a_module/mod.rs) | | lib/src/a_module/mod.rs:0:0:0:0 | LoadSource(lib/src/a_module/mod.rs) | | lib/src/a_module/mod.rs:0:0:0:0 | Parse(lib/src/a_module/mod.rs) | diff --git a/rust/ql/integration-tests/hello-workspace/steps.rust-project.expected b/rust/ql/integration-tests/hello-workspace/steps.rust-project.expected index 09620925ce96..c0958b56523e 100644 --- a/rust/ql/integration-tests/hello-workspace/steps.rust-project.expected +++ b/rust/ql/integration-tests/hello-workspace/steps.rust-project.expected @@ -4,6 +4,7 @@ | exe/src/main.rs:0:0:0:0 | Extract(exe/src/main.rs) | | exe/src/main.rs:0:0:0:0 | LoadSource(exe/src/main.rs) | | exe/src/main.rs:0:0:0:0 | Parse(exe/src/main.rs) | +| file://:0:0:0:0 | FindManifests | | lib/src/a_module/mod.rs:0:0:0:0 | Extract(lib/src/a_module/mod.rs) | | lib/src/a_module/mod.rs:0:0:0:0 | LoadSource(lib/src/a_module/mod.rs) | | lib/src/a_module/mod.rs:0:0:0:0 | Parse(lib/src/a_module/mod.rs) | diff --git a/rust/ql/integration-tests/hello-workspace/summary.rust-project.expected b/rust/ql/integration-tests/hello-workspace/summary.rust-project.expected index 5c57c488fda0..eb8f861f9358 100644 --- a/rust/ql/integration-tests/hello-workspace/summary.rust-project.expected +++ b/rust/ql/integration-tests/hello-workspace/summary.rust-project.expected @@ -1,4 +1,4 @@ -| Elements extracted | 85 | +| Elements extracted | 86 | | Elements unextracted | 0 | | Extraction errors | 0 | | Extraction warnings | 0 | diff --git a/rust/ql/lib/codeql/rust/elements/internal/ExtractorStepImpl.qll b/rust/ql/lib/codeql/rust/elements/internal/ExtractorStepImpl.qll index 95c677e845e9..0f98299c5754 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/ExtractorStepImpl.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/ExtractorStepImpl.qll @@ -14,6 +14,8 @@ module Impl { class ExtractorStep extends Generated::ExtractorStep { override string toString() { result = this.getAction() + "(" + this.getFile().getAbsolutePath() + ")" + or + not this.hasFile() and result = this.getAction() } /** diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/ExtractorStep.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/ExtractorStep.qll index c2d7838865be..e74b0e9680f1 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/ExtractorStep.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/ExtractorStep.qll @@ -29,12 +29,17 @@ module Generated { } /** - * Gets the file of this extractor step. + * Gets the file of this extractor step, if it exists. */ File getFile() { result = Synth::convertExtractorStepToRaw(this).(Raw::ExtractorStep).getFile() } + /** + * Holds if `getFile()` exists. + */ + final predicate hasFile() { exists(this.getFile()) } + /** * Gets the duration ms of this extractor step. */ diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll index deb5cf0764be..a1655224a17f 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll @@ -21,17 +21,17 @@ module Raw { /** * Gets the action of this extractor step. */ - string getAction() { extractor_steps(this, result, _, _) } + string getAction() { extractor_steps(this, result, _) } /** - * Gets the file of this extractor step. + * Gets the file of this extractor step, if it exists. */ - File getFile() { extractor_steps(this, _, result, _) } + File getFile() { extractor_step_files(this, result) } /** * Gets the duration ms of this extractor step. */ - int getDurationMs() { extractor_steps(this, _, _, result) } + int getDurationMs() { extractor_steps(this, _, result) } } /** diff --git a/rust/ql/lib/rust.dbscheme b/rust/ql/lib/rust.dbscheme index 6cb586f2f821..6cd197193bee 100644 --- a/rust/ql/lib/rust.dbscheme +++ b/rust/ql/lib/rust.dbscheme @@ -128,10 +128,15 @@ locatable_locations( extractor_steps( unique int id: @extractor_step, string action: string ref, - int file: @file ref, int duration_ms: int ref ); +#keyset[id] +extractor_step_files( + int id: @extractor_step ref, + int file: @file ref +); + @locatable = @ast_node ; diff --git a/rust/ql/test/query-tests/diagnostics/SummaryStats.expected b/rust/ql/test/query-tests/diagnostics/SummaryStats.expected index c8c0fe398aaf..78bfeb9322c7 100644 --- a/rust/ql/test/query-tests/diagnostics/SummaryStats.expected +++ b/rust/ql/test/query-tests/diagnostics/SummaryStats.expected @@ -1,4 +1,4 @@ -| Elements extracted | 404 | +| Elements extracted | 405 | | Elements unextracted | 0 | | Extraction errors | 0 | | Extraction warnings | 7 | diff --git a/rust/schema/prelude.py b/rust/schema/prelude.py index ec67d7357ab4..c0637826fa25 100644 --- a/rust/schema/prelude.py +++ b/rust/schema/prelude.py @@ -107,5 +107,5 @@ class PathAstNode(Resolvable): @ql.internal class ExtractorStep(Element): action: string - file: File + file: optional[File] duration_ms: int