From 9cca5a8c9ce9cf7ba3c323180fe626fd84b689b8 Mon Sep 17 00:00:00 2001 From: Martin Probst Date: Thu, 15 Feb 2018 22:43:15 +0100 Subject: [PATCH 01/27] build: allow passing node options to ngc. (#22245) PR Close #22245 --- WORKSPACE | 9 +++------ integration/bazel/WORKSPACE | 4 ++-- packages/bazel/src/ng_module.bzl | 18 ++++++++++-------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 57ce53f7c9e6d..9de723c3b3b82 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -16,13 +16,10 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_reposi check_bazel_version("0.9.0") node_repositories(package_json = ["//:package.json"]) -RULES_TYPESCRIPT_VERSION = "0.10.1" - -http_archive( +git_repository( name = "build_bazel_rules_typescript", - url = "https://github.com/bazelbuild/rules_typescript/archive/%s.zip" % RULES_TYPESCRIPT_VERSION, - strip_prefix = "rules_typescript-%s" % RULES_TYPESCRIPT_VERSION, - sha256 = "a2c81776a4a492ff9f878f9705639f5647bef345f7f3e1da09c9eeb8dec80485", + commit = "d3cc5cd72d89aee0e4c2553ae1b99c707ecbef4e", + remote = "https://github.com/bazelbuild/rules_typescript", ) load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace") diff --git a/integration/bazel/WORKSPACE b/integration/bazel/WORKSPACE index a5983fedb5a3d..b49b5dea57c9e 100644 --- a/integration/bazel/WORKSPACE +++ b/integration/bazel/WORKSPACE @@ -13,8 +13,8 @@ node_repositories(package_json = ["//:package.json"]) git_repository( name = "build_bazel_rules_typescript", - remote = "https://github.com/bazelbuild/rules_typescript.git", - commit = "d3ad16d1f105e2490859da9ad528ba4c45991d09" + commit = "d3cc5cd72d89aee0e4c2553ae1b99c707ecbef4e", + remote = "https://github.com/bazelbuild/rules_typescript", ) load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace") diff --git a/packages/bazel/src/ng_module.bzl b/packages/bazel/src/ng_module.bzl index 7998cdff28a93..6282a57b9d081 100644 --- a/packages/bazel/src/ng_module.bzl +++ b/packages/bazel/src/ng_module.bzl @@ -107,7 +107,7 @@ _EXTRA_NODE_OPTIONS_FLAGS = [ ] def ngc_compile_action(ctx, label, inputs, outputs, messages_out, tsconfig_file, - locale=None, i18n_args=[]): + node_opts, locale=None, i18n_args=[]): """Helper function to create the ngc action. This is exposed for google3 to wire up i18n replay rules, and is not intended @@ -120,6 +120,7 @@ def ngc_compile_action(ctx, label, inputs, outputs, messages_out, tsconfig_file, outputs: passed to the ngc action's outputs messages_out: produced xmb files tsconfig_file: tsconfig file with settings used for the compilation + node_opts: list of strings, extra nodejs options. locale: i18n locale, or None i18n_args: additional command-line arguments to ngc @@ -138,7 +139,8 @@ def ngc_compile_action(ctx, label, inputs, outputs, messages_out, tsconfig_file, else: supports_workers = str(int(ctx.attr._supports_workers)) - arguments = list(_EXTRA_NODE_OPTIONS_FLAGS) + arguments = (list(_EXTRA_NODE_OPTIONS_FLAGS) + + ["--node_options=%s" % opt for opt in node_opts]) # One at-sign makes this a params-file, enabling the worker strategy. # Two at-signs escapes the argument so it's passed through to ngc # rather than the contents getting expanded. @@ -185,7 +187,7 @@ def ngc_compile_action(ctx, label, inputs, outputs, messages_out, tsconfig_file, return None -def _compile_action(ctx, inputs, outputs, messages_out, tsconfig_file): +def _compile_action(ctx, inputs, outputs, messages_out, tsconfig_file, node_opts): # Give the Angular compiler all the user-listed assets file_inputs = list(ctx.files.assets) @@ -204,17 +206,17 @@ def _compile_action(ctx, inputs, outputs, messages_out, tsconfig_file): transitive = [inputs] + [dep.collect_summaries_aspect_result for dep in ctx.attr.deps if hasattr(dep, "collect_summaries_aspect_result")]) - return ngc_compile_action(ctx, ctx.label, action_inputs, outputs, messages_out, tsconfig_file) + return ngc_compile_action(ctx, ctx.label, action_inputs, outputs, messages_out, tsconfig_file, node_opts) -def _prodmode_compile_action(ctx, inputs, outputs, tsconfig_file): +def _prodmode_compile_action(ctx, inputs, outputs, tsconfig_file, node_opts): outs = _expected_outs(ctx) - return _compile_action(ctx, inputs, outputs + outs.closure_js, outs.i18n_messages, tsconfig_file) + return _compile_action(ctx, inputs, outputs + outs.closure_js, outs.i18n_messages, tsconfig_file, node_opts) -def _devmode_compile_action(ctx, inputs, outputs, tsconfig_file): +def _devmode_compile_action(ctx, inputs, outputs, tsconfig_file, node_opts): outs = _expected_outs(ctx) compile_action_outputs = outputs + outs.devmode_js + outs.declarations + outs.summaries - _compile_action(ctx, inputs, compile_action_outputs, None, tsconfig_file) + _compile_action(ctx, inputs, compile_action_outputs, None, tsconfig_file, node_opts) def _ts_expected_outs(ctx, label): # rules_typescript expects a function with two arguments, but our From aa100f69f23e6ef7abed35db12696544abccbc76 Mon Sep 17 00:00:00 2001 From: Kapunahele Wong Date: Tue, 6 Feb 2018 16:02:19 -0500 Subject: [PATCH 02/27] docs: edit styleguide recommendation on components as elements (#22074) Change recommendation on using attributes for components since there are use cases including the use of