Skip to content

About

bazel rules for building Mojo 🔥

Resources

Stars

23 stars

Watchers

5 watching

Forks

Latest commit

 

History

122 Commits

Folders and files

Repository files navigation

rules_mojo

This repository provides Bazel rules for building Mojo projects.

Requirements

rules_mojo requires Bzlmod and Bazel 8 or later.

Example

In MODULE.bazel, replace <rules_mojo_version> with a published version from the Bazel Central Registry and <mojo_version> with the Mojo version you want to use:

bazel_dep(name = "rules_mojo", version = "<rules_mojo_version>")

mojo = use_extension("@rules_mojo//mojo:extensions.bzl", "mojo")
mojo.toolchain(version = "<mojo_version>")

Omit version from mojo.toolchain() to use the default Mojo toolchain. See the toolchain definitions for the default version and pinned releases. Unlisted nightly versions are downloaded without pinned checksums.

Then define a mojo_binary target in BUILD.bazel:

load("@rules_mojo//mojo:mojo_binary.bzl", "mojo_binary")

mojo_binary(
    name = "hello_mojo",
    srcs = ["hello_mojo.mojo"],
)

See the tests directory for more examples.

About

bazel rules for building Mojo 🔥

Resources

Stars

23 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages