e-kotov / rJavaEnv

Java Environments for R Projects
http://www.ekotov.pro/rJavaEnv/
Other
7 stars 0 forks source link

Address issue #6 rework env set/unset and install to implement global installation of Java for all R sessions #7

Closed e-kotov closed 4 days ago

e-kotov commented 2 weeks ago

Address issue #6

rework env set/unset and install to implement global installation of Java for all R sessions

Updated behaviour is as follows.

You can now install Java locally in the current project or globally for all projects.

This code will install globally by adding to the global .Rprofile file in the user's home directory. We need "session" to immediately set this path in the current session too so that we can use it right away.

library(rJavaEnv)
java_quick_install(8, where = c("session", "global"))

To revert:

java_env_unset('global')

To install Java in the current project, as before you can

java_quick_install(8)

and it defaults to "project" and "session".

To unset:

java_env_unset('project')

Perhaps this is a bit too cumbersome... Maybe it is worth keeping the flexibility of java_env_set() to accept combinations of "project", "global" and "session", but for java_quick_install() it would be enough to just use either "project" or "global" and avoid "session" and always set the newly quick installed environment in the current session, as it is logical that the user want to use it right away. But for java_install() and java_env_set() I would keep the flexibility and defaults as is, because they can potentially be used to install and set multiple java versions independently in R subprocesses, for example in workers spawned by targets.

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 0% with 82 lines in your changes missing coverage. Please review.

Project coverage is 0.00%. Comparing base (a72e85b) to head (67f40ef). Report is 2 commits behind head on main.

Files Patch % Lines
R/java_install.R 0.00% 41 Missing :warning:
R/java_env.R 0.00% 36 Missing :warning:
R/java_download.R 0.00% 4 Missing :warning:
R/java_quick_install.R 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #7 +/- ## ===================================== Coverage 0.00% 0.00% ===================================== Files 9 9 Lines 499 528 +29 ===================================== - Misses 499 528 +29 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

e-kotov commented 4 days ago

Will not merge to implement #6 , as

modifying .Rprofile is a really, really bad idea and is illegal on CRAN (https://github.com/e-kotov/rJavaEnv/issues/3#issuecomment-2182809726)

That is, the global .Rprofile. Current folder/project .Rprofile is ok.