diff --git a/.bazelrc b/.bazelrc index 96b4eca24..6aa7a768c 100644 --- a/.bazelrc +++ b/.bazelrc @@ -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 diff --git a/.bazelversion b/.bazelversion index b26a34e47..ae9a76b92 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.2.1 +8.0.0 diff --git a/MODULE.bazel b/MODULE.bazel index d3afd78ff..3dcfc5ba9 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -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( @@ -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") diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel index ffd0fb0cd..303e91fcb 100644 --- a/tools/BUILD.bazel +++ b/tools/BUILD.bazel @@ -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. +)