Buck: filegroup()
Support Ukraine. Help Provide Humanitarian Aid to Ukraine.


This rule provides access to a set of files.

Files are accessible to genrules by using their relative path after a $(location) string parameter macro. Other rules may handle filegroup() rules natively for attributes such as resources.


  • name (required) #

    The short name for this build target.

  • srcs (required) #

    The set of files to include in this rule.

  • visibility (defaults to []) #

    List of build target patterns that identify the build rules that can include this rule as a dependency, for example, by listing it in their deps or exported_deps attributes. For more information, see visibility.

  • licenses (defaults to []) #

    Set of license files for this library. To get the list of license files for a given build rule and all of its dependencies, you can use buck query.

  • labels (defaults to []) #

    Set of arbitrary strings which allow you to annotate a build rule with tags that can be searched for over an entire dependency tree using buck query attrfilter().


In this example a target exports .xml files from all subdirectories in resources.

  name = 'example',
  srcs = glob(['resources/**/*.xml']),

  name = 'process_xml',
  out = 'processed.xml',
  cmd = '$(exe //example:tool) -in $(location :example)/resources/file.xml > $OUT',