Skip to content

Commit f8c9d96

Browse files
author
Paolo Tranquilli
committed
Bazel: remove non-working fake tree-sitter-extractor workaround
The `.cargo/config.toml` override based workaround wasn't really working, as while `cargo build|check` was reading that, `cargo metadata` wasn't, ending up in a completely broken IDE experience. For the moment, we just use a unified workspace `Cargo.toml` for all extractors using the shared tree-sitter code, which has the downside of making bazel pull in dependencies for all of them, and not being able to do sparse checkouts for them. We should investigate and rivist this in the future.
1 parent 4f90f5f commit f8c9d96

File tree

21 files changed

+80
-1133
lines changed

21 files changed

+80
-1133
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,6 @@ node_modules/
6868

6969
# Jetbrains IDE files
7070
.idea
71+
72+
# cargo build directory
73+
/target

rust/extractor/Cargo.lock renamed to Cargo.lock

Lines changed: 49 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This is the shared workspace file for extractor using shared/tree-sitter/extractor
2+
[workspace]
3+
4+
resolver = "2"
5+
members = [
6+
"shared/tree-sitter-extractor",
7+
"ruby/extractor",
8+
"rust/extractor",
9+
]
10+
11+
[patch.crates-io]
12+
# patch for build script bug preventing bazel build
13+
# see https://github.com/rust-lang/rustc_apfloat/pull/17
14+
rustc_apfloat = { git = "https://github.com/redsun82/rustc_apfloat.git", rev = "096d585100636bc2e9f09d7eefec38c5b334d47b" }

MODULE.bazel

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,35 +47,23 @@ cp.from_cargo(
4747
)
4848
use_repo(cp, "py_deps")
4949

50-
# crate_ruby, but shortened due to windows file paths
50+
# deps for ruby+rust, but shortened due to windows file paths
5151
r = use_extension(
5252
"@rules_rust//crate_universe:extension.bzl",
5353
"crate",
5454
isolate = True,
5555
)
5656
r.from_cargo(
57-
name = "rd",
58-
cargo_lockfile = "//ruby/extractor:Cargo.lock",
57+
name = "r",
58+
cargo_lockfile = "//:Cargo.lock",
5959
manifests = [
60+
"//:Cargo.toml",
6061
"//ruby/extractor:Cargo.toml",
61-
"//ruby/extractor/codeql-extractor-fake-crate:Cargo.toml",
62-
],
63-
)
64-
use_repo(r, ruby_deps = "rd")
65-
66-
rsp = use_extension(
67-
"@rules_rust//crate_universe:extension.bzl",
68-
"crate",
69-
isolate = True,
70-
)
71-
rsp.from_cargo(
72-
name = "rs_deps",
73-
cargo_lockfile = "//rust/extractor:Cargo.lock",
74-
manifests = [
7562
"//rust/extractor:Cargo.toml",
63+
"//shared/tree-sitter-extractor:Cargo.toml",
7664
],
7765
)
78-
use_repo(rsp, rust_deps = "rs_deps")
66+
use_repo(r, tree_sitter_extractors_deps = "r")
7967

8068
dotnet = use_extension("@rules_dotnet//dotnet:extensions.bzl", "dotnet")
8169
dotnet.toolchain(dotnet_version = "8.0.101")

config/identical-files.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,5 @@
355355
"Python model summaries test extension": [
356356
"python/ql/test/library-tests/dataflow/model-summaries/InlineTaintTest.ext.yml",
357357
"python/ql/test/library-tests/dataflow/model-summaries/NormalDataflowTest.ext.yml"
358-
],
359-
"shared tree-sitter extractor cargo.toml": [
360-
"shared/tree-sitter-extractor/Cargo.toml",
361-
"ruby/extractor/codeql-extractor-fake-crate/Cargo.toml",
362-
"rust/extractor/codeql-extractor-fake-crate/Cargo.toml"
363358
]
364359
}

ruby/extractor/.cargo/config.toml

Lines changed: 0 additions & 1 deletion
This file was deleted.

ruby/extractor/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@ruby_deps//:defs.bzl", "aliases", "all_crate_deps")
1+
load("@tree_sitter_extractors_deps//:defs.bzl", "aliases", "all_crate_deps")
22
load("//misc/bazel:rust.bzl", "codeql_rust_binary")
33

44
codeql_rust_binary(

0 commit comments

Comments
 (0)