blob: dbebe94cde1e6f288bd1700056d5f734a71085ae [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.
module(
name = "maize",
)
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_rust", version = "0.56.0")
bazel_dep(name = "pigweed")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_python", version = "0.40.0")
# Module overrides
# ================
git_override(
module_name = "pigweed",
commit = "5ba5ba26461593625aa59434f8bc129fdeb52692",
remote = "https://pigweed.googlesource.com/pigweed/pigweed",
patch_strip = 1,
patches = [
"//build/external/pigweed:0001-WIP-pw_toolchain-Support-building-Rust-libcore-from-.patch",
"//build/external/pigweed:0002-WIP-Specify-rustc_srcs_subdir-for-rust_analyzer_tool.patch",
],
)
single_version_override(
module_name = "rules_rust",
patch_strip = 1,
patches = [
"//build/external/rules_rust:0001-Add-thumbv6m-and-more-thumbv7m-and-thumbv8m-triples.patch",
"//build/external/rules_rust:0002-Add-rust_srcs_subdir-to-rust_analyzer_toolchain.patch",
],
)
# Toolchain registration
# ======================
# Register Pigweed's C++ toolchains.
register_toolchains(
"@pigweed//pw_toolchain:cc_toolchain_cortex-m0",
"@pigweed//pw_toolchain:cc_toolchain_cortex-m3",
"@pigweed//pw_toolchain:cc_toolchain_cortex-m33",
"@pigweed//pw_toolchain/host_clang:host_cc_toolchain_linux",
"@pigweed//pw_toolchain/host_clang:host_cc_toolchain_macos",
dev_dependency = True,
)
# Disable rules_rust toolchains
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(versions = [])
use_repo(rust, "rust_toolchains")
pw_rust = use_extension("@pigweed//pw_toolchain/rust:extensions.bzl", "pw_rust")
pw_rust.toolchain(cipd_tag = "rust_revision:85c39893a761fe4c050523278da4e7e45ab42b6e")
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 = "//build/crates_io/crates_no_std:Cargo.lock",
manifests = ["//build/crates_io/crates_no_std:Cargo.toml"],
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",
],
)
use_repo(crate, "crates_no_std")
crate.from_cargo(
name = "crates_std",
cargo_lockfile = "//build/crates_io/crates_std:Cargo.lock",
manifests = ["//build/crates_io/crates_std:Cargo.toml"],
)
use_repo(crate, "crates_std")
local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository")
local_repository(name = "rust_crates", path = "build/crates_io/rust_crates")
pw_rust_crates = use_extension("@pigweed//pw_build:pw_rust_crates_extension.bzl", "pw_rust_crates_extension")
override_repo(pw_rust_crates, rust_crates = "rust_crates")
cipd_client_repository = use_repo_rule("@pigweed//pw_env_setup/bazel/cipd_setup:cipd_rules.bzl", "_cipd_client_repository")
cipd_client_repository(name = "cipd_client")
cipd_repository = use_repo_rule("@pigweed//pw_env_setup/bazel/cipd_setup:cipd_rules.bzl", "cipd_repository")
cipd_repository(
name = "qemu",
build_file = "//build/external:qemu.BUILD",
path = "fuchsia/third_party/qemu/${os}-${arch}",
tag = "git_revision:1600b9f46b1bd08b00fe86c46ef6dbb48cbe10d6",
)