Rust: support paths and paths-ignore from the code scanning configuration file

This is done by simply adding the autobuilder from the shared
tree-sitter extractor library.
This commit is contained in:
Paolo Tranquilli
2024-12-19 17:37:56 +01:00
parent 90dbc34c16
commit 73a5a3f7ee
48 changed files with 350 additions and 219 deletions

View File

@@ -0,0 +1,19 @@
load("//misc/bazel:rust.bzl", "codeql_rust_binary")
load("//misc/bazel/3rdparty/tree_sitter_extractors_deps:defs.bzl", "aliases", "all_crate_deps")
exports_files(["Cargo.toml"])
codeql_rust_binary(
name = "autobuild",
srcs = glob(["src/**/*.rs"]),
aliases = aliases(),
proc_macro_deps = all_crate_deps(
proc_macro = True,
),
visibility = ["//rust:__subpackages__"],
deps = all_crate_deps(
normal = True,
) + [
"//shared/tree-sitter-extractor",
],
)

View File

@@ -0,0 +1,7 @@
[package]
name = "codeql-autobuilder-rust"
version = "0.1.0"
edition = "2021"
[dependencies]
codeql-extractor = { path = "../../shared/tree-sitter-extractor" }

View File

@@ -0,0 +1,13 @@
use std::path::PathBuf;
use codeql_extractor::autobuilder;
fn main() -> std::io::Result<()> {
let database = std::env::var("CODEQL_EXTRACTOR_RUST_WIP_DATABASE")
.expect("CODEQL_EXTRACTOR_RUST_WIP_DATABASE not set");
autobuilder::Autobuilder::new("rust", PathBuf::from(database))
.include_extensions(&[".rs"])
.exclude_globs(&["**/.git", "**/tests/**"])
.size_limit("5m")
.run()
}