Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor rustc_compile_action #330

Merged
merged 5 commits into from
Jun 13, 2020
Merged

Refactor rustc_compile_action #330

merged 5 commits into from
Jun 13, 2020

Conversation

smklein
Copy link
Contributor

@smklein smklein commented Jun 10, 2020

Functionally, this code should be identical.

However, it (hopefully) is easier to read, and makes
subcomponents of the rustc command (parsing args, env, etc)
easier to generalize.

Functionally, this code should be identical.

However, it (hopefully) is easier to read, and makes
subcomponents of the rustc command (parsing args, env, etc)
easier to generalize.
Comment on lines -370 to -403
# Make bin crate data deps available to tests.
for data in getattr(ctx.attr, "data", []):
if CrateInfo in data:
dep_crate_info = data[CrateInfo]
if dep_crate_info.type == "bin":
env["CARGO_BIN_EXE_" + dep_crate_info.output.basename] = dep_crate_info.output.short_path

# Update environment with user provided variables.
env.update(crate_info.rustc_env)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled up into _rustc_compile_arguments

Comment on lines -238 to -264
cc_toolchain = find_cpp_toolchain(ctx)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was unused, and removed.

rust/private/rustc.bzl Outdated Show resolved Hide resolved
Comment on lines -311 to -337
# We awkwardly construct this command because we cannot reference $PWD from ctx.actions.run(executable=toolchain.rustc)
out_dir = _create_out_dir_action(ctx, build_info.out_dir if build_info else None)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled up into _rustc_compile_inputs

rust/private/rustc.bzl Outdated Show resolved Hide resolved
rust/private/rustc.bzl Show resolved Hide resolved
rust/private/rustc.bzl Outdated Show resolved Hide resolved
toolchain,
)

compile_inputs, out_dir = _rustc_compile_inputs(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think each of these subcommands should start w/ verbs, eg.

collect_deps
collect_inputs
construct_arguments etc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@smklein smklein merged commit 9a131d6 into master Jun 13, 2020
@smklein smklein deleted the refactor-rustc branch June 13, 2020 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants