Dmitrii Filippov | 3f49f91 | 2020-01-09 15:12:45 +0100 | [diff] [blame] | 1 | # npm packages are split into different node_modules directories based on their usage. |
| 2 | # 1. /node_modules (referenced as @npm) - contains packages to run tests, check code, etc... |
| 3 | # It is expected that @npm is used ONLY to run tools. No packages from @npm are used by |
| 4 | # other code in gerrit. |
| 5 | # 2. @tools_npm (tools/node_tools/node_modules) - the tools/node_tools folder contains self-written tools |
| 6 | # which are run for building and/or testing. The @tools_npm directory contains all the packages needed to |
| 7 | # run this tools. |
| 8 | # 3. @ui_npm (polygerrit-ui/app/node_modules) - packages with source code which are necessary to run polygerrit |
| 9 | # and to bundle it. Only code from these packages can be included in the final bundle for polygerrit. |
| 10 | # @ui_npm folder must not have devDependencies. All dev dependencies must be placed in @ui_dev_npm |
| 11 | # 4. @ui_dev_npm (polygerrit-ui/node_modules) - devDependencies for polygerrit. The packages from these |
| 12 | # folder can be used for testing, but must not be included in the final bundle. |
Tao Zhou | 85b1346 | 2020-06-17 13:52:36 +0200 | [diff] [blame] | 13 | # 5. @plugins_npm (plugins/node_modules) - plugin dependencies for polygerrit plugins. |
| 14 | # The packages here are expected to be used in plugins. |
Dmitrii Filippov | 3f49f91 | 2020-01-09 15:12:45 +0100 | [diff] [blame] | 15 | # Note: separation between @ui_npm and @ui_dev_npm is necessary because with bazel we can't generate |
| 16 | # two managed directories from the same package.json. At the same time we want to avoid accidental |
| 17 | # usages of code from devDependencies in polygerrit bundle. |
| 18 | workspace( |
| 19 | name = "gerrit", |
| 20 | managed_directories = { |
| 21 | "@npm": ["node_modules"], |
| 22 | "@ui_npm": ["polygerrit-ui/app/node_modules"], |
| 23 | "@ui_dev_npm": ["polygerrit-ui/node_modules"], |
| 24 | "@tools_npm": ["tools/node_tools/node_modules"], |
Tao Zhou | 85b1346 | 2020-06-17 13:52:36 +0200 | [diff] [blame] | 25 | "@plugins_npm": ["plugins/node_modules"], |
Dmitrii Filippov | 3f49f91 | 2020-01-09 15:12:45 +0100 | [diff] [blame] | 26 | }, |
| 27 | ) |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 28 | |
Logan Hanks | 784849c | 2018-09-12 14:35:10 -0700 | [diff] [blame] | 29 | load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") |
David Ostrovsky | 6dc8c42 | 2018-06-02 09:07:09 +0200 | [diff] [blame] | 30 | 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] | 31 | load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_LOCAL", "maven_jar") |
Luca Milanesio | 6b19214 | 2017-01-26 14:24:53 +0000 | [diff] [blame] | 32 | load("//plugins:external_plugin_deps.bzl", "external_plugin_deps") |
Nasser Grainawi | a5c2f8fb | 2021-12-06 13:16:59 -0700 | [diff] [blame] | 33 | load("//tools:nongoogle.bzl", "declare_nongoogle_deps") |
Andrew Z Allen | 3384a69 | 2021-11-15 04:28:33 +0000 | [diff] [blame] | 34 | load("//tools:deps.bzl", "CAFFEINE_VERS", "java_dependencies") |
Han-Wen Nienhuys | 28e7a6d | 2016-09-21 15:03:54 +0200 | [diff] [blame] | 35 | |
Kasper Nilsson | 1ea918b | 2017-04-25 13:55:01 +0200 | [diff] [blame] | 36 | http_archive( |
David Ostrovsky | 001943d | 2020-12-20 21:36:25 +0100 | [diff] [blame] | 37 | name = "rbe_jdk11", |
David Ostrovsky | 22e6e98 | 2021-05-22 11:26:40 +0200 | [diff] [blame] | 38 | sha256 = "766796de71916118e528b9f4334c29c9c9b4e926227bf3264dee555e6a4306c8", |
| 39 | strip_prefix = "rbe_autoconfig-2.0.0", |
| 40 | urls = [ |
| 41 | "https://gerrit-bazel.storage.googleapis.com/rbe_autoconfig/v2.0.0.tar.gz", |
| 42 | "https://github.com/davido/rbe_autoconfig/archive/v2.0.0.tar.gz", |
| 43 | ], |
David Ostrovsky | 001943d | 2020-12-20 21:36:25 +0100 | [diff] [blame] | 44 | ) |
Han-Wen Nienhuys | 9c15e2b | 2019-05-16 16:59:33 +0200 | [diff] [blame] | 45 | |
| 46 | http_archive( |
David Ostrovsky | 9eeddbc | 2020-02-02 15:40:12 +0100 | [diff] [blame] | 47 | name = "com_google_protobuf", |
David Ostrovsky | 55e2e36 | 2020-11-21 09:38:37 +0100 | [diff] [blame] | 48 | sha256 = "d0f5f605d0d656007ce6c8b5a82df3037e1d8fe8b121ed42e536f569dec16113", |
| 49 | strip_prefix = "protobuf-3.14.0", |
Luca Milanesio | d849fb4 | 2020-04-23 15:25:19 +0100 | [diff] [blame] | 50 | urls = [ |
David Ostrovsky | 55e2e36 | 2020-11-21 09:38:37 +0100 | [diff] [blame] | 51 | "https://github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz", |
Luca Milanesio | d849fb4 | 2020-04-23 15:25:19 +0100 | [diff] [blame] | 52 | ], |
Kasper Nilsson | 1ea918b | 2017-04-25 13:55:01 +0200 | [diff] [blame] | 53 | ) |
| 54 | |
David Ostrovsky | 9eeddbc | 2020-02-02 15:40:12 +0100 | [diff] [blame] | 55 | load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") |
| 56 | |
| 57 | protobuf_deps() |
| 58 | |
Dmitrii Filippov | 3f49f91 | 2020-01-09 15:12:45 +0100 | [diff] [blame] | 59 | http_archive( |
| 60 | name = "build_bazel_rules_nodejs", |
David Ostrovsky | 4994479 | 2021-05-13 08:07:35 +0200 | [diff] [blame] | 61 | sha256 = "10f534e1c80f795cffe1f2822becd4897754d18564612510c59b3c73544ae7c6", |
| 62 | urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.5.0/rules_nodejs-3.5.0.tar.gz"], |
Dmitrii Filippov | 3f49f91 | 2020-01-09 15:12:45 +0100 | [diff] [blame] | 63 | ) |
| 64 | |
Dmitrii Filippov | af1b1ba | 2021-01-08 21:00:29 +0100 | [diff] [blame] | 65 | http_archive( |
| 66 | name = "rules_pkg", |
| 67 | sha256 = "038f1caa773a7e35b3663865ffb003169c6a71dc995e39bf4815792f385d837d", |
| 68 | urls = [ |
| 69 | "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz", |
| 70 | "https://github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz", |
| 71 | ], |
| 72 | ) |
| 73 | |
| 74 | load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") |
| 75 | |
| 76 | rules_pkg_dependencies() |
| 77 | |
Logan Hanks | 784849c | 2018-09-12 14:35:10 -0700 | [diff] [blame] | 78 | # Golang support for PolyGerrit local dev server. |
| 79 | http_archive( |
| 80 | name = "io_bazel_rules_go", |
David Ostrovsky | 9ee5c00 | 2021-02-13 11:20:49 +0100 | [diff] [blame] | 81 | sha256 = "4d838e2d70b955ef9dd0d0648f673141df1bc1d7ecf5c2d621dcc163f47dd38a", |
Ole Rehmsen | 038ab17 | 2019-06-18 09:35:42 +0200 | [diff] [blame] | 82 | urls = [ |
David Ostrovsky | 9ee5c00 | 2021-02-13 11:20:49 +0100 | [diff] [blame] | 83 | "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.12/rules_go-v0.24.12.tar.gz", |
| 84 | "https://github.com/bazelbuild/rules_go/releases/download/v0.24.12/rules_go-v0.24.12.tar.gz", |
Ole Rehmsen | 038ab17 | 2019-06-18 09:35:42 +0200 | [diff] [blame] | 85 | ], |
Logan Hanks | 784849c | 2018-09-12 14:35:10 -0700 | [diff] [blame] | 86 | ) |
| 87 | |
David Ostrovsky | 3de4a03 | 2019-03-03 20:34:12 +0100 | [diff] [blame] | 88 | load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") |
Logan Hanks | 784849c | 2018-09-12 14:35:10 -0700 | [diff] [blame] | 89 | |
| 90 | go_rules_dependencies() |
| 91 | |
| 92 | go_register_toolchains() |
| 93 | |
| 94 | http_archive( |
| 95 | name = "bazel_gazelle", |
David Ostrovsky | 9ee5c00 | 2021-02-13 11:20:49 +0100 | [diff] [blame] | 96 | sha256 = "222e49f034ca7a1d1231422cdb67066b885819885c356673cb1f72f748a3c9d4", |
David Ostrovsky | e8cf512 | 2020-06-04 07:18:31 +0200 | [diff] [blame] | 97 | urls = [ |
David Ostrovsky | 9ee5c00 | 2021-02-13 11:20:49 +0100 | [diff] [blame] | 98 | "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.3/bazel-gazelle-v0.22.3.tar.gz", |
| 99 | "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.3/bazel-gazelle-v0.22.3.tar.gz", |
David Ostrovsky | e8cf512 | 2020-06-04 07:18:31 +0200 | [diff] [blame] | 100 | ], |
Logan Hanks | 784849c | 2018-09-12 14:35:10 -0700 | [diff] [blame] | 101 | ) |
| 102 | |
| 103 | load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") |
| 104 | |
| 105 | gazelle_dependencies() |
| 106 | |
| 107 | # Dependencies for PolyGerrit local dev server. |
| 108 | go_repository( |
Logan Hanks | 784849c | 2018-09-12 14:35:10 -0700 | [diff] [blame] | 109 | name = "com_github_howeyc_fsnotify", |
| 110 | commit = "441bbc86b167f3c1f4786afae9931403b99fdacf", |
| 111 | importpath = "github.com/howeyc/fsnotify", |
| 112 | ) |
| 113 | |
David Ostrovsky | 21a891c | 2020-12-19 12:57:06 +0100 | [diff] [blame^] | 114 | register_toolchains("//tools:error_prone_warnings_toolchain_java11_definition") |
| 115 | |
| 116 | register_toolchains("//tools:error_prone_warnings_toolchain_java17_definition") |
| 117 | |
David Ostrovsky | 8bec855 | 2019-06-19 01:07:43 +0200 | [diff] [blame] | 118 | # JGit external repository consumed from git submodule |
| 119 | local_repository( |
| 120 | name = "jgit", |
| 121 | path = "modules/jgit", |
| 122 | ) |
| 123 | |
Andrew Z Allen | 3384a69 | 2021-11-15 04:28:33 +0000 | [diff] [blame] | 124 | java_dependencies() |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 125 | |
Marco Miller | 2cdbc4e | 2020-10-19 14:01:40 -0400 | [diff] [blame] | 126 | CAFFEINE_GUAVA_SHA256 = "6e48965614557ba4d3c55a197e20c38f23a20032ef8aace37e95ed64d2ebc9a6" |
David Ostrovsky | 9262cce | 2020-01-17 22:06:20 +0100 | [diff] [blame] | 127 | |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 128 | # 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] | 129 | # naming collision between caffeine guava adapter and guava library itself. |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 130 | # Remove this renaming procedure, once this upstream issue is fixed: |
| 131 | # https://github.com/ben-manes/caffeine/issues/364. |
| 132 | http_file( |
| 133 | name = "caffeine-guava-renamed", |
David Ostrovsky | 9262cce | 2020-01-17 22:06:20 +0100 | [diff] [blame] | 134 | canonical_id = "caffeine-guava-" + CAFFEINE_VERS + ".jar-" + CAFFEINE_GUAVA_SHA256, |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 135 | downloaded_file_path = "caffeine-guava-" + CAFFEINE_VERS + ".jar", |
David Ostrovsky | 9262cce | 2020-01-17 22:06:20 +0100 | [diff] [blame] | 136 | sha256 = CAFFEINE_GUAVA_SHA256, |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 137 | urls = [ |
| 138 | "https://repo1.maven.org/maven2/com/github/ben-manes/caffeine/guava/" + |
| 139 | CAFFEINE_VERS + |
| 140 | "/guava-" + |
| 141 | CAFFEINE_VERS + |
| 142 | ".jar", |
| 143 | ], |
| 144 | ) |
| 145 | |
Han-Wen Nienhuys | f37b820 | 2019-04-17 17:19:55 +0200 | [diff] [blame] | 146 | declare_nongoogle_deps() |
David Ostrovsky | b81b4f7 | 2016-05-21 19:55:01 +0200 | [diff] [blame] | 147 | |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 148 | load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install") |
| 149 | |
| 150 | yarn_install( |
| 151 | name = "npm", |
David Ostrovsky | 6cb69ef | 2020-11-21 09:30:20 +0100 | [diff] [blame] | 152 | frozen_lockfile = False, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 153 | package_json = "//:package.json", |
Ben Rohlfs | a935bd0 | 2021-08-03 15:48:59 +0200 | [diff] [blame] | 154 | package_path = "", |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 155 | yarn_lock = "//:yarn.lock", |
| 156 | ) |
| 157 | |
| 158 | yarn_install( |
| 159 | name = "ui_npm", |
Dmitrii Filippov | ba3dc7a | 2021-06-28 14:42:15 +0200 | [diff] [blame] | 160 | args = [ |
| 161 | "--prod", |
| 162 | # By default, yarn install all optional dependencies. |
| 163 | # In some cases, it installs a lot of additional dependencies which |
| 164 | # are not required (for example, "resemblejs" has one optional |
| 165 | # dependencies "canvas" that leads to tens of additional dependencies). |
| 166 | # Each additional dependency requires a license even if it is not used |
| 167 | # in our code. We want to ensure that all optional dependencies are |
| 168 | # explicitly added to package.json. |
| 169 | "--ignore-optional", |
| 170 | ], |
David Ostrovsky | 6cb69ef | 2020-11-21 09:30:20 +0100 | [diff] [blame] | 171 | frozen_lockfile = False, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 172 | package_json = "//:polygerrit-ui/app/package.json", |
Ben Rohlfs | a935bd0 | 2021-08-03 15:48:59 +0200 | [diff] [blame] | 173 | package_path = "polygerrit-ui/app", |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 174 | yarn_lock = "//:polygerrit-ui/app/yarn.lock", |
| 175 | ) |
| 176 | |
| 177 | yarn_install( |
| 178 | name = "ui_dev_npm", |
David Ostrovsky | 6cb69ef | 2020-11-21 09:30:20 +0100 | [diff] [blame] | 179 | frozen_lockfile = False, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 180 | package_json = "//:polygerrit-ui/package.json", |
Ben Rohlfs | a935bd0 | 2021-08-03 15:48:59 +0200 | [diff] [blame] | 181 | package_path = "polygerrit-ui", |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 182 | yarn_lock = "//:polygerrit-ui/yarn.lock", |
| 183 | ) |
| 184 | |
| 185 | yarn_install( |
| 186 | name = "tools_npm", |
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 | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 190 | yarn_lock = "//:tools/node_tools/yarn.lock", |
| 191 | ) |
| 192 | |
| 193 | yarn_install( |
| 194 | name = "plugins_npm", |
| 195 | args = ["--prod"], |
David Ostrovsky | 6cb69ef | 2020-11-21 09:30:20 +0100 | [diff] [blame] | 196 | frozen_lockfile = False, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 197 | package_json = "//:plugins/package.json", |
Ben Rohlfs | a935bd0 | 2021-08-03 15:48:59 +0200 | [diff] [blame] | 198 | package_path = "plugins", |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 199 | yarn_lock = "//:plugins/yarn.lock", |
| 200 | ) |
| 201 | |
Luca Milanesio | 6b19214 | 2017-01-26 14:24:53 +0000 | [diff] [blame] | 202 | external_plugin_deps() |