From 836549c5fd405cc26a491239bbff88a1e01a6104 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 4 Jan 2025 19:44:16 +0800 Subject: [PATCH] Use stock Rtools toolchain by default for RTools44+ --- .github/workflows/R-CMD-check.yaml | 6 ------ R/install.R | 12 +++++++----- R/utils.R | 2 +- tests/testthat/test-install.R | 2 -- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 9e23f3e3..efd02cd3 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -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 }} diff --git a/R/install.R b/R/install.R index 9bb2550d..eb244d0a 100644 --- a/R/install.R +++ b/R/install.R @@ -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) || @@ -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" } diff --git a/R/utils.R b/R/utils.R index 8c68641a..f1d7d5a6 100644 --- a/R/utils.R +++ b/R/utils.R @@ -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" diff --git a/tests/testthat/test-install.R b/tests/testthat/test-install.R index 5d415543..211a19c3 100644 --- a/tests/testthat/test-install.R +++ b/tests/testthat/test-install.R @@ -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)) {