Skip to content

Commit

Permalink
Make buildifier happy
Browse files Browse the repository at this point in the history
  • Loading branch information
djmarcin committed Feb 14, 2021
1 parent 2b0d3e3 commit bbf3c2f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions rust/private/rust_analyzer.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ given targets. This file can be consumed by rust-analyzer as an alternative
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/platform:triple_mappings.bzl", "system_to_dylib_ext", "triple_to_system")

# We support only these rule kinds.
_rust_rules = [
Expand All @@ -34,13 +34,13 @@ _rust_rules = [
RustAnalyzerInfo = provider(
doc = "RustAnalyzerInfo holds rust crate metadata for targets",
fields = {
"build_info": "BuildInfo: build info for this crate if present",
"cfgs": "List[String]: features or other compilation --cfg settings",
"crate": "rust_common.crate_info",
"deps": "List[RustAnalyzerInfo]: direct dependencies",
"transitive_deps": "List[RustAnalyzerInfo]: transitive closure of dependencies",
"cfgs": "List[String]: features or other compilation --cfg settings",
"env": "Dict{String: String}: Environment variables, used for the `env!` macro",
"proc_macro_dylib_path": "File: compiled shared library output of proc-macro rule",
"build_info": "BuildInfo: build info for this crate if present",
"transitive_deps": "List[RustAnalyzerInfo]: transitive closure of dependencies",
},
)

Expand Down Expand Up @@ -81,7 +81,7 @@ def _rust_analyzer_aspect_impl(target, ctx):

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.
Args:
toolchain: The current rust toolchain.
target: The current target.
Expand All @@ -108,11 +108,11 @@ rust_analyzer_aspect = aspect(
doc = "Annotates rust rules with RustAnalyzerInfo later used to build a rust-project.json",
)

_exec_root_tmpl = '__EXEC_ROOT__/'
_exec_root_tmpl = "__EXEC_ROOT__/"

def _crate_id(crate_info):
"""Returns a unique stable identifier for a crate
Returns:
(string): This crate's unique stable id.
"""
Expand Down Expand Up @@ -149,13 +149,13 @@ def create_crate(ctx, info, crate_mapping):
crate["env"].update({"OUT_DIR": _exec_root_tmpl + info.build_info.out_dir.path})
crate["source"] = {
# We have to tell rust-analyzer about our out_dir since it's not under the crate root.
"include_dirs": [crate_root, _exec_root_tmpl + info.build_info.out_dir.path],
"exclude_dirs": [],
"include_dirs": [crate_root, _exec_root_tmpl + info.build_info.out_dir.path],
}
crate["env"].update(info.env)

deps = [
{"name": d.crate.name, "crate": crate_mapping[_crate_id(d.crate)]}
{"crate": crate_mapping[_crate_id(d.crate)], "name": d.crate.name}
for d in info.deps
]
crate["deps"] = deps
Expand Down
10 changes: 5 additions & 5 deletions rust/rust.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ load(
_rust_test = "rust_test",
_rust_test_binary = "rust_test_binary",
)
load(
"//rust/private:rust_analyzer.bzl",
_rust_analyzer = "rust_analyzer",
_rust_analyzer_aspect = "rust_analyzer_aspect",
)
load(
"//rust/private:rustc.bzl",
_error_format = "error_format",
Expand All @@ -40,11 +45,6 @@ load(
"//rust/private:rustdoc_test.bzl",
_rust_doc_test = "rust_doc_test",
)
load(
"//rust/private:rust_analyzer.bzl",
_rust_analyzer = "rust_analyzer",
_rust_analyzer_aspect = "rust_analyzer_aspect",
)

rust_library = _rust_library
# See @rules_rust//rust/private:rust.bzl for a complete description.
Expand Down

0 comments on commit bbf3c2f

Please sign in to comment.