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") |
Luca Milanesio | 6b19214 | 2017-01-26 14:24:53 +0000 | [diff] [blame] | 29 | load("//plugins:external_plugin_deps.bzl", "external_plugin_deps") |
Nasser Grainawi | a5c2f8fb | 2021-12-06 13:16:59 -0700 | [diff] [blame] | 30 | load("//tools:nongoogle.bzl", "declare_nongoogle_deps") |
Andrew Z Allen | 3384a69 | 2021-11-15 04:28:33 +0000 | [diff] [blame] | 31 | load("//tools:deps.bzl", "CAFFEINE_VERS", "java_dependencies") |
Han-Wen Nienhuys | 28e7a6d | 2016-09-21 15:03:54 +0200 | [diff] [blame] | 32 | |
Kasper Nilsson | 1ea918b | 2017-04-25 13:55:01 +0200 | [diff] [blame] | 33 | http_archive( |
David Ostrovsky | 8d03c3a | 2023-11-14 07:55:44 +0100 | [diff] [blame] | 34 | name = "rules_nodejs", |
| 35 | patch_args = ["-p1"], |
| 36 | patches = ["//tools:rules_nodejs-5.8.4-node_versions.bzl.patch"], |
| 37 | sha256 = "8fc8e300cb67b89ceebd5b8ba6896ff273c84f6099fc88d23f24e7102319d8fd", |
| 38 | urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.4/rules_nodejs-core-5.8.4.tar.gz"], |
| 39 | ) |
| 40 | |
| 41 | http_archive( |
Dmitrii Filippov | 3f49f91 | 2020-01-09 15:12:45 +0100 | [diff] [blame] | 42 | name = "build_bazel_rules_nodejs", |
Paladox none | 511ca19 | 2023-10-21 16:01:41 +0000 | [diff] [blame] | 43 | sha256 = "709cc0dcb51cf9028dd57c268066e5bc8f03a119ded410a13b5c3925d6e43c48", |
| 44 | urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.4/rules_nodejs-5.8.4.tar.gz"], |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 45 | ) |
| 46 | |
| 47 | load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") |
| 48 | |
| 49 | build_bazel_rules_nodejs_dependencies() |
| 50 | |
| 51 | # This is required just because we have a dependency on @bazel/concatjs. |
| 52 | # We don't actually use any of this web_testing stuff. |
| 53 | # TODO: Remove this dependency. |
| 54 | http_archive( |
| 55 | name = "io_bazel_rules_webtesting", |
| 56 | sha256 = "e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a", |
| 57 | urls = [ |
| 58 | "https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz", |
| 59 | ], |
| 60 | ) |
| 61 | |
| 62 | # TODO: Remove this, see comments on `io_bazel_rules_webtesting`. |
| 63 | load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories") |
| 64 | |
| 65 | # TODO: Remove this, see comments on `io_bazel_rules_webtesting`. |
| 66 | web_test_repositories() |
| 67 | |
| 68 | # TODO: Remove this, see comments on `io_bazel_rules_webtesting`. |
| 69 | load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.3.bzl", "browser_repositories") |
| 70 | |
| 71 | # TODO: Remove this, see comments on `io_bazel_rules_webtesting`. |
| 72 | browser_repositories( |
| 73 | chromium = True, |
| 74 | firefox = True, |
Dmitrii Filippov | 3f49f91 | 2020-01-09 15:12:45 +0100 | [diff] [blame] | 75 | ) |
| 76 | |
David Ostrovsky | 7f4793d | 2023-12-26 14:40:22 +0100 | [diff] [blame] | 77 | declare_nongoogle_deps() |
David Ostrovsky | 21a891c | 2020-12-19 12:57:06 +0100 | [diff] [blame] | 78 | |
David Ostrovsky | 7f4793d | 2023-12-26 14:40:22 +0100 | [diff] [blame] | 79 | load("//tools:defs.bzl", "gerrit_init") |
David Ostrovsky | 21a891c | 2020-12-19 12:57:06 +0100 | [diff] [blame] | 80 | |
David Ostrovsky | 7f4793d | 2023-12-26 14:40:22 +0100 | [diff] [blame] | 81 | gerrit_init() |
David Ostrovsky | d773408 | 2023-09-28 16:49:06 +0200 | [diff] [blame] | 82 | |
David Ostrovsky | 04219df | 2023-09-29 10:23:22 +0200 | [diff] [blame] | 83 | # Java-Prettify external repository consumed from git submodule |
| 84 | local_repository( |
| 85 | name = "java-prettify", |
| 86 | path = "modules/java-prettify", |
| 87 | ) |
| 88 | |
David Ostrovsky | 8bec855 | 2019-06-19 01:07:43 +0200 | [diff] [blame] | 89 | # JGit external repository consumed from git submodule |
| 90 | local_repository( |
| 91 | name = "jgit", |
| 92 | path = "modules/jgit", |
| 93 | ) |
| 94 | |
Andrew Z Allen | 3384a69 | 2021-11-15 04:28:33 +0000 | [diff] [blame] | 95 | java_dependencies() |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 96 | |
Marco Miller | 2cdbc4e | 2020-10-19 14:01:40 -0400 | [diff] [blame] | 97 | CAFFEINE_GUAVA_SHA256 = "6e48965614557ba4d3c55a197e20c38f23a20032ef8aace37e95ed64d2ebc9a6" |
David Ostrovsky | 9262cce | 2020-01-17 22:06:20 +0100 | [diff] [blame] | 98 | |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 99 | # 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] | 100 | # naming collision between caffeine guava adapter and guava library itself. |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 101 | # Remove this renaming procedure, once this upstream issue is fixed: |
| 102 | # https://github.com/ben-manes/caffeine/issues/364. |
| 103 | http_file( |
| 104 | name = "caffeine-guava-renamed", |
David Ostrovsky | 9262cce | 2020-01-17 22:06:20 +0100 | [diff] [blame] | 105 | canonical_id = "caffeine-guava-" + CAFFEINE_VERS + ".jar-" + CAFFEINE_GUAVA_SHA256, |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 106 | downloaded_file_path = "caffeine-guava-" + CAFFEINE_VERS + ".jar", |
David Ostrovsky | 9262cce | 2020-01-17 22:06:20 +0100 | [diff] [blame] | 107 | sha256 = CAFFEINE_GUAVA_SHA256, |
David Ostrovsky | 06c8604 | 2019-11-09 12:38:13 +0100 | [diff] [blame] | 108 | urls = [ |
| 109 | "https://repo1.maven.org/maven2/com/github/ben-manes/caffeine/guava/" + |
| 110 | CAFFEINE_VERS + |
| 111 | "/guava-" + |
| 112 | CAFFEINE_VERS + |
| 113 | ".jar", |
| 114 | ], |
| 115 | ) |
| 116 | |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 117 | load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install") |
| 118 | |
| 119 | node_repositories( |
David Ostrovsky | 8d03c3a | 2023-11-14 07:55:44 +0100 | [diff] [blame] | 120 | node_version = "20.9.0", |
paladox | 84c1007 | 2022-08-17 21:06:45 -0400 | [diff] [blame] | 121 | yarn_version = "1.22.19", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 122 | ) |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 123 | |
| 124 | yarn_install( |
| 125 | name = "npm", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 126 | exports_directories_only = False, |
David Ostrovsky | 6cb69ef | 2020-11-21 09:30:20 +0100 | [diff] [blame] | 127 | frozen_lockfile = False, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 128 | package_json = "//:package.json", |
Ben Rohlfs | a935bd0 | 2021-08-03 15:48:59 +0200 | [diff] [blame] | 129 | package_path = "", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 130 | symlink_node_modules = True, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 131 | yarn_lock = "//:yarn.lock", |
| 132 | ) |
| 133 | |
| 134 | yarn_install( |
| 135 | name = "ui_npm", |
Dmitrii Filippov | ba3dc7a | 2021-06-28 14:42:15 +0200 | [diff] [blame] | 136 | args = [ |
| 137 | "--prod", |
| 138 | # By default, yarn install all optional dependencies. |
| 139 | # In some cases, it installs a lot of additional dependencies which |
| 140 | # are not required (for example, "resemblejs" has one optional |
| 141 | # dependencies "canvas" that leads to tens of additional dependencies). |
| 142 | # Each additional dependency requires a license even if it is not used |
| 143 | # in our code. We want to ensure that all optional dependencies are |
| 144 | # explicitly added to package.json. |
| 145 | "--ignore-optional", |
| 146 | ], |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 147 | exports_directories_only = False, |
David Ostrovsky | 6cb69ef | 2020-11-21 09:30:20 +0100 | [diff] [blame] | 148 | frozen_lockfile = False, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 149 | package_json = "//:polygerrit-ui/app/package.json", |
Ben Rohlfs | a935bd0 | 2021-08-03 15:48:59 +0200 | [diff] [blame] | 150 | package_path = "polygerrit-ui/app", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 151 | symlink_node_modules = True, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 152 | yarn_lock = "//:polygerrit-ui/app/yarn.lock", |
| 153 | ) |
| 154 | |
| 155 | yarn_install( |
| 156 | name = "ui_dev_npm", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 157 | exports_directories_only = False, |
David Ostrovsky | 6cb69ef | 2020-11-21 09:30:20 +0100 | [diff] [blame] | 158 | frozen_lockfile = False, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 159 | package_json = "//:polygerrit-ui/package.json", |
Ben Rohlfs | a935bd0 | 2021-08-03 15:48:59 +0200 | [diff] [blame] | 160 | package_path = "polygerrit-ui", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 161 | symlink_node_modules = True, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 162 | yarn_lock = "//:polygerrit-ui/yarn.lock", |
| 163 | ) |
| 164 | |
| 165 | yarn_install( |
| 166 | name = "tools_npm", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 167 | exports_directories_only = False, |
David Ostrovsky | 6cb69ef | 2020-11-21 09:30:20 +0100 | [diff] [blame] | 168 | frozen_lockfile = False, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 169 | package_json = "//:tools/node_tools/package.json", |
Ben Rohlfs | a935bd0 | 2021-08-03 15:48:59 +0200 | [diff] [blame] | 170 | package_path = "tools/node_tools", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 171 | symlink_node_modules = True, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 172 | yarn_lock = "//:tools/node_tools/yarn.lock", |
| 173 | ) |
| 174 | |
| 175 | yarn_install( |
| 176 | name = "plugins_npm", |
| 177 | args = ["--prod"], |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 178 | exports_directories_only = False, |
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 = "//:plugins/package.json", |
Ben Rohlfs | a935bd0 | 2021-08-03 15:48:59 +0200 | [diff] [blame] | 181 | package_path = "plugins", |
David Ostrovsky | f2c9a3d | 2022-02-12 14:53:31 +0100 | [diff] [blame] | 182 | symlink_node_modules = True, |
David Ostrovsky | ffa5cce | 2020-06-27 11:00:10 +0200 | [diff] [blame] | 183 | yarn_lock = "//:plugins/yarn.lock", |
| 184 | ) |
| 185 | |
Luca Milanesio | 6b19214 | 2017-01-26 14:24:53 +0000 | [diff] [blame] | 186 | external_plugin_deps() |