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

[bazel] Add support for --incompatible_disallow_empty_glob #85999

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions utils/bazel/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ build --features=layering_check
# See: https://bazel.build/reference/be/functions#exports_files
build --incompatible_no_implicit_file_export

# Enable so downstream users can flip this flag globally, this should
# eventually become the default
common --incompatible_disallow_empty_glob

###############################################################################
# Options to select different strategies for linking potential dependent
# libraries. The default leaves it disabled.
Expand Down
2 changes: 0 additions & 2 deletions utils/bazel/llvm-project-overlay/bolt/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ cc_library(
srcs = glob([
"lib/Target/AArch64/*.cpp",
]),
hdrs = glob([
]),
includes = ["include"],
deps = [
":Core",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ _common_library_deps = [
]

def clang_tidy_library(name, **kwargs):
kwargs["srcs"] = kwargs.get("srcs", native.glob([paths.join(name, "*.cpp")]))
kwargs["hdrs"] = kwargs.get("hdrs", native.glob([paths.join(name, "*.h")]))
kwargs["srcs"] = kwargs.get("srcs", native.glob([paths.join(name, "*.cpp")], allow_empty = True))
kwargs["hdrs"] = kwargs.get("hdrs", native.glob([paths.join(name, "*.h")], allow_empty=True))
kwargs["deps"] = kwargs.get("deps", []) + _common_library_deps
cc_library(
name = name,
Expand Down
22 changes: 1 addition & 21 deletions utils/bazel/llvm-project-overlay/clang/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,6 @@ cc_library(
"include/clang/Basic/Version.inc",
] + glob([
"lib/Basic/*.cpp",
"lib/Basic/*.c",
"lib/Basic/*.h",
"lib/Basic/Targets/*.cpp",
"lib/Basic/Targets/*.h",
Expand Down Expand Up @@ -1042,7 +1041,6 @@ cc_library(
"lib/Analysis/FlowSensitive/Models/*.cpp",
"lib/Analysis/FlowSensitive/*.cpp",
"lib/Analysis/*.cpp",
"lib/Analysis/*.h",
]) + [
":analysis_htmllogger_gen",
],
Expand Down Expand Up @@ -1180,10 +1178,8 @@ gentbl(

cc_library(
name = "parse",
srcs = [
] + glob([
srcs = glob([
"lib/Parse/*.cpp",
"lib/Parse/*.h",
]),
hdrs = [
"include/clang/Parse/AttrParserStringSwitches.inc",
Expand All @@ -1207,7 +1203,6 @@ cc_library(
name = "ast_matchers",
srcs = glob([
"lib/ASTMatchers/*.cpp",
"lib/ASTMatchers/*.h",
]),
hdrs = glob(["include/clang/ASTMatchers/*.h"]),
includes = ["include"],
Expand Down Expand Up @@ -1241,7 +1236,6 @@ cc_library(
name = "rewrite",
srcs = glob([
"lib/Rewrite/*.cpp",
"lib/Rewrite/*.h",
]),
hdrs = glob(["include/clang/Rewrite/Core/*.h"]),
includes = ["include"],
Expand Down Expand Up @@ -1275,7 +1269,6 @@ cc_library(
name = "tooling_core",
srcs = glob([
"lib/Tooling/Core/*.cpp",
"lib/Tooling/Core/*.h",
]),
hdrs = glob(["include/clang/Tooling/Core/*.h"]),
includes = ["include"],
Expand Down Expand Up @@ -1340,11 +1333,9 @@ cc_library(
name = "tooling_refactoring",
srcs = glob([
"lib/Tooling/Refactoring/**/*.cpp",
"lib/Tooling/Refactoring/**/*.h",
]),
hdrs = glob([
"include/clang/Tooling/Refactoring/**/*.h",
"include/clang/Tooling/Refactoring/**/*.def",
]),
deps = [
":ast",
Expand Down Expand Up @@ -1593,9 +1584,6 @@ cc_library(
srcs = glob(
[
"lib/Driver/*.cpp",
"lib/Driver/*.h",
"lib/Driver/Arch/*.cpp",
"lib/Driver/Arch/*.h",
"lib/Driver/ToolChains/*.cpp",
"lib/Driver/ToolChains/*.h",
"lib/Driver/ToolChains/Arch/*.cpp",
Expand Down Expand Up @@ -1833,9 +1821,6 @@ cc_library(
copts = ["$(STACK_FRAME_UNLIMITED)"],
data = [":builtin_headers_gen"],
includes = ["include"],
textual_hdrs = glob([
"include/clang/Frontend/*.def",
]),
deps = [
":apinotes",
":ast",
Expand Down Expand Up @@ -1872,7 +1857,6 @@ cc_library(
name = "frontend_rewrite",
srcs = glob([
"lib/Frontend/Rewrite/*.cpp",
"lib/Frontend/Rewrite/*.h",
]),
hdrs = glob(["include/clang/Rewrite/Frontend/*.h"]),
includes = ["include"],
Expand Down Expand Up @@ -2116,7 +2100,6 @@ cc_library(
name = "frontend_tool",
srcs = glob([
"lib/FrontendTool/*.cpp",
"lib/FrontendTool/*.h",
]),
hdrs = glob(["include/clang/FrontendTool/*.h"]),
includes = ["include"],
Expand Down Expand Up @@ -2320,7 +2303,6 @@ cc_binary(
testonly = 1,
srcs = glob([
"tools/clang-import-test/*.cpp",
"tools/clang-import-test/*.h",
]),
stamp = 0,
deps = [
Expand Down Expand Up @@ -2350,7 +2332,6 @@ cc_library(
name = "clang-driver",
srcs = glob([
"tools/driver/*.cpp",
"tools/driver/*.h",
]) + ["clang-driver.cpp"],
copts = [
# Disable stack frame size checks in the driver because
Expand Down Expand Up @@ -2668,7 +2649,6 @@ cc_library(
name = "extract_api",
srcs = glob([
"lib/ExtractAPI/**/*.cpp",
"lib/ExtractAPI/**/*.h",
]),
hdrs = glob(["include/clang/ExtractAPI/**/*.h"]),
includes = ["include"],
Expand Down
2 changes: 0 additions & 2 deletions utils/bazel/llvm-project-overlay/lld/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ cc_library(
name = "MinGW",
srcs = glob([
"MinGW/*.cpp",
"MinGW/*.h",
]),
includes = ["MinGW"],
deps = [
Expand Down Expand Up @@ -296,7 +295,6 @@ cc_binary(
name = "lld",
srcs = glob([
"tools/lld/*.cpp",
"tools/lld/*.h",
]) + ["lld-driver.cpp"],
deps = [
":COFF",
Expand Down
Loading
Loading