Skip to content

Commit 092bc64

Browse files
committed
Rust/bazel: Port to bzlmod.
This gets rid of our last workspace dependency. In particular, this change also gets rid of the checked-in extra lock files that took forever to generate.
1 parent 7ecf1f9 commit 092bc64

File tree

8 files changed

+48
-8892
lines changed

8 files changed

+48
-8892
lines changed

MODULE.bazel

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,32 @@ bazel_dep(name = "rules_kotlin", version = "1.9.4-codeql.1")
2626
bazel_dep(name = "gazelle", version = "0.36.0")
2727
bazel_dep(name = "rules_dotnet", version = "0.15.1")
2828
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
29+
bazel_dep(name = "rules_rust", version = "0.46.0")
2930

3031
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
3132

33+
crate = use_extension(
34+
"@rules_rust//crate_universe:extension.bzl",
35+
"crate",
36+
)
37+
crate.from_cargo(
38+
name = "py_deps",
39+
cargo_lockfile = "//python/extractor/tsg-python:Cargo.lock",
40+
manifests = [
41+
"//python/extractor/tsg-python:Cargo.toml",
42+
"//python/extractor/tsg-python/tsp:Cargo.toml",
43+
],
44+
)
45+
crate.from_cargo(
46+
name = "ruby_deps",
47+
cargo_lockfile = "//ruby/extractor:Cargo.lock",
48+
manifests = [
49+
"//ruby/extractor:Cargo.toml",
50+
"//ruby/extractor/codeql-extractor-fake-crate:Cargo.toml",
51+
],
52+
)
53+
use_repo(crate, "py_deps", "ruby_deps")
54+
3255
dotnet = use_extension("@rules_dotnet//dotnet:extensions.bzl", "dotnet")
3356
dotnet.toolchain(dotnet_version = "8.0.101")
3457
use_repo(dotnet, "dotnet_toolchains")

misc/bazel/rust.bzl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
load("@rules_rust//rust:defs.bzl", "rust_binary")
2+
load("@semmle_code//buildutils-internal:glibc_symbols_check.bzl", "glibc_symbols_check")
3+
load("@semmle_code//buildutils-internal:lipo.bzl", "universal_binary")
4+
5+
def codeql_rust_binary(
6+
name,
7+
target_compatible_with = None,
8+
visibility = None,
9+
symbols_test = True,
10+
**kwargs):
11+
rust_label_name = name + "_single_arch"
12+
universal_binary(
13+
name = name,
14+
dep = ":" + rust_label_name,
15+
target_compatible_with = target_compatible_with,
16+
visibility = visibility,
17+
)
18+
rust_binary(
19+
name = rust_label_name,
20+
**kwargs
21+
)
22+
if symbols_test:
23+
glibc_symbols_check(name = name + "symbols-test", binary = name)

python/extractor/tsg-python/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@py_deps//:defs.bzl", "aliases", "all_crate_deps")
2-
load("@semmle_code//:common.bzl", "codeql_rust_binary")
2+
load("//misc/bazel:rust.bzl", "codeql_rust_binary")
33

44
codeql_rust_binary(
55
name = "tsg-python",

0 commit comments

Comments
 (0)