build(bazel): update to nodejs rules 0.31.1 (#30627)

* entry_point attribute of nodejs_binary & rollup_bundle is now a label
* symlinking of node_modules for yarn_install temporarily disabled (except for integration/bazel) until the fix for https://github.com/bazelbuild/bazel/issues/8487 makes it into a future bazel release

PR Close #30627
This commit is contained in:
Greg Magolan
2019-06-07 09:28:41 -07:00
committed by Igor Minar
parent ba83d33dd0
commit a794143820
11 changed files with 59 additions and 35 deletions

View File

@ -38,11 +38,12 @@ def rules_angular_dev_dependencies():
#############################################
# Dependencies for generating documentation #
#############################################
# TODO(gregmagolan): update to upstream commit once https://github.com/bazelbuild/rules_sass/pull/87 lands
http_archive(
name = "io_bazel_rules_sass",
sha256 = "4c87befcb17282b039ba8341df9a6cc45f461bf05776dcf35c7e40c7e79ce374",
strip_prefix = "rules_sass-3a4f31c74513ccfacce3f955b5c006352f7e9587",
url = "https://github.com/bazelbuild/rules_sass/archive/3a4f31c74513ccfacce3f955b5c006352f7e9587.zip",
sha256 = "1c20d2ddc3d42712543e3b77bceac1bfea072849602569a6fc8b107e6d520ac6",
strip_prefix = "rules_sass-d033c0f9f7a2c75b73068f6647a5b0cc5070fd90",
url = "https://github.com/gregmagolan/rules_sass/archive/d033c0f9f7a2c75b73068f6647a5b0cc5070fd90.zip",
)
http_archive(

View File

@ -15,8 +15,8 @@ workspace(
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_NODEJS_VERSION = "0.30.1"
RULES_NODEJS_SHA256 = "abcf497e89cfc1d09132adfcd8c07526d026e162ae2cb681dcb896046417ce91"
RULES_NODEJS_VERSION = "0.31.1"
RULES_NODEJS_SHA256 = "e04a82a72146bfbca2d0575947daa60fda1878c8d3a3afe868a8ec39a6b968bb"
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = RULES_NODEJS_SHA256,
@ -49,8 +49,13 @@ Try running `yarn bazel` instead.
)
yarn_install(
name = "npm",
data = ["//:angular-metadata.tsconfig.json"],
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
# Temporarily disable node_modules symlinking until the fix for
# https://github.com/bazelbuild/bazel/issues/8487 makes it into a
# future Bazel release
symlink_node_modules = False,
)
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")

View File

@ -32,5 +32,4 @@ build --define=compile=legacy
# Turn on managed directories feature in Bazel
# This allows us to avoid installing a second copy of node_modules
build --experimental_allow_incremental_repository_updates
query --experimental_allow_incremental_repository_updates
common --experimental_allow_incremental_repository_updates

View File

@ -173,6 +173,7 @@ def protractor_web_test(
data = [],
server = None,
tags = [],
protractor = "@npm//node_modules/protractor:bin/protractor",
**kwargs):
"""Runs a protractor test in a browser.
@ -187,6 +188,9 @@ def protractor_web_test(
data: Runtime dependencies
server: Optional server executable target
tags: Standard Bazel tags, this macro adds one for ibazel
protractor: Protractor entry_point. Defaults to @npm//node_modules/protractor:bin/protractor
but should be changed to @your_npm_workspace//node_modules/protractor:bin/protractor if
you are not using @npm for your npm dependencies.
**kwargs: passed through to `_protractor_web_test`
"""
@ -194,7 +198,7 @@ def protractor_web_test(
nodejs_binary(
name = protractor_bin_name,
entry_point = "protractor/bin/protractor",
entry_point = protractor,
data = srcs + deps + data,
testonly = 1,
visibility = ["//visibility:private"],
@ -244,6 +248,7 @@ def protractor_web_test_suite(
visibility = None,
web_test_data = [],
wrapped_test_tags = None,
protractor = "@npm//node_modules/protractor:bin/protractor",
**remaining_keyword_args):
"""Defines a test_suite of web_test targets that wrap a protractor_web_test target.
@ -277,6 +282,9 @@ def protractor_web_test_suite(
visibility: List of labels; optional.
web_test_data: Data dependencies for the web_test.
wrapped_test_tags: A list of test tag strings to use for the wrapped test
protractor: Protractor entry_point. Defaults to @npm//node_modules/protractor:bin/protractor
but should be changed to @your_npm_workspace//node_modules/protractor:bin/protractor if
you are not using @npm for your npm dependencies.
**remaining_keyword_args: Arguments for the wrapped test target.
"""
@ -294,7 +302,7 @@ def protractor_web_test_suite(
nodejs_binary(
name = protractor_bin_name,
entry_point = "protractor/bin/protractor",
entry_point = protractor,
data = srcs + deps + data,
testonly = 1,
visibility = ["//visibility:private"],

View File

@ -50,8 +50,8 @@ function addDevDependenciesToPackageJson(options: Schema) {
'@angular/bazel': angularCoreVersion,
'@bazel/bazel': '^0.26.0',
'@bazel/ibazel': '^0.10.2',
'@bazel/karma': '0.30.0',
'@bazel/typescript': '0.30.0',
'@bazel/karma': '0.31.1',
'@bazel/typescript': '0.31.1',
};
const recorder = host.beginUpdate(packageJson);