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

Replace usages of ctx.action with ctx.actions.{run, run_shell} #151

Merged
merged 19 commits into from
Nov 9, 2018

Conversation

mfarrugi
Copy link
Collaborator

@mfarrugi mfarrugi commented Nov 1, 2018

This got fairly yak-shavy, but addresses most of the remainder of #117

Relevant commit messages:

dylibs = [l for l in dep.cc.libs if l.basename.endswith(toolchain.dylib_ext)]
staticlibs = [l for l in dep.cc.libs if l.basename.endswith(toolchain.staticlib_ext)]
if not dylibs and not staticlibs:
fail("Did not find ususable library outputs in {}".format(dep))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

typo

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

bug 2: osx fails this check ... not sure why

out_dir = ctx.actions.declare_directory(ctx.label.name + ".out_dir")
ctx.actions.run_shell(
# TODO: Remove /bin/tar usage
command = "mkdir {dir} && /bin/tar -xzf {tar} -C {dir}".format(tar = tar_file.path, dir = out_dir.path),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

bug 1: change back to tar, it's in a different place on osx

rust/private/rust.bzl Show resolved Hide resolved

return toolchain.compilation_mode_opts[comp_mode]

def _get_lib_name(lib):
# def get_lib_name(lib: File) -> str:
Copy link
Collaborator

Choose a reason for hiding this comment

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

RM?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah. I was trying to think what the best way to include type annotations was, doesn't seem like the docstring convention is quite figured out.

rust/private/rustc.bzl Show resolved Hide resolved
rust/private/rustc.bzl Outdated Show resolved Hide resolved
rust/private/rustc.bzl Show resolved Hide resolved
rust/private/rustc.bzl Show resolved Hide resolved
rust/private/rustc.bzl Show resolved Hide resolved
Copy link
Collaborator

@acmcarther acmcarther left a comment

Choose a reason for hiding this comment

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

I'm having a pretty hard time efficiently separating out the minor refactoring changes from additions. I'd really like to scrutinize any behavior changes more closely, but it's hard for me to pick those out.

Anyway, I trust your judgment generally. If theres anything that merits a closer look, point it out and I'll take a look at it. Else, LGTM.

setup_cmd += [_symlink_dep_cmd(lib, deps_dir, in_runfiles)]
crate_list = transitive_crates.to_list()
transitive_libs = depset([c.output for c in crate_list]) + transitive_staticlibs + transitive_dylibs
indirect_crates = depset([crate for crate in crate_list if crate not in direct_crates])
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the distinction being made here beween "indirect crates" and "transitive libs'? Is indirect crates supposed to be just the rust-lang transitive dependencies?

I'm having a hard time efficiently working through the diff, so I'll ask to be spoonfed: What motivated this particular addition?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

transitive_libs is everything, as opposed to just crates.

I added to compensate for removing the setup_deps symlink hermiticity, by not passing unnecessary link directories to rustc. (This could be entirely pointless, I'm not attached to it)

rust/private/rustc.bzl Show resolved Hide resolved
rust/private/rustdoc_test.bzl Show resolved Hide resolved
@mfarrugi
Copy link
Collaborator Author

mfarrugi commented Nov 9, 2018

@acmcarther most of the individual commits are relatively digestible, but I think overall the change is uncontentious. In hindsight I shouldn't have split up files at the same time as making other changes.

@mfarrugi mfarrugi merged commit 4188d27 into bazelbuild:master Nov 9, 2018
@mfarrugi mfarrugi deleted the marco-update-actions branch November 9, 2018 02:22
damienmg added a commit to damienmg/rules_rust that referenced this pull request Nov 9, 2018
In order to test those flags, PR bazelbuild#151 broke some usage of those flags that
make `cargo raze` build file not work any more.
acmcarther pushed a commit that referenced this pull request Nov 9, 2018
* Add flags and features to the default library

In order to test those flags, PR #151 broke some usage of those flags that
make `cargo raze` build file not work any more.

* Having 2 flags in the same string in rustc is no longer allowed and that's fine

I'll send a PR to cargo-raze to fix it on cargo raze side rather.

* Fix the feature passing

Features needs to be quoted on the command line apparently.

* readability: use single quote to avoid escaping double quotes
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

3 participants