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

Adding 'toolchain' parameter to control rust builds #20

Merged
merged 3 commits into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 6 additions & 1 deletion R/source.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#' be added to the `Cargo.toml` file.
#' @param profile Rust profile. Can be either `"dev"` or `"release"`. The default,
#' `"dev"`, compiles faster but produces slower code.
#' @param toolchain Rust toolchain. The default, `NULL`, compiles with the
#' system default toolchain. Accepts valid Rust toolchain qualifiers.
#' @param extendr_version Version of the extendr-api crate, provided as a Rust
#' version string. `"*"` will use the latest available version on crates.io.
#' @param extendr_macros_version Version of the extendr-macros crate, if different
Expand Down Expand Up @@ -77,7 +79,9 @@ rust_source <- function(file, code = NULL, dependencies = NULL,
'extendr-api = { git = "https://github.com/extendr/extendr" }',
'extendr-macros = { git = "https://github.com/extendr/extendr" }'
),
profile = c("dev", "release"), extendr_version = "*",
profile = c("dev", "release"),
toolchain = NULL,
extendr_version = "*",
extendr_macros_version = extendr_version,
env = parent.frame(),
use_extendr_api = TRUE,
Expand Down Expand Up @@ -124,6 +128,7 @@ rust_source <- function(file, code = NULL, dependencies = NULL,
status <- system2(
command = "cargo",
args = c(
sprintf("+%s", toolchain),
"build",
"--lib",
if (!is.null(specific_target)) sprintf("--target %s", specific_target) else NULL,
Expand Down
4 changes: 4 additions & 0 deletions man/rust_source.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.