add script to run Rust Analyzer using Bazel's build products

Considerably speeds up initial load, but have not done much testing
yet.
This commit is contained in:
Damien Elmes 2021-05-04 20:06:42 +10:00
parent 4951ef12c9
commit 1011dfec9b
4 changed files with 16 additions and 0 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ anki.prof
target
user.bazelrc
.dmypy.json
rust-project.json

View file

@ -1,4 +1,5 @@
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
load("@rules_rust//rust:defs.bzl", "rust_analyzer")
config_setting(
name = "release",
@ -39,5 +40,10 @@ pkg_tar(
tags = ["manual"],
)
rust_analyzer(
name = "rust_analyzer",
targets = ["//rslib:anki"],
)
# for version info
exports_files(["defs.bzl"])

View file

@ -1,6 +1,8 @@
"""Repo setup that can't happen until after defs.bzl:setup_deps() is run."""
load("@py_deps//:requirements.bzl", "pip_install")
load("@rules_rust//tools/rust_analyzer/raze:crates.bzl", "rules_rust_tools_rust_analyzer_fetch_remote_crates")
def setup_late_deps():
pip_install()
rules_rust_tools_rust_analyzer_fetch_remote_crates()

7
scripts/vscode-rust Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
set -e
bazel run @rules_rust//tools/rust_analyzer:gen_rust_project
code .