Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shortcuts to Pigweed formatters #2351

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ common --host_per_file_copt=external/.*@-w

# Produce useful output when the build fails.
common --verbose_failures

# Don't automatically create __init__.py files.
#
# This prevents spurious package name collisions at import time, and should be
# the default (https://github.com/bazelbuild/bazel/issues/7386).
common --incompatible_default_to_explicit_init_py
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.2.1
8.0.0
13 changes: 12 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ bazel_dep(name = "rules_python", version = "0.36.0")
bazel_dep(name = "picotool", version = "2.1.1")
bazel_dep(name = "rules_cc", version = "0.0.10")

# Only use Pigweed for develop flows (code formatting, on-device testing, etc.).
# Since Pigweed isn't in the BCR, any references to Pigweed will force
# downstream projects to add an override. Don't `load()` from @pigweed in
# any directories other than //test/*.
bazel_dep(name = "pigweed", version = "0.0.1", dev_dependency = True)
git_override(
module_name = "pigweed",
commit = "f9979ae9110b650072b463392c72ae536763718b",
remote = "https://pigweed.googlesource.com/pigweed/pigweed",
)

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
Expand Down Expand Up @@ -136,7 +147,7 @@ register_toolchains(
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
configure_coverage_tool = True,
python_version = "3.9",
python_version = "3.11",
)

use_repo(python, "pythons_hub")
Expand Down
15 changes: 15 additions & 0 deletions tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
package(default_visibility = ["//visibility:public"])

# `bazelisk run //tools:format_code` to fix code formatting.
alias(
name = "format_code",
actual = "@pigweed//pw_presubmit/py:format",
tags = ["manual"], # Don't let wildcards touch this.
)

# `bazelisk run //tools:check_code_formatting` to check for formatting
# findings without fixing them in-place.
alias(
name = "check_code_formatting",
actual = "@pigweed//pw_presubmit/py:check_formatting",
tags = ["manual"], # Don't let wildcards touch this.
)