Files
carbon-lang/scripts/BUILD
T
Jon Meow 6fe8411122 Refactor common script functionality and reimplement the buildifier pre-commit (#1080)
Moves common script logic into utils.py (not a great name, but couldn't come up with better). This is in particular to make the buildifier.py script really trivial, allowing that pre-commit to be easily added. However, scripts have also been diverging on how we find bazel, so I'm trying to unify that.

The advantage of reimplementing buildifier's pre-commit is that (a) we can now run buildifier server-side, and (b) we can stop advising installing it manually. Then the only Linux-specific package manager is Cargo, which is only used for watchman, which is optional -- so stop highlighting Linux-specific package managers in the tool instructions.
2022-02-22 10:10:41 -08:00

71 lines
1.8 KiB
Python

# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
# Exceptions. See /LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
load("@mypy_integration//:mypy.bzl", "mypy_test")
py_library(
name = "scripts_utils",
srcs = ["scripts_utils.py"],
)
# Note that this Python script is intended to be run directly, and not through
# Bazel. We have a rule for it so we can type check it.
py_binary(
name = "create_compdb",
testonly = 1,
srcs = ["create_compdb.py"],
deps = [":scripts_utils"],
)
mypy_test(
name = "create_compdb_mypy_test",
include_imports = True,
deps = [":create_compdb"],
)
# Note that this Python script is intended to be run directly, and not through
# Bazel. We have a rule for it so we can type check it.
py_binary(
name = "fix_cc_deps",
testonly = 1,
srcs = ["fix_cc_deps.py"],
deps = [":scripts_utils"],
)
mypy_test(
name = "fix_cc_deps_mypy_test",
include_imports = True,
deps = [":fix_cc_deps"],
)
# Note that this Python script is intended to be run directly, and not through
# Bazel. We have a rule for it so we can type check it.
py_binary(
name = "forbid_llvm_googletest",
testonly = 1,
srcs = ["forbid_llvm_googletest.py"],
deps = [":scripts_utils"],
)
mypy_test(
name = "forbid_llvm_googletest_mypy_test",
include_imports = True,
deps = [":forbid_llvm_googletest"],
)
# Note that this Python script is intended to be run directly, and not through
# Bazel. We have a rule for it so we can type check it.
py_binary(
name = "run_buildifier",
testonly = 1,
srcs = ["run_buildifier.py"],
deps = [":scripts_utils"],
)
mypy_test(
name = "run_buildifier_mypy_test",
include_imports = True,
deps = [":run_buildifier"],
)