diff --git a/.Rbuildignore b/.Rbuildignore index 3ebf95b..5ffb68d 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -24,3 +24,4 @@ ^vignettes/.quarto$ ^revdep$ ^man/figures/card.png$ +^tools$ diff --git a/DESCRIPTION b/DESCRIPTION index 42c8f68..dbee341 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: rJavaEnv Title: 'Java' Environments for R Projects -Version: 0.2.1 +Version: 0.2.1.9000 Authors@R: c( person("Egor", "Kotov", , "kotov.egor@gmail.com", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0001-6690-5345")), diff --git a/NEWS.md b/NEWS.md index df004fc..2979d2f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,5 @@ +# rJavaEnv (development version) + # rJavaEnv 0.2.1 (2024-09-03) * Documentation and description clean-up diff --git a/R/java_env.R b/R/java_env.R index 5edcc5f..9727244 100644 --- a/R/java_env.R +++ b/R/java_env.R @@ -84,13 +84,14 @@ java_env_set <- function( java_env_set_session <- function(java_home) { # check if rJava is installed and alread initialized - if (requireNamespace("rJava", quietly = TRUE)) { - if( getFromNamespace(".jniInitialized", "rJava") == TRUE ) { - cli::cli_inform(c("!" = "You have already initialised `rJava` directly or via your Java-dependent R package in the current session. `Java` version can only be set once per session for packages that rely on `rJava`. Unless you restart the R session or run your code in a new R subprocess using `targets` or `callr`, the new `JAVA_HOME` and `PATH` will not take effect.")) + if (any(installed.packages()[, 1] == "rJava")) { + if( "rJava" %in% loadedNamespaces() == TRUE ) { + cli::cli_inform(c("!" = "You have `rJava` R package loaded in the current session. If you have already initialised it directly with ``rJava::.jinit()` or via your Java-dependent R package in the current session, you may not be able to switch to a different `Java` version unless you restart R. `Java` version can only be set once per session for packages that rely on `rJava`. Unless you restart the R session or run your code in a new R subprocess using `targets` or `callr`, the new `JAVA_HOME` and `PATH` will not take effect.")) } } Sys.setenv(JAVA_HOME = java_home) + old_path <- Sys.getenv("PATH") new_path <- file.path(java_home, "bin") Sys.setenv(PATH = paste(new_path, old_path, sep = .Platform$path.sep)) diff --git a/tools/meta-data-update-and-submission.R b/tools/meta-data-update-and-submission.R new file mode 100644 index 0000000..6ae5193 --- /dev/null +++ b/tools/meta-data-update-and-submission.R @@ -0,0 +1,14 @@ +# before release +# usethis::use_version("patch") +cffr::cff_write() +codemetar::write_codemeta(write_minimeta = T) +usethis::use_tidy_description() +# urlchecker::url_check() +# devtools::check(remote = TRUE, manual = TRUE) +# devtools::check_win_devel() +# revdepcheck::revdep_check(num_workers = 4) + +# devtools::submit_cran() + +# usethis::use_github_release() +# usethis::use_dev_version(push = TRUE)