• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15workspace(
16    name = "pigweed",
17    managed_directories = {"@npm": ["node_modules"]},
18)
19
20# Set up build_bazel_rules_nodejs.
21load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
22load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
23
24http_archive(
25    name = "build_bazel_rules_nodejs",
26    sha256 = "4952ef879704ab4ad6729a29007e7094aef213ea79e9f2e94cbe1c9a753e63ef",
27    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/2.2.0/rules_nodejs-2.2.0.tar.gz"],
28)
29
30# Get the latest LTS version of Node.
31load(
32    "@build_bazel_rules_nodejs//:index.bzl",
33    "node_repositories",
34    "yarn_install",
35)
36
37node_repositories(package_json = ["//:package.json"])
38
39yarn_install(
40    name = "npm",
41    package_json = "//:package.json",
42    yarn_lock = "//:yarn.lock",
43)
44
45# Set up Karma.
46load("@npm//@bazel/karma:package.bzl", "npm_bazel_karma_dependencies")
47
48npm_bazel_karma_dependencies()
49
50load(
51    "@io_bazel_rules_webtesting//web:repositories.bzl",
52    "web_test_repositories",
53)
54
55web_test_repositories()
56
57load(
58    "@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl",
59    "browser_repositories",
60)
61
62browser_repositories(
63    chromium = True,
64    firefox = True,
65)
66
67# Setup embedded C/C++ toolchains.
68git_repository(
69    name = "bazel_embedded",
70    commit = "89c05fa415218abd2e24fa7016cb7903317d606b",
71    remote = "https://github.com/silvergasp/bazel-embedded.git",
72)
73
74# Instantiate Pigweed configuration for embedded toolchain,
75# this must be called before bazel_embedded_deps.
76load(
77    "//pw_build:pigweed_toolchain_upstream.bzl",
78    "toolchain_upstream_deps",
79)
80
81toolchain_upstream_deps()
82
83# Configure bazel_embedded toolchains and platforms.
84load(
85    "@bazel_embedded//:bazel_embedded_deps.bzl",
86    "bazel_embedded_deps",
87)
88
89bazel_embedded_deps()
90
91load(
92    "@bazel_embedded//platforms:execution_platforms.bzl",
93    "register_platforms",
94)
95
96register_platforms()
97
98# Fetch gcc-arm-none-eabi compiler and register for toolchain
99# resolution.
100load(
101    "@bazel_embedded//toolchains/compilers/gcc_arm_none_eabi:gcc_arm_none_repository.bzl",
102    "gcc_arm_none_compiler",
103)
104
105gcc_arm_none_compiler()
106
107load(
108    "@bazel_embedded//toolchains/gcc_arm_none_eabi:gcc_arm_none_toolchain.bzl",
109    "register_gcc_arm_none_toolchain",
110)
111
112register_gcc_arm_none_toolchain()
113
114# Fetch LLVM/Clang compiler and register for toolchain resolution.
115load(
116    "@bazel_embedded//toolchains/compilers/llvm:llvm_repository.bzl",
117    "llvm_repository",
118)
119
120llvm_repository(
121    name = "com_llvm_compiler",
122)
123
124load(
125    "@bazel_embedded//toolchains/clang:clang_toolchain.bzl",
126    "register_clang_toolchain",
127)
128
129register_clang_toolchain()
130
131register_execution_platforms("//pw_build/platforms:all")
132