diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml
index c51dedf5bc..9eecbef632 100644
--- a/.bazelci/presubmit.yml
+++ b/.bazelci/presubmit.yml
@@ -135,13 +135,13 @@ tasks:
bazel: "rolling"
ubuntu1804:
name: "Min Bazel Version"
- bazel: "3.5.0"
+ bazel: "4.0.0"
platform: ubuntu1804
build_targets: *default_linux_targets
test_targets: *default_linux_targets
ubuntu1804_with_aspects:
name: "Min Bazel Version With Aspects"
- bazel: "3.5.0"
+ bazel: "4.0.0"
platform: ubuntu1804
build_targets: *default_linux_targets
test_targets: *default_linux_targets
@@ -172,6 +172,11 @@ tasks:
platform: ubuntu2004
run_targets:
- "//test/rustfmt:test_runner"
+ rust_analyzer_tests:
+ name: Rust-Analyzer Tests
+ platform: ubuntu2004
+ run_targets:
+ - "//test/rust_analyzer:rust_analyzer_test"
ubuntu2004_examples:
name: Examples
platform: ubuntu2004
diff --git a/.gitignore b/.gitignore
index 2f8bfb1f1d..52814c8a7c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,3 +24,6 @@
# BazelCI
bazelci.py
+
+# rust-analyzer
+rust-project.json
diff --git a/docs/flatten.md b/docs/flatten.md
index 305f98ff22..5bf330df93 100644
--- a/docs/flatten.md
+++ b/docs/flatten.md
@@ -205,7 +205,7 @@ A rule defining an incompatible flag.
rust_analyzer(name, targets)
-Produces a rust-project.json for the given targets. Configure rust-analyzer to load the generated file via the linked projects mechanism.
+Deprecated: gen_rust_project can now create a rust-project.json without a rust_analyzer rule.
**ATTRIBUTES**
diff --git a/docs/index.md b/docs/index.md
index cca84afd15..f196154a1b 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -34,7 +34,7 @@ rust_repositories()
```
The rules are under active development, as such the lastest commit on the
-`main` branch should be used. `main` is only tested against `3.5.0` as the
+`main` branch should be used. `main` is only tested against `4.0.0` as the
minimum supported version of Bazel. Though previous versions may still be
functional in certain environments.
diff --git a/docs/rust_analyzer.md b/docs/rust_analyzer.md
index e2429ac647..5a3c884243 100644
--- a/docs/rust_analyzer.md
+++ b/docs/rust_analyzer.md
@@ -9,7 +9,7 @@
For [non-Cargo projects](https://rust-analyzer.github.io/manual.html#non-cargo-based-projects),
[rust-analyzer](https://rust-analyzer.github.io/) depends on a `rust-project.json` file at the
-root of the project that describes its structure. The `rust_analyzer` rule facilitates generating
+root of the project that describes its structure. The `rust_analyzer` rule facilitates generating
such a file.
### Setup
@@ -32,32 +32,11 @@ can also set `include_rustc_srcs = True` on any `rust_repository` or
`rust_repositories` calls in the workspace but the environment variable
has higher priority and can override the attribute.
-Finally, add a rule to the root `BUILD` file like the following.
-
-```python
-load("@rules_rust//rust:defs.bzl", "rust_analyzer")
-
-rust_analyzer(
- name = "rust_analyzer",
- targets = [
- # all the binary/library targets you want in the rust-project.json
- ],
-)
-```
-
-A list of `rust_analyzer` compatible targets can be found by usign the following query:
-
-```bash
-bazel query 'kind("rust_*library|rust_binary", //...:all)'
-```
-
-Note: __All `rust_*` targets provided to the root rust_analyzer must have `//visibility:public`.__
-
-Run `bazel run @rules_rust//tools/rust_analyzer:gen_rust_project` whenever
-dependencies change to regenerate the `rust-project.json` file. It should be
-added to `.gitignore` because it is effectively a build artifact. Once the
-`rust-project.json` has been generated in the project root, rust-analyzer can
-pick it up upon restart.
+Finally, run `bazel run @rules_rust//tools/rust_analyzer:gen_rust_project`
+whenever dependencies change to regenerate the `rust-project.json` file. It
+should be added to `.gitignore` because it is effectively a build artifact.
+Once the `rust-project.json` has been generated in the project root,
+rust-analyzer can pick it up upon restart.
#### VSCode
@@ -100,7 +79,7 @@ to ensure a `rust-project.json` file is created and up to date when the editor i
rust_analyzer(name, targets)
-Produces a rust-project.json for the given targets. Configure rust-analyzer to load the generated file via the linked projects mechanism.
+Deprecated: gen_rust_project can now create a rust-project.json without a rust_analyzer rule.
**ATTRIBUTES**
diff --git a/docs/rust_analyzer.vm b/docs/rust_analyzer.vm
index d96b4f41a7..e3669603c1 100644
--- a/docs/rust_analyzer.vm
+++ b/docs/rust_analyzer.vm
@@ -3,7 +3,7 @@
For [non-Cargo projects](https://rust-analyzer.github.io/manual.html#non-cargo-based-projects),
[rust-analyzer](https://rust-analyzer.github.io/) depends on a `rust-project.json` file at the
-root of the project that describes its structure. The `rust_analyzer` rule facilitates generating
+root of the project that describes its structure. The `rust_analyzer` rule facilitates generating
such a file.
### Setup
@@ -26,32 +26,11 @@ can also set `include_rustc_srcs = True` on any `rust_repository` or
`rust_repositories` calls in the workspace but the environment variable
has higher priority and can override the attribute.
-Finally, add a rule to the root `BUILD` file like the following.
-
-```python
-load("@rules_rust//rust:defs.bzl", "rust_analyzer")
-
-rust_analyzer(
- name = "rust_analyzer",
- targets = [
- # all the binary/library targets you want in the rust-project.json
- ],
-)
-```
-
-A list of `rust_analyzer` compatible targets can be found by usign the following query:
-
-```bash
-bazel query 'kind("rust_*library|rust_binary", //...:all)'
-```
-
-Note: __All `rust_*` targets provided to the root rust_analyzer must have `//visibility:public`.__
-
-Run `bazel run @rules_rust//tools/rust_analyzer:gen_rust_project` whenever
-dependencies change to regenerate the `rust-project.json` file. It should be
-added to `.gitignore` because it is effectively a build artifact. Once the
-`rust-project.json` has been generated in the project root, rust-analyzer can
-pick it up upon restart.
+Finally, run `bazel run @rules_rust//tools/rust_analyzer:gen_rust_project`
+whenever dependencies change to regenerate the `rust-project.json` file. It
+should be added to `.gitignore` because it is effectively a build artifact.
+Once the `rust-project.json` has been generated in the project root,
+rust-analyzer can pick it up upon restart.
#### VSCode
diff --git a/rust/private/BUILD.bazel b/rust/private/BUILD.bazel
index e649c91b44..6e3c77ef9e 100644
--- a/rust/private/BUILD.bazel
+++ b/rust/private/BUILD.bazel
@@ -1,4 +1,5 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+load("//rust/private:rust_analyzer.bzl", "rust_analyzer_detect_sysroot")
load("//rust/private:stamp.bzl", "stamp_build_setting")
bzl_library(
@@ -13,3 +14,8 @@ bzl_library(
)
stamp_build_setting(name = "stamp")
+
+rust_analyzer_detect_sysroot(
+ name = "rust_analyzer_detect_sysroot",
+ visibility = ["//visibility:public"],
+)
diff --git a/rust/private/rust_analyzer.bzl b/rust/private/rust_analyzer.bzl
index ea1b7c6433..7c47235f78 100644
--- a/rust/private/rust_analyzer.bzl
+++ b/rust/private/rust_analyzer.bzl
@@ -23,7 +23,7 @@ to Cargo.toml files.
load("//rust/platform:triple_mappings.bzl", "system_to_dylib_ext", "triple_to_system")
load("//rust/private:common.bzl", "rust_common")
load("//rust/private:rustc.bzl", "BuildInfo")
-load("//rust/private:utils.bzl", "find_toolchain")
+load("//rust/private:utils.bzl", "dedent", "find_toolchain")
RustAnalyzerInfo = provider(
doc = "RustAnalyzerInfo holds rust crate metadata for targets",
@@ -31,10 +31,10 @@ RustAnalyzerInfo = provider(
"build_info": "BuildInfo: build info for this crate if present",
"cfgs": "List[String]: features or other compilation --cfg settings",
"crate": "rust_common.crate_info",
+ "crate_specs": "Depset[File]: transitive closure of OutputGroupInfo files",
"deps": "List[RustAnalyzerInfo]: direct dependencies",
"env": "Dict{String: String}: Environment variables, used for the `env!` macro",
"proc_macro_dylib_path": "File: compiled shared library output of proc-macro rule",
- "transitive_deps": "List[RustAnalyzerInfo]: transitive closure of dependencies",
},
)
@@ -44,8 +44,8 @@ def _rust_analyzer_aspect_impl(target, ctx):
toolchain = find_toolchain(ctx)
- # Always add test & debug_assertions (like here:
- # https://github.com/rust-analyzer/rust-analyzer/blob/505ff4070a3de962dbde66f08b6550cda2eb4eab/crates/project_model/src/lib.rs#L379-L381)
+ # Always add `test` & `debug_assertions`. See rust-analyzer source code:
+ # https://github.com/rust-analyzer/rust-analyzer/blob/2021-11-15/crates/project_model/src/workspace.rs#L529-L531
cfgs = ["test", "debug_assertions"]
if hasattr(ctx.rule.attr, "crate_features"):
cfgs += ['feature="{}"'.format(f) for f in ctx.rule.attr.crate_features]
@@ -61,21 +61,32 @@ def _rust_analyzer_aspect_impl(target, ctx):
dep_infos = [dep[RustAnalyzerInfo] for dep in ctx.rule.attr.deps if RustAnalyzerInfo in dep]
if hasattr(ctx.rule.attr, "proc_macro_deps"):
dep_infos += [dep[RustAnalyzerInfo] for dep in ctx.rule.attr.proc_macro_deps if RustAnalyzerInfo in dep]
- if hasattr(ctx.rule.attr, "crate"):
+ if hasattr(ctx.rule.attr, "crate") and ctx.rule.attr.crate != None:
dep_infos.append(ctx.rule.attr.crate[RustAnalyzerInfo])
- transitive_deps = depset(direct = dep_infos, order = "postorder", transitive = [dep.transitive_deps for dep in dep_infos])
+ crate_spec = ctx.actions.declare_file(ctx.label.name + ".rust_analyzer_crate_spec")
crate_info = target[rust_common.crate_info]
- return [RustAnalyzerInfo(
+
+ rust_analyzer_info = RustAnalyzerInfo(
crate = crate_info,
cfgs = cfgs,
env = getattr(ctx.rule.attr, "rustc_env", {}),
deps = dep_infos,
- transitive_deps = transitive_deps,
+ crate_specs = depset(direct = [crate_spec], transitive = [dep.crate_specs for dep in dep_infos]),
proc_macro_dylib_path = find_proc_macro_dylib_path(toolchain, target),
build_info = build_info,
- )]
+ )
+
+ ctx.actions.write(
+ output = crate_spec,
+ content = json.encode(_create_single_crate(ctx, rust_analyzer_info)),
+ )
+
+ return [
+ rust_analyzer_info,
+ OutputGroupInfo(rust_analyzer_crate_spec = rust_analyzer_info.crate_specs),
+ ]
def find_proc_macro_dylib_path(toolchain, target):
"""Find the proc_macro_dylib_path of target. Returns None if target crate is not type proc-macro.
@@ -117,40 +128,28 @@ def _crate_id(crate_info):
"""
return "ID-" + crate_info.root.path
-def _create_crate(ctx, infos, crate_mapping):
+def _create_single_crate(ctx, info):
"""Creates a crate in the rust-project.json format.
- It can happen a single source file is present in multiple crates - there can
- be a `rust_library` with a `lib.rs` file, and a `rust_test` for the `test`
- module in that file. Tests can declare more dependencies than what library
- had. Therefore we had to collect all RustAnalyzerInfos for a given crate
- and take deps from all of them.
-
- There's one exception - if the dependency is the same crate name as the
- the crate being processed, we don't add it as a dependency to itself. This is
- common and expected - `rust_test.crate` pointing to the `rust_library`.
-
Args:
ctx (ctx): The rule context
- infos (list of RustAnalyzerInfos): RustAnalyzerInfos for the current crate
- crate_mapping (dict): A dict of {String:Int} that memoizes crates for deps.
+ info (RustAnalyzerInfo): RustAnalyzerInfo for the current crate
Returns:
(dict) The crate rust-project.json representation
"""
- if len(infos) == 0:
- fail("Expected to receive at least one crate to serialize to json, got 0.")
- canonical_info = infos[0]
- crate_name = canonical_info.crate.name
+ crate_name = info.crate.name
crate = dict()
+ crate_id = _crate_id(info.crate)
+ crate["crate_id"] = crate_id
crate["display_name"] = crate_name
- crate["edition"] = canonical_info.crate.edition
+ crate["edition"] = info.crate.edition
crate["env"] = {}
# Switch on external/ to determine if crates are in the workspace or remote.
# TODO: Some folks may want to override this for vendored dependencies.
- root_path = canonical_info.crate.root.path
- root_dirname = canonical_info.crate.root.dirname
+ root_path = info.crate.root.path
+ root_dirname = info.crate.root.dirname
if root_path.startswith("external/"):
crate["is_workspace_member"] = False
crate["root_module"] = _exec_root_tmpl + root_path
@@ -160,38 +159,38 @@ def _create_crate(ctx, infos, crate_mapping):
crate["root_module"] = root_path
crate_root = root_dirname
- if canonical_info.build_info != None:
- out_dir_path = canonical_info.build_info.out_dir.path
+ if info.build_info != None:
+ out_dir_path = info.build_info.out_dir.path
crate["env"].update({"OUT_DIR": _exec_root_tmpl + out_dir_path})
crate["source"] = {
# We have to tell rust-analyzer about our out_dir since it's not under the crate root.
"exclude_dirs": [],
"include_dirs": [crate_root, _exec_root_tmpl + out_dir_path],
}
- crate["env"].update(canonical_info.env)
-
- # Collect deduplicated pairs of (crate idx from crate_mapping, crate name).
- # Using dict because we don't have sets in Starlark.
- deps = {
- (crate_mapping[_crate_id(dep.crate)], dep.crate.name): None
- for info in infos
- for dep in info.deps
- if dep.crate.name != crate_name
- }.keys()
-
- crate["deps"] = [{"crate": d[0], "name": d[1]} for d in deps]
- crate["cfg"] = canonical_info.cfgs
+
+ # TODO: The only imagined use case is an env var holding a filename in the workspace passed to a
+ # macro like include_bytes!. Other use cases might exist that require more complex logic.
+ expand_targets = getattr(ctx.rule.attr, "data", []) + getattr(ctx.rule.attr, "compile_data", [])
+ crate["env"].update({k: ctx.expand_location(v, expand_targets) for k, v in info.env.items()})
+
+ # Omit when a crate appears to depend on itself (e.g. foo_test crates).
+ # It can happen a single source file is present in multiple crates - there can
+ # be a `rust_library` with a `lib.rs` file, and a `rust_test` for the `test`
+ # module in that file. Tests can declare more dependencies than what library
+ # had. Therefore we had to collect all RustAnalyzerInfos for a given crate
+ # and take deps from all of them.
+
+ # There's one exception - if the dependency is the same crate name as the
+ # the crate being processed, we don't add it as a dependency to itself. This is
+ # common and expected - `rust_test.crate` pointing to the `rust_library`.
+ crate["deps"] = [_crate_id(dep.crate) for dep in info.deps if _crate_id(dep.crate) != crate_id]
+ crate["cfg"] = info.cfgs
crate["target"] = find_toolchain(ctx).target_triple
- if canonical_info.proc_macro_dylib_path != None:
- crate["proc_macro_dylib_path"] = _exec_root_tmpl + canonical_info.proc_macro_dylib_path
+ if info.proc_macro_dylib_path != None:
+ crate["proc_macro_dylib_path"] = _exec_root_tmpl + info.proc_macro_dylib_path
return crate
-# This implementation is incomplete because in order to get rustc env vars we
-# would need to actually execute the build graph and gather the output of
-# cargo_build_script rules. This would require a genrule to actually construct
-# the JSON, rather than being able to build it completly in starlark.
-# TODO(djmarcin): Run the cargo_build_scripts to gather env vars correctly.
-def _rust_analyzer_impl(ctx):
+def _rust_analyzer_detect_sysroot_impl(ctx):
rust_toolchain = find_toolchain(ctx)
if not rust_toolchain.rustc_srcs:
@@ -204,39 +203,25 @@ def _rust_analyzer_impl(ctx):
if rust_toolchain.rustc_srcs.label.workspace_root:
sysroot_src = _exec_root_tmpl + rust_toolchain.rustc_srcs.label.workspace_root + "/" + sysroot_src
- # Groups of RustAnalyzerInfos with the same _crate_id().
- rust_analyzer_info_groups = []
-
- # Dict from _crate_id() to the index of a RustAnalyzerInfo group in `rust_analyzer_info_groups`.
- crate_mapping = dict()
-
- # Dependencies are referenced by index, so leaves should come first.
- idx = 0
- for target in ctx.attr.targets:
- if RustAnalyzerInfo not in target:
- continue
-
- for info in depset(
- direct = [target[RustAnalyzerInfo]],
- transitive = [target[RustAnalyzerInfo].transitive_deps],
- order = "postorder",
- ).to_list():
- crate_id = _crate_id(info.crate)
- if crate_id not in crate_mapping:
- crate_mapping[crate_id] = idx
- rust_analyzer_info_groups.append([])
- idx += 1
- rust_analyzer_info_groups[crate_mapping[crate_id]].append(info)
-
- crates = []
- for group in rust_analyzer_info_groups:
- crates.append(_create_crate(ctx, group, crate_mapping))
-
- # TODO(djmarcin): Use json module once bazel 4.0 is released.
- ctx.actions.write(output = ctx.outputs.filename, content = struct(
- sysroot_src = sysroot_src,
- crates = crates,
- ).to_json())
+ sysroot_src_file = ctx.actions.declare_file(ctx.label.name + ".rust_analyzer_sysroot_src")
+ ctx.actions.write(
+ output = sysroot_src_file,
+ content = sysroot_src,
+ )
+
+ return [DefaultInfo(files = depset([sysroot_src_file]))]
+
+rust_analyzer_detect_sysroot = rule(
+ implementation = _rust_analyzer_detect_sysroot_impl,
+ toolchains = ["@rules_rust//rust:toolchain"],
+ incompatible_use_toolchain_transition = True,
+ doc = dedent("""\
+ Detect the sysroot and store in a file for use by the gen_rust_project tool.
+ """),
+)
+
+def _rust_analyzer_impl(ctx):
+ pass
rust_analyzer = rule(
attrs = {
@@ -245,13 +230,10 @@ rust_analyzer = rule(
doc = "List of all targets to be included in the index",
),
},
- outputs = {
- "filename": "rust-project.json",
- },
implementation = _rust_analyzer_impl,
toolchains = [str(Label("//rust:toolchain"))],
incompatible_use_toolchain_transition = True,
- doc = """\
-Produces a rust-project.json for the given targets. Configure rust-analyzer to load the generated file via the linked projects mechanism.
-""",
+ doc = dedent("""\
+ Deprecated: gen_rust_project can now create a rust-project.json without a rust_analyzer rule.
+ """),
)
diff --git a/test/rust_analyzer/BUILD.bazel b/test/rust_analyzer/BUILD.bazel
new file mode 100644
index 0000000000..3132ee4206
--- /dev/null
+++ b/test/rust_analyzer/BUILD.bazel
@@ -0,0 +1,5 @@
+sh_binary(
+ name = "rust_analyzer_test",
+ srcs = ["rust_analyzer_test_runner.sh"],
+ args = [package_name()],
+)
diff --git a/test/rust_analyzer/aspect_traversal_test/BUILD.bazel b/test/rust_analyzer/aspect_traversal_test/BUILD.bazel
index cefc646f5c..2a79bbeaba 100644
--- a/test/rust_analyzer/aspect_traversal_test/BUILD.bazel
+++ b/test/rust_analyzer/aspect_traversal_test/BUILD.bazel
@@ -1,4 +1,4 @@
-load("//rust:defs.bzl", "rust_analyzer", "rust_library", "rust_proc_macro", "rust_test")
+load("@rules_rust//rust:defs.bzl", "rust_library", "rust_proc_macro", "rust_test")
rust_library(
name = "mylib",
@@ -34,16 +34,14 @@ rust_proc_macro(
srcs = ["extra_proc_macro_dep.rs"],
)
-rust_analyzer(
- name = "rust_analyzer",
- testonly = True,
- targets = [":mylib_test"],
-)
-
rust_test(
name = "rust_project_json_test",
srcs = ["rust_project_json_test.rs"],
data = [":rust-project.json"],
edition = "2018",
- deps = ["//tools/runfiles"],
+ env = {"RUST_PROJECT_JSON": "$(rootpath :rust-project.json)"},
+ # This target is tagged as manual since it's not expected to pass in
+ # contexts outside of `//test/rust_analyzer:rust_analyzer_test`. Run
+ # that target to execute this test.
+ tags = ["manual"],
)
diff --git a/test/rust_analyzer/aspect_traversal_test/rust_project_json_test.rs b/test/rust_analyzer/aspect_traversal_test/rust_project_json_test.rs
index a297a1449b..b934ac2774 100644
--- a/test/rust_analyzer/aspect_traversal_test/rust_project_json_test.rs
+++ b/test/rust_analyzer/aspect_traversal_test/rust_project_json_test.rs
@@ -1,12 +1,11 @@
#[cfg(test)]
mod tests {
- use runfiles::Runfiles;
+ use std::env;
+ use std::path::PathBuf;
#[test]
fn test_aspect_traverses_all_the_right_corners_of_target_graph() {
- let r = Runfiles::create().unwrap();
- let rust_project_path =
- r.rlocation("rules_rust/test/rust_analyzer/aspect_traversal_test/rust-project.json");
+ let rust_project_path = PathBuf::from(env::var("RUST_PROJECT_JSON").unwrap());
let content = std::fs::read_to_string(&rust_project_path)
.unwrap_or_else(|_| panic!("couldn't open {:?}", &rust_project_path));
diff --git a/test/rust_analyzer/merging_crates_test/BUILD.bazel b/test/rust_analyzer/merging_crates_test/BUILD.bazel
index a54e1932e0..4a7eb3d37c 100644
--- a/test/rust_analyzer/merging_crates_test/BUILD.bazel
+++ b/test/rust_analyzer/merging_crates_test/BUILD.bazel
@@ -1,4 +1,4 @@
-load("//rust:defs.bzl", "rust_analyzer", "rust_library", "rust_test")
+load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
rust_library(
name = "mylib",
@@ -22,20 +22,14 @@ rust_library(
srcs = ["extra_test_dep.rs"],
)
-rust_analyzer(
- name = "rust_analyzer",
- testonly = True,
- targets = [
- # it's significant that `mylib` goes before `mylib_test`.
- ":mylib",
- ":mylib_test",
- ],
-)
-
rust_test(
name = "rust_project_json_test",
srcs = ["rust_project_json_test.rs"],
data = [":rust-project.json"],
edition = "2018",
- deps = ["//tools/runfiles"],
+ env = {"RUST_PROJECT_JSON": "$(rootpath :rust-project.json)"},
+ # This target is tagged as manual since it's not expected to pass in
+ # contexts outside of `//test/rust_analyzer:rust_analyzer_test`. Run
+ # that target to execute this test.
+ tags = ["manual"],
)
diff --git a/test/rust_analyzer/merging_crates_test/rust_project_json_test.rs b/test/rust_analyzer/merging_crates_test/rust_project_json_test.rs
index 417f72f25b..8f0db407f1 100644
--- a/test/rust_analyzer/merging_crates_test/rust_project_json_test.rs
+++ b/test/rust_analyzer/merging_crates_test/rust_project_json_test.rs
@@ -1,18 +1,17 @@
#[cfg(test)]
mod tests {
- use runfiles::Runfiles;
+ use std::env;
+ use std::path::PathBuf;
#[test]
fn test_deps_of_crate_and_its_test_are_merged() {
- let r = Runfiles::create().unwrap();
- let rust_project_path =
- r.rlocation("rules_rust/test/rust_analyzer/merging_crates_test/rust-project.json");
+ let rust_project_path = PathBuf::from(env::var("RUST_PROJECT_JSON").unwrap());
let content = std::fs::read_to_string(&rust_project_path)
.unwrap_or_else(|_| panic!("couldn't open {:?}", &rust_project_path));
assert!(
- content.contains(r#""root_module":"test/rust_analyzer/merging_crates_test/mylib.rs","deps":[{"crate":0,"name":"lib_dep"},{"crate":2,"name":"extra_test_dep"}]"#),
+ content.contains(r#""root_module":"mylib.rs","edition":"2018","deps":[{"crate":0,"name":"extra_test_dep"},{"crate":1,"name":"lib_dep"}]"#),
"expected rust-project.json to contain both lib_dep and extra_test_dep in deps of mylib.rs.");
}
}
diff --git a/test/rust_analyzer/merging_crates_test_reversed/BUILD.bazel b/test/rust_analyzer/merging_crates_test_reversed/BUILD.bazel
deleted file mode 100644
index 8cdd7f567d..0000000000
--- a/test/rust_analyzer/merging_crates_test_reversed/BUILD.bazel
+++ /dev/null
@@ -1,41 +0,0 @@
-load("//rust:defs.bzl", "rust_analyzer", "rust_library", "rust_test")
-
-rust_library(
- name = "mylib",
- srcs = ["mylib.rs"],
- deps = [":lib_dep"],
-)
-
-rust_library(
- name = "lib_dep",
- srcs = ["lib_dep.rs"],
-)
-
-rust_test(
- name = "mylib_test",
- crate = ":mylib",
- deps = [":extra_test_dep"],
-)
-
-rust_library(
- name = "extra_test_dep",
- srcs = ["extra_test_dep.rs"],
-)
-
-rust_analyzer(
- name = "rust_analyzer",
- testonly = True,
- targets = [
- # it's significant that `mylib_test` goes before `mylib`.
- ":mylib_test",
- ":mylib",
- ],
-)
-
-rust_test(
- name = "rust_project_json_test",
- srcs = ["rust_project_json_test.rs"],
- data = [":rust-project.json"],
- edition = "2018",
- deps = ["//tools/runfiles"],
-)
diff --git a/test/rust_analyzer/merging_crates_test_reversed/extra_test_dep.rs b/test/rust_analyzer/merging_crates_test_reversed/extra_test_dep.rs
deleted file mode 100644
index 8b13789179..0000000000
--- a/test/rust_analyzer/merging_crates_test_reversed/extra_test_dep.rs
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/test/rust_analyzer/merging_crates_test_reversed/lib_dep.rs b/test/rust_analyzer/merging_crates_test_reversed/lib_dep.rs
deleted file mode 100644
index 8b13789179..0000000000
--- a/test/rust_analyzer/merging_crates_test_reversed/lib_dep.rs
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/test/rust_analyzer/merging_crates_test_reversed/mylib.rs b/test/rust_analyzer/merging_crates_test_reversed/mylib.rs
deleted file mode 100644
index 8b13789179..0000000000
--- a/test/rust_analyzer/merging_crates_test_reversed/mylib.rs
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/test/rust_analyzer/merging_crates_test_reversed/rust_project_json_test.rs b/test/rust_analyzer/merging_crates_test_reversed/rust_project_json_test.rs
deleted file mode 100644
index f77c2a6ef5..0000000000
--- a/test/rust_analyzer/merging_crates_test_reversed/rust_project_json_test.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-#[cfg(test)]
-mod tests {
- use runfiles::Runfiles;
-
- #[test]
- fn test_deps_of_crate_and_its_test_are_merged() {
- let r = Runfiles::create().unwrap();
- let rust_project_path = r.rlocation(
- "rules_rust/test/rust_analyzer/merging_crates_test_reversed/rust-project.json",
- );
-
- let content = std::fs::read_to_string(&rust_project_path)
- .unwrap_or_else(|_| panic!("couldn't open {:?}", &rust_project_path));
-
- assert!(
- content.contains(r#""root_module":"test/rust_analyzer/merging_crates_test_reversed/mylib.rs","deps":[{"crate":0,"name":"lib_dep"},{"crate":1,"name":"extra_test_dep"}]"#),
- "expected rust-project.json to contain both lib_dep and extra_test_dep in deps of mylib.rs.");
- }
-}
diff --git a/test/rust_analyzer/rust_analyzer_test_runner.sh b/test/rust_analyzer/rust_analyzer_test_runner.sh
new file mode 100755
index 0000000000..69f9a91c6b
--- /dev/null
+++ b/test/rust_analyzer/rust_analyzer_test_runner.sh
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+# This script creates temporary workspaces and generates `rust-project.json`
+# files unique to the set of targets defined in the generated workspace.
+
+set -euo pipefail
+
+if [[ -z "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then
+ echo "This script should be run under Bazel"
+ exit 1
+fi
+
+PACKAGE_NAME="$1"
+if [[ -z "${PACKAGE_NAME:-}" ]]; then
+ echo "The first argument should be the package name of the test target"
+ exit 1
+fi
+
+function generate_workspace() {
+ local temp_dir="$(mktemp -d -t rules_rust_test_rust_analyzer-XXXXXXXXXX)"
+ local new_workspace="${temp_dir}/rules_rust_test_rust_analyzer"
+
+ mkdir -p "${new_workspace}"
+ cat << EOF > "${new_workspace}/WORKSPACE.bazel"
+workspace(name = "rules_rust_test_rust_analyzer")
+local_repository(
+ name = "rules_rust",
+ path = "${BUILD_WORKSPACE_DIRECTORY}",
+)
+load("@rules_rust//rust:repositories.bzl", "rust_repositories")
+rust_repositories(include_rustc_srcs = True)
+load("@rules_rust//tools/rust_analyzer:deps.bzl", "rust_analyzer_deps")
+rust_analyzer_deps()
+EOF
+
+cat << EOF > "${new_workspace}/.bazelrc"
+build --keep_going
+test --test_output=errors
+# The 'strict' config is used to ensure extra checks are run on the test
+# targets that would otherwise not run due to them being tagged as "manual".
+# Note that that tag is stripped for this test.
+build:strict --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect
+build:strict --output_groups=+rustfmt_checks
+build:strict --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
+build:strict --output_groups=+clippy_checks
+EOF
+
+ echo "${new_workspace}"
+}
+
+function rust_analyzer_test() {
+ local source_dir="$1"
+ local workspace="$2"
+
+ echo "Testing '$(basename "${source_dir}")'"
+ rm -f "${workspace}"/*.rs "${workspace}"/*.json "${workspace}/BUILD.bazel"
+ cp -r "${source_dir}"/* "${workspace}"
+
+ # Drop the 'manual' tags
+ if [ "$(uname)" == "Darwin" ]; then
+ SEDOPTS=(-i '' -e)
+ else
+ SEDOPTS=(-i)
+ fi
+ sed ${SEDOPTS[@]} 's/"manual"//' "${workspace}/BUILD.bazel"
+
+ pushd "${workspace}" &> /dev/null
+ echo "Generating rust-project.json..."
+ bazel run "@rules_rust//tools/rust_analyzer:gen_rust_project"
+ echo "Building..."
+ bazel build //...
+ echo "Testing..."
+ bazel test //...
+ echo "Building with Aspects..."
+ bazel build //... --config=strict
+ popd &> /dev/null
+}
+
+function run_test_suite() {
+ local temp_workspace="$(generate_workspace)"
+ echo "Generated workspace: ${temp_workspace}"
+
+ for test_dir in "${BUILD_WORKSPACE_DIRECTORY}/${PACKAGE_NAME}"/*; do
+ # Skip everything but directories
+ if [[ ! -d "${test_dir}" ]]; then
+ continue
+ fi
+
+ rust_analyzer_test "${test_dir}" "${temp_workspace}"
+ done
+
+ rm -rf "${temp_workspace}"
+}
+
+run_test_suite
diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tools/rust_analyzer/BUILD.bazel b/tools/rust_analyzer/BUILD.bazel
index 403516ec51..becac98389 100644
--- a/tools/rust_analyzer/BUILD.bazel
+++ b/tools/rust_analyzer/BUILD.bazel
@@ -1,17 +1,48 @@
-load("//rust:defs.bzl", "rust_binary", "rust_clippy")
+load("//rust:defs.bzl", "rust_binary", "rust_clippy", "rust_library", "rust_test")
+load("//tools:tool_utils.bzl", "aspect_repository")
rust_binary(
name = "gen_rust_project",
srcs = ["main.rs"],
edition = "2018",
+ rustc_env = {
+ "ASPECT_REPOSITORY": aspect_repository(),
+ },
visibility = ["//visibility:public"],
deps = [
+ ":gen_rust_project_lib",
"//tools/rust_analyzer/raze:anyhow",
+ "//tools/rust_analyzer/raze:env_logger",
+ "//tools/rust_analyzer/raze:log",
"//tools/rust_analyzer/raze:structopt",
"//util/label",
],
)
+rust_library(
+ name = "gen_rust_project_lib",
+ srcs = glob(
+ ["**/*.rs"],
+ exclude = ["main.rs"],
+ ),
+ data = [
+ "//rust/private:rust_analyzer_detect_sysroot",
+ ],
+ edition = "2018",
+ deps = [
+ "//tools/runfiles",
+ "//tools/rust_analyzer/raze:anyhow",
+ "//tools/rust_analyzer/raze:log",
+ "//tools/rust_analyzer/raze:serde",
+ "//tools/rust_analyzer/raze:serde_json",
+ ],
+)
+
+rust_test(
+ name = "gen_rust_project_lib_test",
+ crate = ":gen_rust_project_lib",
+)
+
rust_clippy(
name = "gen_rust_project_clippy",
testonly = True,
diff --git a/tools/rust_analyzer/aquery.rs b/tools/rust_analyzer/aquery.rs
new file mode 100644
index 0000000000..c75596af74
--- /dev/null
+++ b/tools/rust_analyzer/aquery.rs
@@ -0,0 +1,389 @@
+use std::collections::{BTreeMap, BTreeSet};
+use std::fs::File;
+use std::option::Option;
+use std::path::Path;
+use std::path::PathBuf;
+use std::process::Command;
+
+use anyhow::Context;
+use serde::Deserialize;
+
+#[derive(Debug, Deserialize)]
+struct AqueryOutput {
+ artifacts: Vec,
+ actions: Vec,
+ #[serde(rename = "pathFragments")]
+ path_fragments: Vec,
+}
+
+#[derive(Debug, Deserialize)]
+struct Artifact {
+ id: u32,
+ #[serde(rename = "pathFragmentId")]
+ path_fragment_id: u32,
+}
+
+#[derive(Debug, Deserialize)]
+struct PathFragment {
+ id: u32,
+ label: String,
+ #[serde(rename = "parentId")]
+ parent_id: Option,
+}
+
+#[derive(Debug, Deserialize)]
+struct Action {
+ #[serde(rename = "outputIds")]
+ output_ids: Vec,
+}
+
+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Deserialize)]
+#[serde(deny_unknown_fields)]
+pub struct CrateSpec {
+ pub crate_id: String,
+ pub display_name: String,
+ pub edition: String,
+ pub root_module: String,
+ pub is_workspace_member: bool,
+ pub deps: BTreeSet,
+ pub proc_macro_dylib_path: Option,
+ pub source: Option,
+ pub cfg: Vec,
+ pub env: BTreeMap,
+ pub target: String,
+}
+
+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Deserialize)]
+#[serde(deny_unknown_fields)]
+pub struct CrateSpecSource {
+ pub exclude_dirs: Vec,
+ pub include_dirs: Vec,
+}
+
+pub fn get_crate_specs(
+ bazel: &Path,
+ workspace: &Path,
+ execution_root: &Path,
+ targets: &[String],
+ rules_rust_name: &str,
+) -> anyhow::Result> {
+ log::debug!("Get crate specs with targets: {:?}", targets);
+ let target_pattern = targets
+ .iter()
+ .map(|t| format!("deps({})", t))
+ .collect::>()
+ .join("+");
+
+ let aquery_output = Command::new(bazel)
+ .current_dir(workspace)
+ .arg("aquery")
+ .arg("--include_aspects")
+ .arg(format!(
+ "--aspects={}//rust:defs.bzl%rust_analyzer_aspect",
+ rules_rust_name
+ ))
+ .arg("--output_groups=rust_analyzer_crate_spec")
+ .arg(format!(
+ r#"outputs(".*[.]rust_analyzer_crate_spec",{})"#,
+ target_pattern
+ ))
+ .arg("--output=jsonproto")
+ .output()?;
+
+ let crate_spec_files =
+ parse_aquery_output_files(execution_root, &String::from_utf8(aquery_output.stdout)?)?;
+
+ let crate_specs = crate_spec_files
+ .into_iter()
+ .map(|file| {
+ let f = File::open(&file)
+ .with_context(|| format!("Failed to open file: {}", file.display()))?;
+ serde_json::from_reader(f)
+ .with_context(|| format!("Failed to deserialize file: {}", file.display()))
+ })
+ .collect::>>()?;
+
+ consolidate_crate_specs(crate_specs)
+}
+
+fn parse_aquery_output_files(
+ execution_root: &Path,
+ aquery_stdout: &str,
+) -> anyhow::Result> {
+ let out: AqueryOutput = serde_json::from_str(aquery_stdout)?;
+
+ let artifacts = out
+ .artifacts
+ .iter()
+ .map(|a| (a.id, a))
+ .collect::>();
+ let path_fragments = out
+ .path_fragments
+ .iter()
+ .map(|pf| (pf.id, pf))
+ .collect::>();
+
+ let mut output_files: Vec = Vec::new();
+ for action in out.actions {
+ for output_id in action.output_ids {
+ let artifact = artifacts
+ .get(&output_id)
+ .expect("internal consistency error in bazel output");
+ let path = path_from_fragments(artifact.path_fragment_id, &path_fragments)?;
+ let path = execution_root.join(path);
+ if path.exists() {
+ output_files.push(path);
+ } else {
+ log::warn!("Skipping missing crate_spec file: {:?}", path);
+ }
+ }
+ }
+
+ Ok(output_files)
+}
+
+fn path_from_fragments(
+ id: u32,
+ fragments: &BTreeMap,
+) -> anyhow::Result {
+ let path_fragment = fragments
+ .get(&id)
+ .expect("internal consistency error in bazel output");
+
+ let buf = match path_fragment.parent_id {
+ Some(parent_id) => path_from_fragments(parent_id, fragments)?
+ .join(PathBuf::from(&path_fragment.label.clone())),
+ None => PathBuf::from(&path_fragment.label.clone()),
+ };
+
+ Ok(buf)
+}
+
+/// Read all crate specs, deduplicating crates with the same ID. This happens when
+/// a rust_test depends on a rust_library, for example.
+fn consolidate_crate_specs(crate_specs: Vec) -> anyhow::Result> {
+ let mut consolidated_specs: BTreeMap = BTreeMap::new();
+ for spec in crate_specs.into_iter() {
+ log::debug!("{:?}", spec);
+ if let Some(existing) = consolidated_specs.get_mut(&spec.crate_id) {
+ existing.deps.extend(spec.deps);
+ } else {
+ consolidated_specs.insert(spec.crate_id.clone(), spec);
+ }
+ }
+
+ Ok(consolidated_specs.into_values().collect())
+}
+
+#[cfg(test)]
+mod test {
+ use super::*;
+
+ #[test]
+ fn consolidate_lib_then_test_specs() {
+ let crate_specs = vec![
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-lib_dep.rs".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-extra_test_dep.rs".into(),
+ display_name: "extra_test_dep".into(),
+ edition: "2018".into(),
+ root_module: "extra_test_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-lib_dep.rs".into(),
+ display_name: "lib_dep".into(),
+ edition: "2018".into(),
+ root_module: "lib_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib_test".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-extra_test_dep.rs".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ ];
+
+ assert_eq!(
+ consolidate_crate_specs(crate_specs).unwrap(),
+ BTreeSet::from([
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-lib_dep.rs".into(), "ID-extra_test_dep.rs".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-extra_test_dep.rs".into(),
+ display_name: "extra_test_dep".into(),
+ edition: "2018".into(),
+ root_module: "extra_test_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-lib_dep.rs".into(),
+ display_name: "lib_dep".into(),
+ edition: "2018".into(),
+ root_module: "lib_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ ])
+ );
+ }
+
+ #[test]
+ fn consolidate_test_then_lib_specs() {
+ let crate_specs = vec![
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib_test".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-extra_test_dep.rs".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ display_name: "mylib".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-lib_dep.rs".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-extra_test_dep.rs".into(),
+ display_name: "extra_test_dep".into(),
+ edition: "2018".into(),
+ root_module: "extra_test_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-lib_dep.rs".into(),
+ display_name: "lib_dep".into(),
+ edition: "2018".into(),
+ root_module: "lib_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ ];
+
+ assert_eq!(
+ consolidate_crate_specs(crate_specs).unwrap(),
+ BTreeSet::from([
+ CrateSpec {
+ crate_id: "ID-mylib.rs".into(),
+ // TODO: It's probably better if the display name matches the library target
+ // after the specs are consolidated.
+ display_name: "mylib_test".into(),
+ edition: "2018".into(),
+ root_module: "mylib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-lib_dep.rs".into(), "ID-extra_test_dep.rs".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-extra_test_dep.rs".into(),
+ display_name: "extra_test_dep".into(),
+ edition: "2018".into(),
+ root_module: "extra_test_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-lib_dep.rs".into(),
+ display_name: "lib_dep".into(),
+ edition: "2018".into(),
+ root_module: "lib_dep.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ ])
+ );
+ }
+}
diff --git a/tools/rust_analyzer/lib.rs b/tools/rust_analyzer/lib.rs
new file mode 100644
index 0000000000..f7887574ad
--- /dev/null
+++ b/tools/rust_analyzer/lib.rs
@@ -0,0 +1,77 @@
+use std::path::Path;
+use std::process::Command;
+
+use anyhow::anyhow;
+use runfiles::Runfiles;
+
+mod aquery;
+mod rust_project;
+
+pub fn generate_crate_info(
+ bazel: impl AsRef,
+ workspace: impl AsRef,
+ rules_rust: impl AsRef,
+ targets: &[String],
+) -> anyhow::Result<()> {
+ log::debug!("Building rust_analyzer_crate_spec files for {:?}", targets);
+
+ let output = Command::new(bazel.as_ref())
+ .current_dir(workspace.as_ref())
+ .arg("build")
+ .arg(format!(
+ "--aspects={}//rust:defs.bzl%rust_analyzer_aspect",
+ rules_rust.as_ref()
+ ))
+ .arg("--output_groups=rust_analyzer_crate_spec")
+ .args(targets)
+ .output()?;
+
+ if !output.status.success() {
+ return Err(anyhow!(
+ "bazel build failed:({})\n{}",
+ output.status,
+ String::from_utf8_lossy(&output.stderr)
+ ));
+ }
+
+ Ok(())
+}
+
+pub fn write_rust_project(
+ bazel: impl AsRef,
+ workspace: impl AsRef,
+ rules_rust_name: &impl AsRef,
+ targets: &[String],
+ execution_root: impl AsRef,
+ rust_project_path: impl AsRef,
+) -> anyhow::Result<()> {
+ let crate_specs = aquery::get_crate_specs(
+ bazel.as_ref(),
+ workspace.as_ref(),
+ execution_root.as_ref(),
+ targets,
+ rules_rust_name.as_ref(),
+ )?;
+
+ let workspace_name = match rules_rust_name.as_ref().trim_start_matches('@') {
+ "" => "rules_rust",
+ s => s,
+ };
+ let sysroot_path = format!(
+ "{}/rust/private/rust_analyzer_detect_sysroot.rust_analyzer_sysroot_src",
+ workspace_name
+ );
+ let r = Runfiles::create()?;
+ let path = r.rlocation(sysroot_path);
+ let sysroot_src = std::fs::read_to_string(&path)?;
+
+ let rust_project = rust_project::generate_rust_project(&sysroot_src, &crate_specs)?;
+
+ rust_project::write_rust_project(
+ rust_project_path.as_ref(),
+ execution_root.as_ref(),
+ &rust_project,
+ )?;
+
+ Ok(())
+}
diff --git a/tools/rust_analyzer/main.rs b/tools/rust_analyzer/main.rs
index 1f44d5e91c..2bad0e9396 100644
--- a/tools/rust_analyzer/main.rs
+++ b/tools/rust_analyzer/main.rs
@@ -1,88 +1,54 @@
-use anyhow::anyhow;
-use anyhow::Context;
use std::collections::HashMap;
use std::env;
-use std::fs;
-use std::io::ErrorKind;
use std::path::PathBuf;
use std::process::Command;
+
+use anyhow::anyhow;
+use gen_rust_project_lib::generate_crate_info;
+use gen_rust_project_lib::write_rust_project;
use structopt::StructOpt;
// TODO(david): This shells out to an expected rule in the workspace root //:rust_analyzer that the user must define.
-// It would be more convenient if it could automatically discover all the rust code in the workspace if this target does not exist.
+// It would be more convenient if it could automatically discover all the rust code in the workspace if this target
+// does not exist.
fn main() -> anyhow::Result<()> {
+ env_logger::init();
+
let config = parse_config()?;
let workspace_root = config
.workspace
.as_ref()
.expect("failed to find workspace root, set with --workspace");
+
let execution_root = config
.execution_root
.as_ref()
.expect("failed to find execution root, is --execution-root set correctly?");
- let bazel_bin = config
- .bazel_bin
- .as_ref()
- .expect("failed to find execution root, is --bazel-bin set correctly?");
-
- build_rust_project_target(&config);
- let label = label::analyze(&config.bazel_analyzer_target)
- .with_context(|| "Cannot parse --bazel-analyzer-target")?;
-
- let mut generated_rust_project = bazel_bin.clone();
-
- if let Some(repository_name) = label.repository_name {
- generated_rust_project = generated_rust_project
- .join("external")
- .join(repository_name);
- }
-
- for package in label.packages() {
- generated_rust_project = generated_rust_project.join(package);
- }
-
- generated_rust_project = generated_rust_project.join("rust-project.json");
- let workspace_rust_project = workspace_root.join("rust-project.json");
- // The generated_rust_project has a template string we must replace with the workspace name.
- let generated_json = fs::read_to_string(&generated_rust_project)
- .expect("failed to read generated rust-project.json");
-
- // Try to remove the existing rust-project.json. It's OK if the file doesn't exist.
- match fs::remove_file(&workspace_rust_project) {
- Ok(_) => {}
- Err(err) if err.kind() == ErrorKind::NotFound => {}
- Err(err) => panic!("Unexpected error removing old rust-project.json: {}", err),
- }
-
- // Write the new rust-project.json file.
- fs::write(
- workspace_rust_project,
- generated_json.replace("__EXEC_ROOT__", &execution_root.to_string_lossy()),
- )
- .expect("failed to write workspace rust-project.json");
+ let rules_rust_name = env!("ASPECT_REPOSITORY");
+
+ // Generate the crate specs.
+ generate_crate_info(
+ &config.bazel,
+ &workspace_root,
+ &rules_rust_name,
+ &config.targets,
+ )?;
+
+ // Use the generated files to write rust-project.json.
+ write_rust_project(
+ &config.bazel,
+ &workspace_root,
+ &rules_rust_name,
+ &config.targets,
+ &execution_root,
+ &workspace_root.join("rust-project.json"),
+ )?;
Ok(())
}
-fn build_rust_project_target(config: &Config) {
- let output = Command::new(&config.bazel)
- .current_dir(config.workspace.as_ref().unwrap())
- .arg("build")
- .arg(&config.bazel_analyzer_target)
- .output()
- .expect("failed to execute bazel process");
- if !output.status.success() {
- panic!(
- "bazel build failed:({}) of {:?}:\n{}",
- output.status,
- &config.bazel_analyzer_target,
- String::from_utf8_lossy(&output.stderr)
- );
- }
-}
-
// Parse the configuration flags and supplement with bazel info as needed.
fn parse_config() -> anyhow::Result {
let mut config = Config::from_args();
@@ -131,9 +97,6 @@ fn parse_config() -> anyhow::Result {
if config.execution_root.is_none() {
config.execution_root = bazel_info.get("execution_root").map(Into::into);
}
- if config.bazel_bin.is_none() {
- config.bazel_bin = bazel_info.get("bazel-bin").map(Into::into);
- }
Ok(config)
}
@@ -148,13 +111,10 @@ struct Config {
#[structopt(long)]
execution_root: Option,
- // If not specified, uses the result of `bazel info bazel-bin`.
- #[structopt(long)]
- bazel_bin: Option,
-
#[structopt(long, default_value = "bazel")]
bazel: PathBuf,
- #[structopt(long, default_value = "//:rust_analyzer")]
- bazel_analyzer_target: String,
+ // Space separated list of target patterns that comes after all other args.
+ #[structopt(default_value = "@//...")]
+ targets: Vec,
}
diff --git a/tools/rust_analyzer/raze/BUILD.bazel b/tools/rust_analyzer/raze/BUILD.bazel
index b071f0c294..1c5f85cdaf 100644
--- a/tools/rust_analyzer/raze/BUILD.bazel
+++ b/tools/rust_analyzer/raze/BUILD.bazel
@@ -14,7 +14,43 @@ licenses([
# Aliased targets
alias(
name = "anyhow",
- actual = "@rules_rust_tools_rust_analyzer__anyhow__1_0_38//:anyhow",
+ actual = "@rules_rust_tools_rust_analyzer__anyhow__1_0_45//:anyhow",
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+)
+
+alias(
+ name = "env_logger",
+ actual = "@rules_rust_tools_rust_analyzer__env_logger__0_9_0//:env_logger",
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+)
+
+alias(
+ name = "log",
+ actual = "@rules_rust_tools_rust_analyzer__log__0_4_14//:log",
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+)
+
+alias(
+ name = "serde",
+ actual = "@rules_rust_tools_rust_analyzer__serde__1_0_130//:serde",
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+)
+
+alias(
+ name = "serde_json",
+ actual = "@rules_rust_tools_rust_analyzer__serde_json__1_0_69//:serde_json",
tags = [
"cargo-raze",
"manual",
@@ -23,7 +59,7 @@ alias(
alias(
name = "structopt",
- actual = "@rules_rust_tools_rust_analyzer__structopt__0_3_21//:structopt",
+ actual = "@rules_rust_tools_rust_analyzer__structopt__0_3_25//:structopt",
tags = [
"cargo-raze",
"manual",
diff --git a/tools/rust_analyzer/raze/Cargo.raze.lock b/tools/rust_analyzer/raze/Cargo.raze.lock
index 1f42f80163..dd6a19a8ab 100644
--- a/tools/rust_analyzer/raze/Cargo.raze.lock
+++ b/tools/rust_analyzer/raze/Cargo.raze.lock
@@ -1,5 +1,14 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
+[[package]]
+name = "aho-corasick"
+version = "0.7.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "ansi_term"
version = "0.11.0"
@@ -11,9 +20,9 @@ dependencies = [
[[package]]
name = "anyhow"
-version = "1.0.38"
+version = "1.0.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1"
+checksum = "ee10e43ae4a853c0a3591d4e2ada1719e553be18199d9da9d4a83f5927c2f5c7"
[[package]]
name = "atty"
@@ -28,9 +37,15 @@ dependencies = [
[[package]]
name = "bitflags"
-version = "1.2.1"
+version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
@@ -52,27 +67,56 @@ name = "compile_with_bazel"
version = "0.0.0"
dependencies = [
"anyhow",
+ "env_logger",
+ "log",
+ "serde",
+ "serde_json",
"structopt",
]
+[[package]]
+name = "env_logger"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
+dependencies = [
+ "atty",
+ "humantime",
+ "log",
+ "regex",
+ "termcolor",
+]
+
[[package]]
name = "heck"
-version = "0.3.2"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac"
+checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "hermit-abi"
-version = "0.1.18"
+version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c"
+checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
+[[package]]
+name = "humantime"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
+
+[[package]]
+name = "itoa"
+version = "0.4.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
+
[[package]]
name = "lazy_static"
version = "1.4.0"
@@ -81,9 +125,24 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
-version = "0.2.86"
+version = "0.2.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c"
+checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219"
+
+[[package]]
+name = "log"
+version = "0.4.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "memchr"
+version = "2.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "proc-macro-error"
@@ -111,20 +170,74 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.24"
+version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
+checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
dependencies = [
"unicode-xid",
]
[[package]]
name = "quote"
-version = "1.0.9"
+version = "1.0.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "regex"
+version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
+checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.6.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
+
+[[package]]
+name = "ryu"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
+
+[[package]]
+name = "serde"
+version = "1.0.130"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.130"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
dependencies = [
"proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e466864e431129c7e0d3476b92f20458e5879919a0596c6472738d9fa2d342f8"
+dependencies = [
+ "itoa",
+ "ryu",
+ "serde",
]
[[package]]
@@ -135,9 +248,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "structopt"
-version = "0.3.21"
+version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c"
+checksum = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c"
dependencies = [
"clap",
"lazy_static",
@@ -146,9 +259,9 @@ dependencies = [
[[package]]
name = "structopt-derive"
-version = "0.4.14"
+version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ba9cdfda491b814720b6b06e0cac513d922fc407582032e8706e9f137976f90"
+checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
dependencies = [
"heck",
"proc-macro-error",
@@ -159,15 +272,24 @@ dependencies = [
[[package]]
name = "syn"
-version = "1.0.60"
+version = "1.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081"
+checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
+[[package]]
+name = "termcolor"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
+dependencies = [
+ "winapi-util",
+]
+
[[package]]
name = "textwrap"
version = "0.11.0"
@@ -179,21 +301,21 @@ dependencies = [
[[package]]
name = "unicode-segmentation"
-version = "1.7.1"
+version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
+checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
[[package]]
name = "unicode-width"
-version = "0.1.8"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
+checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
[[package]]
name = "unicode-xid"
-version = "0.2.1"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
+checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "vec_map"
@@ -203,9 +325,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version_check"
-version = "0.9.2"
+version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
+checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
[[package]]
name = "winapi"
@@ -223,6 +345,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+[[package]]
+name = "winapi-util"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
+dependencies = [
+ "winapi",
+]
+
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
diff --git a/tools/rust_analyzer/raze/Cargo.toml b/tools/rust_analyzer/raze/Cargo.toml
index 8f3fb7ef27..935f6f58cc 100644
--- a/tools/rust_analyzer/raze/Cargo.toml
+++ b/tools/rust_analyzer/raze/Cargo.toml
@@ -8,6 +8,10 @@ path = "fake_lib.rs"
[dependencies]
anyhow = "1.0"
+log = "0.4"
+env_logger = "0.9"
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1.0"
structopt = "0.3"
[package.metadata.raze]
diff --git a/tools/rust_analyzer/raze/crates.bzl b/tools/rust_analyzer/raze/crates.bzl
index 5088704270..e0fe541141 100644
--- a/tools/rust_analyzer/raze/crates.bzl
+++ b/tools/rust_analyzer/raze/crates.bzl
@@ -11,6 +11,16 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") # buildifier: di
def rules_rust_tools_rust_analyzer_fetch_remote_crates():
"""This function defines a collection of repos and should be called in a WORKSPACE file"""
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__aho_corasick__0_7_18",
+ url = "https://crates.io/api/v1/crates/aho-corasick/0.7.18/download",
+ type = "tar.gz",
+ sha256 = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f",
+ strip_prefix = "aho-corasick-0.7.18",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.aho-corasick-0.7.18.bazel"),
+ )
+
maybe(
http_archive,
name = "rules_rust_tools_rust_analyzer__ansi_term__0_11_0",
@@ -23,12 +33,12 @@ def rules_rust_tools_rust_analyzer_fetch_remote_crates():
maybe(
http_archive,
- name = "rules_rust_tools_rust_analyzer__anyhow__1_0_38",
- url = "https://crates.io/api/v1/crates/anyhow/1.0.38/download",
+ name = "rules_rust_tools_rust_analyzer__anyhow__1_0_45",
+ url = "https://crates.io/api/v1/crates/anyhow/1.0.45/download",
type = "tar.gz",
- sha256 = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1",
- strip_prefix = "anyhow-1.0.38",
- build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.anyhow-1.0.38.bazel"),
+ sha256 = "ee10e43ae4a853c0a3591d4e2ada1719e553be18199d9da9d4a83f5927c2f5c7",
+ strip_prefix = "anyhow-1.0.45",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.anyhow-1.0.45.bazel"),
)
maybe(
@@ -43,12 +53,22 @@ def rules_rust_tools_rust_analyzer_fetch_remote_crates():
maybe(
http_archive,
- name = "rules_rust_tools_rust_analyzer__bitflags__1_2_1",
- url = "https://crates.io/api/v1/crates/bitflags/1.2.1/download",
+ name = "rules_rust_tools_rust_analyzer__bitflags__1_3_2",
+ url = "https://crates.io/api/v1/crates/bitflags/1.3.2/download",
+ type = "tar.gz",
+ sha256 = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a",
+ strip_prefix = "bitflags-1.3.2",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.bitflags-1.3.2.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__cfg_if__1_0_0",
+ url = "https://crates.io/api/v1/crates/cfg-if/1.0.0/download",
type = "tar.gz",
- sha256 = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693",
- strip_prefix = "bitflags-1.2.1",
- build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.bitflags-1.2.1.bazel"),
+ sha256 = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd",
+ strip_prefix = "cfg-if-1.0.0",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.cfg-if-1.0.0.bazel"),
)
maybe(
@@ -63,22 +83,52 @@ def rules_rust_tools_rust_analyzer_fetch_remote_crates():
maybe(
http_archive,
- name = "rules_rust_tools_rust_analyzer__heck__0_3_2",
- url = "https://crates.io/api/v1/crates/heck/0.3.2/download",
+ name = "rules_rust_tools_rust_analyzer__env_logger__0_9_0",
+ url = "https://crates.io/api/v1/crates/env_logger/0.9.0/download",
+ type = "tar.gz",
+ sha256 = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3",
+ strip_prefix = "env_logger-0.9.0",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.env_logger-0.9.0.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__heck__0_3_3",
+ url = "https://crates.io/api/v1/crates/heck/0.3.3/download",
+ type = "tar.gz",
+ sha256 = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c",
+ strip_prefix = "heck-0.3.3",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.heck-0.3.3.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__hermit_abi__0_1_19",
+ url = "https://crates.io/api/v1/crates/hermit-abi/0.1.19/download",
+ type = "tar.gz",
+ sha256 = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33",
+ strip_prefix = "hermit-abi-0.1.19",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.hermit-abi-0.1.19.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__humantime__2_1_0",
+ url = "https://crates.io/api/v1/crates/humantime/2.1.0/download",
type = "tar.gz",
- sha256 = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac",
- strip_prefix = "heck-0.3.2",
- build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.heck-0.3.2.bazel"),
+ sha256 = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4",
+ strip_prefix = "humantime-2.1.0",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.humantime-2.1.0.bazel"),
)
maybe(
http_archive,
- name = "rules_rust_tools_rust_analyzer__hermit_abi__0_1_18",
- url = "https://crates.io/api/v1/crates/hermit-abi/0.1.18/download",
+ name = "rules_rust_tools_rust_analyzer__itoa__0_4_8",
+ url = "https://crates.io/api/v1/crates/itoa/0.4.8/download",
type = "tar.gz",
- sha256 = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c",
- strip_prefix = "hermit-abi-0.1.18",
- build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.hermit-abi-0.1.18.bazel"),
+ sha256 = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4",
+ strip_prefix = "itoa-0.4.8",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.itoa-0.4.8.bazel"),
)
maybe(
@@ -93,12 +143,32 @@ def rules_rust_tools_rust_analyzer_fetch_remote_crates():
maybe(
http_archive,
- name = "rules_rust_tools_rust_analyzer__libc__0_2_86",
- url = "https://crates.io/api/v1/crates/libc/0.2.86/download",
+ name = "rules_rust_tools_rust_analyzer__libc__0_2_107",
+ url = "https://crates.io/api/v1/crates/libc/0.2.107/download",
type = "tar.gz",
- sha256 = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c",
- strip_prefix = "libc-0.2.86",
- build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.libc-0.2.86.bazel"),
+ sha256 = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219",
+ strip_prefix = "libc-0.2.107",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.libc-0.2.107.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__log__0_4_14",
+ url = "https://crates.io/api/v1/crates/log/0.4.14/download",
+ type = "tar.gz",
+ sha256 = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710",
+ strip_prefix = "log-0.4.14",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.log-0.4.14.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__memchr__2_4_1",
+ url = "https://crates.io/api/v1/crates/memchr/2.4.1/download",
+ type = "tar.gz",
+ sha256 = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a",
+ strip_prefix = "memchr-2.4.1",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.memchr-2.4.1.bazel"),
)
maybe(
@@ -123,22 +193,82 @@ def rules_rust_tools_rust_analyzer_fetch_remote_crates():
maybe(
http_archive,
- name = "rules_rust_tools_rust_analyzer__proc_macro2__1_0_24",
- url = "https://crates.io/api/v1/crates/proc-macro2/1.0.24/download",
+ name = "rules_rust_tools_rust_analyzer__proc_macro2__1_0_32",
+ url = "https://crates.io/api/v1/crates/proc-macro2/1.0.32/download",
type = "tar.gz",
- sha256 = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71",
- strip_prefix = "proc-macro2-1.0.24",
- build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.proc-macro2-1.0.24.bazel"),
+ sha256 = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43",
+ strip_prefix = "proc-macro2-1.0.32",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.proc-macro2-1.0.32.bazel"),
)
maybe(
http_archive,
- name = "rules_rust_tools_rust_analyzer__quote__1_0_9",
- url = "https://crates.io/api/v1/crates/quote/1.0.9/download",
+ name = "rules_rust_tools_rust_analyzer__quote__1_0_10",
+ url = "https://crates.io/api/v1/crates/quote/1.0.10/download",
type = "tar.gz",
- sha256 = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7",
- strip_prefix = "quote-1.0.9",
- build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.quote-1.0.9.bazel"),
+ sha256 = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05",
+ strip_prefix = "quote-1.0.10",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.quote-1.0.10.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__regex__1_5_4",
+ url = "https://crates.io/api/v1/crates/regex/1.5.4/download",
+ type = "tar.gz",
+ sha256 = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461",
+ strip_prefix = "regex-1.5.4",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.regex-1.5.4.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__regex_syntax__0_6_25",
+ url = "https://crates.io/api/v1/crates/regex-syntax/0.6.25/download",
+ type = "tar.gz",
+ sha256 = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b",
+ strip_prefix = "regex-syntax-0.6.25",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.regex-syntax-0.6.25.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__ryu__1_0_5",
+ url = "https://crates.io/api/v1/crates/ryu/1.0.5/download",
+ type = "tar.gz",
+ sha256 = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e",
+ strip_prefix = "ryu-1.0.5",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.ryu-1.0.5.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__serde__1_0_130",
+ url = "https://crates.io/api/v1/crates/serde/1.0.130/download",
+ type = "tar.gz",
+ sha256 = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913",
+ strip_prefix = "serde-1.0.130",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.serde-1.0.130.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__serde_derive__1_0_130",
+ url = "https://crates.io/api/v1/crates/serde_derive/1.0.130/download",
+ type = "tar.gz",
+ sha256 = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b",
+ strip_prefix = "serde_derive-1.0.130",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.serde_derive-1.0.130.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__serde_json__1_0_69",
+ url = "https://crates.io/api/v1/crates/serde_json/1.0.69/download",
+ type = "tar.gz",
+ sha256 = "e466864e431129c7e0d3476b92f20458e5879919a0596c6472738d9fa2d342f8",
+ strip_prefix = "serde_json-1.0.69",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.serde_json-1.0.69.bazel"),
)
maybe(
@@ -153,32 +283,42 @@ def rules_rust_tools_rust_analyzer_fetch_remote_crates():
maybe(
http_archive,
- name = "rules_rust_tools_rust_analyzer__structopt__0_3_21",
- url = "https://crates.io/api/v1/crates/structopt/0.3.21/download",
+ name = "rules_rust_tools_rust_analyzer__structopt__0_3_25",
+ url = "https://crates.io/api/v1/crates/structopt/0.3.25/download",
+ type = "tar.gz",
+ sha256 = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c",
+ strip_prefix = "structopt-0.3.25",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.structopt-0.3.25.bazel"),
+ )
+
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__structopt_derive__0_4_18",
+ url = "https://crates.io/api/v1/crates/structopt-derive/0.4.18/download",
type = "tar.gz",
- sha256 = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c",
- strip_prefix = "structopt-0.3.21",
- build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.structopt-0.3.21.bazel"),
+ sha256 = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0",
+ strip_prefix = "structopt-derive-0.4.18",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.structopt-derive-0.4.18.bazel"),
)
maybe(
http_archive,
- name = "rules_rust_tools_rust_analyzer__structopt_derive__0_4_14",
- url = "https://crates.io/api/v1/crates/structopt-derive/0.4.14/download",
+ name = "rules_rust_tools_rust_analyzer__syn__1_0_81",
+ url = "https://crates.io/api/v1/crates/syn/1.0.81/download",
type = "tar.gz",
- sha256 = "5ba9cdfda491b814720b6b06e0cac513d922fc407582032e8706e9f137976f90",
- strip_prefix = "structopt-derive-0.4.14",
- build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.structopt-derive-0.4.14.bazel"),
+ sha256 = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966",
+ strip_prefix = "syn-1.0.81",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.syn-1.0.81.bazel"),
)
maybe(
http_archive,
- name = "rules_rust_tools_rust_analyzer__syn__1_0_60",
- url = "https://crates.io/api/v1/crates/syn/1.0.60/download",
+ name = "rules_rust_tools_rust_analyzer__termcolor__1_1_2",
+ url = "https://crates.io/api/v1/crates/termcolor/1.1.2/download",
type = "tar.gz",
- sha256 = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081",
- strip_prefix = "syn-1.0.60",
- build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.syn-1.0.60.bazel"),
+ sha256 = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4",
+ strip_prefix = "termcolor-1.1.2",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.termcolor-1.1.2.bazel"),
)
maybe(
@@ -193,32 +333,32 @@ def rules_rust_tools_rust_analyzer_fetch_remote_crates():
maybe(
http_archive,
- name = "rules_rust_tools_rust_analyzer__unicode_segmentation__1_7_1",
- url = "https://crates.io/api/v1/crates/unicode-segmentation/1.7.1/download",
+ name = "rules_rust_tools_rust_analyzer__unicode_segmentation__1_8_0",
+ url = "https://crates.io/api/v1/crates/unicode-segmentation/1.8.0/download",
type = "tar.gz",
- sha256 = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796",
- strip_prefix = "unicode-segmentation-1.7.1",
- build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.unicode-segmentation-1.7.1.bazel"),
+ sha256 = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b",
+ strip_prefix = "unicode-segmentation-1.8.0",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.unicode-segmentation-1.8.0.bazel"),
)
maybe(
http_archive,
- name = "rules_rust_tools_rust_analyzer__unicode_width__0_1_8",
- url = "https://crates.io/api/v1/crates/unicode-width/0.1.8/download",
+ name = "rules_rust_tools_rust_analyzer__unicode_width__0_1_9",
+ url = "https://crates.io/api/v1/crates/unicode-width/0.1.9/download",
type = "tar.gz",
- sha256 = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3",
- strip_prefix = "unicode-width-0.1.8",
- build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.unicode-width-0.1.8.bazel"),
+ sha256 = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973",
+ strip_prefix = "unicode-width-0.1.9",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.unicode-width-0.1.9.bazel"),
)
maybe(
http_archive,
- name = "rules_rust_tools_rust_analyzer__unicode_xid__0_2_1",
- url = "https://crates.io/api/v1/crates/unicode-xid/0.2.1/download",
+ name = "rules_rust_tools_rust_analyzer__unicode_xid__0_2_2",
+ url = "https://crates.io/api/v1/crates/unicode-xid/0.2.2/download",
type = "tar.gz",
- sha256 = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564",
- strip_prefix = "unicode-xid-0.2.1",
- build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.unicode-xid-0.2.1.bazel"),
+ sha256 = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3",
+ strip_prefix = "unicode-xid-0.2.2",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.unicode-xid-0.2.2.bazel"),
)
maybe(
@@ -233,12 +373,12 @@ def rules_rust_tools_rust_analyzer_fetch_remote_crates():
maybe(
http_archive,
- name = "rules_rust_tools_rust_analyzer__version_check__0_9_2",
- url = "https://crates.io/api/v1/crates/version_check/0.9.2/download",
+ name = "rules_rust_tools_rust_analyzer__version_check__0_9_3",
+ url = "https://crates.io/api/v1/crates/version_check/0.9.3/download",
type = "tar.gz",
- sha256 = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed",
- strip_prefix = "version_check-0.9.2",
- build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.version_check-0.9.2.bazel"),
+ sha256 = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe",
+ strip_prefix = "version_check-0.9.3",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.version_check-0.9.3.bazel"),
)
maybe(
@@ -261,6 +401,16 @@ def rules_rust_tools_rust_analyzer_fetch_remote_crates():
build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel"),
)
+ maybe(
+ http_archive,
+ name = "rules_rust_tools_rust_analyzer__winapi_util__0_1_5",
+ url = "https://crates.io/api/v1/crates/winapi-util/0.1.5/download",
+ type = "tar.gz",
+ sha256 = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178",
+ strip_prefix = "winapi-util-0.1.5",
+ build_file = Label("//tools/rust_analyzer/raze/remote:BUILD.winapi-util-0.1.5.bazel"),
+ )
+
maybe(
http_archive,
name = "rules_rust_tools_rust_analyzer__winapi_x86_64_pc_windows_gnu__0_4_0",
diff --git a/tools/rust_analyzer/raze/remote/BUILD.aho-corasick-0.7.18.bazel b/tools/rust_analyzer/raze/remote/BUILD.aho-corasick-0.7.18.bazel
new file mode 100644
index 0000000000..d0d1788289
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.aho-corasick-0.7.18.bazel
@@ -0,0 +1,56 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "unencumbered", # Unlicense from expression "Unlicense OR MIT"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "aho_corasick",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ "std",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.7.18",
+ # buildifier: leave-alone
+ deps = [
+ "@rules_rust_tools_rust_analyzer__memchr__2_4_1//:memchr",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.anyhow-1.0.38.bazel b/tools/rust_analyzer/raze/remote/BUILD.anyhow-1.0.45.bazel
similarity index 98%
rename from tools/rust_analyzer/raze/remote/BUILD.anyhow-1.0.38.bazel
rename to tools/rust_analyzer/raze/remote/BUILD.anyhow-1.0.45.bazel
index 3a57af85a9..737d7df5ac 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.anyhow-1.0.38.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.anyhow-1.0.45.bazel
@@ -56,7 +56,7 @@ cargo_build_script(
"cargo-raze",
"manual",
],
- version = "1.0.38",
+ version = "1.0.45",
visibility = ["//visibility:private"],
deps = [
],
@@ -79,7 +79,7 @@ rust_library(
"cargo-raze",
"manual",
],
- version = "1.0.38",
+ version = "1.0.45",
# buildifier: leave-alone
deps = [
":anyhow_build_script",
diff --git a/tools/rust_analyzer/raze/remote/BUILD.atty-0.2.14.bazel b/tools/rust_analyzer/raze/remote/BUILD.atty-0.2.14.bazel
index be8c6ef708..c8b5efa30a 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.atty-0.2.14.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.atty-0.2.14.bazel
@@ -73,7 +73,7 @@ rust_library(
"@rules_rust//rust/platform:x86_64-linux-android",
"@rules_rust//rust/platform:x86_64-unknown-freebsd",
): [
- "@rules_rust_tools_rust_analyzer__libc__0_2_86//:libc",
+ "@rules_rust_tools_rust_analyzer__libc__0_2_107//:libc",
],
"//conditions:default": [],
}) + selects.with_or({
diff --git a/tools/rust_analyzer/raze/remote/BUILD.bitflags-1.3.2.bazel b/tools/rust_analyzer/raze/remote/BUILD.bitflags-1.3.2.bazel
new file mode 100644
index 0000000000..417aee7ee0
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.bitflags-1.3.2.bazel
@@ -0,0 +1,58 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "bitflags",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.3.2",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
+
+# Unsupported target "basic" with type "test" omitted
+
+# Unsupported target "compile" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.cfg-if-1.0.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.cfg-if-1.0.0.bazel
new file mode 100644
index 0000000000..84595a63ba
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.cfg-if-1.0.0.bazel
@@ -0,0 +1,55 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "cfg_if",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.0",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
+
+# Unsupported target "xcrate" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.clap-2.33.3.bazel b/tools/rust_analyzer/raze/remote/BUILD.clap-2.33.3.bazel
index 826f4f1ba0..0ecdf7a52a 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.clap-2.33.3.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.clap-2.33.3.bazel
@@ -59,10 +59,10 @@ rust_library(
# buildifier: leave-alone
deps = [
"@rules_rust_tools_rust_analyzer__atty__0_2_14//:atty",
- "@rules_rust_tools_rust_analyzer__bitflags__1_2_1//:bitflags",
+ "@rules_rust_tools_rust_analyzer__bitflags__1_3_2//:bitflags",
"@rules_rust_tools_rust_analyzer__strsim__0_8_0//:strsim",
"@rules_rust_tools_rust_analyzer__textwrap__0_11_0//:textwrap",
- "@rules_rust_tools_rust_analyzer__unicode_width__0_1_8//:unicode_width",
+ "@rules_rust_tools_rust_analyzer__unicode_width__0_1_9//:unicode_width",
"@rules_rust_tools_rust_analyzer__vec_map__0_8_2//:vec_map",
] + selects.with_or({
# cfg(not(windows))
diff --git a/tools/rust_analyzer/raze/remote/BUILD.env_logger-0.9.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.env_logger-0.9.0.bazel
new file mode 100644
index 0000000000..4d35482417
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.env_logger-0.9.0.bazel
@@ -0,0 +1,71 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "env_logger",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "atty",
+ "default",
+ "humantime",
+ "regex",
+ "termcolor",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.9.0",
+ # buildifier: leave-alone
+ deps = [
+ "@rules_rust_tools_rust_analyzer__atty__0_2_14//:atty",
+ "@rules_rust_tools_rust_analyzer__humantime__2_1_0//:humantime",
+ "@rules_rust_tools_rust_analyzer__log__0_4_14//:log",
+ "@rules_rust_tools_rust_analyzer__regex__1_5_4//:regex",
+ "@rules_rust_tools_rust_analyzer__termcolor__1_1_2//:termcolor",
+ ],
+)
+
+# Unsupported target "init-twice-retains-filter" with type "test" omitted
+
+# Unsupported target "log-in-log" with type "test" omitted
+
+# Unsupported target "log_tls_dtors" with type "test" omitted
+
+# Unsupported target "regexp_filter" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.heck-0.3.2.bazel b/tools/rust_analyzer/raze/remote/BUILD.heck-0.3.3.bazel
similarity index 95%
rename from tools/rust_analyzer/raze/remote/BUILD.heck-0.3.2.bazel
rename to tools/rust_analyzer/raze/remote/BUILD.heck-0.3.3.bazel
index cc70a3f0e0..7aac08314d 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.heck-0.3.2.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.heck-0.3.3.bazel
@@ -46,9 +46,9 @@ rust_library(
"cargo-raze",
"manual",
],
- version = "0.3.2",
+ version = "0.3.3",
# buildifier: leave-alone
deps = [
- "@rules_rust_tools_rust_analyzer__unicode_segmentation__1_7_1//:unicode_segmentation",
+ "@rules_rust_tools_rust_analyzer__unicode_segmentation__1_8_0//:unicode_segmentation",
],
)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.hermit-abi-0.1.18.bazel b/tools/rust_analyzer/raze/remote/BUILD.hermit-abi-0.1.19.bazel
similarity index 92%
rename from tools/rust_analyzer/raze/remote/BUILD.hermit-abi-0.1.18.bazel
rename to tools/rust_analyzer/raze/remote/BUILD.hermit-abi-0.1.19.bazel
index 71572205e2..99cba1b595 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.hermit-abi-0.1.18.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.hermit-abi-0.1.19.bazel
@@ -47,9 +47,9 @@ rust_library(
"cargo-raze",
"manual",
],
- version = "0.1.18",
+ version = "0.1.19",
# buildifier: leave-alone
deps = [
- "@rules_rust_tools_rust_analyzer__libc__0_2_86//:libc",
+ "@rules_rust_tools_rust_analyzer__libc__0_2_107//:libc",
],
)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.humantime-2.1.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.humantime-2.1.0.bazel
new file mode 100644
index 0000000000..9905a0d3f7
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.humantime-2.1.0.bazel
@@ -0,0 +1,57 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+# Unsupported target "datetime_format" with type "bench" omitted
+
+# Unsupported target "datetime_parse" with type "bench" omitted
+
+rust_library(
+ name = "humantime",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "2.1.0",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.unicode-segmentation-1.7.1.bazel b/tools/rust_analyzer/raze/remote/BUILD.itoa-0.4.8.bazel
similarity index 86%
rename from tools/rust_analyzer/raze/remote/BUILD.unicode-segmentation-1.7.1.bazel
rename to tools/rust_analyzer/raze/remote/BUILD.itoa-0.4.8.bazel
index 63b32abb82..27868c7d2b 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.unicode-segmentation-1.7.1.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.itoa-0.4.8.bazel
@@ -31,10 +31,10 @@ licenses([
# Generated Targets
-# Unsupported target "graphemes" with type "bench" omitted
+# Unsupported target "bench" with type "bench" omitted
rust_library(
- name = "unicode_segmentation",
+ name = "itoa",
srcs = glob(["**/*.rs"]),
crate_features = [
],
@@ -48,8 +48,10 @@ rust_library(
"cargo-raze",
"manual",
],
- version = "1.7.1",
+ version = "0.4.8",
# buildifier: leave-alone
deps = [
],
)
+
+# Unsupported target "test" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.libc-0.2.86.bazel b/tools/rust_analyzer/raze/remote/BUILD.libc-0.2.107.bazel
similarity index 97%
rename from tools/rust_analyzer/raze/remote/BUILD.libc-0.2.86.bazel
rename to tools/rust_analyzer/raze/remote/BUILD.libc-0.2.107.bazel
index 1d60962339..bfb4b822bd 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.libc-0.2.86.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.libc-0.2.107.bazel
@@ -54,7 +54,7 @@ cargo_build_script(
"cargo-raze",
"manual",
],
- version = "0.2.86",
+ version = "0.2.107",
visibility = ["//visibility:private"],
deps = [
],
@@ -75,7 +75,7 @@ rust_library(
"cargo-raze",
"manual",
],
- version = "0.2.86",
+ version = "0.2.107",
# buildifier: leave-alone
deps = [
":libc_build_script",
diff --git a/tools/rust_analyzer/raze/remote/BUILD.log-0.4.14.bazel b/tools/rust_analyzer/raze/remote/BUILD.log-0.4.14.bazel
new file mode 100644
index 0000000000..79cad4df8d
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.log-0.4.14.bazel
@@ -0,0 +1,92 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "log_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ "std",
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.4.14",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+# Unsupported target "value" with type "bench" omitted
+
+rust_library(
+ name = "log",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "std",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.4.14",
+ # buildifier: leave-alone
+ deps = [
+ ":log_build_script",
+ "@rules_rust_tools_rust_analyzer__cfg_if__1_0_0//:cfg_if",
+ ],
+)
+
+# Unsupported target "filters" with type "test" omitted
+
+# Unsupported target "macros" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.bitflags-1.2.1.bazel b/tools/rust_analyzer/raze/remote/BUILD.memchr-2.4.1.bazel
similarity index 84%
rename from tools/rust_analyzer/raze/remote/BUILD.bitflags-1.2.1.bazel
rename to tools/rust_analyzer/raze/remote/BUILD.memchr-2.4.1.bazel
index 4d237cf796..2016ce4fa3 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.bitflags-1.2.1.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.memchr-2.4.1.bazel
@@ -26,7 +26,7 @@ package(default_visibility = [
])
licenses([
- "notice", # MIT from expression "MIT OR Apache-2.0"
+ "unencumbered", # Unlicense from expression "Unlicense OR MIT"
])
# Generated Targets
@@ -38,16 +38,17 @@ load(
)
cargo_build_script(
- name = "bitflags_build_script",
+ name = "memchr_build_script",
srcs = glob(["**/*.rs"]),
build_script_env = {
},
crate_features = [
"default",
+ "std",
],
crate_root = "build.rs",
data = glob(["**"]),
- edition = "2015",
+ edition = "2018",
rustc_flags = [
"--cap-lints=allow",
],
@@ -55,21 +56,22 @@ cargo_build_script(
"cargo-raze",
"manual",
],
- version = "1.2.1",
+ version = "2.4.1",
visibility = ["//visibility:private"],
deps = [
],
)
rust_library(
- name = "bitflags",
+ name = "memchr",
srcs = glob(["**/*.rs"]),
crate_features = [
"default",
+ "std",
],
crate_root = "src/lib.rs",
data = [],
- edition = "2015",
+ edition = "2018",
rustc_flags = [
"--cap-lints=allow",
],
@@ -77,9 +79,9 @@ rust_library(
"cargo-raze",
"manual",
],
- version = "1.2.1",
+ version = "2.4.1",
# buildifier: leave-alone
deps = [
- ":bitflags_build_script",
+ ":memchr_build_script",
],
)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.proc-macro-error-1.0.4.bazel b/tools/rust_analyzer/raze/remote/BUILD.proc-macro-error-1.0.4.bazel
index b94dee0277..c6c622c704 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.proc-macro-error-1.0.4.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.proc-macro-error-1.0.4.bazel
@@ -60,7 +60,7 @@ cargo_build_script(
version = "1.0.4",
visibility = ["//visibility:private"],
deps = [
- "@rules_rust_tools_rust_analyzer__version_check__0_9_2//:version_check",
+ "@rules_rust_tools_rust_analyzer__version_check__0_9_3//:version_check",
],
)
@@ -89,9 +89,9 @@ rust_library(
# buildifier: leave-alone
deps = [
":proc_macro_error_build_script",
- "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_24//:proc_macro2",
- "@rules_rust_tools_rust_analyzer__quote__1_0_9//:quote",
- "@rules_rust_tools_rust_analyzer__syn__1_0_60//:syn",
+ "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_32//:proc_macro2",
+ "@rules_rust_tools_rust_analyzer__quote__1_0_10//:quote",
+ "@rules_rust_tools_rust_analyzer__syn__1_0_81//:syn",
],
)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.proc-macro-error-attr-1.0.4.bazel b/tools/rust_analyzer/raze/remote/BUILD.proc-macro-error-attr-1.0.4.bazel
index 1b5ff095e8..ba807a815c 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.proc-macro-error-attr-1.0.4.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.proc-macro-error-attr-1.0.4.bazel
@@ -57,7 +57,7 @@ cargo_build_script(
version = "1.0.4",
visibility = ["//visibility:private"],
deps = [
- "@rules_rust_tools_rust_analyzer__version_check__0_9_2//:version_check",
+ "@rules_rust_tools_rust_analyzer__version_check__0_9_3//:version_check",
],
)
@@ -80,7 +80,7 @@ rust_proc_macro(
# buildifier: leave-alone
deps = [
":proc_macro_error_attr_build_script",
- "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_24//:proc_macro2",
- "@rules_rust_tools_rust_analyzer__quote__1_0_9//:quote",
+ "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_32//:proc_macro2",
+ "@rules_rust_tools_rust_analyzer__quote__1_0_10//:quote",
],
)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.proc-macro2-1.0.24.bazel b/tools/rust_analyzer/raze/remote/BUILD.proc-macro2-1.0.32.bazel
similarity index 94%
rename from tools/rust_analyzer/raze/remote/BUILD.proc-macro2-1.0.24.bazel
rename to tools/rust_analyzer/raze/remote/BUILD.proc-macro2-1.0.32.bazel
index 58e31c8055..925284166a 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.proc-macro2-1.0.24.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.proc-macro2-1.0.32.bazel
@@ -56,7 +56,7 @@ cargo_build_script(
"cargo-raze",
"manual",
],
- version = "1.0.24",
+ version = "1.0.32",
visibility = ["//visibility:private"],
deps = [
],
@@ -79,11 +79,11 @@ rust_library(
"cargo-raze",
"manual",
],
- version = "1.0.24",
+ version = "1.0.32",
# buildifier: leave-alone
deps = [
":proc_macro2_build_script",
- "@rules_rust_tools_rust_analyzer__unicode_xid__0_2_1//:unicode_xid",
+ "@rules_rust_tools_rust_analyzer__unicode_xid__0_2_2//:unicode_xid",
],
)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.quote-1.0.9.bazel b/tools/rust_analyzer/raze/remote/BUILD.quote-1.0.10.bazel
similarity index 89%
rename from tools/rust_analyzer/raze/remote/BUILD.quote-1.0.9.bazel
rename to tools/rust_analyzer/raze/remote/BUILD.quote-1.0.10.bazel
index 1782e2e7e0..77f52365ef 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.quote-1.0.9.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.quote-1.0.10.bazel
@@ -31,6 +31,8 @@ licenses([
# Generated Targets
+# Unsupported target "bench" with type "bench" omitted
+
rust_library(
name = "quote",
srcs = glob(["**/*.rs"]),
@@ -48,10 +50,10 @@ rust_library(
"cargo-raze",
"manual",
],
- version = "1.0.9",
+ version = "1.0.10",
# buildifier: leave-alone
deps = [
- "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_24//:proc_macro2",
+ "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_32//:proc_macro2",
],
)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.regex-1.5.4.bazel b/tools/rust_analyzer/raze/remote/BUILD.regex-1.5.4.bazel
new file mode 100644
index 0000000000..8ba41a86c2
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.regex-1.5.4.bazel
@@ -0,0 +1,94 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+# Unsupported target "shootout-regex-dna" with type "example" omitted
+
+# Unsupported target "shootout-regex-dna-bytes" with type "example" omitted
+
+# Unsupported target "shootout-regex-dna-cheat" with type "example" omitted
+
+# Unsupported target "shootout-regex-dna-replace" with type "example" omitted
+
+# Unsupported target "shootout-regex-dna-single" with type "example" omitted
+
+# Unsupported target "shootout-regex-dna-single-cheat" with type "example" omitted
+
+rust_library(
+ name = "regex",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "aho-corasick",
+ "memchr",
+ "perf",
+ "perf-cache",
+ "perf-dfa",
+ "perf-inline",
+ "perf-literal",
+ "std",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.5.4",
+ # buildifier: leave-alone
+ deps = [
+ "@rules_rust_tools_rust_analyzer__aho_corasick__0_7_18//:aho_corasick",
+ "@rules_rust_tools_rust_analyzer__memchr__2_4_1//:memchr",
+ "@rules_rust_tools_rust_analyzer__regex_syntax__0_6_25//:regex_syntax",
+ ],
+)
+
+# Unsupported target "backtrack" with type "test" omitted
+
+# Unsupported target "backtrack-bytes" with type "test" omitted
+
+# Unsupported target "backtrack-utf8bytes" with type "test" omitted
+
+# Unsupported target "crates-regex" with type "test" omitted
+
+# Unsupported target "default" with type "test" omitted
+
+# Unsupported target "default-bytes" with type "test" omitted
+
+# Unsupported target "nfa" with type "test" omitted
+
+# Unsupported target "nfa-bytes" with type "test" omitted
+
+# Unsupported target "nfa-utf8bytes" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.regex-syntax-0.6.25.bazel b/tools/rust_analyzer/raze/remote/BUILD.regex-syntax-0.6.25.bazel
new file mode 100644
index 0000000000..d4e0b56f31
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.regex-syntax-0.6.25.bazel
@@ -0,0 +1,55 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+# Unsupported target "bench" with type "bench" omitted
+
+rust_library(
+ name = "regex_syntax",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.6.25",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.ryu-1.0.5.bazel b/tools/rust_analyzer/raze/remote/BUILD.ryu-1.0.5.bazel
new file mode 100644
index 0000000000..d4df380733
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.ryu-1.0.5.bazel
@@ -0,0 +1,101 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # Apache-2.0 from expression "Apache-2.0 OR BSL-1.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "ryu_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.5",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+# Unsupported target "bench" with type "bench" omitted
+
+# Unsupported target "upstream_benchmark" with type "example" omitted
+
+rust_library(
+ name = "ryu",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.5",
+ # buildifier: leave-alone
+ deps = [
+ ":ryu_build_script",
+ ],
+)
+
+# Unsupported target "common_test" with type "test" omitted
+
+# Unsupported target "d2s_table_test" with type "test" omitted
+
+# Unsupported target "d2s_test" with type "test" omitted
+
+# Unsupported target "exhaustive" with type "test" omitted
+
+# Unsupported target "f2s_test" with type "test" omitted
+
+# Unsupported target "s2d_test" with type "test" omitted
+
+# Unsupported target "s2f_test" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.serde-1.0.130.bazel b/tools/rust_analyzer/raze/remote/BUILD.serde-1.0.130.bazel
new file mode 100644
index 0000000000..7b5cb8c98c
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.serde-1.0.130.bazel
@@ -0,0 +1,94 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "serde_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ "default",
+ "derive",
+ "serde_derive",
+ "std",
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.130",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+rust_library(
+ name = "serde",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ "derive",
+ "serde_derive",
+ "std",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ proc_macro_deps = [
+ "@rules_rust_tools_rust_analyzer__serde_derive__1_0_130//:serde_derive",
+ ],
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.130",
+ # buildifier: leave-alone
+ deps = [
+ ":serde_build_script",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.serde_derive-1.0.130.bazel b/tools/rust_analyzer/raze/remote/BUILD.serde_derive-1.0.130.bazel
new file mode 100644
index 0000000000..2d84e1d8ec
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.serde_derive-1.0.130.bazel
@@ -0,0 +1,88 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "serde_derive_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ "default",
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.130",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+rust_proc_macro(
+ name = "serde_derive",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2015",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.130",
+ # buildifier: leave-alone
+ deps = [
+ ":serde_derive_build_script",
+ "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_32//:proc_macro2",
+ "@rules_rust_tools_rust_analyzer__quote__1_0_10//:quote",
+ "@rules_rust_tools_rust_analyzer__syn__1_0_81//:syn",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.serde_json-1.0.69.bazel b/tools/rust_analyzer/raze/remote/BUILD.serde_json-1.0.69.bazel
new file mode 100644
index 0000000000..2f4105fff4
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.serde_json-1.0.69.bazel
@@ -0,0 +1,90 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+ "@rules_rust//cargo:cargo_build_script.bzl",
+ "cargo_build_script",
+)
+
+cargo_build_script(
+ name = "serde_json_build_script",
+ srcs = glob(["**/*.rs"]),
+ build_script_env = {
+ },
+ crate_features = [
+ "default",
+ "std",
+ ],
+ crate_root = "build.rs",
+ data = glob(["**"]),
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.69",
+ visibility = ["//visibility:private"],
+ deps = [
+ ],
+)
+
+rust_library(
+ name = "serde_json",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ "std",
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.0.69",
+ # buildifier: leave-alone
+ deps = [
+ ":serde_json_build_script",
+ "@rules_rust_tools_rust_analyzer__itoa__0_4_8//:itoa",
+ "@rules_rust_tools_rust_analyzer__ryu__1_0_5//:ryu",
+ "@rules_rust_tools_rust_analyzer__serde__1_0_130//:serde",
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.structopt-0.3.21.bazel b/tools/rust_analyzer/raze/remote/BUILD.structopt-0.3.25.bazel
similarity index 95%
rename from tools/rust_analyzer/raze/remote/BUILD.structopt-0.3.21.bazel
rename to tools/rust_analyzer/raze/remote/BUILD.structopt-0.3.25.bazel
index 314590e338..24b86f7f3b 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.structopt-0.3.21.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.structopt-0.3.25.bazel
@@ -43,6 +43,8 @@ licenses([
# Unsupported target "enum_in_args" with type "example" omitted
+# Unsupported target "enum_in_args_with_strum" with type "example" omitted
+
# Unsupported target "enum_tuple" with type "example" omitted
# Unsupported target "env" with type "example" omitted
@@ -83,7 +85,7 @@ rust_library(
data = [],
edition = "2018",
proc_macro_deps = [
- "@rules_rust_tools_rust_analyzer__structopt_derive__0_4_14//:structopt_derive",
+ "@rules_rust_tools_rust_analyzer__structopt_derive__0_4_18//:structopt_derive",
],
rustc_flags = [
"--cap-lints=allow",
@@ -92,7 +94,7 @@ rust_library(
"cargo-raze",
"manual",
],
- version = "0.3.21",
+ version = "0.3.25",
# buildifier: leave-alone
deps = [
"@rules_rust_tools_rust_analyzer__clap__2_33_3//:clap",
@@ -120,6 +122,8 @@ rust_library(
# Unsupported target "flatten" with type "test" omitted
+# Unsupported target "generics" with type "test" omitted
+
# Unsupported target "issues" with type "test" omitted
# Unsupported target "macro-errors" with type "test" omitted
diff --git a/tools/rust_analyzer/raze/remote/BUILD.structopt-derive-0.4.14.bazel b/tools/rust_analyzer/raze/remote/BUILD.structopt-derive-0.4.18.bazel
similarity index 80%
rename from tools/rust_analyzer/raze/remote/BUILD.structopt-derive-0.4.14.bazel
rename to tools/rust_analyzer/raze/remote/BUILD.structopt-derive-0.4.18.bazel
index ea770f1766..8c8dfd869f 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.structopt-derive-0.4.14.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.structopt-derive-0.4.18.bazel
@@ -46,13 +46,13 @@ rust_proc_macro(
"cargo-raze",
"manual",
],
- version = "0.4.14",
+ version = "0.4.18",
# buildifier: leave-alone
deps = [
- "@rules_rust_tools_rust_analyzer__heck__0_3_2//:heck",
- "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_24//:proc_macro2",
+ "@rules_rust_tools_rust_analyzer__heck__0_3_3//:heck",
+ "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_32//:proc_macro2",
"@rules_rust_tools_rust_analyzer__proc_macro_error__1_0_4//:proc_macro_error",
- "@rules_rust_tools_rust_analyzer__quote__1_0_9//:quote",
- "@rules_rust_tools_rust_analyzer__syn__1_0_60//:syn",
+ "@rules_rust_tools_rust_analyzer__quote__1_0_10//:quote",
+ "@rules_rust_tools_rust_analyzer__syn__1_0_81//:syn",
],
)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.syn-1.0.60.bazel b/tools/rust_analyzer/raze/remote/BUILD.syn-1.0.81.bazel
similarity index 93%
rename from tools/rust_analyzer/raze/remote/BUILD.syn-1.0.60.bazel
rename to tools/rust_analyzer/raze/remote/BUILD.syn-1.0.81.bazel
index c956a55b3b..efd5cfed47 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.syn-1.0.60.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.syn-1.0.81.bazel
@@ -62,7 +62,7 @@ cargo_build_script(
"cargo-raze",
"manual",
],
- version = "1.0.60",
+ version = "1.0.81",
visibility = ["//visibility:private"],
deps = [
],
@@ -95,13 +95,13 @@ rust_library(
"cargo-raze",
"manual",
],
- version = "1.0.60",
+ version = "1.0.81",
# buildifier: leave-alone
deps = [
":syn_build_script",
- "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_24//:proc_macro2",
- "@rules_rust_tools_rust_analyzer__quote__1_0_9//:quote",
- "@rules_rust_tools_rust_analyzer__unicode_xid__0_2_1//:unicode_xid",
+ "@rules_rust_tools_rust_analyzer__proc_macro2__1_0_32//:proc_macro2",
+ "@rules_rust_tools_rust_analyzer__quote__1_0_10//:quote",
+ "@rules_rust_tools_rust_analyzer__unicode_xid__0_2_2//:unicode_xid",
],
)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.termcolor-1.1.2.bazel b/tools/rust_analyzer/raze/remote/BUILD.termcolor-1.1.2.bazel
new file mode 100644
index 0000000000..7605e0c18a
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.termcolor-1.1.2.bazel
@@ -0,0 +1,64 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "unencumbered", # Unlicense from expression "Unlicense OR MIT"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "termcolor",
+ srcs = glob(["**/*.rs"]),
+ aliases = {
+ },
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.1.2",
+ # buildifier: leave-alone
+ deps = [
+ ] + selects.with_or({
+ # cfg(windows)
+ (
+ "@rules_rust//rust/platform:i686-pc-windows-msvc",
+ "@rules_rust//rust/platform:x86_64-pc-windows-msvc",
+ ): [
+ "@rules_rust_tools_rust_analyzer__winapi_util__0_1_5//:winapi_util",
+ ],
+ "//conditions:default": [],
+ }),
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.textwrap-0.11.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.textwrap-0.11.0.bazel
index b38e73dc4b..38a4138675 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.textwrap-0.11.0.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.textwrap-0.11.0.bazel
@@ -55,7 +55,7 @@ rust_library(
version = "0.11.0",
# buildifier: leave-alone
deps = [
- "@rules_rust_tools_rust_analyzer__unicode_width__0_1_8//:unicode_width",
+ "@rules_rust_tools_rust_analyzer__unicode_width__0_1_9//:unicode_width",
],
)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.unicode-segmentation-1.8.0.bazel b/tools/rust_analyzer/raze/remote/BUILD.unicode-segmentation-1.8.0.bazel
new file mode 100644
index 0000000000..126a432b6a
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.unicode-segmentation-1.8.0.bazel
@@ -0,0 +1,59 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+# Unsupported target "graphemes" with type "bench" omitted
+
+# Unsupported target "unicode_words" with type "bench" omitted
+
+# Unsupported target "word_bounds" with type "bench" omitted
+
+rust_library(
+ name = "unicode_segmentation",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "1.8.0",
+ # buildifier: leave-alone
+ deps = [
+ ],
+)
diff --git a/tools/rust_analyzer/raze/remote/BUILD.unicode-width-0.1.8.bazel b/tools/rust_analyzer/raze/remote/BUILD.unicode-width-0.1.9.bazel
similarity index 97%
rename from tools/rust_analyzer/raze/remote/BUILD.unicode-width-0.1.8.bazel
rename to tools/rust_analyzer/raze/remote/BUILD.unicode-width-0.1.9.bazel
index ba3f9724e5..1b1b356e8b 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.unicode-width-0.1.8.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.unicode-width-0.1.9.bazel
@@ -47,7 +47,7 @@ rust_library(
"cargo-raze",
"manual",
],
- version = "0.1.8",
+ version = "0.1.9",
# buildifier: leave-alone
deps = [
],
diff --git a/tools/rust_analyzer/raze/remote/BUILD.unicode-xid-0.2.1.bazel b/tools/rust_analyzer/raze/remote/BUILD.unicode-xid-0.2.2.bazel
similarity index 93%
rename from tools/rust_analyzer/raze/remote/BUILD.unicode-xid-0.2.1.bazel
rename to tools/rust_analyzer/raze/remote/BUILD.unicode-xid-0.2.2.bazel
index 46fe776b88..9b7936d9f0 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.unicode-xid-0.2.1.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.unicode-xid-0.2.2.bazel
@@ -31,6 +31,8 @@ licenses([
# Generated Targets
+# Unsupported target "xid" with type "bench" omitted
+
rust_library(
name = "unicode_xid",
srcs = glob(["**/*.rs"]),
@@ -47,7 +49,7 @@ rust_library(
"cargo-raze",
"manual",
],
- version = "0.2.1",
+ version = "0.2.2",
# buildifier: leave-alone
deps = [
],
diff --git a/tools/rust_analyzer/raze/remote/BUILD.version_check-0.9.2.bazel b/tools/rust_analyzer/raze/remote/BUILD.version_check-0.9.3.bazel
similarity index 97%
rename from tools/rust_analyzer/raze/remote/BUILD.version_check-0.9.2.bazel
rename to tools/rust_analyzer/raze/remote/BUILD.version_check-0.9.3.bazel
index 50385cbcae..2d24b1f8a6 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.version_check-0.9.2.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.version_check-0.9.3.bazel
@@ -46,7 +46,7 @@ rust_library(
"cargo-raze",
"manual",
],
- version = "0.9.2",
+ version = "0.9.3",
# buildifier: leave-alone
deps = [
],
diff --git a/tools/rust_analyzer/raze/remote/BUILD.winapi-0.3.9.bazel b/tools/rust_analyzer/raze/remote/BUILD.winapi-0.3.9.bazel
index 94185d4178..89fc3a83ea 100644
--- a/tools/rust_analyzer/raze/remote/BUILD.winapi-0.3.9.bazel
+++ b/tools/rust_analyzer/raze/remote/BUILD.winapi-0.3.9.bazel
@@ -45,10 +45,15 @@ cargo_build_script(
crate_features = [
"consoleapi",
"errhandlingapi",
+ "fileapi",
"minwinbase",
"minwindef",
"processenv",
+ "std",
"winbase",
+ "wincon",
+ "winerror",
+ "winnt",
],
crate_root = "build.rs",
data = glob(["**"]),
@@ -72,10 +77,15 @@ rust_library(
crate_features = [
"consoleapi",
"errhandlingapi",
+ "fileapi",
"minwinbase",
"minwindef",
"processenv",
+ "std",
"winbase",
+ "wincon",
+ "winerror",
+ "winnt",
],
crate_root = "src/lib.rs",
data = [],
diff --git a/tools/rust_analyzer/raze/remote/BUILD.winapi-util-0.1.5.bazel b/tools/rust_analyzer/raze/remote/BUILD.winapi-util-0.1.5.bazel
new file mode 100644
index 0000000000..d72f51f63c
--- /dev/null
+++ b/tools/rust_analyzer/raze/remote/BUILD.winapi-util-0.1.5.bazel
@@ -0,0 +1,64 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:defs.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_proc_macro",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//tools/rust_analyzer/raze", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "unencumbered", # Unlicense from expression "Unlicense OR MIT"
+])
+
+# Generated Targets
+
+rust_library(
+ name = "winapi_util",
+ srcs = glob(["**/*.rs"]),
+ aliases = {
+ },
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.1.5",
+ # buildifier: leave-alone
+ deps = [
+ ] + selects.with_or({
+ # cfg(windows)
+ (
+ "@rules_rust//rust/platform:i686-pc-windows-msvc",
+ "@rules_rust//rust/platform:x86_64-pc-windows-msvc",
+ ): [
+ "@rules_rust_tools_rust_analyzer__winapi__0_3_9//:winapi",
+ ],
+ "//conditions:default": [],
+ }),
+)
diff --git a/tools/rust_analyzer/rust_project.rs b/tools/rust_analyzer/rust_project.rs
new file mode 100644
index 0000000000..06cdc3dbdf
--- /dev/null
+++ b/tools/rust_analyzer/rust_project.rs
@@ -0,0 +1,307 @@
+//! Library for generating rust_project.json files from a `Vec`
+//! See official documentation of file format at https://rust-analyzer.github.io/manual.html
+
+use std::collections::{BTreeMap, BTreeSet, HashMap};
+use std::io::ErrorKind;
+use std::path::Path;
+
+use anyhow::anyhow;
+use serde::Serialize;
+
+use crate::aquery::CrateSpec;
+
+/// A `rust-project.json` workspace representation. See
+/// [rust-analyzer documentation][rd] for a thorough description of this interface.
+/// [rd]: https://rust-analyzer.github.io/manual.html#non-cargo-based-projects
+#[derive(Debug, Serialize)]
+pub struct RustProject {
+ /// Path to the directory with *source code* of
+ /// sysroot crates.
+ sysroot_src: Option,
+
+ /// The set of crates comprising the current
+ /// project. Must include all transitive
+ /// dependencies as well as sysroot crate (libstd,
+ /// libcore and such).
+ crates: Vec,
+}
+
+/// A `rust-project.json` crate representation. See
+/// [rust-analyzer documentation][rd] for a thorough description of this interface.
+/// [rd]: https://rust-analyzer.github.io/manual.html#non-cargo-based-projects
+#[derive(Debug, Serialize)]
+pub struct Crate {
+ /// A name used in the package's project declaration
+ #[serde(skip_serializing_if = "Option::is_none")]
+ display_name: Option,
+
+ /// Path to the root module of the crate.
+ root_module: String,
+
+ /// Edition of the crate.
+ edition: String,
+
+ /// Dependencies
+ deps: Vec,
+
+ /// Should this crate be treated as a member of current "workspace".
+ #[serde(skip_serializing_if = "Option::is_none")]
+ is_workspace_member: Option,
+
+ /// Optionally specify the (super)set of `.rs` files comprising this crate.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ source: Option,
+
+ /// The set of cfgs activated for a given crate, like
+ /// `["unix", "feature=\"foo\"", "feature=\"bar\""]`.
+ cfg: Vec,
+
+ /// Target triple for this Crate.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ target: Option,
+
+ /// Environment variables, used for the `env!` macro
+ #[serde(skip_serializing_if = "Option::is_none")]
+ env: Option>,
+
+ /// Whether the crate is a proc-macro crate.
+ is_proc_macro: bool,
+
+ /// For proc-macro crates, path to compiled proc-macro (.so file).
+ #[serde(skip_serializing_if = "Option::is_none")]
+ proc_macro_dylib_path: Option,
+}
+
+#[derive(Debug, Serialize)]
+pub struct Source {
+ include_dirs: Vec,
+ exclude_dirs: Vec,
+}
+
+#[derive(Debug, Serialize)]
+pub struct Dependency {
+ /// Index of a crate in the `crates` array.
+ #[serde(rename = "crate")]
+ crate_index: usize,
+
+ /// The display name of the crate.
+ name: String,
+}
+
+pub fn generate_rust_project(
+ sysroot_src: &str,
+ crates: &BTreeSet,
+) -> anyhow::Result {
+ let mut project = RustProject {
+ sysroot_src: Some(sysroot_src.into()),
+ crates: Vec::new(),
+ };
+
+ let mut unmerged_crates: Vec<&CrateSpec> = crates.iter().collect();
+ let mut skipped_crates: Vec<&CrateSpec> = Vec::new();
+ let mut merged_crates_index: HashMap = HashMap::new();
+
+ while !unmerged_crates.is_empty() {
+ for c in unmerged_crates.iter() {
+ if c.deps
+ .iter()
+ .any(|dep| !merged_crates_index.contains_key(dep))
+ {
+ log::trace!(
+ "Skipped crate {} because missing deps: {:?}",
+ &c.crate_id,
+ c.deps
+ .iter()
+ .filter(|dep| !merged_crates_index.contains_key(*dep))
+ .cloned()
+ .collect::>()
+ );
+ skipped_crates.push(c);
+ } else {
+ log::trace!("Merging crate {}", &c.crate_id);
+ merged_crates_index.insert(c.crate_id.clone(), project.crates.len());
+ project.crates.push(Crate {
+ display_name: Some(c.display_name.clone()),
+ root_module: c.root_module.clone(),
+ edition: c.edition.clone(),
+ deps: c
+ .deps
+ .iter()
+ .map(|dep| {
+ let crate_index = *merged_crates_index
+ .get(dep)
+ .expect("failed to find dependency on second lookup");
+ let dep_crate = &project.crates[crate_index as usize];
+ Dependency {
+ crate_index,
+ name: dep_crate
+ .display_name
+ .as_ref()
+ .expect("all crates should have display_name")
+ .clone(),
+ }
+ })
+ .collect(),
+ is_workspace_member: Some(c.is_workspace_member),
+ source: c.source.as_ref().map(|s| Source {
+ exclude_dirs: s.exclude_dirs.clone(),
+ include_dirs: s.include_dirs.clone(),
+ }),
+ cfg: c.cfg.clone(),
+ target: Some(c.target.clone()),
+ env: Some(c.env.clone()),
+ is_proc_macro: c.proc_macro_dylib_path.is_some(),
+ proc_macro_dylib_path: c.proc_macro_dylib_path.clone(),
+ });
+ }
+ }
+
+ // This should not happen, but if it does exit to prevent infinite loop.
+ if unmerged_crates.len() == skipped_crates.len() {
+ log::debug!(
+ "Did not make progress on {} unmerged crates. Crates: {:?}",
+ skipped_crates.len(),
+ skipped_crates
+ );
+ return Err(anyhow!(
+ "Failed to make progress on building crate dependency graph"
+ ));
+ }
+ std::mem::swap(&mut unmerged_crates, &mut skipped_crates);
+ skipped_crates.clear();
+ }
+
+ Ok(project)
+}
+
+pub fn write_rust_project(
+ rust_project_path: &Path,
+ execution_root: &Path,
+ rust_project: &RustProject,
+) -> anyhow::Result<()> {
+ let execution_root = execution_root
+ .to_str()
+ .ok_or_else(|| anyhow!("execution_root is not valid UTF-8"))?;
+
+ // Try to remove the existing rust-project.json. It's OK if the file doesn't exist.
+ match std::fs::remove_file(rust_project_path) {
+ Ok(_) => {}
+ Err(err) if err.kind() == ErrorKind::NotFound => {}
+ Err(err) => {
+ return Err(anyhow!(
+ "Unexpected error removing old rust-project.json: {}",
+ err
+ ))
+ }
+ }
+
+ // Render the `rust-project.json` file and replace the exec root
+ // placeholders with the path to the local exec root.
+ let rust_project_content =
+ serde_json::to_string(rust_project)?.replace("__EXEC_ROOT__", execution_root);
+
+ // Write the new rust-project.json file.
+ std::fs::write(rust_project_path, rust_project_content)?;
+
+ Ok(())
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ use std::collections::BTreeSet;
+
+ use crate::aquery::CrateSpec;
+
+ /// A simple example with a single crate and no dependencies.
+ #[test]
+ fn generate_rust_project_single() {
+ let project = generate_rust_project(
+ "sysroot",
+ &BTreeSet::from([CrateSpec {
+ crate_id: "ID-example".into(),
+ display_name: "example".into(),
+ edition: "2018".into(),
+ root_module: "example/lib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ }]),
+ )
+ .expect("expect success");
+
+ assert_eq!(project.crates.len(), 1);
+ let c = &project.crates[0];
+ assert_eq!(c.display_name, Some("example".into()));
+ assert_eq!(c.root_module, "example/lib.rs");
+ assert_eq!(c.deps.len(), 0);
+ }
+
+ /// An example with a one crate having two dependencies.
+ #[test]
+ fn generate_rust_project_with_deps() {
+ let project = generate_rust_project(
+ "sysroot",
+ &BTreeSet::from([
+ CrateSpec {
+ crate_id: "ID-example".into(),
+ display_name: "example".into(),
+ edition: "2018".into(),
+ root_module: "example/lib.rs".into(),
+ is_workspace_member: true,
+ deps: BTreeSet::from(["ID-dep_a".into(), "ID-dep_b".into()]),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-dep_a".into(),
+ display_name: "dep_a".into(),
+ edition: "2018".into(),
+ root_module: "dep_a/lib.rs".into(),
+ is_workspace_member: false,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ CrateSpec {
+ crate_id: "ID-dep_b".into(),
+ display_name: "dep_b".into(),
+ edition: "2018".into(),
+ root_module: "dep_b/lib.rs".into(),
+ is_workspace_member: false,
+ deps: BTreeSet::new(),
+ proc_macro_dylib_path: None,
+ source: None,
+ cfg: vec!["test".into(), "debug_assertions".into()],
+ env: BTreeMap::new(),
+ target: "x86_64-unknown-linux-gnu".into(),
+ },
+ ]),
+ )
+ .expect("expect success");
+
+ assert_eq!(project.crates.len(), 3);
+ // Both dep_a and dep_b should be one of the first two crates.
+ assert!(
+ Some("dep_a".into()) == project.crates[0].display_name
+ || Some("dep_a".into()) == project.crates[1].display_name
+ );
+ assert!(
+ Some("dep_b".into()) == project.crates[0].display_name
+ || Some("dep_b".into()) == project.crates[1].display_name
+ );
+ let c = &project.crates[2];
+ assert_eq!(c.display_name, Some("example".into()));
+ }
+}
diff --git a/tools/rustfmt/BUILD.bazel b/tools/rustfmt/BUILD.bazel
index 135ec025d9..1456eb1cc1 100644
--- a/tools/rustfmt/BUILD.bazel
+++ b/tools/rustfmt/BUILD.bazel
@@ -1,5 +1,5 @@
load("//rust:defs.bzl", "rust_binary", "rust_clippy", "rust_library")
-load(":rustfmt_utils.bzl", "aspect_repository")
+load("//tools:tool_utils.bzl", "aspect_repository")
package(default_visibility = ["//visibility:public"])
diff --git a/tools/rustfmt/rustfmt_utils.bzl b/tools/rustfmt/rustfmt_utils.bzl
deleted file mode 100644
index b1fb391058..0000000000
--- a/tools/rustfmt/rustfmt_utils.bzl
+++ /dev/null
@@ -1,18 +0,0 @@
-"""A helper module for the `@rules_rust//tools/rustfmt` package"""
-
-def aspect_repository():
- """Determines the repository name to use for the `rustfmt_manifest` aspect in `rustfmt` binaries.
-
- The `//tools/rustfmt` target has a hard coded `--aspects` command built into it.
- This function is designed to allow for this aspect to be updated to work within
- the `rules_rust` repository itself since aspects do not work if the repository name
- is explicitly set.
-
- https://github.com/bazelbuild/rules_rust/issues/749
-
- Returns:
- str: The string to use for the `rustfmt_aspect` repository
- """
- if native.repository_name() == "@":
- return ""
- return native.repository_name()
diff --git a/tools/tool_utils.bzl b/tools/tool_utils.bzl
new file mode 100644
index 0000000000..de876b1403
--- /dev/null
+++ b/tools/tool_utils.bzl
@@ -0,0 +1,15 @@
+"""A helper module for the various targets in the `@rules_rust//tools` package"""
+
+def aspect_repository():
+ """Determines the repository name to use in Bazel commands that use aspects.
+
+ Some tools (`//tools/rustfmt` `//tools/rust_analyzer`) make calls to Bazel
+ and pass the `--aspects` flag. This macro allows those tools to work around
+ the following issue: https://github.com/bazelbuild/bazel/issues/11734
+
+ Returns:
+ str: The string to use for the `--aspects` repository labels
+ """
+ if native.repository_name() == "@":
+ return ""
+ return native.repository_name()