Skip to content

Add ability to override the download URL manually #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion mojo/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ _PLATFORM_MAPPINGS = {

def _mojo_toolchain_impl(rctx):
rctx.download_and_extract(
url = "https://dl.modular.com/public/nightly/python/max-{}-py3-none-{}.whl".format(
url = rctx.attr.url_override or "https://dl.modular.com/public/nightly/python/max-{}-py3-none-{}.whl".format(
rctx.attr.version,
_PLATFORM_MAPPINGS[rctx.attr.platform],
),
Expand Down Expand Up @@ -47,6 +47,10 @@ _mojo_toolchain_repository = repository_rule(
values = _PLATFORMS,
mandatory = True,
),
"url_override": attr.string(
doc = "Override the download URL for the prebuilt package.",
default = "",
),
"use_prebuilt_packages": attr.bool(
doc = "Whether to automatically add prebuilt mojopkgs to every mojo target.",
mandatory = True,
Expand Down Expand Up @@ -106,6 +110,7 @@ def _mojo_impl(mctx):
name = name,
version = tags.version,
platform = platform,
url_override = tags.url_override,
use_prebuilt_packages = tags.use_prebuilt_packages,
)

Expand All @@ -124,6 +129,10 @@ _toolchain_tag = tag_class(
doc = "The version of the Mojo toolchain to download.",
default = _DEFAULT_VERSION,
),
"url_override": attr.string(
doc = "Override the download URL for the prebuilt package.",
default = "",
),
"use_prebuilt_packages": attr.bool(
doc = "Whether to automatically add prebuilt mojopkgs to every mojo target.",
default = True,
Expand Down