This is liable to change in the future.A
sh_binary()is used to execute a shell script.
The name of the sh_binary.
Either the path to the script (relative to the build file), or a build target. This file must be executable in order to be run.
A list of files or build rules that this rule requires in order to run. These could be things such as random data files. These files are made available in a directory at run time and are placed relative to their original location in the project repository. This directory's location is determined entirely by Buck; the script should not assume the directory's location. The location is provided to the script in the
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.
This sh_binary() just cats a sample data file back at the user.
# $REPO/BUCK sh_binary( name = "script", main = "script.sh", resources = [ "data.dat", ], )
# Sample data file with data we need at runtime $ echo "I'm a datafile" > data.dat # Create a simple script that prints out the resource $ cat > script.sh #!/bin/sh cat $BUCK_PROJECT_ROOT/data.dat # Make sure the script is executable $ chmod u+x script.sh # Run the script, and see that it prints out the resource we provided $ buck run //:script Building: finished in 1.9 sec (100%) 1/1 jobs, 1 updated Total time: 2.1 sec I'm a datafile