Run buildifier

This commit is contained in:
Armando Montanez 2024-09-09 08:36:30 -07:00
parent c2c7987f55
commit c9a859abce
6 changed files with 29 additions and 29 deletions

View File

@ -6,9 +6,11 @@ module(
bazel_dep(name = "platforms", version = "0.0.10") bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "googletest", version = "1.15.2") bazel_dep(name = "googletest", version = "1.15.2")
bazel_dep(name = "bazel_skylib", version = "1.7.1") bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_cc") bazel_dep(name = "rules_cc")
local_path_override(module_name = "rules_cc", path = "../..") local_path_override(
module_name = "rules_cc",
path = "../..",
)
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

View File

@ -20,28 +20,27 @@ licenses(["notice"]) # Apache 2.0
cc_library( cc_library(
name = "headers", name = "headers",
includes = ["public"],
hdrs = ["public/dynamic_answer.h"], hdrs = ["public/dynamic_answer.h"],
includes = ["public"],
visibility = ["//visibility:private"], visibility = ["//visibility:private"],
) )
cc_library( cc_library(
name = "answer", name = "answer",
srcs = ["dynamic_answer.c"], srcs = ["dynamic_answer.c"],
deps = [":headers"],
visibility = ["//visibility:private"], visibility = ["//visibility:private"],
deps = [":headers"],
) )
cc_shared_library( cc_shared_library(
name = "shared_library", name = "shared_library",
deps = [":answer"],
visibility = ["//visibility:private"], visibility = ["//visibility:private"],
deps = [":answer"],
) )
# Forces linkage as a shared library. # Forces linkage as a shared library.
cc_library( cc_library(
name = "dynamic_answer", name = "dynamic_answer",
deps = [":headers"],
srcs = [":shared_library"], srcs = [":shared_library"],
deps = [":headers"],
) )

View File

@ -20,9 +20,9 @@ licenses(["notice"]) # Apache 2.0
cc_library( cc_library(
name = "answer", name = "answer",
includes = ["public"],
hdrs = ["public/static_answer.h"],
srcs = ["static_answer.cc"], srcs = ["static_answer.cc"],
hdrs = ["public/static_answer.h"],
includes = ["public"],
linkstatic = True, linkstatic = True,
visibility = ["//visibility:private"], visibility = ["//visibility:private"],
) )

View File

@ -59,10 +59,10 @@ cc_args(
":no_canonical_prefixes", ":no_canonical_prefixes",
":warnings", ":warnings",
], ],
tool_map = "@clang-{}//:all_tools".format(platform_name),
known_features = ["@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features"],
enabled_features = ["@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features"], enabled_features = ["@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features"],
known_features = ["@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features"],
target_compatible_with = constraints, target_compatible_with = constraints,
tool_map = "@clang-{}//:all_tools".format(platform_name),
) )
for platform_name, constraints in PLATFORMS.items() for platform_name, constraints in PLATFORMS.items()
] ]

View File

@ -12,11 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
load("@rules_cc//cc/toolchains:tool.bzl", "cc_tool")
load("@rules_cc//cc/toolchains:tool_map.bzl", "cc_tool_map")
load("@bazel_skylib//rules/directory:directory.bzl", "directory") load("@bazel_skylib//rules/directory:directory.bzl", "directory")
load("@bazel_skylib//rules/directory:subdirectory.bzl", "subdirectory") load("@bazel_skylib//rules/directory:subdirectory.bzl", "subdirectory")
load("@bazel_skylib//lib:selects.bzl", "selects") load("@rules_cc//cc/toolchains:tool.bzl", "cc_tool")
load("@rules_cc//cc/toolchains:tool_map.bzl", "cc_tool_map")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -41,7 +40,7 @@ alias(
actual = select({ actual = select({
"@platforms//os:macos": ":macos_tools", "@platforms//os:macos": ":macos_tools",
"//conditions:default": ":default_tools", "//conditions:default": ":default_tools",
}) }),
) )
COMMON_TOOLS = { COMMON_TOOLS = {
@ -56,7 +55,7 @@ COMMON_TOOLS = {
cc_tool_map( cc_tool_map(
name = "default_tools", name = "default_tools",
tools = COMMON_TOOLS | { tools = COMMON_TOOLS | {
"@rules_cc//cc/toolchains/actions:ar_actions": ":llvm-ar" "@rules_cc//cc/toolchains/actions:ar_actions": ":llvm-ar",
}, },
visibility = ["//visibility:private"], visibility = ["//visibility:private"],
) )
@ -64,7 +63,7 @@ cc_tool_map(
cc_tool_map( cc_tool_map(
name = "macos_tools", name = "macos_tools",
tools = COMMON_TOOLS | { tools = COMMON_TOOLS | {
"@rules_cc//cc/toolchains/actions:ar_actions": ":llvm-libtool-darwin" "@rules_cc//cc/toolchains/actions:ar_actions": ":llvm-libtool-darwin",
}, },
visibility = ["//visibility:private"], visibility = ["//visibility:private"],
) )
@ -82,14 +81,14 @@ cc_tool(
"@platforms//os:windows": "//:bin/clang.exe", "@platforms//os:windows": "//:bin/clang.exe",
"//conditions:default": "//:bin/clang", "//conditions:default": "//:bin/clang",
}), }),
allowlist_include_directories = [
":lib-clang-include",
],
data = glob([ data = glob([
"bin/llvm", "bin/llvm",
"include/**", "include/**",
"lib/clang/**/include/**", "lib/clang/**/include/**",
]), ]),
allowlist_include_directories = [
":lib-clang-include",
],
) )
cc_tool( cc_tool(
@ -98,16 +97,16 @@ cc_tool(
"@platforms//os:windows": "//:bin/clang++.exe", "@platforms//os:windows": "//:bin/clang++.exe",
"//conditions:default": "//:bin/clang++", "//conditions:default": "//:bin/clang++",
}), }),
data = glob([
"bin/llvm",
"include/**",
"lib/clang/**/include/**",
]),
allowlist_include_directories = [ allowlist_include_directories = [
":include-x86_64-unknown-linux-gnu-c++-v1", ":include-x86_64-unknown-linux-gnu-c++-v1",
":include-c++-v1", ":include-c++-v1",
":lib-clang-include", ":lib-clang-include",
], ],
data = glob([
"bin/llvm",
"include/**",
"lib/clang/**/include/**",
]),
) )
cc_tool( cc_tool(

View File

@ -20,12 +20,12 @@ package(default_visibility = ["//visibility:public"])
cc_sysroot( cc_sysroot(
name = "sysroot", name = "sysroot",
sysroot = ":root",
data = [":root"],
allowlist_include_directories = [ allowlist_include_directories = [
":usr-include-x86_64-linux-gnu", ":usr-include-x86_64-linux-gnu",
":usr-include", ":usr-include",
], ],
data = [":root"],
sysroot = ":root",
) )
directory( directory(
@ -35,12 +35,12 @@ directory(
subdirectory( subdirectory(
name = "usr-include-x86_64-linux-gnu", name = "usr-include-x86_64-linux-gnu",
path = "usr/include/x86_64-linux-gnu",
parent = ":root", parent = ":root",
path = "usr/include/x86_64-linux-gnu",
) )
subdirectory( subdirectory(
name = "usr-include", name = "usr-include",
path = "usr/include",
parent = ":root", parent = ":root",
path = "usr/include",
) )