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
This commit is contained in:
David Ostrovsky
2017-08-30 08:20:43 +02:00
parent c01f2f853c
commit e2eed17d37
5 changed files with 13 additions and 13 deletions

View File

@@ -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),

View File

@@ -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",

View File

@@ -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))

View File

@@ -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],

View File

@@ -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',