"Fossies" - the Fresh Open Source Software Archive 
Member "selenium-selenium-4.8.1/dotnet/private/generate_devtools.bzl" (17 Feb 2023, 2441 Bytes) of package /linux/www/selenium-selenium-4.8.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 def _generate_devtools_impl(ctx):
2 outdir = ctx.actions.declare_directory("{}".format(ctx.attr.out))
3 settings_template_file = ctx.actions.declare_file("generator_settings_{}.json".format(ctx.attr.protocol_version))
4
5 ctx.actions.expand_template(
6 template = ctx.attr._generator_settings_template.files.to_list()[0],
7 output = settings_template_file,
8 substitutions = {
9 "{DEVTOOLS_VERSION}": ctx.attr.protocol_version.upper(),
10 },
11 )
12
13 template_files = []
14 for template_file in ctx.attr.templates:
15 template_files.append(template_file.files.to_list()[0])
16
17 args = ctx.actions.args()
18 args.add_all("-s", [settings_template_file])
19 args.add_all("-b", [ctx.attr.browser_protocol.files.to_list()[0]])
20 args.add_all("-j", [ctx.attr.js_protocol.files.to_list()[0]])
21 args.add_all("-t", [template_files[0]])
22 args.add("-q")
23 args.add_all("-o", [outdir.path])
24
25 ctx.actions.run(
26 executable = ctx.executable.generator,
27 progress_message = "Generating {} DevTools Protocol bindings for .NET".format(ctx.attr.out),
28 arguments = [args],
29 outputs = [
30 outdir,
31 ],
32 inputs = [
33 settings_template_file,
34 ctx.file.browser_protocol,
35 ctx.file.js_protocol,
36 ] + template_files,
37 use_default_shell_env = True,
38 )
39
40 return DefaultInfo(files = depset([
41 outdir,
42 ]))
43
44 generate_devtools = rule(
45 implementation = _generate_devtools_impl,
46 attrs = {
47 "protocol_version": attr.string(
48 mandatory = True,
49 default = "",
50 ),
51 "browser_protocol": attr.label(
52 allow_single_file = True,
53 ),
54 "js_protocol": attr.label(
55 allow_single_file = True,
56 ),
57 "templates": attr.label_list(
58 allow_files = True,
59 ),
60 "out": attr.string(
61 doc = "File name, without extension, of the built assembly.",
62 ),
63 "generator": attr.label(
64 default = Label("//third_party/dotnet/devtools/src/generator:generator"),
65 executable = True,
66 cfg = "exec",
67 ),
68 "deps": attr.label_list(),
69 "_generator_settings_template": attr.label(
70 default = Label("//third_party/dotnet/devtools:generator_settings_template.json"),
71 allow_single_file = True,
72 ),
73 },
74 )