Rob Mohr | be98ead | 2019-11-14 07:16:40 -0800 | [diff] [blame] | 1 | # 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 Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 15 | load( |
| 16 | "@com_github_bazelbuild_buildtools//buildifier:def.bzl", |
| 17 | "buildifier", |
| 18 | "buildifier_test", |
| 19 | ) |
| 20 | |
Rob Mohr | e8fbe6a | 2019-11-15 11:51:28 -0800 | [diff] [blame] | 21 | licenses(["notice"]) # Apache License 2.0 |
Nathaniel Brough | a1113be | 2021-03-07 09:05:41 +0800 | [diff] [blame] | 22 | |
| 23 | exports_files( |
| 24 | ["tsconfig.json"], |
| 25 | visibility = ["//:__subpackages__"], |
| 26 | ) |
| 27 | |
| 28 | # Fix all Bazel relevant files. |
| 29 | buildifier( |
| 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. |
| 44 | buildifier_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 | ) |