docs: Add --incompatible_disallow_empty_glob to correctness.bazelrc (#524)

This commit is contained in:
Ted Kaplan 2023-09-18 19:58:27 -07:00 committed by GitHub
parent 89d8605502
commit fc3c3181f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 1 deletions

View File

@ -60,3 +60,9 @@ query --experimental_allow_tags_propagation
# https://github.com/bazelbuild/bazel/issues/10076.
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_default_to_explicit_init_py
build --incompatible_default_to_explicit_init_py
# Set default value of `allow_empty` to `False` in `glob()`. This prevents a common mistake when
# attempting to use `glob()` to match files in a subdirectory that is opaque to the current package
# because it contains a BUILD file. See https://github.com/bazelbuild/bazel/issues/8195.
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_disallow_empty_glob
common --incompatible_disallow_empty_glob

View File

@ -60,3 +60,9 @@ query --experimental_allow_tags_propagation
# https://github.com/bazelbuild/bazel/issues/10076.
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_default_to_explicit_init_py
build --incompatible_default_to_explicit_init_py
# Set default value of `allow_empty` to `False` in `glob()`. This prevents a common mistake when
# attempting to use `glob()` to match files in a subdirectory that is opaque to the current package
# because it contains a BUILD file. See https://github.com/bazelbuild/bazel/issues/8195.
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_disallow_empty_glob
common --incompatible_disallow_empty_glob

View File

@ -133,7 +133,7 @@ def _file_exists(path):
label = _to_label(path)
file_abs = "%s/%s" % (label.package, label.name)
file_rel = file_abs[len(native.package_name()) + 1:]
file_glob = native.glob([file_rel], exclude_directories = 1)
file_glob = native.glob([file_rel], exclude_directories = 1, allow_empty = True)
return len(file_glob) > 0
def _default_timeout(size, timeout):

View File

@ -60,3 +60,9 @@ query --experimental_allow_tags_propagation
# https://github.com/bazelbuild/bazel/issues/10076.
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_default_to_explicit_init_py
build --incompatible_default_to_explicit_init_py
# Set default value of `allow_empty` to `False` in `glob()`. This prevents a common mistake when
# attempting to use `glob()` to match files in a subdirectory that is opaque to the current package
# because it contains a BUILD file. See https://github.com/bazelbuild/bazel/issues/8195.
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_disallow_empty_glob
common --incompatible_disallow_empty_glob