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

Add allow_empty to glob, as the patterns don't necessarily match something #245

Merged
merged 3 commits into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ sass_repositories()

http_archive(
name = "bazel_toolchains",
sha256 = "5962fe677a43226c409316fcb321d668fc4b7fa97cb1f9ef45e7dc2676097b26",
strip_prefix = "bazel-toolchains-be10bee3010494721f08a0fccd7f57411a1e773e",
sha256 = "d8c2f20deb2f6143bac792d210db1a4872102d81529fe0ea3476c1696addd7ff",
strip_prefix = "bazel-toolchains-0.28.3",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/be10bee3010494721f08a0fccd7f57411a1e773e.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/archive/be10bee3010494721f08a0fccd7f57411a1e773e.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/0.28.3.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/archive/0.28.3.tar.gz",
],
)

Expand Down
13 changes: 8 additions & 5 deletions rust/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,14 @@ def BUILD_for_stdlib(target_triple):
return """
filegroup(
name = "rust_lib-{target_triple}",
srcs = glob([
"lib/rustlib/{target_triple}/lib/*.rlib",
"lib/rustlib/{target_triple}/lib/*{dylib_ext}",
"lib/rustlib/{target_triple}/lib/*{staticlib_ext}",
]),
srcs = glob(
[
"lib/rustlib/{target_triple}/lib/*.rlib",
"lib/rustlib/{target_triple}/lib/*{dylib_ext}",
"lib/rustlib/{target_triple}/lib/*{staticlib_ext}",
],
allow_empty = True,
Copy link
Collaborator

Choose a reason for hiding this comment

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

In which case does that glob is empty? Can a comment be added to justify it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the error message I got:
glob pattern 'lib/rustlib/x86_64-unknown-linux-gnu/lib/*.a' didn't match anything, but allow_empty is set to False.

I don't know if it happens in other cases too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That seems to indicate a potential bug, this is expected that there is no .a file here. I guess the empty glob is acting if any of those is empty.

Can you just add a comment with the pattern that fails to justify this allow_empty? It's not important to fix at the moment but keeping track of why we did that is useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comment

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks!

),
visibility = ["//visibility:public"],
)
""".format(
Expand Down