Skip to content

Instantly share code, notes, and snippets.

@jimevans
Last active October 28, 2020 13:01
Show Gist options
  • Save jimevans/56c426ae0faed1e4a71af11f94b59277 to your computer and use it in GitHub Desktop.
Save jimevans/56c426ae0faed1e4a71af11f94b59277 to your computer and use it in GitHub Desktop.
def _generate_devtools_impl(ctx):
outdir = ctx.actions.declare_directory("generated")
args = ctx.actions.args()
args.add_all("-s", [ctx.attr.src.files])
args.add_all("-b", [ctx.attr.browser_protocol.files])
args.add_all("-j", [ctx.attr.js_protocol.files])
args.add_all("-t", [ctx.attr.template.files])
args.add_all("-o", [outdir])
ctx.actions.run(
executable = ctx.executable.generator,
arguments = [args],
outputs = [
outdir,
],
)
return DefaultInfo(files = depset([
outdir,
]))
generate_devtools = rule(
implementation = _generate_devtools_impl,
attrs = {
"src": attr.label(
allow_single_file = True,
),
"browser_protocol": attr.label(
allow_single_file = True,
),
"js_protocol": attr.label(
allow_single_file = True,
),
"template": attr.label(
allow_single_file = True,
),
"generator": attr.label(
default = Label("//third_party/dotnet/devtools_generation/DevToolsProtocolGenerator/GeneratorCommandLine:generator"),
executable = True,
cfg = "exec",
),
"deps": attr.label_list(),
},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment