[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.
This commit is contained in:
parent
c162846f8b
commit
86f74c4d01
@ -3,6 +3,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
||||
load(":targets.bzl", "bolt_targets")
|
||||
|
||||
package(
|
||||
|
@ -2,6 +2,8 @@
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
features = ["layering_check"],
|
||||
|
@ -3,7 +3,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("//llvm:lit_test.bzl", "lit_test", "package_path")
|
||||
|
||||
package(
|
||||
|
@ -3,7 +3,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_test")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
|
||||
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
|
@ -2,6 +2,7 @@
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load(
|
||||
"//:vars.bzl",
|
||||
|
@ -2,6 +2,8 @@
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
@ -2,6 +2,8 @@
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
features = ["layering_check"],
|
||||
|
@ -2,6 +2,8 @@
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_test")
|
||||
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
features = ["layering_check"],
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
load("@bazel_skylib//lib:paths.bzl", "paths")
|
||||
load("@bazel_skylib//lib:selects.bzl", "selects")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load(":libc_configure_options.bzl", "LIBC_CONFIGURE_OPTIONS")
|
||||
load(":libc_namespace.bzl", "LIBC_NAMESPACE")
|
||||
load(":platforms.bzl", "PLATFORM_CPU_X86_64")
|
||||
@ -52,7 +53,7 @@ def _libc_library(name, **kwargs):
|
||||
for attr in ["copts", "local_defines"]:
|
||||
if attr in kwargs:
|
||||
fail("disallowed attribute: '{}' in rule: '{}'".format(attr, name))
|
||||
native.cc_library(
|
||||
cc_library(
|
||||
name = name,
|
||||
copts = libc_common_copts(),
|
||||
local_defines = LIBC_CONFIGURE_OPTIONS,
|
||||
@ -188,7 +189,7 @@ def libc_release_library(
|
||||
name = name + "_textual_hdrs",
|
||||
libs = libc_functions,
|
||||
)
|
||||
native.cc_library(
|
||||
cc_library(
|
||||
name = name + "_textual_hdr_library",
|
||||
textual_hdrs = [":" + name + "_textual_hdrs"],
|
||||
)
|
||||
@ -197,8 +198,7 @@ def libc_release_library(
|
||||
"LLVM_LIBC_FUNCTION_ATTR_" + name + "='LLVM_LIBC_EMPTY, [[gnu::weak]]'"
|
||||
for name in weak_symbols
|
||||
]
|
||||
|
||||
native.cc_library(
|
||||
cc_library(
|
||||
name = name,
|
||||
srcs = [":" + name + "_srcs"],
|
||||
copts = libc_common_copts() + libc_release_copts(),
|
||||
@ -229,12 +229,11 @@ def libc_header_library(name, hdrs, deps = [], **kwargs):
|
||||
name = name + "_textual_hdrs",
|
||||
libs = deps,
|
||||
)
|
||||
native.cc_library(
|
||||
cc_library(
|
||||
name = name + "_textual_hdr_library",
|
||||
textual_hdrs = [":" + name + "_textual_hdrs"],
|
||||
)
|
||||
|
||||
native.cc_library(
|
||||
cc_library(
|
||||
name = name,
|
||||
hdrs = hdrs,
|
||||
# We put _hdr_deps in srcs, as they are not a part of this cc_library
|
||||
|
@ -12,6 +12,7 @@ They come in two flavors:
|
||||
When performing tests we make sure to always use the internal version.
|
||||
"""
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
|
||||
load("//libc:libc_build_rules.bzl", "libc_common_copts")
|
||||
load("//libc:libc_configure_options.bzl", "LIBC_CONFIGURE_OPTIONS")
|
||||
|
||||
@ -58,8 +59,7 @@ def libc_test(
|
||||
|
||||
if full_build:
|
||||
copts = copts + _FULL_BUILD_COPTS
|
||||
|
||||
native.cc_test(
|
||||
cc_test(
|
||||
name = name,
|
||||
local_defines = local_defines + LIBC_CONFIGURE_OPTIONS,
|
||||
deps = deps,
|
||||
@ -77,7 +77,7 @@ def libc_test_library(name, copts = [], local_defines = [], **kwargs):
|
||||
local_defines: See cc_library.local_defines.
|
||||
**kwargs: Other attributes relevant to cc_library (e.g. "deps").
|
||||
"""
|
||||
native.cc_library(
|
||||
cc_library(
|
||||
name = name,
|
||||
testonly = True,
|
||||
copts = copts + libc_common_copts(),
|
||||
|
@ -83,7 +83,6 @@ libc_test(
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
libc_test(
|
||||
name = "wcslcat_test",
|
||||
srcs = ["wcslcat_test.cpp"],
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
# A wrapper library over MPC for use with LLVM libc math unittests.
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("//libc/test:libc_test_rules.bzl", "libc_test_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
# A wrapper library over MPFR for use with LLVM libc math unittests.
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("//libc/test:libc_test_rules.bzl", "libc_test_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
@ -2,6 +2,8 @@
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
@ -2,6 +2,7 @@
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load(
|
||||
"//:vars.bzl",
|
||||
"LLVM_VERSION",
|
||||
|
@ -6,6 +6,7 @@ load("@bazel_skylib//lib:selects.bzl", "selects")
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
|
||||
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
|
||||
load("@build_bazel_apple_support//rules:apple_genrule.bzl", "apple_genrule")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//:vars.bzl", "LLVM_VERSION_MAJOR", "LLVM_VERSION_MINOR", "LLVM_VERSION_PATCH", "LLVM_VERSION_SUFFIX", "PACKAGE_VERSION")
|
||||
load("//lldb/source/Plugins:plugin_config.bzl", "DEFAULT_PLUGINS", "DEFAULT_SCRIPT_PLUGINS", "OBJCPP_COPTS")
|
||||
|
@ -2,6 +2,7 @@
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library")
|
||||
load(":plugin_config.bzl", "DEFAULT_PLUGINS", "DEFAULT_SCRIPT_PLUGINS", "OBJCPP_COPTS")
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
|
||||
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "gentbl_filegroup", "td_library")
|
||||
load(":binary_alias.bzl", "binary_alias")
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
|
||||
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
|
||||
# Mapping from every tool to the cc_library that implements the tool's entrypoint.
|
||||
_TOOLS = {
|
||||
@ -175,7 +176,7 @@ def llvm_driver_cc_binary(
|
||||
template = "//llvm:cmake/modules/llvm-driver-template.cpp.in",
|
||||
)
|
||||
deps = deps or []
|
||||
native.cc_binary(
|
||||
cc_binary(
|
||||
name = name,
|
||||
srcs = [name + "-driver.cpp"],
|
||||
deps = deps + ["//llvm:Support"],
|
||||
|
@ -2,6 +2,7 @@
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library")
|
||||
|
||||
package(
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
|
||||
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
||||
load(
|
||||
":build_defs.bzl",
|
||||
"cc_headers_only",
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
"""Rules and macros for MLIR"""
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
def if_cuda_available(if_true, if_false = []):
|
||||
return select({
|
||||
# CUDA auto-detection is not yet supported.
|
||||
@ -49,20 +51,20 @@ def mlir_c_api_cc_library(
|
||||
"""
|
||||
capi_header_deps = ["%sHeaders" % d for d in capi_deps]
|
||||
capi_object_deps = ["%sObjects" % d for d in capi_deps]
|
||||
native.cc_library(
|
||||
cc_library(
|
||||
name = name,
|
||||
srcs = srcs,
|
||||
hdrs = hdrs,
|
||||
deps = deps + capi_deps + header_deps,
|
||||
**kwargs
|
||||
)
|
||||
native.cc_library(
|
||||
cc_library(
|
||||
name = name + "Headers",
|
||||
hdrs = hdrs,
|
||||
deps = header_deps + capi_header_deps,
|
||||
**kwargs
|
||||
)
|
||||
native.cc_library(
|
||||
cc_library(
|
||||
name = name + "Objects",
|
||||
srcs = srcs,
|
||||
hdrs = hdrs,
|
||||
|
@ -1,5 +1,8 @@
|
||||
# Description:
|
||||
# MLIR Tutorial
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Description:
|
||||
# MLIR Tutorial
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Description:
|
||||
# MLIR Tutorial
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Description:
|
||||
# MLIR Tutorial
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Description:
|
||||
# MLIR Tutorial
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Description:
|
||||
# MLIR Tutorial
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Description:
|
||||
# MLIR Tutorial
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
"""BUILD extensions for MLIR linalg generation."""
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
def genlinalg(name, linalggen, src, linalg_outs):
|
||||
"""genlinalg() generates code from a tc spec file.
|
||||
|
||||
@ -35,7 +37,7 @@ def genlinalg(name, linalggen, src, linalg_outs):
|
||||
)
|
||||
|
||||
hdrs = [f for (opts, f) in linalg_outs]
|
||||
native.cc_library(
|
||||
cc_library(
|
||||
name = name,
|
||||
hdrs = hdrs,
|
||||
textual_hdrs = hdrs,
|
||||
|
@ -4,6 +4,7 @@
|
||||
"""BUILD extensions for MLIR table generation."""
|
||||
|
||||
load("@bazel_skylib//lib:paths.bzl", "paths")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
TdInfo = provider(
|
||||
"Holds TableGen files and the dependencies and include paths necessary to" +
|
||||
@ -424,7 +425,7 @@ def gentbl_cc_library(
|
||||
skip_opts = ["-gen-op-doc"],
|
||||
**kwargs
|
||||
)
|
||||
native.cc_library(
|
||||
cc_library(
|
||||
name = name,
|
||||
# strip_include_prefix does not apply to textual_hdrs.
|
||||
# https://github.com/bazelbuild/bazel/issues/12424
|
||||
|
@ -3,6 +3,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("//llvm:lit_test.bzl", "package_path")
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "gentbl_sharded_ops", "td_library")
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_test")
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library")
|
||||
|
||||
package(
|
||||
|
@ -2,12 +2,14 @@
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
cc_library(
|
||||
name = "siphash",
|
||||
hdrs = ["include/siphash/SipHash.h"],
|
||||
strip_include_prefix = "include",
|
||||
)
|
||||
name = "siphash",
|
||||
hdrs = ["include/siphash/SipHash.h"],
|
||||
strip_include_prefix = "include",
|
||||
)
|
||||
|
@ -2,6 +2,8 @@
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
Loading…
x
Reference in New Issue
Block a user