Skip to content

Commit efd192b

Browse files
authored
Add ability to override the download URL manually (#9)
1 parent fcfda29 commit efd192b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

mojo/extensions.bzl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ _PLATFORM_MAPPINGS = {
1717

1818
def _mojo_toolchain_impl(rctx):
1919
rctx.download_and_extract(
20-
url = "https://dl.modular.com/public/nightly/python/max-{}-py3-none-{}.whl".format(
20+
url = rctx.attr.url_override or "https://dl.modular.com/public/nightly/python/max-{}-py3-none-{}.whl".format(
2121
rctx.attr.version,
2222
_PLATFORM_MAPPINGS[rctx.attr.platform],
2323
),
@@ -47,6 +47,10 @@ _mojo_toolchain_repository = repository_rule(
4747
values = _PLATFORMS,
4848
mandatory = True,
4949
),
50+
"url_override": attr.string(
51+
doc = "Override the download URL for the prebuilt package.",
52+
default = "",
53+
),
5054
"use_prebuilt_packages": attr.bool(
5155
doc = "Whether to automatically add prebuilt mojopkgs to every mojo target.",
5256
mandatory = True,
@@ -106,6 +110,7 @@ def _mojo_impl(mctx):
106110
name = name,
107111
version = tags.version,
108112
platform = platform,
113+
url_override = tags.url_override,
109114
use_prebuilt_packages = tags.use_prebuilt_packages,
110115
)
111116

@@ -124,6 +129,10 @@ _toolchain_tag = tag_class(
124129
doc = "The version of the Mojo toolchain to download.",
125130
default = _DEFAULT_VERSION,
126131
),
132+
"url_override": attr.string(
133+
doc = "Override the download URL for the prebuilt package.",
134+
default = "",
135+
),
127136
"use_prebuilt_packages": attr.bool(
128137
doc = "Whether to automatically add prebuilt mojopkgs to every mojo target.",
129138
default = True,

0 commit comments

Comments
 (0)