Skip to content

Commit

Permalink
Make get_default_canonical_id public
Browse files Browse the repository at this point in the history
  • Loading branch information
Silic0nS0ldier committed Jun 15, 2024
1 parent 5add0c9 commit 67a07d7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,16 @@ private StructImpl completeDownload(PendingDownload pendingDownload)
"Downloads a file to the output path for the provided url and returns a struct"
+ " containing <code>success</code>, a flag which is <code>true</code> if the"
+ " download completed successfully, and if successful, a hash of the file"
+ " with the fields <code>sha256</code> and <code>integrity</code>.",
+ " with the fields <code>sha256</code> and <code>integrity</code>."
+ "Setting an explicit <code>canonical_id</code> is highly recommended. e.g."
+ "<pre class='language-python'>\n"
+ "load(\"@bazel_tools//tools/build_defs/repo:cache.bzl\", \"get_default_canonical_id\")\n"
+ "# ...\n"
+ " repository_ctx.download(\n"
+ " url = urls,\n"
+ " canonical_id = get_default_canonical_id(repository_ctx, urls),\n"
+ " ),\n"
+ "</pre>",
useStarlarkThread = true,
parameters = {
@Param(
Expand Down Expand Up @@ -755,7 +764,16 @@ public Object download(
"Downloads a file to the output path for the provided url, extracts it, and returns a"
+ " struct containing <code>success</code>, a flag which is <code>true</code> if the"
+ " download completed successfully, and if successful, a hash of the file with the"
+ " fields <code>sha256</code> and <code>integrity</code>.",
+ " fields <code>sha256</code> and <code>integrity</code>."
+ "Setting an explicit <code>canonical_id</code> is highly recommended. e.g."
+ "<pre class='language-python'>\n"
+ "load(\"@bazel_tools//tools/build_defs/repo:cache.bzl\", \"get_default_canonical_id\")\n"
+ "# ...\n"
+ " repository_ctx.download_and_extract(\n"
+ " url = urls,\n"
+ " canonical_id = get_default_canonical_id(repository_ctx, urls),\n"
+ " ),\n"
+ "</pre>",
useStarlarkThread = true,
parameters = {
@Param(
Expand Down
8 changes: 4 additions & 4 deletions src/test/tools/bzlmod/MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/build_defs/repo/cache.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

"""Returns the default canonical id to use for downloads."""

visibility("private")
visibility("public")

DEFAULT_CANONICAL_ID_ENV = "BAZEL_HTTP_RULES_URLS_AS_DEFAULT_CANONICAL_ID"

Expand Down

0 comments on commit 67a07d7

Please sign in to comment.