Skip to content

Commit 86f74c4

Browse files
authored
[bazel] Use rules_cc everywhere and reformat (#149584)
We already use cc rules from `@rules_cc//cc:defs.bzl` in a few files, but this uses it everywhere. Done automatically by running `buildifier --lint=fix --warnings=native-cc-binary,native-cc-library,native-cc-test,load` over all the files. I also ran `buildifier` once more to ensure there wasn't any missing formatting, so that caused a few unrelated diffs.
1 parent c162846 commit 86f74c4

File tree

35 files changed

+62
-23
lines changed

35 files changed

+62
-23
lines changed

utils/bazel/llvm-project-overlay/bolt/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
6+
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
67
load(":targets.bzl", "bolt_targets")
78

89
package(

utils/bazel/llvm-project-overlay/clang-tools-extra/clangd/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
load("@rules_cc//cc:defs.bzl", "cc_library")
6+
57
package(
68
default_visibility = ["//visibility:public"],
79
features = ["layering_check"],

utils/bazel/llvm-project-overlay/clang-tools-extra/include-cleaner/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
6-
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
6+
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
77
load("//llvm:lit_test.bzl", "lit_test", "package_path")
88

99
package(

utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
6-
load("@rules_cc//cc:defs.bzl", "cc_test")
6+
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
77

88
package(
99
default_visibility = ["//visibility:public"],

utils/bazel/llvm-project-overlay/clang/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
56
load("@rules_python//python:defs.bzl", "py_binary")
67
load(
78
"//:vars.bzl",

utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
6+
57
package(default_visibility = ["//visibility:public"])
68

79
licenses(["notice"])

utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
load("@rules_cc//cc:defs.bzl", "cc_library")
6+
57
package(
68
default_visibility = ["//visibility:public"],
79
features = ["layering_check"],

utils/bazel/llvm-project-overlay/compiler-rt/lib/orc/tests/unit/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
load("@rules_cc//cc:defs.bzl", "cc_test")
6+
57
package(
68
default_visibility = ["//visibility:public"],
79
features = ["layering_check"],

utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
load("@bazel_skylib//lib:paths.bzl", "paths")
88
load("@bazel_skylib//lib:selects.bzl", "selects")
9+
load("@rules_cc//cc:defs.bzl", "cc_library")
910
load(":libc_configure_options.bzl", "LIBC_CONFIGURE_OPTIONS")
1011
load(":libc_namespace.bzl", "LIBC_NAMESPACE")
1112
load(":platforms.bzl", "PLATFORM_CPU_X86_64")
@@ -52,7 +53,7 @@ def _libc_library(name, **kwargs):
5253
for attr in ["copts", "local_defines"]:
5354
if attr in kwargs:
5455
fail("disallowed attribute: '{}' in rule: '{}'".format(attr, name))
55-
native.cc_library(
56+
cc_library(
5657
name = name,
5758
copts = libc_common_copts(),
5859
local_defines = LIBC_CONFIGURE_OPTIONS,
@@ -188,7 +189,7 @@ def libc_release_library(
188189
name = name + "_textual_hdrs",
189190
libs = libc_functions,
190191
)
191-
native.cc_library(
192+
cc_library(
192193
name = name + "_textual_hdr_library",
193194
textual_hdrs = [":" + name + "_textual_hdrs"],
194195
)
@@ -197,8 +198,7 @@ def libc_release_library(
197198
"LLVM_LIBC_FUNCTION_ATTR_" + name + "='LLVM_LIBC_EMPTY, [[gnu::weak]]'"
198199
for name in weak_symbols
199200
]
200-
201-
native.cc_library(
201+
cc_library(
202202
name = name,
203203
srcs = [":" + name + "_srcs"],
204204
copts = libc_common_copts() + libc_release_copts(),
@@ -229,12 +229,11 @@ def libc_header_library(name, hdrs, deps = [], **kwargs):
229229
name = name + "_textual_hdrs",
230230
libs = deps,
231231
)
232-
native.cc_library(
232+
cc_library(
233233
name = name + "_textual_hdr_library",
234234
textual_hdrs = [":" + name + "_textual_hdrs"],
235235
)
236-
237-
native.cc_library(
236+
cc_library(
238237
name = name,
239238
hdrs = hdrs,
240239
# We put _hdr_deps in srcs, as they are not a part of this cc_library

utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ They come in two flavors:
1212
When performing tests we make sure to always use the internal version.
1313
"""
1414

15+
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
1516
load("//libc:libc_build_rules.bzl", "libc_common_copts")
1617
load("//libc:libc_configure_options.bzl", "LIBC_CONFIGURE_OPTIONS")
1718

@@ -58,8 +59,7 @@ def libc_test(
5859

5960
if full_build:
6061
copts = copts + _FULL_BUILD_COPTS
61-
62-
native.cc_test(
62+
cc_test(
6363
name = name,
6464
local_defines = local_defines + LIBC_CONFIGURE_OPTIONS,
6565
deps = deps,
@@ -77,7 +77,7 @@ def libc_test_library(name, copts = [], local_defines = [], **kwargs):
7777
local_defines: See cc_library.local_defines.
7878
**kwargs: Other attributes relevant to cc_library (e.g. "deps").
7979
"""
80-
native.cc_library(
80+
cc_library(
8181
name = name,
8282
testonly = True,
8383
copts = copts + libc_common_copts(),

0 commit comments

Comments
 (0)