github.com/0xKiwi/rules_go@v0.24.3/tests/legacy/examples/cgo/example_command/generate_test.bzl (about)

     1  def _generate_script_impl(ctx):
     2      script_file = ctx.actions.declare_file(ctx.label.name + ".bash")
     3      ctx.actions.write(output = script_file, is_executable = True, content = """
     4  {0}
     5  """.format(ctx.file.binary.short_path))
     6      return struct(
     7          files = depset([script_file]),
     8      )
     9  
    10  generate_script = rule(
    11      _generate_script_impl,
    12      attrs = {
    13          "binary": attr.label(
    14              allow_single_file = True,
    15          ),
    16      },
    17  )