blob: 9b29fbf6666f3e3b17ca8ae02390433dc1f2ddfa [file] [edit]
# Copyright 2024 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
module(
name = "pigweed",
version = "0.0.1",
bazel_compatibility = [">=8.0.0"],
)
bazel_dep(name = "aspect_bazel_lib", version = "2.22.5")
bazel_dep(name = "aspect_rules_js", version = "2.1.3")
bazel_dep(name = "bazel_skylib", version = "1.8.2")
bazel_dep(name = "boringssl", version = "0.20241024.0")
# TODO: https://github.com/google/emboss/issues/164 - Wire up the emboss repo to
# LINT.IfChange(emboss)
bazel_dep(name = "emboss", version = "2025.1003.000719", repo_name = "com_google_emboss")
# LINT.ThenChange(/pw_package/py/pw_package/packages/emboss.py:emboss)
bazel_dep(name = "freertos", version = "10.5.1.bcr.4")
bazel_dep(name = "fuzztest", version = "20250805.0")
bazel_dep(name = "gazelle", version = "0.48.0", repo_name = "bazel_gazelle")
# When this version is bumped, remove the patch referenced below if included
bazel_dep(name = "googletest", version = "1.17.0.bcr.2", repo_name = "com_google_googletest")
bazel_dep(name = "grpc-java", version = "1.69.0")
bazel_dep(name = "nanopb", version = "0.4.9.1.bcr.3")
bazel_dep(name = "mbedtls", version = "3.6.5")
bazel_dep(name = "pico-sdk", version = "2.2.2-develop.bcr.20260420-79b38e95")
bazel_dep(name = "picotool", version = "2.2.1-develop.bcr.20260407-d1a8d35")
bazel_dep(name = "platforms", version = "1.0.0")
# LINT.IfChange(protobuf)
bazel_dep(name = "protobuf", version = "33.4", repo_name = "com_google_protobuf")
# LINT.ThenChange(pw_env_setup/py/pw_env_setup/cipd_setup/pigweed.json,pw_env_setup/py/pw_env_setup/virtualenv_setup/constraint.list:protobuf)
bazel_dep(name = "re2", version = "2025-11-05.bcr.1")
bazel_dep(name = "rules_android", version = "0.7.2")
bazel_dep(name = "rules_cc", version = "0.2.17")
bazel_dep(name = "rules_fuzzing", version = "0.6.0")
bazel_dep(name = "rules_go", version = "0.60.0", repo_name = "io_bazel_rules_go")
bazel_dep(name = "rules_java", version = "9.3.0")
bazel_dep(name = "rules_jni", version = "0.11.1")
bazel_dep(name = "rules_jvm_external", version = "6.9")
bazel_dep(name = "rules_libusb", version = "0.1.0-rc2.bcr.1")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_nodejs", version = "6.7.4")
bazel_dep(name = "rules_platform", version = "0.1.0")
bazel_dep(name = "rules_probe_rs", version = "0.0.6")
bazel_dep(name = "rules_python", version = "1.8.5")
bazel_dep(name = "rules_rust", version = "0.70.0")
bazel_dep(name = "rules_rust_prost", version = "0.68.1")
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "rules_doxygen", version = "2.4.2", dev_dependency = True)
bazel_dep(name = "rules_mypy", version = "0.41.0", dev_dependency = True)
# Bazel 9 compatibility
# =====================
# These bazel_deps are here only to force a minimum version of certain packages
# so that downstream projects that use Bazel 9 can use Pigweed without having
# similar overrides. If Pigweed does them, then everyone benefits.
# Require rules_foreign_cc to be at least 0.13.0, to resolve a `rule() got
# unexpected keyword argument 'incompatible_use_toolchain_transition'` error.
# rules_foreign_cc@0.13.0 removes that keyword argument.
bazel_dep(name = "rules_foreign_cc", version = "0.13.0")
# Require aspect_rules_esbuild to be at least 0.25.1, to resolve a `rule() got
# unexpected keyword argument 'incompatible_use_toolchain_transition'` error.
# aspect_rules_esbuild@0.25.1 removes that keyword argument.
bazel_dep(name = "aspect_rules_esbuild", version = "0.25.1")
# Repository overrides
# ====================
single_version_override(
module_name = "rules_rust",
patch_strip = 1,
patches = [
# Adds more thumbv6m, thumbv8m, and thumbv8m triples
# TODO: https://pwbug.dev/392707726 - Upstream below patch
"//pw_rust/bazel_patches:0003-Add-thumbv6m-and-more-thumbv7m-and-thumbv8m-triples.patch",
],
)
single_version_override(
module_name = "googletest",
patch_strip = 1,
patches = [
# This patches googletest to remove the Fuchsia syslog dependency (which is unused and deprecated)
"//pw_build/bazel_patches:0001-Remove-unused-syslog-dependency-for-Fuchsia.patch",
],
)
# Transitive deps not in BCR
# ==========================
http_archive = use_repo_rule(
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive",
)
# TODO(b/370523804): Remove this once the following issues are addressed in a
# released version of rules_fuzzing
# https://github.com/bazel-contrib/rules_fuzzing/issues/257
non_module_dependencies = use_extension("@rules_fuzzing//fuzzing/private:extensions.bzl", "non_module_dependencies")
use_repo(
non_module_dependencies,
"rules_fuzzing_oss_fuzz",
)
git_repository = use_repo_rule(
"@bazel_tools//tools/build_defs/repo:git.bzl",
"git_repository",
)
git_repository(
name = "bazel_clang_tidy",
commit = "db677011c7363509a288a9fb3bf0a50830bbf791",
remote = "https://github.com/erenon/bazel_clang_tidy.git",
)
git_repository(
name = "pigweed_doxylink",
build_file = "//third_party/doxylink:doxylink.BUILD.bazel",
commit = "e3303148c641e3a192026090fd7f445c433f08fc",
remote = "https://pigweed.googlesource.com/third_party/github/sphinx-contrib/doxylink",
)
# Configure libusb
# ================
#
# The rules_libusb lets you configure which actual libusb version to use.
libusb = use_extension("@rules_libusb//:extensions.bzl", "libusb")
libusb.source_release(min_version = "1.0.27")
use_repo(libusb, "libusb")
xcode_sdk_repository = use_repo_rule("//pw_toolchain:xcode.bzl", "xcode_sdk_repository")
xcode_sdk_repository(
name = "macos_sysroot",
build_file = "//pw_toolchain/host_clang:macos_sysroot.BUILD",
)
cipd_ext = use_extension("//pw_env_setup/bazel/cipd:defs.bzl", "cipd")
use_repo(cipd_ext, "cipd_client")
pw_cxx_toolchain = use_extension("//pw_toolchain/cc:pw_cxx_toolchain.bzl", "pw_cxx_toolchain")
# Fetch llvm toolchain.
LLVM_VERSION = "git_revision:a3f244e2d5550e110daee562b88bee247b75d66c"
pw_cxx_toolchain.llvm(cipd_tag = LLVM_VERSION)
pw_cxx_toolchain.arm_gcc(cipd_tag = "version:2@12.2.MPACBTI-Rel1.1")
pw_cxx_toolchain.zephyr_gcc(cipd_tag = "version:3@1.0.0")
pw_cxx_toolchain.zephyr_llvm(cipd_tag = "version:3@1.0.0")
use_repo(pw_cxx_toolchain, "gcc_arm_none_eabi_toolchain", "llvm_toolchain", "zephyr_llvm_toolchain", "zephyr_toolchain")
# Fetch linux sysroot for host builds.
cipd_ext.require(
name = "pigweed.linux_sysroot",
build_file = "//pw_toolchain/host_clang:linux_sysroot.BUILD",
packages = {
"fuchsia/third_party/sysroot/bionic": "git_revision:702eb9654703a7cec1cadf93a7e3aa269d053943",
},
)
use_repo(cipd_ext, linux_sysroot = "pigweed.linux_sysroot")
register_toolchains(
"//pw_toolchain:cc_toolchain_cortex-m0",
"//pw_toolchain:cc_toolchain_cortex-m0plus",
"//pw_toolchain:cc_toolchain_cortex-m3",
"//pw_toolchain:cc_toolchain_cortex-m4",
"//pw_toolchain:cc_toolchain_cortex-m33",
"//pw_toolchain/host_clang:host_cc_toolchain_linux",
"//pw_toolchain/host_clang:host_cc_toolchain_macos",
"//pw_toolchain/riscv_clang:riscv_clang_cc_toolchain_rv32imc",
"//pw_toolchain/riscv_clang:riscv_clang_cc_toolchain_rv32imac",
dev_dependency = True,
)
register_toolchains(
"//pw_toolchain/fuchsia:all",
dev_dependency = True,
)
# Configure cc_compatibility_proxy
cc_compatibility_proxy = use_extension("@rules_cc//cc:extensions.bzl", "compatibility_proxy")
use_repo(cc_compatibility_proxy, "cc_compatibility_proxy")
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
# Inhibit rules_rust from registering any default toolchains.
rust.toolchain(versions = [])
# Rust toolchains
pw_rust = use_extension("//pw_toolchain/rust:extensions.bzl", "pw_rust")
RUST_VERSION = "git_revisions:d32e620a107b5b3dccd9ddb53fa124956a92b589,a3f244e2d5550e110daee562b88bee247b75d66c"
# TODO(b/488384121): Setup a roller
# ROLL: Warning: this variable is automatically updated.
# ROLL: Last updated 2026-05-23.
# ROLL: By https://cr-buildbucket.appspot.com/build/8680980756675934369.
RUST_ANALYZER_VERSION = "git_revision:4a32bbe46e23913ff5850d79b264913154a883e9"
pw_rust.toolchain(
cipd_tag = RUST_VERSION,
rust_analyzer_cipd_tag = RUST_ANALYZER_VERSION,
)
use_repo(pw_rust, "pw_rust_toolchains")
register_toolchains(
"@pw_rust_toolchains//:all",
dev_dependency = True,
)
crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate")
crate.from_cargo(
name = "crates_no_std",
cargo_lockfile = "//third_party/crates_io/crates_no_std:Cargo.lock",
manifests = ["//third_party/crates_io/crates_no_std:Cargo.toml"],
# crate_universe's defaults do not include some embedded triples so the
# triples are listed explicitly.
supported_platform_triples = [
# Host platforms
"aarch64-unknown-linux-gnu",
"x86_64-unknown-linux-gnu",
"aarch64-apple-darwin",
"x86_64-apple-darwin",
# Target platforms
"thumbv6m-none-eabi",
"thumbv7m-none-eabi",
"thumbv8m.main-none-eabihf",
"aarch64-unknown-none",
"riscv32imc-unknown-none-elf",
"riscv32imac-unknown-none-elf",
],
)
use_repo(crate, "crates_no_std")
crate.from_cargo(
name = "crates_std",
cargo_lockfile = "//third_party/crates_io/crates_std:Cargo.lock",
manifests = ["//third_party/crates_io/crates_std:Cargo.toml"],
supported_platform_triples = [
# Host platforms
"aarch64-unknown-linux-gnu",
"x86_64-unknown-linux-gnu",
"aarch64-apple-darwin",
"x86_64-apple-darwin",
],
)
use_repo(crate, "crates_std")
crate.annotation(
crate = "protoc-gen-prost",
gen_binaries = ["protoc-gen-prost"],
repositories = ["crates_std"],
)
pw_rust_crates = use_extension("@pigweed//pw_build:pw_rust_crates_extension.bzl", "pw_rust_crates_extension")
use_repo(pw_rust_crates, "rust_crates")
# Get probe-rs
# ============
probe_rs = use_extension("@rules_probe_rs//probe_rs:extensions.bzl", "probe_rs")
probe_rs.tools(
name = "probe_rs",
version = "0.27.0",
)
use_repo(probe_rs, "probe_rs")
# Configure Python toolchains and pip dependencies.
# =================================================
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
# Allows building as root in a docker container. Required by oss-fuzz.
ignore_root_user_error = True,
is_default = True,
python_version = "3.12",
)
use_repo(python, "pythons_hub")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.default(
# This special "none_any_mcu" pip platform allows rules_python to find PIP
# packages when the target platform is an MCU. However the MCU is not
# actually expected to run any Python code.
#
# We must associate this platform with requirements files. We do so with
# the pip configurations below, using upstream_requirements_linux_lock.txt.
# The
#
# Behind the scenes rules_python is creating Bazel alias rules that
# map each Python package to a repo using a select expression that uses
# the targets (filtered to those that match the "target_platform" setting).
#
# The default for those select expressions is a special internal
# "_no_matching_repository" match that generates an error. This is meant
# to catch the pip repo not having a build for a given host target, but
# isn't great for an MCU target that will never have a match.
#
# The only way to stop Bazel from triggering the error otherwise requires
# ensuring no rules build anything that require the deps, using perhaps
# a "target_compatible_with = incompatible_with_mcu()" attribute, but that
# requires rules that support that attribute. With rules_python 1.8.3, its
# own "py_console_script_binary" does not, which is why workaround is being
# used.
# A valid arch_name is required, but the value does not matter since this
# configuration is for any target with @platforms//os:none
arch_name = "aarch32",
config_settings = [
"@platforms//os:none",
],
os_name = "none",
platform = "none_any_mcu",
)
pip.parse(
envsubst = ["PIGWEED_PIP_INDEX_URL"],
experimental_index_url = "${PIGWEED_PIP_INDEX_URL:-https://pypi.org/simple}",
hub_name = "pigweed_python_packages",
python_version = "3.10",
requirements_by_platform = {
# All supported target_platforms, including none_any_mcu must have an
# associated requirements file.
"//pw_env_setup/py:pw_env_setup/virtualenv_setup/upstream_requirements_darwin_lock.txt": "osx_aarch64",
"//pw_env_setup/py:pw_env_setup/virtualenv_setup/upstream_requirements_linux_lock.txt": "linux_x86_64,linux_aarch64,none_any_mcu",
"//pw_env_setup/py:pw_env_setup/virtualenv_setup/upstream_requirements_windows_lock.txt": "windows_x86_64,windows_aarch64",
},
target_platforms = [
"{os}_{arch}",
"none_any_mcu",
],
)
pip.parse(
envsubst = ["PIGWEED_PIP_INDEX_URL"],
experimental_index_url = "${PIGWEED_PIP_INDEX_URL:-https://pypi.org/simple}",
hub_name = "pigweed_python_packages",
python_version = "3.11",
requirements_by_platform = {
# All supported target_platforms, including none_any_mcu must have an
# associated requirements file.
"//pw_env_setup/py:pw_env_setup/virtualenv_setup/upstream_requirements_darwin_lock.txt": "osx_aarch64",
"//pw_env_setup/py:pw_env_setup/virtualenv_setup/upstream_requirements_linux_lock.txt": "linux_x86_64,linux_aarch64,none_any_mcu",
"//pw_env_setup/py:pw_env_setup/virtualenv_setup/upstream_requirements_windows_lock.txt": "windows_x86_64,windows_aarch64",
},
target_platforms = [
"{os}_{arch}",
"none_any_mcu",
],
)
pip.parse(
envsubst = ["PIGWEED_PIP_INDEX_URL"],
experimental_index_url = "${PIGWEED_PIP_INDEX_URL:-https://pypi.org/simple}",
hub_name = "pigweed_python_packages",
python_version = "3.12",
requirements_by_platform = {
# All supported target_platforms, including none_any_mcu must have an
# associated requirements file.
"//pw_env_setup/py:pw_env_setup/virtualenv_setup/upstream_requirements_darwin_lock.txt": "osx_aarch64",
"//pw_env_setup/py:pw_env_setup/virtualenv_setup/upstream_requirements_linux_lock.txt": "linux_x86_64,linux_aarch64,none_any_mcu",
"//pw_env_setup/py:pw_env_setup/virtualenv_setup/upstream_requirements_windows_lock.txt": "windows_x86_64,windows_aarch64",
},
target_platforms = [
"{os}_{arch}",
"none_any_mcu",
],
)
use_repo(pip, "pigweed_python_packages")
types = use_extension("@rules_mypy//mypy:types.bzl", "types", dev_dependency = True)
types.requirements(
name = "pip_types",
pip_requirements = "@pigweed_python_packages//:requirements.bzl",
# TODO: b/248344378 - Technically we should use separate per-OS requirements
# here. Support for this is added to rules_mypy in
# https://github.com/theoremlp/rules_mypy/pull/110. In practice I don't
# believe any of our -types repository dependencies are OS-specific at this
# time.
requirements_txt = "//pw_env_setup/py:pw_env_setup/virtualenv_setup/upstream_requirements_linux_lock.txt",
)
use_repo(types, "pip_types")
# TODO: b/354241571 - The next two lines are only required because the Fuchsia
# SDK doesn't correctly restrict the target platform compatibility of all its
# targets. We should remove them once the bug is fixed.
register_toolchains("@pythons_hub//:all")
register_toolchains("@rules_python//python/runtime_env_toolchains:all")
# Configure Go dependencies
# =========================
go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(go_deps, "org_golang_google_grpc", "org_golang_google_grpc_examples", "org_golang_google_protobuf")
go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.24.12")
# Configure Java dependencies
# ===========================
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
name = "pigweed_maven_deps",
artifacts = [
"com.google.auto.value:auto-value-annotations:1.8.2",
"com.google.auto.value:auto-value:1.8.2",
"com.google.code.findbugs:jsr305:3.0.2",
"com.google.flogger:flogger-system-backend:0.7.1",
"com.google.flogger:flogger:0.7.1",
"com.google.guava:failureaccess:1.0.2",
"com.google.guava:guava:31.0.1-jre",
"com.google.truth:truth:1.1.3",
"org.mockito:mockito-core:4.1.0",
],
repositories = [
"https://maven.google.com/",
"https://jcenter.bintray.com/",
"https://repo1.maven.org/maven2",
],
)
use_repo(maven, "pigweed_maven_deps")
# QEMU prebuilts
# ==============
cipd_ext.require(
name = "pigweed.qemu",
build_file = "//third_party/qemu:qemu.BUILD",
packages = {
"fuchsia/third_party/qemu/${platform}": "git_revision:1da8f3a3c53b604edfe0d55e475102640490549e",
},
)
use_repo(cipd_ext, qemu = "pigweed.qemu")
# Vendored libraries
# ==================
# TODO: https://pwbug.dev/378531541 - These are one-off external libraries that
# are NOT in the BCR that downstream users may need to override/unify to their
# expected version.
# TODO: https://github.com/bazelbuild/bazel/issues/23077 - Make these
# bazel_deps dev_dependencies once archive_override has a build_file argument.
http_archive(
name = "stm32f4xx_hal_driver",
build_file = "//third_party/stm32cube:stm32_hal_driver.BUILD.bazel",
sha256 = "d0427a3830f0c23dd4810952321b8209be7b3c50897d1fc2d79587435cc3a379",
strip_prefix = "stm32f4xx-hal-driver-1.8.0",
urls = ["https://github.com/STMicroelectronics/stm32f4xx-hal-driver/archive/refs/tags/v1.8.0.tar.gz"],
)
http_archive(
name = "cmsis_device_f4",
build_file = "//third_party/stm32cube:cmsis_device.BUILD.bazel",
sha256 = "1d9612ecaaab8708c88be2c9573927f2e5e9a911aa2c1427182b545ed5ed0fd6",
strip_prefix = "cmsis-device-f4-2.6.8",
urls = ["https://github.com/STMicroelectronics/cmsis-device-f4/archive/refs/tags/v2.6.8.tar.gz"],
)
http_archive(
name = "cmsis_core",
build_file = "//third_party/stm32cube:cmsis_core.BUILD.bazel",
sha256 = "32f226c31d7d1ff4a504404400603e047b99f405cd0c9a8f417f1f250251b829",
strip_prefix = "cmsis-core-5.4.0_cm4",
urls = ["https://github.com/STMicroelectronics/cmsis-core/archive/refs/tags/v5.4.0_cm4.tar.gz"],
)
git_repository(
name = "mcuxpresso",
commit = "0cc0caa0c44fc9ceae1ad4c0a9e3b79e8b38d751",
# temporary point to antmicro github fork until SDK generated files
# will be pushed to: https://pigweed.googlesource.com/pigweed/mcuxpresso-sdk
remote = "https://github.com/antmicro/mcuxpresso-sdk.git",
)
git_repository(
name = "smartfusion_mss",
build_file = "//third_party/smartfusion_mss:smartfusion_mss.BUILD.bazel",
commit = "052a2ed78fa2c7a1a7cdac5e4a988b03269d2b42",
remote = "https://github.com/seank/smartfusion_mss",
)
# Other Pigweed-specific dependencies
# ===================================
cipd_ext.require(
name = "pigweed.bloaty",
packages = {
"fuchsia/third_party/bloaty/${os=linux,mac}-amd64": "git_revision:c057ba4f43db0506d4ba8c096925b054b02a8bd3",
},
)
use_repo(cipd_ext, bloaty = "pigweed.bloaty")
cipd_ext.require(
name = "pigweed.buildifier",
packages = {
"infra/3pp/tools/buildifier/${platform}": "version:3@v8.2.1",
},
)
use_repo(cipd_ext, buildifier = "pigweed.buildifier")
# GN is only used to format GN build files.
cipd_ext.require(
name = "pigweed.gn",
packages = {
"gn/gn/${platform}": "git_revision:97b68a0bb62b7528bc3491c7949d6804223c2b82",
},
)
use_repo(cipd_ext, gn = "pigweed.gn")
# This is only used to get access to gofmt for code formatting.
cipd_ext.require(
name = "pigweed.go",
packages = {
"infra/3pp/tools/go/${platform}": "version:3@1.24.12",
},
)
use_repo(cipd_ext, go = "pigweed.go")
# Set up legacy pw_transfer test binaries.
# Required by: pigweed.
# Used in modules: //pw_transfer.
cipd_ext.require(
name = "pigweed.pw_transfer_test_binaries",
# Only ever needed if you run the pw_transfer unit tests.
dev_dependency = True,
packages = {
"pigweed/pw_transfer_test_binaries/${os=linux}-${arch=amd64}": "version:pw_transfer_test_binaries_528098d588f307881af83f769207b8e6e1b57520-linux-amd64-cipd.cipd",
},
)
use_repo(cipd_ext, pw_transfer_test_binaries = "pigweed.pw_transfer_test_binaries")
workspace_and_buildfile = use_repo_rule("//pw_build/bazel_internal:workspace_and_buildfile.bzl", "workspace_and_buildfile")
workspace_and_buildfile(
name = "pw_build_external_runfile_resource",
build_file = "//pw_build:test_data/external_py_runfiles.BUILD",
dev_dependency = True,
)
local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository")
local_repository(
name = "pw_cc_compile_commands_test_external",
dev_dependency = True,
path = "pw_ide/bazel/compile_commands/test/external_repo",
)
local_repository(
name = "pw_bazel_test_external",
dev_dependency = True,
path = "pw_bazel/test/external_repo",
)
# Doxygen setup
# =============
# Get executables.
cipd_ext.require(
name = "pigweed.doxygen_linux_amd64",
packages = {
"pigweed/third_party/doxygen/linux-amd64": "version:1.9.6-1",
},
)
use_repo(cipd_ext, doxygen_linux_amd64 = "pigweed.doxygen_linux_amd64")
cipd_ext.require(
name = "pigweed.doxygen_mac_amd64",
packages = {
"pigweed/third_party/doxygen/mac-amd64": "version:1.9.6-1",
},
)
use_repo(cipd_ext, doxygen_mac_amd64 = "pigweed.doxygen_mac_amd64")
cipd_ext.require(
name = "pigweed.doxygen_mac_arm64",
packages = {
"pigweed/third_party/doxygen/mac-arm64": "version:1.9.6",
},
)
use_repo(cipd_ext, doxygen_mac_arm64 = "pigweed.doxygen_mac_arm64")
cipd_ext.require(
name = "pigweed.doxygen_windows_amd64",
packages = {
"pigweed/third_party/doxygen/windows-amd64": "version:1.9.6-1",
},
)
use_repo(cipd_ext, doxygen_windows_amd64 = "pigweed.doxygen_windows_amd64")
# Configure rules_doxygen to use our executables.
doxygen_extension = use_extension("@rules_doxygen//:extensions.bzl", "doxygen_extension", dev_dependency = True)
doxygen_extension.configuration(
executable = "@doxygen_linux_amd64//:bin/doxygen",
platform = "linux",
)
doxygen_extension.configuration(
executable = "@doxygen_mac_amd64//:doxygen",
platform = "mac",
)
doxygen_extension.configuration(
executable = "@doxygen_mac_arm64//:doxygen",
platform = "mac-arm",
)
doxygen_extension.configuration(
executable = "@doxygen_windows_amd64//:windows.exe",
platform = "windows",
)
use_repo(doxygen_extension, "doxygen")
# Configure Node.js dependencies
# ==============================
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node", dev_dependency = True)
node.toolchain(node_version = "20.12.1")
npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)
npm.npm_translate_lock(
name = "npm",
data = [
"//:package.json",
"//pw_async2/codelab/webui:package.json",
"//pw_web:package.json",
"//pw_web:pnpm-workspace.yaml",
],
# Uncomment the following when pnpm lock file needs to be updated.
# update_pnpm_lock = True,
pnpm_lock = "//pw_web:pnpm-lock.yaml",
)
use_repo(npm, "npm")
pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
use_repo(pnpm, "pnpm")
# Setup Fuchsia SDK.
# ==================
# Since `@fuchsia_infra` isn't a real BCR module and relies on `git_override` to bring in its
# transitive dependencies, mark it as a `dev_dependency` for now.
bazel_dep(name = "fuchsia_infra", dev_dependency = True)
git_override(
module_name = "fuchsia_infra",
# ROLL: Warning: this entry is automatically updated by
# ROLL: https://cr-buildbucket.appspot.com/builder/pigweed/tools.roll/fuchsia-infra-bazel-rules-roller
commit = "84960e16b49220678f22d48282d84be8aeab4d31",
remote = "https://fuchsia.googlesource.com/fuchsia-infra-bazel-rules",
)
FUCHSIA_SDK_VERSION = "version:32.20260525.7.1"
# Use `cipd_ext` and `fuchsia_clang_ext` from `@fuchsia_infra` to override `@fuchsia_infra`'s
# instantiations of `@rules_fuchsia`, `@fuchsia_sdk` and `@fuchsia_clang`.
#
# This simultaneously allows:
# - `@rules_fuchsia`/`@fuchsia_sdk` builddefs to have providers compatible with
# `@fuchsia_infra` builddefs,
# - the version of `@fuchsia_products` to be aligned with `@rules_fuchsia` and `@fuchsia_sdk`,
# - not double-fetching large dependencies like `@fuchsia_sdk` and `@fuchsia_clang`, and
# - decoupling `@fuchsia_infra` vs `@rules_fuchsia`/`@fuchsia_sdk` vs `@fuchsia_clang` versions.
fuchsia_cipd_ext = use_extension("@fuchsia_infra//cipd:defs.bzl", "cipd_ext", dev_dependency = True)
fuchsia_clang_ext = use_extension("@fuchsia_infra//:extensions.bzl", "fuchsia_clang_ext", dev_dependency = True)
fuchsia_cipd_ext.repository(
name = "rules_fuchsia",
cipd_bin = "@cipd_client//:cipd",
package = "fuchsia/development/rules_fuchsia",
tag = FUCHSIA_SDK_VERSION,
)
use_repo(fuchsia_cipd_ext, "rules_fuchsia")
fuchsia_cipd_ext.repository(
name = "fuchsia_sdk",
cipd_bin = "@cipd_client//:cipd",
package = "fuchsia/sdk/core/fuchsia-bazel-rules/linux-amd64",
tag = FUCHSIA_SDK_VERSION,
)
use_repo(fuchsia_cipd_ext, "fuchsia_sdk")
cipd_ext.require(
name = "fuchsia_products_metadata",
dev_dependency = True,
packages = {
"fuchsia/development/product_bundles/v2": FUCHSIA_SDK_VERSION,
},
)
use_repo(cipd_ext, "fuchsia_products_metadata")
fuchsia_products_repository = use_repo_rule("@rules_fuchsia//fuchsia:products.bzl", "fuchsia_products_repository")
fuchsia_products_repository(
name = "fuchsia_products",
dev_dependency = True,
metadata_file = "@fuchsia_products_metadata//:product_bundles.json",
)
fuchsia_clang_ext.cipd_tag(
cipd_tag = LLVM_VERSION,
)
use_repo(fuchsia_clang_ext, "fuchsia_clang")
register_toolchains(
"//pw_toolchain/fuchsia:fuchsia_sdk_toolchain",
dev_dependency = True,
)
fake_fuchsia_sdk_extension = use_extension("@com_google_googletest//:fake_fuchsia_sdk.bzl", "fuchsia_sdk", dev_dependency = True)
override_repo(fake_fuchsia_sdk_extension, "fuchsia_sdk")
# Set up Zephyr RTOS support, by default to a stub.
pw_zephyr_config = use_extension("@pigweed//zephyr/config:pw_zephyr_config.bzl", "pw_zephyr_config")
use_repo(pw_zephyr_config, "kconfig", "zephyr", "zephyr_version")