From e2eed17d370286ca1ce36705ccde13c892f0177b Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Wed, 30 Aug 2017 08:20:43 +0200 Subject: [PATCH] Bazel: Replace ctx.action with actions#run / actions#run_shell ctx.action() is deprecated in favor of ctx.actions.run() / ctx.actions.run_shell(): [1]. See discussion in [2], why we need this. [1] https://docs.bazel.build/versions/master/skylark/lib/ctx.html#action [2] https://github.com/bazelbuild/bazel/issues/3589 Change-Id: I11af3afebc0d3c76bb8fb59a790db2e3f3ce982b --- tools/bzl/asciidoc.bzl | 8 ++++---- tools/bzl/gwt.bzl | 4 ++-- tools/bzl/javadoc.bzl | 2 +- tools/bzl/js.bzl | 10 +++++----- tools/bzl/pkg_war.bzl | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/bzl/asciidoc.bzl b/tools/bzl/asciidoc.bzl index 1ddb6922e8..28c8012cd6 100644 --- a/tools/bzl/asciidoc.bzl +++ b/tools/bzl/asciidoc.bzl @@ -43,7 +43,7 @@ def _replace_macros_impl(ctx): cmd.append('--searchbox') else: cmd.append('--no-searchbox') - ctx.action( + ctx.actions.run_shell( inputs = [ctx.file._exe, ctx.file.src], outputs = [ctx.outputs.out], command = cmd, @@ -107,7 +107,7 @@ def _asciidoc_impl(ctx): "--out-ext", ".html", ] args.extend(_generate_asciidoc_args(ctx)) - ctx.action( + ctx.actions.run( inputs = ctx.files.srcs + [ctx.executable._exe, ctx.file.version], outputs = ctx.outputs.outs, executable = ctx.executable._exe, @@ -211,7 +211,7 @@ def _asciidoc_html_zip_impl(ctx): "--out-ext", ".html", ] args.extend(_generate_asciidoc_args(ctx)) - ctx.action( + ctx.actions.run( inputs = ctx.files.srcs + [ctx.executable._exe, ctx.file.version], outputs = [ctx.outputs.out], executable = ctx.executable._exe, @@ -268,7 +268,7 @@ def _asciidoc_zip_impl(ctx): "cd %s" % tmpdir, "zip -qr $p/%s *" % ctx.outputs.out.path, ]) - ctx.action( + ctx.actions.run_shell( inputs = [ctx.file.src] + ctx.files.resources, outputs = [ctx.outputs.out], command = " && ".join(cmd), diff --git a/tools/bzl/gwt.bzl b/tools/bzl/gwt.bzl index b0e250de0e..803c45b711 100644 --- a/tools/bzl/gwt.bzl +++ b/tools/bzl/gwt.bzl @@ -127,7 +127,7 @@ def _gwt_user_agent_module(ctx): "cp $p/%s %s" % (gwt_user_agent_xml.path, gwt), "$p/%s cC $p/%s $(find . | sed 's|^./||')" % (ctx.executable._zip.path, gwt_user_agent_zip.path) ]) - ctx.action( + ctx.actions.run_shell( inputs = [gwt_user_agent_xml] + ctx.files._zip, outputs = [gwt_user_agent_zip], command = cmd, @@ -180,7 +180,7 @@ def _gwt_binary_impl(ctx): ) ]) - ctx.action( + ctx.actions.run_shell( inputs = list(deps) + ctx.files._jdk + ctx.files._zip + gwt_user_agent_modules, outputs = [output_zip], mnemonic = "GwtBinary", diff --git a/tools/bzl/javadoc.bzl b/tools/bzl/javadoc.bzl index 18ca129648..97f291b118 100644 --- a/tools/bzl/javadoc.bzl +++ b/tools/bzl/javadoc.bzl @@ -52,7 +52,7 @@ def _impl(ctx): "find %s -exec touch -t 198001010000 '{}' ';'" % dir, "(cd %s && zip -qr ../%s *)" % (dir, ctx.outputs.zip.basename), ] - ctx.action( + ctx.actions.run_shell( inputs = list(transitive_jar_set) + list(source_jars) + ctx.files._jdk, outputs = [zip_output], command = " && ".join(cmd)) diff --git a/tools/bzl/js.bzl b/tools/bzl/js.bzl index 39d6acfbbf..63fca988f3 100644 --- a/tools/bzl/js.bzl +++ b/tools/bzl/js.bzl @@ -167,7 +167,7 @@ def _js_component(ctx): "zip -qr ../%s *" % ctx.outputs.zip.basename ]) - ctx.action( + ctx.actions.run_shell( inputs = ctx.files.srcs, outputs = [ctx.outputs.zip], command = cmd, @@ -234,7 +234,7 @@ def _bower_component_bundle_impl(ctx): out_zip = ctx.outputs.zip out_versions = ctx.outputs.version_json - ctx.action( + ctx.actions.run_shell( inputs=list(zips), outputs=[out_zip], command=" && ".join([ @@ -249,7 +249,7 @@ def _bower_component_bundle_impl(ctx): ]), mnemonic="BowerCombine") - ctx.action( + ctx.actions.run_shell( inputs=list(versions), outputs=[out_versions], mnemonic="BowerVersions", @@ -317,7 +317,7 @@ def _vulcanize_impl(ctx): use_default_shell_env = True, execution_requirements = {"local": "1"}, ) - ctx.action( + ctx.actions.run_shell( mnemonic = "Vulcanize", inputs = [ctx.file._run_npm, ctx.file.app, ctx.file._vulcanize_archive @@ -335,7 +335,7 @@ def _vulcanize_impl(ctx): "--html", ctx.outputs.html.path, "--js", ctx.outputs.js.path]) - ctx.action( + ctx.actions.run_shell( mnemonic = "Crisper", inputs = [ctx.file._run_npm, ctx.file.app, ctx.file._crisper_archive, vulcanized], diff --git a/tools/bzl/pkg_war.bzl b/tools/bzl/pkg_war.bzl index ebb632fd06..e722584f49 100644 --- a/tools/bzl/pkg_war.bzl +++ b/tools/bzl/pkg_war.bzl @@ -109,7 +109,7 @@ def _war_impl(ctx): # Add zip war cmd.append(_make_war(build_output, war)) - ctx.action( + ctx.actions.run_shell( inputs = inputs, outputs = [war], mnemonic = 'WAR',