Skip to content

Commit

Permalink
Use stock Rtools toolchain by default for RTools44+
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Jan 4, 2025
1 parent 8710b1f commit 836549c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ jobs:
echo "CMDSTAN_PATH=${HOME}/.cmdstan" >> $GITHUB_ENV
shell: bash

- name: Use stock RTools for Windows R-Devel
if: ${{ matrix.config.os == 'windows-latest' && matrix.config.r == 'devel' }}
run: |
echo "CMDSTANR_USE_RTOOLS=TRUE" >> $GITHUB_ENV
shell: bash

- uses: n1hility/cancel-previous-runs@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
12 changes: 7 additions & 5 deletions R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,8 @@ check_rtools4x_windows_toolchain <- function(fix = FALSE, quiet = FALSE) {
call. = FALSE
)
}
if (Sys.getenv("CMDSTANR_USE_RTOOLS") != "") {
# No additional utilities/toolchains are needed with RTools44
if (rtools4x_version() >= "44" && Sys.getenv("CMDSTANR_USE_MSYS_TOOLCHAIN") == "") {
return(invisible(NULL))
}
if (!is_toolchain_installed(app = "g++", path = toolchain_path) ||
Expand Down Expand Up @@ -855,10 +856,11 @@ toolchain_PATH_env_var <- function() {
}

rtools4x_toolchain_path <- function() {
toolchain <- ifelse(is_ucrt_toolchain(), "ucrt64", "mingw64")
if (Sys.getenv("CMDSTANR_USE_RTOOLS") != "") {
if (arch_is_aarch64()) {
toolchain <- "aarch64-w64-mingw32.static.posix"
if (arch_is_aarch64()) {
toolchain <- "aarch64-w64-mingw32.static.posix"
} else {
if (rtools4x_version() < "44" || Sys.getenv("CMDSTANR_USE_MSYS_TOOLCHAIN") != "") {
toolchain <- ifelse(is_ucrt_toolchain(), "ucrt64", "mingw64")
} else {
toolchain <- "x86_64-w64-mingw32.static.posix"
}
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ arch_is_aarch64 <- function() {
make_cmd <- function() {
if (Sys.getenv("MAKE") != "") {
Sys.getenv("MAKE")
} else if (os_is_windows() && !os_is_wsl() && (Sys.getenv("CMDSTANR_USE_RTOOLS") == "")) {
} else if (os_is_windows() && !os_is_wsl() && (rtools4x_version() < "44" || Sys.getenv("CMDSTANR_USE_MSYS_TOOLCHAIN") != "")) {
"mingw32-make.exe"
} else {
"make"
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-install.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
context("install")
# Current tests need CmdStan 2.35 for stock rtools, but is not yet released
skip_if(Sys.getenv("CMDSTANR_USE_RTOOLS") != "")

cmdstan_test_tarball_url <- Sys.getenv("CMDSTAN_TEST_TARBALL_URL")
if (!nzchar(cmdstan_test_tarball_url)) {
Expand Down

0 comments on commit 836549c

Please sign in to comment.