From 1346cb68076a9ea2435434d81238773bcf396583 Mon Sep 17 00:00:00 2001 From: David Klein Date: Thu, 20 Jun 2024 11:36:40 +0200 Subject: [PATCH 1/5] Use the folder from which the R session is started as the renv project (not always the main folder). Change renv test back from warning into error. --- .Rprofile | 3 +++ scripts/start/run.R | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.Rprofile b/.Rprofile index bf3c215a9..da9b92df8 100644 --- a/.Rprofile +++ b/.Rprofile @@ -13,6 +13,9 @@ if (file.exists("renv.lock") && file.exists("README.md") && !file.exists("renv/o # do not check if library and renv.lock are in sync, because normally renv.lock does not exist options(renv.config.synchronized.check = FALSE) +# always set the renv project to the current direcotry (formerly done by renv/activate.R under version 0.16.0) +Sys.setenv("RENV_PROJECT" = getwd()) + source("renv/activate.R") # when increasing renvVersion first commit new version's activate script and diff --git a/scripts/start/run.R b/scripts/start/run.R index 5655b1fd8..8fa14b828 100644 --- a/scripts/start/run.R +++ b/scripts/start/run.R @@ -259,7 +259,7 @@ run <- function() { # make sure the renv used for the run is also used for generating output if (!is.null(renv::project())) { if (normalizePath(renv::project()) != normalizePath(outputdir)) { - warning("loaded renv=", normalizePath(renv::project()), " and outputdir=", normalizePath(outputdir), " must be equal.") + stop("loaded renv=", normalizePath(renv::project()), " and outputdir=", normalizePath(outputdir), " must be equal.") } argv <- c(get0("argv"), paste0("--renv=", renv::project())) } From 3bb99e668f31a3a57c21f3bc8778dfa064eed9ae Mon Sep 17 00:00:00 2001 From: David Klein Date: Thu, 20 Jun 2024 12:01:19 +0200 Subject: [PATCH 2/5] Update .Rprofile Co-authored-by: orichters <90761609+orichters@users.noreply.github.com> --- .Rprofile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.Rprofile b/.Rprofile index da9b92df8..3e1a88ed8 100644 --- a/.Rprofile +++ b/.Rprofile @@ -13,7 +13,7 @@ if (file.exists("renv.lock") && file.exists("README.md") && !file.exists("renv/o # do not check if library and renv.lock are in sync, because normally renv.lock does not exist options(renv.config.synchronized.check = FALSE) -# always set the renv project to the current direcotry (formerly done by renv/activate.R under version 0.16.0) +# always set the renv project to the current directory (formerly done by renv/activate.R under version 0.16.0) Sys.setenv("RENV_PROJECT" = getwd()) source("renv/activate.R") From b7d0ef3bd0072c4c5ad12d84b2e4889126826834 Mon Sep 17 00:00:00 2001 From: David Klein Date: Thu, 20 Jun 2024 12:07:10 +0200 Subject: [PATCH 3/5] Reverting previous commit: throw warning instead of error if reporting runs with renv other than that of the run. --- scripts/start/run.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/start/run.R b/scripts/start/run.R index 8fa14b828..cafd1cffd 100644 --- a/scripts/start/run.R +++ b/scripts/start/run.R @@ -259,10 +259,11 @@ run <- function() { # make sure the renv used for the run is also used for generating output if (!is.null(renv::project())) { if (normalizePath(renv::project()) != normalizePath(outputdir)) { - stop("loaded renv=", normalizePath(renv::project()), " and outputdir=", normalizePath(outputdir), " must be equal.") + warning("loaded renv=", normalizePath(renv::project()), " and outputdir=", normalizePath(outputdir), " must be equal.") } argv <- c(get0("argv"), paste0("--renv=", renv::project())) } + message("Using ", normalizePath(renv::project()), " as renv project") sys.source("output.R",envir=new.env()) # get runtime for output From 68bbf7e3cfe5df78ac0145c7b0635d02b638716b Mon Sep 17 00:00:00 2001 From: David Klein Date: Thu, 20 Jun 2024 12:09:30 +0200 Subject: [PATCH 4/5] Shift code up --- scripts/start/run.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/start/run.R b/scripts/start/run.R index cafd1cffd..c5d2baca9 100644 --- a/scripts/start/run.R +++ b/scripts/start/run.R @@ -261,9 +261,10 @@ run <- function() { if (normalizePath(renv::project()) != normalizePath(outputdir)) { warning("loaded renv=", normalizePath(renv::project()), " and outputdir=", normalizePath(outputdir), " must be equal.") } + message("Using ", normalizePath(renv::project()), " as renv project") argv <- c(get0("argv"), paste0("--renv=", renv::project())) } - message("Using ", normalizePath(renv::project()), " as renv project") + sys.source("output.R",envir=new.env()) # get runtime for output From 25d7c967fbbd3e956107975bea8f287c44065467 Mon Sep 17 00:00:00 2001 From: David Klein Date: Thu, 20 Jun 2024 12:10:17 +0200 Subject: [PATCH 5/5] Remove empty line --- scripts/start/run.R | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/start/run.R b/scripts/start/run.R index c5d2baca9..15ad01541 100644 --- a/scripts/start/run.R +++ b/scripts/start/run.R @@ -264,7 +264,6 @@ run <- function() { message("Using ", normalizePath(renv::project()), " as renv project") argv <- c(get0("argv"), paste0("--renv=", renv::project())) } - sys.source("output.R",envir=new.env()) # get runtime for output