Class ExportFile

  • All Implemented Interfaces:
    BuildEngineAction, HasOutputName, AllowsNonAnnotatedFields, HasRuntimeDeps, SupportsInputBasedRuleKey, BuildRule, HasNameAndType, Comparable<BuildRule>

    public class ExportFile
    extends AbstractBuildRule
    implements HasOutputName, HasRuntimeDeps, SupportsInputBasedRuleKey
    Export a file so that it can be easily referenced by other BuildRules. There are several valid ways of using export_file (all examples in a build file located at "path/to/buck/BUCK").

    The most common usage of export_file is:

       export_file(name = 'some-file.html')
    This is equivalent to:
       export_file(name = 'some-file.html',
         src = 'some-file.html',
         out = 'some-file.html')
    This results in "//path/to/buck:some-file.html" as the rule, and will export the file "some-file.html" as "some-file.html".
         name = 'foobar.html',
         src = 'some-file.html',
    Is equivalent to:
        export_file(name = 'foobar.html', src = 'some-file.html', out = 'foobar.html')
    Finally, it's possible to refer to the exported file with a logical name, while controlling the actual file name. For example:
       export_file(name = 'ie-exports',
         src = 'some-file.js',
         out = 'some-file-ie.js',
    As a rule of thumb, if the "out" parameter is missing, the "name" parameter is used as the name of the file to be saved.