title: Using data dependency for bazel ctx.action.run_shell custom rule
body: <p>I am looking at emit_rule example in bazel source tree:</p>
  <p><a href="https://github.com/bazelbuild/examples/blob/5a8696429e36090a75eb6fee4ef4e91a3413ef13/rules/shell_command/rules.bzl" rel="nofollow noreferrer">https://github.com/bazelbuild/examples/blob/5a8696429e36090a75eb6fee4ef4e91a3413ef13/rules/shell_command/rules.bzl</a></p>
  <p>I want to add a data dependency to the custom rule. My understanding of <a href="https://docs.bazel.build/versions/main/skylark/rules.html#dependency-attributes" rel="nofollow noreferrer">dependency attributes documentation</a> calls for data attr label_list to be used, but it does not appear to work?</p>
  <pre><code># This example copied from docs
  
  def _emit_size_impl(ctx):
      in_file = ctx.file.file
      out_file = ctx.actions.declare_file(&quot;%s.pylint&quot; % ctx.attr.name)
      ctx.actions.run_shell(
          inputs = [in_file],
          outputs = [out_file],
          command = &quot;wc -c '%s' &gt; '%s'&quot; % (in_file.path, out_file.path),
      )   
      return [DefaultInfo(files = depset([out_file]),)]  
  
  emit_size = rule(
      implementation = _emit_size_impl,
      attrs = { 
          &quot;file&quot;: attr.label(mandatory = True,allow_single_file = True,),
          &quot;data&quot;: attr.label_list(allow_files = True),
        # ^^^^^^^ Above does not appear to be sufficient to copy data dependency into sandbox 
      },
  )
  </code></pre>
  <p>With this rule <code>emit_size(name = &quot;my_name&quot;, file = &quot;my_file&quot;, data = [&quot;my_data&quot;])</code> I want to see <code>my_data</code> copied to bazel-out/ before running the command. How do I go about doing this?</p>