With this release, we're announcing not just tier 2, but also tier 3 support for the Rust language.
Instead we'll only talk about the key features that you, the consumers, will actually care about. To start, we've started working on a Rust handbook, that outlines how to enable Rust, what kind of integrations we support, and a handful of common questions.
moon are enabled through configuration blocks in
.moon/toolchain.yml, and Rust is no different. We now support a
rust toolchain setting
(view all available settings).
rust setting is defined, it will enable the language and
deep platform integration, and when the
field is defined, it will further enable
toolchain support. Both of these features provide
heavy automation, improving the overall developer experience.
This is fantastic, but what if another Rust project in the monorepo requires a different toolchain
channel/version? If so, they can use the new
moon.yml to define project-level overrides.
rust task platform
The main benefit of Rust language support is that tasks can be ran within the context of our
Rust platform integration. This can easily be done
by setting the project's
language to "rust" in
This will set the
platform of all tasks within the project to
"rust", unless they have been explicitly configured to something else.
If you're mixing languages within a single project, and can't use the
language setting above, you
platform on the task directly.
command: 'cargo build'
We also attempt to detect this automatially by comparing command names and checking for the existence of files like
moon init command
As part of this release, we've also updated the
moon init command to
support initializing Rust. By default, the command will prompt you on whether to install Rust or
not, otherwise, when
--yes is passed, the language will be installed if a
Cargo.toml file is
detected in the destination directory.
If you already have a moon workspace, you can pass
--tool rust to install Rust into the workspace.
$ moon init --tool rust
moon docker commands
And lastly, we also want to provide a great
Dockerfile experience when
using Rust. The
moon docker scaffold command has been updated to
rust-toolchain.toml, and other Rust/Cargo related files. When
using Cargo workspaces, nested
Cargo.toml files are also scaffolded.
RUN moon docker scaffold rust-app
Furthermore, we've also updated the
moon docker prune command to
remove the entire
target directory, greatly reducing the size of the image. Pruning makes the
assumption that it's being ran after a release profile has been built.
RUN moon run rust-app:build-release
RUN moon docker prune
View the official release for a full list of changes.