From 47aa63f5dd71406003b9c7872857fa924edd05dd Mon Sep 17 00:00:00 2001 From: Cameron Mulhern Date: Mon, 25 Apr 2022 18:42:45 -0400 Subject: [PATCH] Use __EXEC_ROOT__ paths for genfiles in rust_analyzer aspect --- rust/private/rust_analyzer.bzl | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/rust/private/rust_analyzer.bzl b/rust/private/rust_analyzer.bzl index 4e2d757b7f..249775952a 100644 --- a/rust/private/rust_analyzer.bzl +++ b/rust/private/rust_analyzer.bzl @@ -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