build: Use rust-project.json (#10)

Now that https://github.com/bazelbuild/rules_rust/pull/2450 is fixed, we
can use a `rust-project.json` instead of `Cargo.toml` for IDE features.
This commit is contained in:
Cameron Martin 2024-02-18 21:32:54 +00:00 committed by GitHub
parent abc99e964b
commit 0364d75588
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 31 additions and 1 deletions

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
/target
/bazel-*
/MODULE.bazel.lock
/MODULE.bazel.lock
/rust-project.json

5
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,5 @@
{
"rust-analyzer.linkedProjects": [
"rust-project.json"
]
}

22
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,22 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Generate rust-project.json",
"command": "bazel",
"args": ["run", "@rules_rust//tools/rust_analyzer:gen_rust_project"],
"options": {
"cwd": "${workspaceFolder}"
},
"group": "build",
"problemMatcher": [],
"presentation": {
"reveal": "never",
"panel": "dedicated",
},
"runOptions": {
"runOn": "folderOpen"
}
},
]
}

View file

@ -1,5 +1,7 @@
bazel_dep(name = "rules_rust", version = "0.38.0")
git_override(module_name = "rules_rust", remote = "https://github.com/bazelbuild/rules_rust.git", commit = "547f6a0666024c4b14b794598ecac3ce56a5e950")
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2021",