blob: 9d4cb4fcebd28730cc11741f0edf75634ea3b103 [file] [log] [blame]
Rob Mohrbe98ead2019-11-14 07:16:40 -08001# Copyright 2019 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7# https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
Nathaniel Brougha1113be2021-03-07 09:05:41 +080015load(
16 "@com_github_bazelbuild_buildtools//buildifier:def.bzl",
17 "buildifier",
18 "buildifier_test",
19)
20
Rob Mohr5fc25412021-06-23 09:35:23 -070021licenses(["notice"])
Nathaniel Brougha1113be2021-03-07 09:05:41 +080022
23exports_files(
24 ["tsconfig.json"],
Ted Pudlik64110f52022-01-14 21:09:44 +000025 visibility = [":__subpackages__"],
Nathaniel Brougha1113be2021-03-07 09:05:41 +080026)
27
28# Fix all Bazel relevant files.
29buildifier(
30 name = "buildifier",
31 # Ignore gn and CIPD outputs in formatting.
32 # NOTE: These globs are not Bazel native and are passed directly
33 # through to the buildifier binary.
34 # TODO: Remove these globs when
35 # https://github.com/bazelbuild/buildtools/issues/623 is addressed.
36 exclude_patterns = [
37 "./.environment/**/*",
38 "./.presubmit/**/*",
39 "./.out/**/*",
40 ],
41)
42
43# Test to ensure all Bazel build files are properly formatted.
44buildifier_test(
45 name = "buildifier_test",
46 srcs = glob(
47 [
48 "**/*.bazel",
49 "**/*.bzl",
50 "**/*.oss",
51 "**/*.sky",
52 "**/BUILD",
53 ],
54 # Node modules do not play nice with buildifier. Exclude these
55 # generated Bazel files from format testing.
56 exclude = ["**/node_modules/**/*"],
57 ) + ["WORKSPACE"],
58 diff_command = "diff -u",
59 mode = "diff",
60 verbose = True,
61)