blob: 03644f6a07f6eaf9882966d12a5b25e49720f9b9 [file] [log] [blame]
# 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.
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Load Pigweed's own dependencies that we'll need.
#
# TODO: b/274148833 - Don't require users to spell these out.
http_archive(
name = "platforms",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz",
],
sha256 = "218efe8ee736d26a3572663b374a253c012b716d8af0c07e842e82f238a0a7ee",
)
http_archive(
name = "bazel_skylib",
sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz",
],
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
http_archive(
name = "rules_cc",
sha256 = "d75a040c32954da0d308d3f2ea2ba735490f49b3a7aa3e4b40259ca4b814f825",
# strip_prefix = "rules_cc-0.0.10-rc1",
urls = [
"https://github.com/bazelbuild/rules_cc/releases/download/0.0.10-rc1/rules_cc-0.0.10-rc1.tar.gz",
],
)
load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains")
rules_cc_dependencies()
rules_cc_toolchains()
http_archive(
name = "rules_proto",
sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd",
strip_prefix = "rules_proto-5.3.0-21.7",
urls = [
"https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz",
],
)
http_archive(
name = "rules_python",
sha256 = "0a8003b044294d7840ac7d9d73eef05d6ceb682d7516781a4ec62eeb34702578",
strip_prefix = "rules_python-0.24.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.24.0/rules_python-0.24.0.tar.gz",
)
load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()
http_archive(
name = "com_google_protobuf",
sha256 = "c6003e1d2e7fefa78a3039f19f383b4f3a61e81be8c19356f85b6461998ad3db",
strip_prefix = "protobuf-3.17.3",
url = "https://github.com/protocolbuffers/protobuf/archive/v3.17.3.tar.gz",
)
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()
git_repository(
name = "pigweed",
remote = "https://github.com/google/pigweed",
branch = "main",
)
git_repository(
name = "pw_toolchain",
remote = "https://github.com/google/pigweed",
branch = "main",
strip_prefix = "pw_toolchain_bazel",
)
local_repository(
name = "zephyr-bazel",
path = "../..",
)
load("@zephyr-bazel//:setup.bzl", "create_zephyr_patch_file")
create_zephyr_patch_file(
name = "zephyr-patch",
filename = "patch.diff",
debug = True,
)
git_repository(
name = "zephyr",
remote = "https://github.com/zephyrproject-rtos/zephyr.git",
branch = "main",
patches = [
"@zephyr-patch//:patch.diff",
],
)
# Get ready to grab CIPD dependencies. For this minimal example, the only
# dependencies will be the toolchains and OpenOCD (used for flashing).
load(
"@pigweed//pw_env_setup/bazel/cipd_setup:cipd_rules.bzl",
"cipd_client_repository",
"cipd_repository",
)
cipd_client_repository()
load("@pigweed//pw_toolchain:register_toolchains.bzl", "register_pigweed_cxx_toolchains")
register_pigweed_cxx_toolchains()
# Get the OpenOCD binary (we'll use it for flashing).
cipd_repository(
name = "openocd",
path = "infra/3pp/tools/openocd/${os}-${arch}",
tag = "version:2@0.11.0-3",
)
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
# Set up the Python interpreter and PyPI dependencies we'll need.
python_register_toolchains(
name = "python3",
python_version = "3.11",
)
load("@python3//:defs.bzl", "interpreter")
load("@rules_python//python:pip.bzl", "pip_parse")
pip_parse(
name = "pypi",
python_interpreter_target = interpreter,
requirements_lock = "//:requirements_lock.txt",
)
load("@pypi//:requirements.bzl", "install_deps")
install_deps()
# Load the Zephyr pip requirements
pip_parse(
name = "py_deps",
python_interpreter_target = interpreter,
requirements_lock = "@@zephyr//:scripts/requirements-base.txt",
)
load("@py_deps//:requirements.bzl", zephyr_install_deps = "install_deps")
zephyr_install_deps()