mirror of
https://github.com/github/codeql.git
synced 2025-12-16 08:43:11 +01:00
This introduces tooling and enforcement for formatting bazel files. The tooling is provided as a bazel run target from [keith/buildifier-prebuilt](https://github.com/keith/buildifier-prebuilt). This is used in a [`pre-commit`](https://pre-commit.com/) hook for those having that installed. In turn this is used in a CI check. Relying on a `pre-commit` action gives us easy checking that buildifying did not change anything in the files and printing the diff, without having to hand-roll the check ourselves. This enforcement will make usage of gazelle easier, as gazelle itself might reformat files, even outside of `go`. Having them properly formatted will allow gazelle to leave them unchanged, without needing to configure awkward exclude directives.
39 lines
863 B
Python
39 lines
863 B
Python
load("@py_deps//:defs.bzl", "aliases", "all_crate_deps")
|
|
load("@rules_rust//cargo:defs.bzl", "cargo_build_script")
|
|
load("@rules_rust//rust:defs.bzl", "rust_library")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
# This will run the build script from the root of the workspace, and
|
|
# collect the outputs.
|
|
cargo_build_script(
|
|
name = "tsp-build",
|
|
srcs = ["bindings/rust/build.rs"],
|
|
data = glob([
|
|
"src/**",
|
|
]),
|
|
deps = all_crate_deps(
|
|
build = True,
|
|
),
|
|
)
|
|
|
|
rust_library(
|
|
name = "tsp",
|
|
srcs = [
|
|
"bindings/rust/lib.rs",
|
|
],
|
|
aliases = aliases(),
|
|
compile_data = glob([
|
|
"src/**",
|
|
"queries/**",
|
|
]) + [
|
|
"grammar.js",
|
|
],
|
|
proc_macro_deps = all_crate_deps(
|
|
proc_macro = True,
|
|
),
|
|
deps = [":tsp-build"] + all_crate_deps(
|
|
normal = True,
|
|
),
|
|
)
|