diff --git a/docs/rules/lib/builtins/repository_ctx.mdx b/docs/rules/lib/builtins/repository_ctx.mdx new file mode 100644 index 00000000000000..e468762aedd17f --- /dev/null +++ b/docs/rules/lib/builtins/repository_ctx.mdx @@ -0,0 +1,41 @@ +--- +layout: "doc" +title: "repository_ctx" +--- + +## repository_ctx + +A context object for repository rule implementations. + +### download_and_extract + +
+struct repository_ctx.download_and_extract(url, output, sha256, type, strip_prefix, strip_components, allow_fail, canonical_id, auth, headers, integrity, rename_files)
+
+ +Downloads a file, extracts it, and returns a struct with success information. + +**PARAMETERS** + +| Parameter | Description | +| :------------- | :------------- | +| `strip_prefix` | A directory prefix to strip from the extracted files. Many archives contain a top-level directory that contains all files in the archive. Instead of needing to specify this prefix over and over in the `build_file`, this field can be used to strip it from extracted files.

For compatibility, this parameter may also be used under the deprecated name `stripPrefix`. Only one of `strip_prefix` or `strip_components` can be used.

| +| `strip_components` | Strip the given number of leading components from file paths on extraction. Only one of `strip_components` or `strip_prefix` can be used. | +| *other parameters* | ... | + + +### extract + +
+None repository_ctx.extract(archive, output, strip_prefix, strip_components, rename_files, watch_archive, type)
+
+ +Extract an archive to the repository directory. + +**PARAMETERS** + +| Parameter | Description | +| :------------- | :------------- | +| `strip_prefix` | A directory prefix to strip from the extracted files. Many archives contain a top-level directory that contains all files in the archive. Instead of needing to specify this prefix over and over in the `build_file`, this field can be used to strip it from extracted files.

For compatibility, this parameter may also be used under the deprecated name `stripPrefix`. Only one of `strip_prefix` or `strip_components` can be set.

| +| `strip_components` | Strip the given number of leading components from file paths on extraction. Only one of `strip_components` or `strip_prefix` can be set. | +| *other parameters* | ... | diff --git a/site/en/rules/lib/builtins/repository_ctx.md b/site/en/rules/lib/builtins/repository_ctx.md new file mode 100644 index 00000000000000..e468762aedd17f --- /dev/null +++ b/site/en/rules/lib/builtins/repository_ctx.md @@ -0,0 +1,41 @@ +--- +layout: "doc" +title: "repository_ctx" +--- + +## repository_ctx + +A context object for repository rule implementations. + +### download_and_extract + +
+struct repository_ctx.download_and_extract(url, output, sha256, type, strip_prefix, strip_components, allow_fail, canonical_id, auth, headers, integrity, rename_files)
+
+ +Downloads a file, extracts it, and returns a struct with success information. + +**PARAMETERS** + +| Parameter | Description | +| :------------- | :------------- | +| `strip_prefix` | A directory prefix to strip from the extracted files. Many archives contain a top-level directory that contains all files in the archive. Instead of needing to specify this prefix over and over in the `build_file`, this field can be used to strip it from extracted files.

For compatibility, this parameter may also be used under the deprecated name `stripPrefix`. Only one of `strip_prefix` or `strip_components` can be used.

| +| `strip_components` | Strip the given number of leading components from file paths on extraction. Only one of `strip_components` or `strip_prefix` can be used. | +| *other parameters* | ... | + + +### extract + +
+None repository_ctx.extract(archive, output, strip_prefix, strip_components, rename_files, watch_archive, type)
+
+ +Extract an archive to the repository directory. + +**PARAMETERS** + +| Parameter | Description | +| :------------- | :------------- | +| `strip_prefix` | A directory prefix to strip from the extracted files. Many archives contain a top-level directory that contains all files in the archive. Instead of needing to specify this prefix over and over in the `build_file`, this field can be used to strip it from extracted files.

For compatibility, this parameter may also be used under the deprecated name `stripPrefix`. Only one of `strip_prefix` or `strip_components` can be set.

| +| `strip_components` | Strip the given number of leading components from file paths on extraction. Only one of `strip_components` or `strip_prefix` can be set. | +| *other parameters* | ... |