blob: fe6b94e7fb427d67f15c03f826609eb8ad064675 [file] [log] [blame]
# npm packages are split into different node_modules directories based on their usage.
# 1. /node_modules (referenced as @npm) - contains packages to run tests, check code, etc...
# It is expected that @npm is used ONLY to run tools. No packages from @npm are used by
# other code in gerrit.
# 2. @tools_npm (tools/node_tools/node_modules) - the tools/node_tools folder contains self-written tools
# which are run for building and/or testing. The @tools_npm directory contains all the packages needed to
# run this tools.
# 3. @ui_npm (polygerrit-ui/app/node_modules) - packages with source code which are necessary to run polygerrit
# and to bundle it. Only code from these packages can be included in the final bundle for polygerrit.
# @ui_npm folder must not have devDependencies. All dev dependencies must be placed in @ui_dev_npm
# 4. @ui_dev_npm (polygerrit-ui/node_modules) - devDependencies for polygerrit. The packages from these
# folder can be used for testing, but must not be included in the final bundle.
# 5. @plugins_npm (plugins/node_modules) - plugin dependencies for polygerrit plugins.
# The packages here are expected to be used in plugins.
# Note: separation between @ui_npm and @ui_dev_npm is necessary because with bazel we can't generate
# two managed directories from the same package.json. At the same time we want to avoid accidental
# usages of code from devDependencies in polygerrit bundle.
workspace(
name = "gerrit",
managed_directories = {
"@npm": ["node_modules"],
"@ui_npm": ["polygerrit-ui/app/node_modules"],
"@ui_dev_npm": ["polygerrit-ui/node_modules"],
"@tools_npm": ["tools/node_tools/node_modules"],
"@plugins_npm": ["plugins/node_modules"],
},
)
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_LOCAL", "maven_jar")
load("//plugins:external_plugin_deps.bzl", "external_plugin_deps")
load("//tools:nongoogle.bzl", "declare_nongoogle_deps")
load("//tools:deps.bzl", "CAFFEINE_VERS", "java_dependencies")
http_archive(
name = "platforms",
sha256 = "379113459b0feaf6bfbb584a91874c065078aa673222846ac765f86661c27407",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz",
],
)
http_archive(
name = "rbe_jdk11",
sha256 = "5939e2a4e56d1fc53b6c44c6db97ee068c9f4bd18e86c762f6ab8b4fff5e294b",
strip_prefix = "rbe_autoconfig-3.0.0",
urls = [
"https://gerrit-bazel.storage.googleapis.com/rbe_autoconfig/v3.0.0.tar.gz",
"https://github.com/davido/rbe_autoconfig/archive/v3.0.0.tar.gz",
],
)
http_archive(
name = "com_google_protobuf",
sha256 = "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568",
strip_prefix = "protobuf-3.19.4",
urls = [
"https://github.com/protocolbuffers/protobuf/archive/v3.19.4.tar.gz",
],
)
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "c077680a307eb88f3e62b0b662c2e9c6315319385bc8c637a861ffdbed8ca247",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.1.0/rules_nodejs-5.1.0.tar.gz"],
)
load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
build_bazel_rules_nodejs_dependencies()
# This is required just because we have a dependency on @bazel/concatjs.
# We don't actually use any of this web_testing stuff.
# TODO: Remove this dependency.
http_archive(
name = "io_bazel_rules_webtesting",
sha256 = "e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a",
urls = [
"https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz",
],
)
# TODO: Remove this, see comments on `io_bazel_rules_webtesting`.
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
# TODO: Remove this, see comments on `io_bazel_rules_webtesting`.
web_test_repositories()
# TODO: Remove this, see comments on `io_bazel_rules_webtesting`.
load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.3.bzl", "browser_repositories")
# TODO: Remove this, see comments on `io_bazel_rules_webtesting`.
browser_repositories(
chromium = True,
firefox = True,
)
http_archive(
name = "rules_pkg",
sha256 = "038f1caa773a7e35b3663865ffb003169c6a71dc995e39bf4815792f385d837d",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz",
],
)
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
rules_pkg_dependencies()
# Golang support for PolyGerrit local dev server.
http_archive(
name = "io_bazel_rules_go",
sha256 = "d6b2513456fe2229811da7eb67a444be7785f5323c6708b38d851d2b51e54d83",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.17.6")
http_archive(
name = "bazel_gazelle",
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
],
)
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
gazelle_dependencies()
# Dependencies for PolyGerrit local dev server.
go_repository(
name = "com_github_howeyc_fsnotify",
commit = "441bbc86b167f3c1f4786afae9931403b99fdacf",
importpath = "github.com/howeyc/fsnotify",
)
register_toolchains("//tools:error_prone_warnings_toolchain_java11_definition")
register_toolchains("//tools:error_prone_warnings_toolchain_java17_definition")
# JGit external repository consumed from git submodule
local_repository(
name = "jgit",
path = "modules/jgit",
)
java_dependencies()
CAFFEINE_GUAVA_SHA256 = "6e48965614557ba4d3c55a197e20c38f23a20032ef8aace37e95ed64d2ebc9a6"
# TODO(davido): Rename guava.jar to caffeine-guava.jar on fetch to prevent potential
# naming collision between caffeine guava adapter and guava library itself.
# Remove this renaming procedure, once this upstream issue is fixed:
# https://github.com/ben-manes/caffeine/issues/364.
http_file(
name = "caffeine-guava-renamed",
canonical_id = "caffeine-guava-" + CAFFEINE_VERS + ".jar-" + CAFFEINE_GUAVA_SHA256,
downloaded_file_path = "caffeine-guava-" + CAFFEINE_VERS + ".jar",
sha256 = CAFFEINE_GUAVA_SHA256,
urls = [
"https://repo1.maven.org/maven2/com/github/ben-manes/caffeine/guava/" +
CAFFEINE_VERS +
"/guava-" +
CAFFEINE_VERS +
".jar",
],
)
declare_nongoogle_deps()
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install")
node_repositories(
node_version = "16.13.2",
yarn_version = "1.22.17",
)
yarn_install(
name = "npm",
exports_directories_only = False,
frozen_lockfile = False,
package_json = "//:package.json",
package_path = "",
symlink_node_modules = True,
yarn_lock = "//:yarn.lock",
)
yarn_install(
name = "ui_npm",
args = [
"--prod",
# By default, yarn install all optional dependencies.
# In some cases, it installs a lot of additional dependencies which
# are not required (for example, "resemblejs" has one optional
# dependencies "canvas" that leads to tens of additional dependencies).
# Each additional dependency requires a license even if it is not used
# in our code. We want to ensure that all optional dependencies are
# explicitly added to package.json.
"--ignore-optional",
],
exports_directories_only = False,
frozen_lockfile = False,
package_json = "//:polygerrit-ui/app/package.json",
package_path = "polygerrit-ui/app",
symlink_node_modules = True,
yarn_lock = "//:polygerrit-ui/app/yarn.lock",
)
yarn_install(
name = "ui_dev_npm",
exports_directories_only = False,
frozen_lockfile = False,
package_json = "//:polygerrit-ui/package.json",
package_path = "polygerrit-ui",
symlink_node_modules = True,
yarn_lock = "//:polygerrit-ui/yarn.lock",
)
yarn_install(
name = "tools_npm",
exports_directories_only = False,
frozen_lockfile = False,
package_json = "//:tools/node_tools/package.json",
package_path = "tools/node_tools",
symlink_node_modules = True,
yarn_lock = "//:tools/node_tools/yarn.lock",
)
yarn_install(
name = "plugins_npm",
args = ["--prod"],
exports_directories_only = False,
frozen_lockfile = False,
package_json = "//:plugins/package.json",
package_path = "plugins",
symlink_node_modules = True,
yarn_lock = "//:plugins/yarn.lock",
)
external_plugin_deps()