blob: 581c05acef0f03e2bbe1ed5e355a391335bd3a9d [file] [log] [blame]
# Copyright 2021 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.
workspace(
name = "pigweed",
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
load(
"//pw_env_setup/bazel/cipd_setup:cipd_rules.bzl",
"cipd_client_repository",
"cipd_repository",
"pigweed_deps",
)
# Set up Bazel platforms.
# Required by: pigweed.
# Used in modules: //pw_build, (Assorted modules via select statements).
http_archive(
name = "platforms",
sha256 = "5308fc1d8865406a49427ba24a9ab53087f17f5266a7aabbfc28823f3916e1ca",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz",
],
)
# Setup CIPD client and packages.
# Required by: pigweed.
# Used by modules: all.
pigweed_deps()
load("@cipd_deps//:cipd_init.bzl", "cipd_init")
cipd_init()
cipd_client_repository()
cipd_repository(
name = "pw_transfer_test_binaries",
path = "pigweed/pw_transfer_test_binaries/${os=linux}-${arch=amd64}",
tag = "version:pw_transfer_test_binaries_528098d588f307881af83f769207b8e6e1b57520-linux-amd64-cipd.cipd",
)
# Set up Python support.
# Required by: rules_fuzzing, com_github_nanopb_nanopb.
# Used in modules: None.
http_archive(
name = "rules_python",
sha256 = "a30abdfc7126d497a7698c29c46ea9901c6392d6ed315171a6df5ce433aa4502",
strip_prefix = "rules_python-0.6.0",
url = "https://github.com/bazelbuild/rules_python/archive/0.6.0.tar.gz",
)
# Set up Starlark library.
# Required by: io_bazel_rules_go, com_google_protobuf.
# Used in modules: None.
# This must be instantiated before com_google_protobuf as protobuf_deps() pulls
# in an older version of bazel_skylib. However io_bazel_rules_go requires a
# newer version.
http_archive(
name = "bazel_skylib", # 2022-09-01
sha256 = "4756ab3ec46d94d99e5ed685d2d24aece484015e45af303eb3a11cab3cdc2e71",
strip_prefix = "bazel-skylib-1.3.0",
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/refs/tags/1.3.0.zip"],
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
# Set up upstream googletest and googlemock.
# Required by: Pigweed.
# Used in modules: //pw_analog, //pw_i2c.
http_archive(
name = "com_google_googletest",
sha256 = "ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363",
strip_prefix = "googletest-1.13.0",
urls = [
"https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz",
],
)
# Set up host hermetic host toolchain.
# Required by: All cc targets.
# Used in modules: All cc targets.
git_repository(
name = "rules_cc_toolchain",
commit = "16554e29b63641ad0c6ce9caa12910548dfb6506",
remote = "https://github.com/bazelembedded/rules_cc_toolchain.git",
)
load("@rules_cc_toolchain//:rules_cc_toolchain_deps.bzl", "rules_cc_toolchain_deps")
rules_cc_toolchain_deps()
load("@rules_cc_toolchain//cc_toolchain:cc_toolchain.bzl", "register_cc_toolchains")
register_cc_toolchains()
# Sets up Bazels documentation generator.
# Required by: rules_cc_toolchain.
# Required by modules: All
git_repository(
name = "io_bazel_stardoc",
commit = "2b801dc9b93f73812948ee4e505805511b0f55dc",
remote = "https://github.com/bazelbuild/stardoc.git",
)
# Set up tools to build custom GRPC rules.
# Required by: pigweed.
# Used in modules: //pw_protobuf.
http_archive(
name = "rules_proto_grpc",
sha256 = "7954abbb6898830cd10ac9714fbcacf092299fda00ed2baf781172f545120419",
strip_prefix = "rules_proto_grpc-3.1.1",
urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/archive/3.1.1.tar.gz"],
)
load(
"@rules_proto_grpc//:repositories.bzl",
"rules_proto_grpc_repos",
"rules_proto_grpc_toolchains",
)
rules_proto_grpc_toolchains()
rules_proto_grpc_repos()
# Set up Protobuf rules.
# Required by: pigweed.
# Used in modules: //pw_protobuf.
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()
# Setup Nanopb protoc plugin.
# Required by: Pigweed.
# Used in modules: pw_protobuf.
git_repository(
name = "com_github_nanopb_nanopb",
commit = "e601fca6d9ed7fb5c09e2732452753b2989f128b",
remote = "https://github.com/nanopb/nanopb.git",
)
load("@com_github_nanopb_nanopb//:nanopb_deps.bzl", "nanopb_deps")
nanopb_deps()
load("@com_github_nanopb_nanopb//:python_deps.bzl", "nanopb_python_deps")
nanopb_python_deps()
load("@com_github_nanopb_nanopb//:nanopb_workspace.bzl", "nanopb_workspace")
nanopb_workspace()
# Set up NodeJs rules.
# Required by: pigweed.
# Used in modules: //pw_web.
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "b32a4713b45095e9e1921a7fcb1adf584bc05959f3336e7351bcf77f015a2d7c",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.1.0/rules_nodejs-4.1.0.tar.gz"],
)
# Get the latest LTS version of Node.
load(
"@build_bazel_rules_nodejs//:index.bzl",
"node_repositories",
"yarn_install",
)
node_repositories(package_json = ["//:package.json"])
yarn_install(
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
# Set up web-testing rules.
# Required by: pigweed.
# Used in modules: //pw_web.
http_archive(
name = "io_bazel_rules_webtesting",
sha256 = "9bb461d5ef08e850025480bab185fd269242d4e533bca75bfb748001ceb343c3",
urls = ["https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.3/rules_webtesting.tar.gz"],
)
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
web_test_repositories()
load(
"@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl",
"browser_repositories",
)
browser_repositories(
chromium = True,
firefox = True,
)
# Set up embedded C/C++ toolchains.
# Required by: pigweed.
# Used in modules: //pw_polyfill, //pw_build (all pw_cc* targets).
git_repository(
name = "bazel_embedded",
commit = "17c93d5fa52c4c78860b8bbd327325fba6c85555",
remote = "https://github.com/bazelembedded/bazel-embedded.git",
)
# Configure bazel_embedded toolchains and platforms.
load(
"@bazel_embedded//:bazel_embedded_deps.bzl",
"bazel_embedded_deps",
)
bazel_embedded_deps()
load(
"@bazel_embedded//platforms:execution_platforms.bzl",
"register_platforms",
)
register_platforms()
# Fetch gcc-arm-none-eabi compiler and register for toolchain
# resolution.
load(
"@bazel_embedded//toolchains/compilers/gcc_arm_none_eabi:gcc_arm_none_repository.bzl",
"gcc_arm_none_compiler",
)
gcc_arm_none_compiler()
load(
"@bazel_embedded//toolchains/gcc_arm_none_eabi:gcc_arm_none_toolchain.bzl",
"register_gcc_arm_none_toolchain",
)
register_gcc_arm_none_toolchain()
# Registers platforms for use with toolchain resolution
register_execution_platforms("//pw_build/platforms:all")
load("//pw_build:target_config.bzl", "pigweed_config")
# Configure Pigweeds backend.
pigweed_config(
name = "pigweed_config",
build_file = "//targets:default_config.BUILD",
)
# Set up rules for fuzz testing.
# Required by: pigweed.
# Used in modules: //pw_protobuf, //pw_tokenizer, //pw_fuzzer.
http_archive(
name = "rules_fuzzing",
sha256 = "d9002dd3cd6437017f08593124fdd1b13b3473c7b929ceb0e60d317cb9346118",
strip_prefix = "rules_fuzzing-0.3.2",
urls = ["https://github.com/bazelbuild/rules_fuzzing/archive/v0.3.2.zip"],
)
load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies")
rules_fuzzing_dependencies()
load("@rules_fuzzing//fuzzing:init.bzl", "rules_fuzzing_init")
rules_fuzzing_init()
# esbuild setup
load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", "esbuild_repositories")
esbuild_repositories(npm_repository = "npm") # Note, npm is the default value for npm_repository
RULES_JVM_EXTERNAL_TAG = "2.8"
RULES_JVM_EXTERNAL_SHA = "79c9850690d7614ecdb72d68394f994fef7534b292c4867ce5e7dec0aa7bdfad"
http_archive(
name = "rules_jvm_external",
sha256 = RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
)
load("@rules_jvm_external//:defs.bzl", "maven_install")
# Pull in packages for the pw_rpc Java client with Maven.
maven_install(
artifacts = [
"com.google.auto.value:auto-value:1.8.2",
"com.google.auto.value:auto-value-annotations:1.8.2",
"com.google.code.findbugs:jsr305:3.0.2",
"com.google.flogger:flogger:0.7.1",
"com.google.flogger:flogger-system-backend:0.7.1",
"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",
],
)
new_git_repository(
name = "micro_ecc",
build_file = "//:third_party/micro_ecc/BUILD.micro_ecc",
commit = "b335ee812bfcca4cd3fb0e2a436aab39553a555a",
remote = "https://github.com/kmackay/micro-ecc.git",
)
git_repository(
name = "boringssl",
commit = "b9232f9e27e5668bc0414879dcdedb2a59ea75f2",
# Requires patching as pw_polyfill uses c++14, whereas boringssl uses c++11.
# This results in a scenario where std::conditional_t is disabled in the
# polyfill implementation.
patches = ["//third_party/boringssl:cc_version.patch"],
remote = "https://boringssl.googlesource.com/boringssl",
)