This is liable to change in the future.
Warning: this build rule is deprecated for folders. Use
filegroup instead. It is still supported for individual files.
export_file() takes a single file or folder and exposes it so other rules can use it.
The short name for this build target. If this is the only parameter, this must also be the path to the file.
The path to the file that should be exported.
The name which the file will be called if another rule depends on it instead of the name it already has.
How files are referenced internally in buck. If set to 'copy', then a full copy will be made into the new location in buck-out. If set to 'reference', the original file will be used by internal build rules in-place. However, this mode does not work across repositories or if the 'out' property is set. For read-only operations, 'reference' can be more performant.
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
exported_depsattributes. For more information, see visibility.
The best way to see how the
export_file() rule works is with some examples. The common case is:
export_file( name = 'example.html', ) # This is equivalent to export_file( name = 'example.html', src = 'example.html', out = 'example.html', )
It is sometimes useful to refer to the file not by its path, but by a more logical name:
export_file( name = 'example', src = 'example.html', ) # This is equivalent to export_file( name = 'example', src = 'example.html', out = 'example.html', )
Finally, there are occasions where you want to export a file more than once but want to copy it to a different name for each output:
export_file( name = 'runner', src = 'RemoteRunner.html', ) export_file( name = 'runner_hta', src = 'RemoteRunner.html', out = 'RemoteRunner.hta', )
export_file() rule is also simple:
export_file( name = 'example', src = 'example.html', ) genrule( name = 'demo', out = 'result.html' cmd = 'cp $(location :example) $OUT', )