Files
gerrit/tools/node_tools/BUILD
Dmitrii Filippov 7043396ac8 Specify exact dependencies for rollup-bin
rollup-bin specified whole @tools_npm//:node_modules. As a result, any
rule which uses rollup-bin requires the whole content of the
node_modules folder. This leads to the issue with the remote build
executor which has a limit on the number of files in an input tree.

Issue: 12511
Change-Id: Iff5330417f78bdba4b5c1de4b67c3a10f15b7272
2020-03-30 15:32:37 +02:00

39 lines
1.8 KiB
Python

load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
package(default_visibility = ["//visibility:public"])
# By default, rollup_bundle rule uses rollup from @npm workspace
# and it expects that all plugins are installed in the same workspace.
# This rule defines another rollup-bin from @tools_npm workspace.
# Usage: rollup_bundle(rollup_bin = "//tools/node_tools:rollup-bin, ...)
nodejs_binary(
name = "rollup-bin",
# Define only minimal required dependencies.
# Otherwise remote build execution fails with the too many
# files error when it builds :release target.
data = [
"@tools_npm//rollup",
"@tools_npm//rollup-plugin-terser",
],
# The entry point must be "@tools_npm:node_modules/rollup/dist/bin/rollup",
# But bazel doesn't run it correctly with the following command line:
# bazel test --test_env=GERRIT_NOTEDB=ON --spawn_strategy=standalone \
# --genrule_strategy=standalone --test_output errors --test_summary detailed \
# --flaky_test_attempts 3 --test_verbose_timeout_warnings --build_tests_only \
# --subcommands //...
# This command line appears in Gerrit CI.
# For details, see comment in rollup-runner.js file
entry_point = "//tools/node_tools:rollup-runner.js",
)
# Create a tsc_wrapped compiler rule to use in the ts_library
# compiler attribute when using self-managed dependencies
nodejs_binary(
name = "tsc_wrapped-bin",
# Point bazel to your node_modules to find the entry point
data = ["@tools_npm//:node_modules"],
# It seems, bazel uses different approaches to compile ts files (it runs some
# ts service in background). It works without any workaround.
entry_point = "@tools_npm//:node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js",
)