Skip to content

Commit

Permalink
cleanup: replace crate_type argument with crate_info.type (#864)
Browse files Browse the repository at this point in the history
* replace crate_type arg with crate_info.type

* update proto.bzl
  • Loading branch information
krasimirgg committed Jul 30, 2021
1 parent 72cc0aa commit d2d2ece
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 11 deletions.
1 change: 0 additions & 1 deletion proto/proto.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ def _rust_proto_compile(protos, descriptor_sets, imports, crate_name, ctx, is_gr
return rustc_compile_action(
ctx = ctx,
toolchain = find_toolchain(ctx),
crate_type = "rlib",
crate_info = rust_common.create_crate_info(
name = crate_name,
type = "rlib",
Expand Down
1 change: 0 additions & 1 deletion rust/private/clippy.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def _clippy_aspect_impl(target, ctx):
toolchain.clippy_driver.path,
cc_toolchain,
feature_configuration,
crate_type,
crate_info,
dep_info,
output_hash = determine_output_hash(crate_info.root),
Expand Down
3 changes: 0 additions & 3 deletions rust/private/rust.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ def _rust_library_common(ctx, crate_type):
return rustc_compile_action(
ctx = ctx,
toolchain = toolchain,
crate_type = crate_type,
crate_info = rust_common.create_crate_info(
name = crate_name,
type = crate_type,
Expand Down Expand Up @@ -289,7 +288,6 @@ def _rust_binary_impl(ctx):
return rustc_compile_action(
ctx = ctx,
toolchain = toolchain,
crate_type = ctx.attr.crate_type,
crate_info = rust_common.create_crate_info(
name = crate_name,
type = ctx.attr.crate_type,
Expand Down Expand Up @@ -450,7 +448,6 @@ def _rust_test_common(ctx, toolchain, output):
providers = rustc_compile_action(
ctx = ctx,
toolchain = toolchain,
crate_type = crate_type,
crate_info = crate_info,
rust_flags = ["--test"] if ctx.attr.use_libtest_harness else ["--cfg", "test"],
)
Expand Down
7 changes: 1 addition & 6 deletions rust/private/rustc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ def construct_arguments(
tool_path,
cc_toolchain,
feature_configuration,
crate_type,
crate_info,
dep_info,
output_hash,
Expand All @@ -353,7 +352,6 @@ def construct_arguments(
tool_path (str): Path to rustc
cc_toolchain (CcToolchain): The CcToolchain for the current target.
feature_configuration (FeatureConfiguration): Class used to construct command lines from CROSSTOOL features.
crate_type (str): Crate type of the current target.
crate_info (CrateInfo): The CrateInfo provider of the target crate
dep_info (DepInfo): The DepInfo provider of the target crate
output_hash (str): The hashed path of the crate root
Expand Down Expand Up @@ -489,7 +487,7 @@ def construct_arguments(
rustc_flags.add("--codegen=linker=" + ld)
rustc_flags.add_joined("--codegen", link_args, join_with = " ", format_joined = "link-args=%s")

_add_native_link_flags(rustc_flags, dep_info, crate_type, toolchain, cc_toolchain, feature_configuration)
_add_native_link_flags(rustc_flags, dep_info, crate_info.type, toolchain, cc_toolchain, feature_configuration)

# These always need to be added, even if not linking this crate.
add_crate_link_flags(rustc_flags, dep_info)
Expand Down Expand Up @@ -531,7 +529,6 @@ def construct_arguments(
def rustc_compile_action(
ctx,
toolchain,
crate_type,
crate_info,
output_hash = None,
rust_flags = [],
Expand All @@ -541,7 +538,6 @@ def rustc_compile_action(
Args:
ctx (ctx): The rule's context object
toolchain (rust_toolchain): The current `rust_toolchain`
crate_type (str): Crate type of the current target
crate_info (CrateInfo): The CrateInfo provider for the current target.
output_hash (str, optional): The hashed path of the crate root. Defaults to None.
rust_flags (list, optional): Additional flags to pass to rustc. Defaults to [].
Expand Down Expand Up @@ -581,7 +577,6 @@ def rustc_compile_action(
toolchain.rustc.path,
cc_toolchain,
feature_configuration,
crate_type,
crate_info,
dep_info,
output_hash,
Expand Down

0 comments on commit d2d2ece

Please sign in to comment.