From 9fd59c57318c53f6f28b730a2bf26c4709c41f2a Mon Sep 17 00:00:00 2001 From: Don van den Bergh Date: Tue, 8 Oct 2024 16:49:08 +0200 Subject: [PATCH] ensure new data reading is backwards compatible (#47) --- R/dataset.R | 2 +- R/options.R | 5 ++++- R/rbridge.R | 2 +- R/run.R | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/R/dataset.R b/R/dataset.R index 30f00c3..206b0ce 100644 --- a/R/dataset.R +++ b/R/dataset.R @@ -59,7 +59,7 @@ preloadDataset <- function(datasetPathOrObject, options) { dataset <- convertToTypes(dataset[variables], types, datasetPathOrObject) - .setInternal("dataset", dataset) + .setInternal("preloadedDataset", dataset) } diff --git a/R/options.R b/R/options.R index a49569d..028ba73 100644 --- a/R/options.R +++ b/R/options.R @@ -299,7 +299,10 @@ parsePreloadDataFromDescriptionQml <- function(analysisName) { preloadData <- isTRUE(description[["Description"]][["preloadData"]]) || isTRUE(description[[analysisName]][["preloadData"]]) if (!preloadData) - warning("Analysis ", analysisName, " does not preload data. Please update the code.") + lifecycle::deprecate_warn( + when = "0.19.2", + what = I(sprintf("The analysis `%s` does not preload data. Please update inst/Description.qml, add `preloadData: true`, and fix any minor issues.", analysisName)) + ) return(preloadData) diff --git a/R/rbridge.R b/R/rbridge.R index 49ae5ab..9aa5359 100644 --- a/R/rbridge.R +++ b/R/rbridge.R @@ -53,7 +53,7 @@ } .readDataSetRequestedNative <- function() { - return(.getInternal("dataset")) + return(.getInternal("preloadedDataset")) } .requestTempFileNameNative <- function(...) { diff --git a/R/run.R b/R/run.R index 1fd32c3..6bac20a 100644 --- a/R/run.R +++ b/R/run.R @@ -140,6 +140,7 @@ initAnalysisRuntime <- function(dataset, options, makeTests, ...) { reinstallChangedModules() # dataset to be found in the analysis when it needs to be read + .setInternal("dataset", dataset) preloadDataset(dataset, options) # prevent the results from being translated (unless the user explicitly wants to)