github.com/emcfarlane/larking@v0.0.0-20220605172417-1704b45ee6c3/builder/testdata/merge/concat.star (about)

     1  """Execute a binary.
     2  The example below executes the binary target "merge" with some arguments.
     3  
     4  The rule must declare its dependencies.
     5  """
     6  
     7  load("rules.star", "attr", "rule")
     8  
     9  def _implementation(ctx):
    10      # The list of arguments we pass to the script.
    11      args = [ctx.outputs.out.path] + [f.path for f in ctx.files.chunks]
    12  
    13      # Action to call the script.
    14      ctx.actions.run(
    15          inputs = ctx.files.chunks,
    16          outputs = [ctx.outputs.out],
    17          arguments = args,
    18          progress_message = "Merging into %s" % ctx.outputs.out.short_path,
    19          executable = ctx.executable.merge_tool,
    20      )
    21  
    22  concat = rule(
    23      implementation = _implementation,
    24      resolver = _recolver,
    25      attrs = {
    26          "chunks": attr.label_list(allow_files = True),
    27          "out": attr.output(mandatory = True),
    28          "_merge_tool": attr.label(
    29              executable = True,
    30              cfg = "exec",
    31              allow_files = True,
    32              default = "merge",
    33          ),
    34      },
    35  )