David Ostrovsky | 122d4ce | 2022-06-08 10:53:11 +0200 | [diff] [blame] | 1 | # 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 Filippov | 3f49f91 | 2020-01-09 15:12:45 +0100 | [diff] [blame] | 23 | workspace( |
| 24 | name = "gerrit", |
Dmitrii Filippov | 3f49f91 | 2020-01-09 15:12:45 +0100 | [diff] [blame] | 25 | ) |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 26 | |
Logan Hanks | 784849c | 2018-09-12 14:35:10 -0700 | [diff] [blame] | 27 | load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") |
David Ostrovsky | 6dc8c42 | 2018-06-02 09:07:09 +0200 | [diff] [blame] | 28 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file") |
David Pursehouse | fd0fcb2 | 2018-06-14 15:32:28 +0900 | [diff] [blame] | 29 | load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_LOCAL", "maven_jar") |
Luca Milanesio | 6b19214 | 2017-01-26 14:24:53 +0000 | [diff] [blame] | 30 | load("//plugins:external_plugin_deps.bzl", "external_plugin_deps") |
Nasser Grainawi | a5c2f8fb | 2021-12-06 13:16:59 -0700 | [diff] [blame] | 31 | load("//tools:nongoogle.bzl", "declare_nongoogle_deps") |
Andrew Z Allen | 3384a69 | 2021-11-15 04:28:33 +0000 | [diff] [blame] | 32 | load("//tools:deps.bzl", "CAFFEINE_VERS", "java_dependencies") |
Han-Wen Nienhuys | 28e7a6d | 2016-09-21 15:03:54 +0200 | [diff] [blame] | 33 | |
Kasper Nilsson | 1ea918b | 2017-04-25 13:55:01 +0200 | [diff] [blame] | 34 | http_archive( |
Matthias Sohn | 06b7b99 | 2022-04-25 15:53:40 +0200 | [diff] [blame] | 35 | 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 | |
| 43 | http_archive( |
David Ostrovsky | 001943d | 2020-12-20 21:36:25 +0100 | [diff] [blame] | 44 | name = "rbe_jdk11", |
David Ostrovsky | cad44f0 | 2022-11-08 16:31:48 +0100 | [diff] [blame] | 45 | sha256 = "dbcfd6f26589ef506b91fe03a12dc559ca9c84699e4cf6381150522287f0e6f6", |
| 46 | strip_prefix = "rbe_autoconfig-3.1.0", |
David Ostrovsky | 22e6e98 | 2021-05-22 11:26:40 +0200 | [diff] [blame] | 47 | urls = [ |
David Ostrovsky | cad44f0 | 2022-11-08 16:31:48 +0100 | [diff] [blame] | 48 | "https://gerrit-bazel.storage.googleapis.com/rbe_autoconfig/v3.1.0.tar.gz", |
| 49 | "https://github.com/davido/rbe_autoconfig/archive/v3.1.0.tar.gz", |
David Ostrovsky | 22e6e98 | 2021-05-22 11:26:40 +0200 | [diff] [blame] | 50 | ], |
David Ostrovsky | 001943d | 2020-12-20 21:36:25 +0100 | [diff] [blame] | 51 | ) |
Han-Wen Nienhuys | 9c15e2b | 2019-05-16 16:59:33 +0200 | [diff] [blame] | 52 | |
| 53 | http_archive( |
David Ostrovsky | 9eeddbc | 2020-02-02 15:40:12 +0100 | [diff] [blame] | 54 | name = "com_google_protobuf", |
David Ostrovsky | baae1eb | 2022-02-12 15:56:33 +0100 | [diff] [blame] | 55 | sha256 = "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568", |
| 56 | strip_prefix = "protobuf-3.19.4", |
Luca Milanesio | d849fb4 | 2020-04-23 15:25:19 +0100 | [diff] [blame] | 57 | urls = [ |
David Ostrovsky | baae1eb | 2022-02-12 15:56:33 +0100 | [diff] [blame] | 58 | "https://github.com/protocolbuffers/protobuf/archive/v3.19.4.tar.gz", |
Luca Milanesio | d849fb4 | 2020-04-23 15:25:19 +0100 | [diff] [blame] | 59 | ], |
Kasper Nilsson | 1ea918b | 2017-04-25 13:55:01 +0200 | [diff] [blame] | 60 | ) |
| 61 | |
David Ostrovsky | 9eeddbc | 2020-02-02 15:40:12 +0100 | [diff] [blame] | 62 | load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") |
| 63 | |
| 64 | protobuf_deps() |
| 65 | |
Dmitrii Filippov | 3f49f91 | 2020-01-09 15:12:45 +0100 | [diff] [blame] | 66 | http_archive( |
| 67 | name = "build_bazel_rules_nodejs", |
Paladox none | d0c5c64 | 2022-10-22 14:47:39 +0000 | [diff] [blame] | 68 | sha256 = "c29944ba9b0b430aadcaf3bf2570fece6fc5ebfb76df145c6cdad40d65c20811", |
| 69 | urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.7.0/rules_nodejs-5.7.0.tar.gz"], |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 70 | ) |
| 71 | |
| 72 | load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") |
| 73 | |
| 74 | build_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. |
| 79 | http_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`. |
| 88 | load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories") |
| 89 | |
| 90 | # TODO: Remove this, see comments on `io_bazel_rules_webtesting`. |
| 91 | web_test_repositories() |
| 92 | |
| 93 | # TODO: Remove this, see comments on `io_bazel_rules_webtesting`. |
| 94 | load("@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`. |
| 97 | browser_repositories( |
| 98 | chromium = True, |
| 99 | firefox = True, |
Dmitrii Filippov | 3f49f91 | 2020-01-09 15:12:45 +0100 | [diff] [blame] | 100 | ) |
| 101 | |
David Ostrovsky | 21a891c | 2020-12-19 12:57:06 +0100 | [diff] [blame] | 102 | register_toolchains("//tools:error_prone_warnings_toolchain_java11_definition") |
| 103 | |
| 104 | register_toolchains("//tools:error_prone_warnings_toolchain_java17_definition") |
| 105 | |
David Ostrovsky | 8bec855 | 2019-06-19 01:07:43 +0200 | [diff] [blame] | 106 | # JGit external repository consumed from git submodule |
| 107 | local_repository( |
| 108 | name = "jgit", |
| 109 | path = "modules/jgit", |
| 110 | ) |
| 111 | |
Andrew Z Allen | 3384a69 | 2021-11-15 04:28:33 +0000 | [diff] [blame] | 112 | java_dependencies() |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 113 | |
Marco Miller | 2cdbc4e | 2020-10-19 14:01:40 -0400 | [diff] [blame] | 114 | CAFFEINE_GUAVA_SHA256 = "6e48965614557ba4d3c55a197e20c38f23a20032ef8aace37e95ed64d2ebc9a6" |
David Ostrovsky | 9262cce | 2020-01-17 22:06:20 +0100 | [diff] [blame] | 115 | |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 116 | # TODO(davido): Rename guava.jar to caffeine-guava.jar on fetch to prevent potential |
David Pursehouse | 0461b43 | 2020-05-17 10:44:00 +0900 | [diff] [blame] | 117 | # naming collision between caffeine guava adapter and guava library itself. |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 118 | # Remove this renaming procedure, once this upstream issue is fixed: |
| 119 | # https://github.com/ben-manes/caffeine/issues/364. |
| 120 | http_file( |
| 121 | name = "caffeine-guava-renamed", |
David Ostrovsky | 9262cce | 2020-01-17 22:06:20 +0100 | [diff] [blame] | 122 | canonical_id = "caffeine-guava-" + CAFFEINE_VERS + ".jar-" + CAFFEINE_GUAVA_SHA256, |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 123 | downloaded_file_path = "caffeine-guava-" + CAFFEINE_VERS + ".jar", |
David Ostrovsky | 9262cce | 2020-01-17 22:06:20 +0100 | [diff] [blame] | 124 | sha256 = CAFFEINE_GUAVA_SHA256, |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 125 | urls = [ |
| 126 | "https://repo1.maven.org/maven2/com/github/ben-manes/caffeine/guava/" + |
| 127 | CAFFEINE_VERS + |
| 128 | "/guava-" + |
| 129 | CAFFEINE_VERS + |
| 130 | ".jar", |
| 131 | ], |
| 132 | ) |
| 133 | |
Han-Wen Nienhuys | f37b820 | 2019-04-17 17:19:55 +0200 | [diff] [blame] | 134 | declare_nongoogle_deps() |
David Ostrovsky | b81b4f7 | 2016-05-21 19:55:01 +0200 | [diff] [blame] | 135 | |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 136 | load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install") |
| 137 | |
| 138 | node_repositories( |
paladox | ecefaa2 | 2022-08-17 21:09:49 -0400 | [diff] [blame] | 139 | node_version = "17.9.1", |
paladox | 84c1007 | 2022-08-17 21:06:45 -0400 | [diff] [blame] | 140 | yarn_version = "1.22.19", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 141 | ) |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 142 | |
| 143 | yarn_install( |
| 144 | name = "npm", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 145 | exports_directories_only = False, |
David Ostrovsky | 6cb69ef | 2020-11-21 09:30:20 +0100 | [diff] [blame] | 146 | frozen_lockfile = False, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 147 | package_json = "//:package.json", |
Ben Rohlfs | a935bd0 | 2021-08-03 15:48:59 +0200 | [diff] [blame] | 148 | package_path = "", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 149 | symlink_node_modules = True, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 150 | yarn_lock = "//:yarn.lock", |
| 151 | ) |
| 152 | |
| 153 | yarn_install( |
| 154 | name = "ui_npm", |
Dmitrii Filippov | ba3dc7a | 2021-06-28 14:42:15 +0200 | [diff] [blame] | 155 | args = [ |
| 156 | "--prod", |
| 157 | # By default, yarn install all optional dependencies. |
| 158 | # In some cases, it installs a lot of additional dependencies which |
| 159 | # are not required (for example, "resemblejs" has one optional |
| 160 | # dependencies "canvas" that leads to tens of additional dependencies). |
| 161 | # Each additional dependency requires a license even if it is not used |
| 162 | # in our code. We want to ensure that all optional dependencies are |
| 163 | # explicitly added to package.json. |
| 164 | "--ignore-optional", |
| 165 | ], |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 166 | exports_directories_only = False, |
David Ostrovsky | 6cb69ef | 2020-11-21 09:30:20 +0100 | [diff] [blame] | 167 | frozen_lockfile = False, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 168 | package_json = "//:polygerrit-ui/app/package.json", |
Ben Rohlfs | a935bd0 | 2021-08-03 15:48:59 +0200 | [diff] [blame] | 169 | package_path = "polygerrit-ui/app", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 170 | symlink_node_modules = True, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 171 | yarn_lock = "//:polygerrit-ui/app/yarn.lock", |
| 172 | ) |
| 173 | |
| 174 | yarn_install( |
| 175 | name = "ui_dev_npm", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 176 | exports_directories_only = False, |
David Ostrovsky | 6cb69ef | 2020-11-21 09:30:20 +0100 | [diff] [blame] | 177 | frozen_lockfile = False, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 178 | package_json = "//:polygerrit-ui/package.json", |
Ben Rohlfs | a935bd0 | 2021-08-03 15:48:59 +0200 | [diff] [blame] | 179 | package_path = "polygerrit-ui", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 180 | symlink_node_modules = True, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 181 | yarn_lock = "//:polygerrit-ui/yarn.lock", |
| 182 | ) |
| 183 | |
| 184 | yarn_install( |
| 185 | name = "tools_npm", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 186 | exports_directories_only = False, |
David Ostrovsky | 6cb69ef | 2020-11-21 09:30:20 +0100 | [diff] [blame] | 187 | frozen_lockfile = False, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 188 | package_json = "//:tools/node_tools/package.json", |
Ben Rohlfs | a935bd0 | 2021-08-03 15:48:59 +0200 | [diff] [blame] | 189 | package_path = "tools/node_tools", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 190 | symlink_node_modules = True, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 191 | yarn_lock = "//:tools/node_tools/yarn.lock", |
| 192 | ) |
| 193 | |
| 194 | yarn_install( |
| 195 | name = "plugins_npm", |
| 196 | args = ["--prod"], |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 197 | exports_directories_only = False, |
David Ostrovsky | 6cb69ef | 2020-11-21 09:30:20 +0100 | [diff] [blame] | 198 | frozen_lockfile = False, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 199 | package_json = "//:plugins/package.json", |
Ben Rohlfs | a935bd0 | 2021-08-03 15:48:59 +0200 | [diff] [blame] | 200 | package_path = "plugins", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 201 | symlink_node_modules = True, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 202 | yarn_lock = "//:plugins/yarn.lock", |
| 203 | ) |
| 204 | |
Luca Milanesio | 6b19214 | 2017-01-26 14:24:53 +0000 | [diff] [blame] | 205 | external_plugin_deps() |