Skip to content

Commit 9575a9c

Browse files
Nhat Minh Lefacebook-github-bot
authored andcommitted
Make content-based paths available for cxx_compile
Summary: Expose the necessary attributes ready for the artefacts from the cxx main action to use content-based paths. This diff only exposes the fields but does not enable content-based paths for any of them yet. Reviewed By: patskovn Differential Revision: D80569343 fbshipit-source-id: eaef2b29a5834ae7b141c514f4bccedc0eb44ee4
1 parent 3bb8e97 commit 9575a9c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

cxx/compile.bzl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ def create_compile_cmds(
256256
args = src_args,
257257
index = src.index,
258258
is_header = src.is_header,
259+
uses_experimental_content_based_path_hashing = False,
259260
index_store_factory = impl_params.index_store_factory,
260261
error_handler = impl_params.error_handler,
261262
)
@@ -315,10 +316,13 @@ def _compile_single_cxx(
315316
filename_base = "{}.{}".format(filename_base, flavor.value)
316317
identifier = "{} ({})".format(identifier, flavor.value)
317318

319+
content_based = src_compile_cmd.uses_experimental_content_based_path_hashing
320+
318321
folder_name = "__objects__"
319322
object = ctx.actions.declare_output(
320323
folder_name,
321324
"{}.{}".format(filename_base, toolchain.linker_info.object_file_extension),
325+
uses_experimental_content_based_path_hashing = content_based,
322326
)
323327

324328
compiler_type = src_compile_cmd.cxx_compile_cmd.compiler_type
@@ -357,13 +361,15 @@ def _compile_single_cxx(
357361
cmd.add(["-fsave-optimization-record", "-fdiagnostics-show-hotness", "-foptimization-record-passes=" + toolchain.clang_remarks])
358362
clang_remarks = ctx.actions.declare_output(
359363
paths.join("__objects__", "{}.opt.yaml".format(filename_base)),
364+
uses_experimental_content_based_path_hashing = content_based,
360365
)
361366
cmd.add(cmd_args(hidden = clang_remarks.as_output()))
362367

363368
clang_llvm_statistics = None
364369
if toolchain.clang_llvm_statistics and compiler_type == "clang":
365370
clang_llvm_statistics = ctx.actions.declare_output(
366371
paths.join("__objects__", "{}.stats".format(filename_base)),
372+
uses_experimental_content_based_path_hashing = content_based,
367373
)
368374

369375
# Use stderr_to_file to capture clang statistics output
@@ -379,6 +385,7 @@ def _compile_single_cxx(
379385
cmd.add(["-ftime-trace"])
380386
clang_trace = ctx.actions.declare_output(
381387
paths.join("__objects__", "{}.json".format(filename_base)),
388+
uses_experimental_content_based_path_hashing = content_based,
382389
)
383390
cmd.add(cmd_args(hidden = clang_trace.as_output()))
384391

@@ -387,6 +394,7 @@ def _compile_single_cxx(
387394
cmd.add(["--coverage"])
388395
gcno_file = ctx.actions.declare_output(
389396
paths.join("__objects__", "{}.gcno".format(filename_base)),
397+
uses_experimental_content_based_path_hashing = content_based,
390398
)
391399
cmd.add(cmd_args(hidden = gcno_file.as_output()))
392400

@@ -397,6 +405,7 @@ def _compile_single_cxx(
397405
external_debug_info = ctx.actions.declare_output(
398406
folder_name,
399407
"{}.{}".format(filename_base, "dwo"),
408+
uses_experimental_content_based_path_hashing = content_based,
400409
)
401410
cmd.add(cmd_args(external_debug_info.as_output(), format = "--fbcc-create-external-debug-info={}"))
402411

cxx/compile_types.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ CxxSrcCompileCommand = record(
101101
args = field(list[typing.Any]),
102102
# Is this a header file?
103103
is_header = field(bool, False),
104+
# Whether to use content-based paths for the outputs of the compilation command.
105+
uses_experimental_content_based_path_hashing = field(bool),
104106
# The index store factory to use to generate index store for this source file.
105107
index_store_factory = field(typing.Callable | None, None),
106108
error_handler = field([typing.Callable, None], None),

0 commit comments

Comments
 (0)