blob: da62bb509629e2941ee94e581089e8f514fdee61 [file] [log] [blame]
David Ostrovsky122d4ce2022-06-08 10:53:11 +02001# npm packages are split into different node_modules directories based on their
2# usage.
3# 1. @npm (node_modules) - contains packages to run tests, check code, etc...
4# It is expected that @npm is used ONLY to run tools. No packages from @npm
5# are used by other code in gerrit.
6# 2. @tools_npm (tools/node_tools/node_modules) - the tools/node_tools folder
7# contains self-written tools which are run for building and/or testing. The
8# @tools_npm directory contains all the packages needed to run this tools.
9# 3. @ui_npm (polygerrit-ui/app/node_modules) - packages with source code which
10# are necessary to run polygerrit and to bundle it. Only code from these
11# packages can be included in the final bundle for polygerrit. @ui_npm folder
12# must not have devDependencies. All devDependencies must be placed in
13# @ui_dev_npm.
14# 4. @ui_dev_npm (polygerrit-ui/node_modules) - devDependencies for polygerrit.
15# The packages from these folder can be used for testing, but must not be
16# included in the final bundle.
17# 5. @plugins_npm (plugins/node_modules) - plugin dependencies for polygerrit
18# plugins. The packages here are expected to be used in plugins.
19# Note: separation between @ui_npm and @ui_dev_npm is necessary because with
20# rules_nodejs we can't generate two external repositories from the same
21# package.json. At the same time we want to avoid accidental usages of code
22# from devDependencies in polygerrit bundle.
Dmitrii Filippov3f49f912020-01-09 15:12:45 +010023workspace(
24 name = "gerrit",
Dmitrii Filippov3f49f912020-01-09 15:12:45 +010025)
David Ostrovskyfa189072016-11-30 08:52:06 +010026
Logan Hanks784849c2018-09-12 14:35:10 -070027load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
David Ostrovsky6dc8c422018-06-02 09:07:09 +020028load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
David Pursehousefd0fcb22018-06-14 15:32:28 +090029load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_LOCAL", "maven_jar")
Luca Milanesio6b192142017-01-26 14:24:53 +000030load("//plugins:external_plugin_deps.bzl", "external_plugin_deps")
Nasser Grainawia5c2f8fb2021-12-06 13:16:59 -070031load("//tools:nongoogle.bzl", "declare_nongoogle_deps")
Andrew Z Allen3384a692021-11-15 04:28:33 +000032load("//tools:deps.bzl", "CAFFEINE_VERS", "java_dependencies")
Han-Wen Nienhuys28e7a6d2016-09-21 15:03:54 +020033
Kasper Nilsson1ea918b2017-04-25 13:55:01 +020034http_archive(
Matthias Sohn06b7b992022-04-25 15:53:40 +020035 name = "platforms",
36 sha256 = "379113459b0feaf6bfbb584a91874c065078aa673222846ac765f86661c27407",
37 urls = [
38 "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz",
39 "https://github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz",
40 ],
41)
42
43http_archive(
David Ostrovsky001943d2020-12-20 21:36:25 +010044 name = "rbe_jdk11",
David Ostrovsky65951c52020-03-28 18:23:20 +010045 sha256 = "5939e2a4e56d1fc53b6c44c6db97ee068c9f4bd18e86c762f6ab8b4fff5e294b",
46 strip_prefix = "rbe_autoconfig-3.0.0",
David Ostrovsky22e6e982021-05-22 11:26:40 +020047 urls = [
David Ostrovsky65951c52020-03-28 18:23:20 +010048 "https://gerrit-bazel.storage.googleapis.com/rbe_autoconfig/v3.0.0.tar.gz",
49 "https://github.com/davido/rbe_autoconfig/archive/v3.0.0.tar.gz",
David Ostrovsky22e6e982021-05-22 11:26:40 +020050 ],
David Ostrovsky001943d2020-12-20 21:36:25 +010051)
Han-Wen Nienhuys9c15e2b2019-05-16 16:59:33 +020052
53http_archive(
David Ostrovsky9eeddbc2020-02-02 15:40:12 +010054 name = "com_google_protobuf",
David Ostrovskybaae1eb2022-02-12 15:56:33 +010055 sha256 = "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568",
56 strip_prefix = "protobuf-3.19.4",
Luca Milanesiod849fb42020-04-23 15:25:19 +010057 urls = [
David Ostrovskybaae1eb2022-02-12 15:56:33 +010058 "https://github.com/protocolbuffers/protobuf/archive/v3.19.4.tar.gz",
Luca Milanesiod849fb42020-04-23 15:25:19 +010059 ],
Kasper Nilsson1ea918b2017-04-25 13:55:01 +020060)
61
David Ostrovsky9eeddbc2020-02-02 15:40:12 +010062load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
63
64protobuf_deps()
65
Dmitrii Filippov3f49f912020-01-09 15:12:45 +010066http_archive(
67 name = "build_bazel_rules_nodejs",
Paladox noneb6ec22c2022-05-31 21:45:22 +000068 sha256 = "0fad45a9bda7dc1990c47b002fd64f55041ea751fafc00cd34efb96107675778",
69 urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.5.0/rules_nodejs-5.5.0.tar.gz"],
David Ostrovskyf2c9a3d2022-02-12 14:53:31 +010070)
71
72load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
73
74build_bazel_rules_nodejs_dependencies()
75
76# This is required just because we have a dependency on @bazel/concatjs.
77# We don't actually use any of this web_testing stuff.
78# TODO: Remove this dependency.
79http_archive(
80 name = "io_bazel_rules_webtesting",
81 sha256 = "e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a",
82 urls = [
83 "https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz",
84 ],
85)
86
87# TODO: Remove this, see comments on `io_bazel_rules_webtesting`.
88load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
89
90# TODO: Remove this, see comments on `io_bazel_rules_webtesting`.
91web_test_repositories()
92
93# TODO: Remove this, see comments on `io_bazel_rules_webtesting`.
94load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.3.bzl", "browser_repositories")
95
96# TODO: Remove this, see comments on `io_bazel_rules_webtesting`.
97browser_repositories(
98 chromium = True,
99 firefox = True,
Dmitrii Filippov3f49f912020-01-09 15:12:45 +0100100)
101
Logan Hanks784849c2018-09-12 14:35:10 -0700102# Golang support for PolyGerrit local dev server.
103http_archive(
104 name = "io_bazel_rules_go",
David Ostrovsky9f419eb2022-02-12 16:13:20 +0100105 sha256 = "d6b2513456fe2229811da7eb67a444be7785f5323c6708b38d851d2b51e54d83",
Ole Rehmsen038ab172019-06-18 09:35:42 +0200106 urls = [
David Ostrovsky9f419eb2022-02-12 16:13:20 +0100107 "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
108 "https://github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
Ole Rehmsen038ab172019-06-18 09:35:42 +0200109 ],
Logan Hanks784849c2018-09-12 14:35:10 -0700110)
111
David Ostrovsky3de4a032019-03-03 20:34:12 +0100112load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
Logan Hanks784849c2018-09-12 14:35:10 -0700113
114go_rules_dependencies()
115
David Ostrovsky9f419eb2022-02-12 16:13:20 +0100116go_register_toolchains(version = "1.17.6")
Logan Hanks784849c2018-09-12 14:35:10 -0700117
118http_archive(
119 name = "bazel_gazelle",
David Ostrovsky9f419eb2022-02-12 16:13:20 +0100120 sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
David Ostrovskye8cf5122020-06-04 07:18:31 +0200121 urls = [
David Ostrovsky9f419eb2022-02-12 16:13:20 +0100122 "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
123 "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
David Ostrovskye8cf5122020-06-04 07:18:31 +0200124 ],
Logan Hanks784849c2018-09-12 14:35:10 -0700125)
126
127load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
128
129gazelle_dependencies()
130
131# Dependencies for PolyGerrit local dev server.
132go_repository(
Logan Hanks784849c2018-09-12 14:35:10 -0700133 name = "com_github_howeyc_fsnotify",
134 commit = "441bbc86b167f3c1f4786afae9931403b99fdacf",
135 importpath = "github.com/howeyc/fsnotify",
136)
137
David Ostrovsky21a891c2020-12-19 12:57:06 +0100138register_toolchains("//tools:error_prone_warnings_toolchain_java11_definition")
139
140register_toolchains("//tools:error_prone_warnings_toolchain_java17_definition")
141
David Ostrovsky8bec8552019-06-19 01:07:43 +0200142# JGit external repository consumed from git submodule
143local_repository(
144 name = "jgit",
145 path = "modules/jgit",
146)
147
Andrew Z Allen3384a692021-11-15 04:28:33 +0000148java_dependencies()
David Ostrovsky06c86042019-11-09 12:38:13 +0100149
Marco Miller2cdbc4e2020-10-19 14:01:40 -0400150CAFFEINE_GUAVA_SHA256 = "6e48965614557ba4d3c55a197e20c38f23a20032ef8aace37e95ed64d2ebc9a6"
David Ostrovsky9262cce2020-01-17 22:06:20 +0100151
David Ostrovsky06c86042019-11-09 12:38:13 +0100152# TODO(davido): Rename guava.jar to caffeine-guava.jar on fetch to prevent potential
David Pursehouse0461b432020-05-17 10:44:00 +0900153# naming collision between caffeine guava adapter and guava library itself.
David Ostrovsky06c86042019-11-09 12:38:13 +0100154# Remove this renaming procedure, once this upstream issue is fixed:
155# https://github.com/ben-manes/caffeine/issues/364.
156http_file(
157 name = "caffeine-guava-renamed",
David Ostrovsky9262cce2020-01-17 22:06:20 +0100158 canonical_id = "caffeine-guava-" + CAFFEINE_VERS + ".jar-" + CAFFEINE_GUAVA_SHA256,
David Ostrovsky06c86042019-11-09 12:38:13 +0100159 downloaded_file_path = "caffeine-guava-" + CAFFEINE_VERS + ".jar",
David Ostrovsky9262cce2020-01-17 22:06:20 +0100160 sha256 = CAFFEINE_GUAVA_SHA256,
David Ostrovsky06c86042019-11-09 12:38:13 +0100161 urls = [
162 "https://repo1.maven.org/maven2/com/github/ben-manes/caffeine/guava/" +
163 CAFFEINE_VERS +
164 "/guava-" +
165 CAFFEINE_VERS +
166 ".jar",
167 ],
168)
169
Han-Wen Nienhuysf37b8202019-04-17 17:19:55 +0200170declare_nongoogle_deps()
David Ostrovskyb81b4f72016-05-21 19:55:01 +0200171
David Ostrovskyf2c9a3d2022-02-12 14:53:31 +0100172load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install")
173
174node_repositories(
Paladox noneb6ec22c2022-05-31 21:45:22 +0000175 node_version = "16.15.0",
176 yarn_version = "1.22.18",
David Ostrovskyf2c9a3d2022-02-12 14:53:31 +0100177)
David Ostrovskyffa5cce2020-06-27 11:00:10 +0200178
179yarn_install(
180 name = "npm",
David Ostrovskyf2c9a3d2022-02-12 14:53:31 +0100181 exports_directories_only = False,
David Ostrovsky6cb69ef2020-11-21 09:30:20 +0100182 frozen_lockfile = False,
David Ostrovskyffa5cce2020-06-27 11:00:10 +0200183 package_json = "//:package.json",
Ben Rohlfsa935bd02021-08-03 15:48:59 +0200184 package_path = "",
David Ostrovskyf2c9a3d2022-02-12 14:53:31 +0100185 symlink_node_modules = True,
David Ostrovskyffa5cce2020-06-27 11:00:10 +0200186 yarn_lock = "//:yarn.lock",
187)
188
189yarn_install(
190 name = "ui_npm",
Dmitrii Filippovba3dc7a2021-06-28 14:42:15 +0200191 args = [
192 "--prod",
193 # By default, yarn install all optional dependencies.
194 # In some cases, it installs a lot of additional dependencies which
195 # are not required (for example, "resemblejs" has one optional
196 # dependencies "canvas" that leads to tens of additional dependencies).
197 # Each additional dependency requires a license even if it is not used
198 # in our code. We want to ensure that all optional dependencies are
199 # explicitly added to package.json.
200 "--ignore-optional",
201 ],
David Ostrovskyf2c9a3d2022-02-12 14:53:31 +0100202 exports_directories_only = False,
David Ostrovsky6cb69ef2020-11-21 09:30:20 +0100203 frozen_lockfile = False,
David Ostrovskyffa5cce2020-06-27 11:00:10 +0200204 package_json = "//:polygerrit-ui/app/package.json",
Ben Rohlfsa935bd02021-08-03 15:48:59 +0200205 package_path = "polygerrit-ui/app",
David Ostrovskyf2c9a3d2022-02-12 14:53:31 +0100206 symlink_node_modules = True,
David Ostrovskyffa5cce2020-06-27 11:00:10 +0200207 yarn_lock = "//:polygerrit-ui/app/yarn.lock",
208)
209
210yarn_install(
211 name = "ui_dev_npm",
David Ostrovskyf2c9a3d2022-02-12 14:53:31 +0100212 exports_directories_only = False,
David Ostrovsky6cb69ef2020-11-21 09:30:20 +0100213 frozen_lockfile = False,
David Ostrovskyffa5cce2020-06-27 11:00:10 +0200214 package_json = "//:polygerrit-ui/package.json",
Ben Rohlfsa935bd02021-08-03 15:48:59 +0200215 package_path = "polygerrit-ui",
David Ostrovskyf2c9a3d2022-02-12 14:53:31 +0100216 symlink_node_modules = True,
David Ostrovskyffa5cce2020-06-27 11:00:10 +0200217 yarn_lock = "//:polygerrit-ui/yarn.lock",
218)
219
220yarn_install(
221 name = "tools_npm",
David Ostrovskyf2c9a3d2022-02-12 14:53:31 +0100222 exports_directories_only = False,
David Ostrovsky6cb69ef2020-11-21 09:30:20 +0100223 frozen_lockfile = False,
David Ostrovskyffa5cce2020-06-27 11:00:10 +0200224 package_json = "//:tools/node_tools/package.json",
Ben Rohlfsa935bd02021-08-03 15:48:59 +0200225 package_path = "tools/node_tools",
David Ostrovskyf2c9a3d2022-02-12 14:53:31 +0100226 symlink_node_modules = True,
David Ostrovskyffa5cce2020-06-27 11:00:10 +0200227 yarn_lock = "//:tools/node_tools/yarn.lock",
228)
229
230yarn_install(
231 name = "plugins_npm",
232 args = ["--prod"],
David Ostrovskyf2c9a3d2022-02-12 14:53:31 +0100233 exports_directories_only = False,
David Ostrovsky6cb69ef2020-11-21 09:30:20 +0100234 frozen_lockfile = False,
David Ostrovskyffa5cce2020-06-27 11:00:10 +0200235 package_json = "//:plugins/package.json",
Ben Rohlfsa935bd02021-08-03 15:48:59 +0200236 package_path = "plugins",
David Ostrovskyf2c9a3d2022-02-12 14:53:31 +0100237 symlink_node_modules = True,
David Ostrovskyffa5cce2020-06-27 11:00:10 +0200238 yarn_lock = "//:plugins/yarn.lock",
239)
240
Luca Milanesio6b192142017-01-26 14:24:53 +0000241external_plugin_deps()