Skip to content
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

Allow specifying a channel for the system rustc #347

Merged
merged 2 commits into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions rustler_mix/lib/rustler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ defmodule Rustler do
## Configuration options

* `:cargo` - Specify how to envoke the rust compiler. Options are:
- `:system` (default) - use `cargo` from the system (must by in `$PATH`)
- `:system` (default) - use `cargo` from the system (must be in `$PATH`)
- `{:system, <channel>}` - use `cargo` from the system with the given channel.
Specified as a string, passed directly to `cargo` (e.g. "+nightly").
- `{:rustup, <version>}` - use `rustup` to specify which channel to use.
Available options include: `:stable`, `:beta`, `:nightly`, or a string
which specifies a specific version (i.e. `"1.39.0"`).
which specifies a specific version (e.g. `"1.39.0"`).
- `{:bin, "/path/to/binary"}` - provide a specific path to `cargo`.

* `:crate` - the name of the Rust crate, if different from your `otp_app`
Expand Down
1 change: 1 addition & 0 deletions rustler_mix/lib/rustler/compiler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ defmodule Rustler.Compiler do
end

defp make_base_command(:system), do: ["cargo", "rustc"]
defp make_base_command({:system, channel}), do: ["cargo", channel, "rustc"]
evnu marked this conversation as resolved.
Show resolved Hide resolved
defp make_base_command({:bin, path}), do: [path, "rustc"]

defp make_base_command({:rustup, version}) do
Expand Down