Skip to content

Commit

Permalink
Don't apply name_to_crate_name to test binary names. (#670)
Browse files Browse the repository at this point in the history
Normal `rust_binary` targets don't do this, so for consistency, don't do it in tests either.

An additional motivation for this change is that I'm trying to whittle down the number of uses of the `name_to_crate_name` function, as it doesn't take a possible `crate_name` attribute into account. For context, see also the changes and discussion in

#645
  • Loading branch information
martinboehme committed Mar 31, 2021
1 parent 86589e0 commit feefdd4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rust/private/rust.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# buildifier: disable=module-docstring
load("//rust/private:common.bzl", "rust_common")
load("//rust/private:rustc.bzl", "rustc_compile_action")
load("//rust/private:utils.bzl", "crate_name_from_attr", "determine_output_hash", "expand_locations", "find_toolchain", "name_to_crate_name")
load("//rust/private:utils.bzl", "crate_name_from_attr", "determine_output_hash", "expand_locations", "find_toolchain")

# TODO(marco): Separate each rule into its own file.

Expand Down Expand Up @@ -316,9 +316,9 @@ def _create_test_launcher(ctx, toolchain, output, providers):
# This should be investigated but for now, we generally assume if the target environment is windows,
# the execution environment is windows.
if toolchain.os == "windows":
launcher = ctx.actions.declare_file(name_to_crate_name(ctx.label.name + ".launcher.exe"))
launcher = ctx.actions.declare_file(ctx.label.name + ".launcher.exe")
else:
launcher = ctx.actions.declare_file(name_to_crate_name(ctx.label.name + ".launcher"))
launcher = ctx.actions.declare_file(ctx.label.name + ".launcher")

# Because returned executables must be created from the same rule, the
# launcher target is simply symlinked and exposed.
Expand Down Expand Up @@ -450,7 +450,7 @@ def _rust_test_impl(ctx):
toolchain = find_toolchain(ctx)

output = ctx.actions.declare_file(
name_to_crate_name(ctx.label.name) + toolchain.binary_ext,
ctx.label.name + toolchain.binary_ext,
)

return _rust_test_common(ctx, toolchain, output)
Expand Down

0 comments on commit feefdd4

Please sign in to comment.