mirror of
https://github.com/github/codeql.git
synced 2026-01-16 16:04:45 +01:00
Previously, we pulled in the shared tree-sitter extractor via a `git` dependency in `Cargo.toml` to address a `rules_rust` limitation (no `path` dependencies outside of the cargo workspace)). This was a problem, as that means we're cloning `github/codeql` _again_ for the build, which is quite slow. I found another way that is faster, and still produces correct builds for both `cargo`` and `rules_rust`: * Cargo depends on a fake crate that has the same dependencies as the real crate (thanks to `sync-files.py`). Therefore, cargo pulls in the right dependencies into the lockfile, which bazel targets * For local builds, we override the path to that dependency in a cargo config, so we're pulling in the correct code * rules_rust only uses `path` dependencies for collecting transitive dependencies, it never pulls in the code from there. So far that, we manually provide a `BUILD.bazel` file for the shared extractor, and depend on that.
18 lines
458 B
Python
18 lines
458 B
Python
load("@ruby_deps//:defs.bzl", "aliases", "all_crate_deps")
|
|
load("@semmle_code//:common.bzl", "codeql_rust_binary")
|
|
|
|
codeql_rust_binary(
|
|
name = "extractor",
|
|
srcs = glob(["src/*.rs"]),
|
|
aliases = aliases(),
|
|
proc_macro_deps = all_crate_deps(
|
|
proc_macro = True,
|
|
),
|
|
visibility = ["//visibility:public"],
|
|
deps = all_crate_deps(
|
|
normal = True,
|
|
) + [
|
|
"//shared/tree-sitter-extractor:codeql-extractor",
|
|
],
|
|
)
|