Skip to content

Commit

Permalink
Remove create_crate_info_dict_callback
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinh Tran committed Oct 9, 2023
1 parent 7a21c1c commit 1d5891d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 0 additions & 2 deletions rust/private/rust.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ def _rust_library_common(ctx, crate_type):
toolchain = toolchain,
output_hash = output_hash,
crate_type = crate_type,
create_crate_info_callback = create_crate_info_dict,
rust_metadata = rust_metadata,
output_file = rust_lib,
)
Expand All @@ -206,7 +205,6 @@ def _rust_binary_impl(ctx):
attr = ctx.attr,
toolchain = toolchain,
crate_type = ctx.attr.crate_type,
create_crate_info_callback = create_crate_info_dict,
output_file = output,
)

Expand Down
12 changes: 4 additions & 8 deletions rust/private/rustc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ load(
"is_exec_configuration",
"make_static_lib_symlink",
"relativize",
"create_crate_info_dict",
)

BuildInfo = _BuildInfo
Expand Down Expand Up @@ -1091,10 +1092,6 @@ def rustc_compile_action(
force_all_deps_direct = False,
rust_metadata = None,
output_file = None,
# TODO: Remove create_crate_info_callback and skip_expanding_rustc_env attributes
# after all CrateInfo structs are constructed in rustc_compile_action
create_crate_info_callback = None,
crate_info_dict = None,
skip_expanding_rustc_env = False):
"""Create and run a rustc compile action based on the current rule's attributes
Expand All @@ -1121,14 +1118,13 @@ def rustc_compile_action(
# removing CrateInfo construction before `rust_compile_action

crate_info_dict = None
if create_crate_info_callback:
if ctx == None or toolchain == None or crate_type == None or crate_info != None:
if crate_info == None:
if ctx == None or toolchain == None or crate_type == None:
fail("FAIL", ctx, toolchain, crate_type)
crate_info_dict = create_crate_info_callback(
crate_info_dict = create_crate_info_dict(
ctx = ctx,
toolchain = toolchain,
crate_type = crate_type,
output_hash = output_hash,
rust_metadata = rust_metadata,
output_file = output_file,
)
Expand Down
2 changes: 1 addition & 1 deletion rust/private/utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ def _symlink_for_non_generated_source(ctx, src_file, package_root):
else:
return src_file

def create_crate_info_dict(ctx, toolchain, crate_type, output_hash, rust_metadata, output_file):
def create_crate_info_dict(ctx, toolchain, crate_type, rust_metadata, output_file):
"""Creates a mutable dict() representing CrateInfo provider
create_crate_info_dict is a *temporary* solution until create_crate_info is completely moved into
Expand Down

0 comments on commit 1d5891d

Please sign in to comment.