Skip to content

Commit

Permalink
Don't use an absolute path for index unit names
Browse files Browse the repository at this point in the history
After recent IndexStoreDB changes, relative paths are supported
using the explicit unit list.

PiperOrigin-RevId: 486725675
(cherry picked from commit 5b728e6)
Signed-off-by: Brentley Jones <github@brentleyjones.com>
  • Loading branch information
DavidGoldman authored and brentleyjones committed Oct 3, 2024
1 parent b94f378 commit d8cc3ea
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions swift/internal/compiling.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ def _precompile_clang_module(
"{}.swift.pcm.indexstore".format(target_name),
)
outputs.append(indexstore_directory)
index_unit_output_path = _index_unit_output_path(precompiled_module)
index_unit_output_path = precompiled_module.path
else:
indexstore_directory = None
index_unit_output_path = None
Expand Down Expand Up @@ -1409,14 +1409,6 @@ def _intermediate_frontend_file_path(target_name, src):

return paths.join(objs_dir, paths.dirname(owner_rel_path)), safe_name

def _index_unit_output_path(output_file):
"""Returns the hermetic index unit output path for indexing.
We use an absolute path since IndexStoreDB can't properly handle relative
paths.
"""
return "/BAZEL_EXECUTION_ROOT/{}".format(output_file.path)

def _declare_per_source_ast_file(*, actions, target_name, src):
"""Declares a file for an ast file during compilation.
Expand Down Expand Up @@ -1600,7 +1592,7 @@ def _declare_multiple_outputs_and_write_output_file_map(
src_output_map["object"] = obj.path

if include_index_unit_paths:
src_output_map["index-unit-output-path"] = _index_unit_output_path(obj)
src_output_map["index-unit-output-path"] = obj.path

ast = _declare_per_source_ast_file(
actions = actions,
Expand Down

0 comments on commit d8cc3ea

Please sign in to comment.