Files
Greg Magolan c5f2979a87 build(bazel): update to nodejs rules 0.31.1 & bazel 0.26.1 (#30965)
* entry_point attribute of nodejs_binary & rollup_bundle is now a label
* nodejs rules 0.30.1 has new feature to symlink node_modules with yarn_install and bazel 0.26.0 includes new managed_directories feature which enables this
* 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. This is needed to work-around issue: yarn_install & npm_install with managed directories can't handle deleted or manually regenerated node_modules folder [https://github.com/bazelbuild/rules_nodejs/issues/802]. Underlying issue has been fixed in Bazel https://github.com/bazelbuild/bazel/issues/8487 but hasn't landed in a release yet

PR Close #30965
2019-06-11 10:54:28 -07:00

48 lines
1.3 KiB
Python

# Copyright Google Inc. All Rights Reserved.
#
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE file at https://angular.io/license
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "nodejs_test")
"""
Macro that can be used to track the size of a given input file by inspecting
the corresponding source map. A golden file is used to compare the current
file size data against previously approved file size data
"""
def js_size_tracking_test(
name,
src,
sourceMap,
goldenFile,
maxPercentageDiff,
maxByteDiff,
data = [],
**kwargs):
all_data = data + [
"//tools/size-tracking",
"@npm//source-map",
"@npm//chalk",
]
entry_point = ":index.ts"
nodejs_test(
name = name,
data = all_data,
entry_point = entry_point,
configuration_env_vars = ["compile"],
templated_args = [src, sourceMap, goldenFile, "%d" % maxPercentageDiff, "%d" % maxByteDiff, "false"],
**kwargs
)
nodejs_binary(
name = "%s.accept" % name,
testonly = True,
data = all_data,
entry_point = entry_point,
configuration_env_vars = ["compile"],
templated_args = [src, sourceMap, goldenFile, "0", "0", "true"],
**kwargs
)