mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
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:
19
rust/autobuild/BUILD.bazel
Normal file
19
rust/autobuild/BUILD.bazel
Normal 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",
|
||||
],
|
||||
)
|
||||
7
rust/autobuild/Cargo.toml
Normal file
7
rust/autobuild/Cargo.toml
Normal file
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "codeql-autobuilder-rust"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
codeql-extractor = { path = "../../shared/tree-sitter-extractor" }
|
||||
13
rust/autobuild/src/main.rs
Normal file
13
rust/autobuild/src/main.rs
Normal 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()
|
||||
}
|
||||
Reference in New Issue
Block a user