Packages
rustler
0.2.0
0.38.0
0.37.3
0.37.1
0.37.0
retired
0.36.2
0.36.1
0.36.0
0.35.1
0.35.0
0.34.0
0.33.0
0.32.1
0.31.0
0.30.0
0.29.1
0.29.0
0.28.0
0.27.0
0.26.0
0.25.0
0.24.0
0.23.0
0.22.2
0.22.1
0.22.0
0.22.0-rc.2
0.22.0-rc.1
0.22.0-rc.0
0.21.1
0.21.0
0.20.0
0.19.1
0.19.0
0.18.0
0.17.1
0.17.0
0.16.0
0.10.1
0.10.0
0.9.0
0.8.0
0.7.0
0.6.0
0.5.0
0.4.0
0.3.2
0.3.1
0.3.0
0.2.0
0.1.1
0.1.0
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
Mix compiler and runtime helpers for Rustler.
Current section
Files
Jump to
Current section
Files
lib/compiler/rustup.ex
defmodule Rustler.Compiler.Rustup do
def rustup_binary, do: System.get_env("RUSTUP_BINARY") || "rustup"
def version do
multirust_exec = System.find_executable(rustup_binary)
if multirust_exec == nil do
:none
else
{version, 0} = System.cmd(rustup_binary, ["--version"])
{:ok, version}
end
end
def version_installed?(version) do
{_resp, return} = System.cmd(rustup_binary, ["run", version, "rustc", "--version"])
case return do
0 -> true
_ -> false
end
end
#def rust_versions do
# {versions_raw, 0} = System.cmd("rustup", ["list-toolchains"])
# versions_raw
# |> String.strip(?\n)
# |> String.split("\n")
#end
def install_toolchain(version) do
{_resp, 0} = System.cmd(rustup_binary, ["install", version],
into: IO.stream(:stdio, :line))
end
def compile_with(path, version, args \\ [], env \\ [], into \\ "") do
System.cmd(rustup_binary, ["run", version, "cargo", "build" | args],
cd: path, into: into, env: env)
end
end