2024-10-19 12:54:49 -04:00
|
|
|
def _generate_version_file_impl(ctx):
|
|
|
|
|
out = ctx.actions.declare_file(ctx.attr.output_file)
|
2025-07-26 15:10:15 -07:00
|
|
|
wpilib_version = ctx.var.get("WPILIB_VERSION")
|
2024-10-19 12:54:49 -04:00
|
|
|
ctx.actions.expand_template(
|
|
|
|
|
output = out,
|
|
|
|
|
template = ctx.file.template,
|
2025-07-26 15:10:15 -07:00
|
|
|
substitutions = {"${wpilib_version}": wpilib_version},
|
2024-10-19 12:54:49 -04:00
|
|
|
)
|
|
|
|
|
return [DefaultInfo(files = depset([out]))]
|
|
|
|
|
|
|
|
|
|
generate_version_file = rule(
|
|
|
|
|
implementation = _generate_version_file_impl,
|
|
|
|
|
attrs = {
|
|
|
|
|
"output_file": attr.string(mandatory = True),
|
|
|
|
|
"template": attr.label(
|
|
|
|
|
allow_single_file = True,
|
|
|
|
|
mandatory = True,
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
)
|