Skip to content

Commit

Permalink
Use __EXEC_ROOT__ paths for genfiles in rust_analyzer aspect (#1293)
Browse files Browse the repository at this point in the history
Fixes #1121.
  • Loading branch information
csmulhern authored Apr 27, 2022
1 parent 97de47d commit a6f332f
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions rust/private/rust_analyzer.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,12 @@ def _create_single_crate(ctx, info):

# 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 = 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
crate_root = _exec_root_tmpl + root_dirname
else:
crate["is_workspace_member"] = True
crate["root_module"] = root_path
crate_root = root_dirname
is_external = info.crate.root.path.startswith("external/")
is_generated = not info.crate.root.is_source
path_prefix = _exec_root_tmpl if is_external or is_generated else ""
crate["is_workspace_member"] = not is_external
crate["root_module"] = path_prefix + info.crate.root.path
crate_root = path_prefix + info.crate.root.dirname

if info.build_info != None:
out_dir_path = info.build_info.out_dir.path
Expand Down

0 comments on commit a6f332f

Please sign in to comment.