Files
codeql/swift/extractor/BUILD.bazel
Paolo Tranquilli 9f5782b67b Bazel: introduce buildifier formatting
This introduces tooling and enforcement for formatting bazel files.

The tooling is provided as a bazel run target from
[keith/buildifier-prebuilt](https://github.com/keith/buildifier-prebuilt).

This is used in a [`pre-commit`](https://pre-commit.com/) hook for those
having that installed. In turn this is used in a CI check. Relying on a
`pre-commit` action gives us easy checking that buildifying did not
change anything in the files and printing the diff, without having to
hand-roll the check ourselves.

This enforcement will make usage of gazelle easier, as gazelle itself
might reformat files, even outside of `go`. Having them properly
formatted will allow gazelle to leave them unchanged, without needing
to configure awkward exclude directives.
2024-04-24 15:49:48 +02:00

38 lines
974 B
Python

load("//misc/bazel:pkg_runfiles.bzl", "pkg_runfiles")
load("//swift:rules.bzl", "swift_cc_binary")
swift_cc_binary(
name = "extractor.real",
srcs = glob([
"*.h",
"*.cpp",
]),
linkopts = select({
"@platforms//os:macos": ["-headerpad_max_install_names"],
"//conditions:default": [],
}),
visibility = ["//swift:__pkg__"],
deps = [
"//swift/extractor/config",
"//swift/extractor/infra",
"//swift/extractor/invocation",
"//swift/extractor/remapping",
"//swift/extractor/translators",
"//swift/third_party/swift-llvm-support",
"@absl//absl/strings",
],
)
sh_binary(
name = "extractor",
srcs = ["extractor.sh"],
data = [":extractor.real"],
)
pkg_runfiles(
name = "pkg",
srcs = [":extractor"],
excludes = ["extractor.sh"], # script gets copied as "extractor", no need for the original .sh file
visibility = ["//swift:__pkg__"],
)