Skip to content

add support for macos integration#858

Merged
jdx merged 9 commits intojdx:mainfrom
roele:issues/857
Aug 30, 2023
Merged

add support for macos integration#858
jdx merged 9 commits intojdx:mainfrom
roele:issues/857

Conversation

@roele
Copy link
Copy Markdown
Contributor

@roele roele commented Aug 28, 2023

This is first rough draft. Which works with with sudo, what i currently don't like yet is that using sudo installs the JDK with root as the owner which currently fails with an unspecific error (since installation is removed before the symlink remove is attempted). Having root as owner potentially leads to other issues as well.

$ sudo env RTX_JAVA_MACOS_INTEGRATION=true .bin/rtx install java@corretto-20.0.2.10.1
$ /usr/libexec/java_home -V
$ sudo env .bin/rtx uninstall java@corretto-20.0.2.10.1
$ /usr/libexec/java_home -V

@roele roele changed the title add support for macos integration #857 add support for macos integration Aug 28, 2023
@roele roele changed the title #857 add support for macos integration add support for macos integration Aug 28, 2023
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 28, 2023

Codecov Report

Patch coverage: 12.50% and project coverage change: -0.16% ⚠️

Comparison is base (10647a9) 87.62% compared to head (b5b87a6) 87.47%.

❗ Current head b5b87a6 differs from pull request most recent head 5aabc9c. Consider uploading reports for the commit 5aabc9c to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #858      +/-   ##
==========================================
- Coverage   87.62%   87.47%   -0.16%     
==========================================
  Files         132      132              
  Lines       11552    11576      +24     
==========================================
+ Hits        10123    10126       +3     
- Misses       1429     1450      +21     
Files Changed Coverage Δ
src/plugins/core/java.rs 84.67% <12.50%> (-7.31%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jdx
Copy link
Copy Markdown
Owner

jdx commented Aug 28, 2023

thanks for taking this on, I have been looking at this over the past couple of weeks but have't found the time to work on it

@roele roele marked this pull request as ready for review August 28, 2023 18:46
Copy link
Copy Markdown
Owner

@jdx jdx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will try to test this myself probably tomorrow

docs/java.md Outdated

```sh
sudo mkdir /Library/Java/JavaVirtualMachines/openjdk-20
ln -s ~/.local/share/rtx/installs/java/openjdk-20/Contents /Library/Java/JavaVirtualMachines/openjdk-20/Contents
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs sudo as well

@roele
Copy link
Copy Markdown
Contributor Author

roele commented Aug 28, 2023

Great. Thanks @jdx.

Ran some manual tests with almost all distributions. Iberica does not ship with the required files and Zulu has the files but they're located in a different sub-folder (e.g. zulu-11.jdk). Added an additional comment in the docs about that.

&tv.install_path().join("Contents").join("Home"),
)?;
info!(
"To enable macOS integration, run the following commands: \
Copy link
Copy Markdown
Owner

@jdx jdx Aug 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the backslashes so it prints on multiple lines, this is hard to read
CleanShot 2023-08-29 at 14 04 21@2x

also, at least on my machine it looks like the convention is to add ".jdk" to the end of the directory name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, the output is not optimal and mixes even different output types (progress message java -version).
you're probably right, package installation folders usually end in .jdk even though it also seems to work fine without.

&tv.install_path().join("Contents").join("Home"),
)?;
info!(
"To enable macOS integration, run the following commands:\n\
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rust supports linebreaks inside of strings so you can just remove the end of these lines entirely

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried that, it interpreted the spaces in front of the commands

Copy link
Copy Markdown
Owner

@jdx jdx Aug 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdx jdx merged commit 21fcc4e into jdx:main Aug 30, 2023
@roele roele deleted the issues/857 branch October 14, 2023 09:08
jdx pushed a commit that referenced this pull request Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants