This is liable to change in the future.An
http_archive()rule is used to download and extract archives from the Internet to be used as dependencies for other rules. These rules are downloaded by running
buck fetch, or can be downloaded as part of
buck buildby setting
A list of urls to attempt to download from. They are tried in order, and subsequent ones are only tried if the download fails. If validation fails, a new URL is not used. Supported protocols are "http", "https", and "mvn".
SHA-256hash of the downloaded artifact. Buck verifies this is correct and fails the fetch command if it doesn't match in order to guarantee repeatable builds.
An optional name to call the directory that the downloaded artifact is extracted into. Buck will generate a default name if one is not provided that uses the
nameof the rule.
If set, files under this path will be extracted to the root of the output directory. Siblings or cousins to this prefix will not be extracted at all.
For example, if a tarball has the layout:
data.datwill be extracted, and it will be extracted into the output directory specified in
Normally, archive type is determined by the file's extension. If
typeis set, then autodetection is overriden, and the specified type is used instead.
Supported values are:
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.
http_archive(), third party packages can be downloaded from an
https URL and used in other library types.
http_archive( name = 'thrift-archive', urls = [ 'https://internal-mirror.example.com/bin/thrift-compiler-0.1.tar.gz.badextension', ], sha256 = '7baa80df284117e5b945b19b98d367a85ea7b7801bd358ff657946c3bd1b6596', type='tar.gz', strip_prefix='thrift-compiler-0.1' ) genrule( name = 'thrift-compiler-bin', out = 'thrift', cmd = 'cp $(location :thrift-archive)/bin/thrift $OUT', ) genrule( name="my-thrift-lib-cpp2", cmd="$(exe :thrift-compiler-bin) --gen cpp2 -o $OUT $(location //:thrift-file)", out="gen-cpp2", )