build: remove obsolete Bazel function ctx.new_file (#38080)

The function was removed by default in Bazel 0.27.
It is still accessible with the flag `--incompatible_new_actions_api`
(which is set in Google code base), but the flag will be deleted very soon.

This change should be a no-op for Bazel users. The change was tested in
Google (cl/318277076) and should be safe as well.

PR Close #38080
This commit is contained in:
Laurent Le Brun 2020-06-26 00:13:26 +02:00 committed by Andrew Kushnir
parent c8e77d8536
commit 406f801b70
1 changed files with 2 additions and 11 deletions

View File

@ -277,11 +277,8 @@ def _expected_outs(ctx):
# TODO(alxhub): i18n is only produced by the legacy compiler currently. This should be re-enabled # TODO(alxhub): i18n is only produced by the legacy compiler currently. This should be re-enabled
# when ngtsc can extract messages # when ngtsc can extract messages
if is_legacy_ngc and _is_bazel(): if is_legacy_ngc:
i18n_messages_files = [ctx.actions.declare_file(ctx.label.name + "_ngc_messages.xmb")] i18n_messages_files = [ctx.actions.declare_file(ctx.label.name + "_ngc_messages.xmb")]
elif is_legacy_ngc:
# write the xmb file to blaze-genfiles since that path appears in the translation console keys
i18n_messages_files = [ctx.new_file(ctx.genfiles_dir, ctx.label.name + "_ngc_messages.xmb")]
else: else:
i18n_messages_files = [] i18n_messages_files = []
@ -458,19 +455,13 @@ def ngc_compile_action(
) )
if is_legacy_ngc and messages_out != None: if is_legacy_ngc and messages_out != None:
# The base path is bin_dir because of the way the ngc
# compiler host is configured. Under Blaze, we need to explicitly
# point to genfiles/ to redirect the output.
# See _expected_outs above, where the output path for the message file
# is conditional on whether we are in Bazel.
message_file_path = messages_out[0].short_path if _is_bazel() else "../genfiles/" + messages_out[0].short_path
ctx.actions.run( ctx.actions.run(
inputs = inputs, inputs = inputs,
outputs = messages_out, outputs = messages_out,
executable = ctx.executable.ng_xi18n, executable = ctx.executable.ng_xi18n,
arguments = (_EXTRA_NODE_OPTIONS_FLAGS + arguments = (_EXTRA_NODE_OPTIONS_FLAGS +
[tsconfig_file.path] + [tsconfig_file.path] +
[message_file_path]), [messages_out[0].short_path]),
progress_message = "Extracting Angular 2 messages (ng_xi18n)", progress_message = "Extracting Angular 2 messages (ng_xi18n)",
mnemonic = "Angular2MessageExtractor", mnemonic = "Angular2MessageExtractor",
) )