blob: adcb01078289b60711655cd398a9856aa6df3792 [file] [log] [blame]
Nathaniel Brough82cf6872021-02-16 15:51:57 +08001# Copyright 2021 The Pigweed Authors
Rob Mohrbe98ead2019-11-14 07:16:40 -08002#
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.
Matthew Soulanille376d7972020-06-01 15:50:07 -070014
15workspace(
16 name = "pigweed",
17 managed_directories = {"@npm": ["node_modules"]},
18)
19
Nathaniel Brough82cf6872021-02-16 15:51:57 +080020# Set up build_bazel_rules_nodejs.
Matthew Soulanille376d7972020-06-01 15:50:07 -070021load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Nathaniel Brough82cf6872021-02-16 15:51:57 +080022load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
23
Matthew Soulanille376d7972020-06-01 15:50:07 -070024http_archive(
25 name = "build_bazel_rules_nodejs",
Matthew Soulanille83c82822020-09-10 10:59:50 -070026 sha256 = "4952ef879704ab4ad6729a29007e7094aef213ea79e9f2e94cbe1c9a753e63ef",
27 urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/2.2.0/rules_nodejs-2.2.0.tar.gz"],
Matthew Soulanille376d7972020-06-01 15:50:07 -070028)
Nathaniel Brough82cf6872021-02-16 15:51:57 +080029
30# Get the latest LTS version of Node.
31load(
32 "@build_bazel_rules_nodejs//:index.bzl",
33 "node_repositories",
34 "yarn_install",
35)
36
Matthew Soulanille376d7972020-06-01 15:50:07 -070037node_repositories(package_json = ["//:package.json"])
38
Matthew Soulanille376d7972020-06-01 15:50:07 -070039yarn_install(
40 name = "npm",
41 package_json = "//:package.json",
42 yarn_lock = "//:yarn.lock",
43)
44
Nathaniel Brough82cf6872021-02-16 15:51:57 +080045# Set up Karma.
Matthew Soulanille83c82822020-09-10 10:59:50 -070046load("@npm//@bazel/karma:package.bzl", "npm_bazel_karma_dependencies")
Nathaniel Brough82cf6872021-02-16 15:51:57 +080047
Matthew Soulanille5e78acf2020-06-08 10:58:29 -070048npm_bazel_karma_dependencies()
49
Nathaniel Brough82cf6872021-02-16 15:51:57 +080050load(
51 "@io_bazel_rules_webtesting//web:repositories.bzl",
52 "web_test_repositories",
53)
54
Matthew Soulanille5e78acf2020-06-08 10:58:29 -070055web_test_repositories()
56
Nathaniel Brough82cf6872021-02-16 15:51:57 +080057load(
58 "@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl",
59 "browser_repositories",
60)
Matthew Soulanille5e78acf2020-06-08 10:58:29 -070061
62browser_repositories(
63 chromium = True,
64 firefox = True,
65)
66
Nathaniel Brough82cf6872021-02-16 15:51:57 +080067# Setup embedded C/C++ toolchains.
68git_repository(
69 name = "bazel_embedded",
70 commit = "89c05fa415218abd2e24fa7016cb7903317d606b",
71 remote = "https://github.com/silvergasp/bazel-embedded.git",
72 shallow_since = "1614045367 +0800",
73)
74
75# Instantiate Pigweed configuration for embedded toolchain,
76# this must be called before bazel_embedded_deps.
77load(
78 "//pw_build:pigweed_toolchain_upstream.bzl",
79 "toolchain_upstream_deps",
80)
81
82toolchain_upstream_deps()
83
84# Configure bazel_embedded toolchains and platforms.
85load(
86 "@bazel_embedded//:bazel_embedded_deps.bzl",
87 "bazel_embedded_deps",
88)
89
90bazel_embedded_deps()
91
92load(
93 "@bazel_embedded//platforms:execution_platforms.bzl",
94 "register_platforms",
95)
96
97register_platforms()
98
99# Fetch gcc-arm-none-eabi compiler and register for toolchain
100# resolution.
101load(
102 "@bazel_embedded//toolchains/compilers/gcc_arm_none_eabi:gcc_arm_none_repository.bzl",
103 "gcc_arm_none_compiler",
104)
105
106gcc_arm_none_compiler()
107
108load(
109 "@bazel_embedded//toolchains/gcc_arm_none_eabi:gcc_arm_none_toolchain.bzl",
110 "register_gcc_arm_none_toolchain",
111)
112
113register_gcc_arm_none_toolchain()
114
115# Fetch LLVM/Clang compiler and register for toolchain resolution.
116load(
117 "@bazel_embedded//toolchains/compilers/llvm:llvm_repository.bzl",
118 "llvm_repository",
119)
120
121llvm_repository(
122 name = "com_llvm_compiler",
123)
124
125load(
126 "@bazel_embedded//toolchains/clang:clang_toolchain.bzl",
127 "register_clang_toolchain",
128)
129
130register_clang_toolchain()