2020-05-19 15:08:49 -04:00
|
|
|
# Copyright Google LLC All Rights Reserved.
|
2019-10-24 20:40:17 -04:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
"""Bazel macro for running Angular benchmarks"""
|
|
|
|
|
2019-10-25 04:13:43 -04:00
|
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
|
2019-10-24 20:40:17 -04:00
|
|
|
|
|
|
|
def ng_benchmark(name, bundle):
|
|
|
|
"""
|
|
|
|
|
|
|
|
This macro creates two targets, one that is runnable and prints results and one that can be used for profiling via chrome://inspect.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
name: name of the runnable rule to create
|
|
|
|
bundle: label of the ng_rollup_bundle to run
|
|
|
|
"""
|
|
|
|
|
|
|
|
nodejs_binary(
|
|
|
|
name = name,
|
|
|
|
data = [bundle],
|
2020-06-17 04:37:36 -04:00
|
|
|
entry_point = bundle + ".min_debug.js",
|
2019-11-22 19:56:09 -05:00
|
|
|
tags = ["local", "manual"], # run benchmarks locally and never on CI
|
2019-10-24 20:40:17 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
nodejs_binary(
|
|
|
|
name = name + "_profile",
|
|
|
|
data = [bundle],
|
2020-06-17 04:37:36 -04:00
|
|
|
entry_point = bundle + ".min_debug.js",
|
2019-10-24 20:40:17 -04:00
|
|
|
args = ["--node_options=--no-turbo-inlining --node_options=--inspect-brk"],
|
2019-11-22 19:56:09 -05:00
|
|
|
tags = ["local", "manual"], # run benchmarks locally and never on CI
|
2019-10-24 20:40:17 -04:00
|
|
|
)
|