Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System Java now works on macOS #142

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

delgurth
Copy link
Contributor

@delgurth delgurth commented Apr 5, 2021

Fixes #132

Added special case for macOS in all 4 set-java-home scripts. Also created tests to validate this.

Updated the README.md to contain information on how to use the set-java-home scripts.

Cloned mstksg/get-package and released delgurth/get-package@v3 because it was using linuxbrew on Ubuntu and because I needed the apt-update (not released by mstksg) and -y flag in the apt-get install (when running github action on https://github.com/nektos/act). I've created an issue in the mstksg repository about this.

added .editorconfig because of mixed indent styles
added .gitignore to ignore Intellij directory

asdf/asdf.sh needs $PWD in front as soon as you change directories

added tests for JAVA_HOME setting
added tests for macOS JAVA_HOME setting in case version is set to system

Unfortunately the tests are not exactly as it would be on a system because of the way github actions spawn shells. Have to call the bash function _asdf_java_prompt_command and the fish & zsh function asdf_update_java_home to actually update the JAVA_HOME.

@delgurth delgurth mentioned this pull request Apr 5, 2021
@delgurth delgurth marked this pull request as draft April 6, 2021 12:41
@delgurth delgurth marked this pull request as ready for review April 6, 2021 12:50
@delgurth delgurth marked this pull request as draft April 6, 2021 16:55
@delgurth delgurth force-pushed the fix-macos-system-ready-for-pull branch from 241a906 to 5ef46c0 Compare April 6, 2021 17:07
delgurth added 2 commits April 6, 2021 19:36
Fixes halcyon#132

Added special case for macOS in all 4 set-java-home scripts. Also created tests to validate this. Unfortunately xonsh does not seem to have a way to exit with other status then 0, so this will not report errors (yet).

Updated the README.md to contain information on how to use the set-java-home scripts.

Cloned mstksg/get-package and released delgurth/get-package@v3 because it was using linuxbrew on Ubuntu and because I needed the apt-update (not released by mstksg) and -y flag in the apt-get install (when running github action on https://github.com/nektos/act)

added .editorconfig because of mixed indent styles
added .gitignore to ignore Intellij directory

asdf/asdf.sh needs $PWD in front as soon as you change directories

added tests for JAVA_HOME setting
added tests for macOS JAVA_HOME setting in case version is set to system

Unfortunately the tests are not exactly as it would be on a system because of the way github actions spawn shells. Have to call the bash function _asdf_java_prompt_command and the fish & zsh function asdf_update_java_home to actually update the JAVA_HOME.
…w fail with an error if something is wrong. Also suppressed output of the grep commands, we are only interested in the command result status, not in the output.
@delgurth delgurth force-pushed the fix-macos-system-ready-for-pull branch from 5ef46c0 to a0f78f5 Compare April 6, 2021 18:00
@delgurth delgurth marked this pull request as ready for review April 6, 2021 18:00
.editorconfig Outdated Show resolved Hide resolved
@halcyon
Copy link
Owner

halcyon commented Apr 6, 2021

LGTM.

@joschi thoughts?

@delgurth
Copy link
Contributor Author

@joschi did you have time to look at this pull-request?

@@ -16,10 +16,10 @@ jobs:
TERM: dumb
steps:
- uses: actions/checkout@v2
- uses: mstksg/get-package@v1
- uses: delgurth/get-package@v3
Copy link
Contributor

Choose a reason for hiding this comment

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

Any specific reason the replace the GitHub Action here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there was a specific reason, v1 installed packages twice on newer Ubuntu images, once via brew and once via the normal apt-get. mstksg/get-package#5

@@ -0,0 +1,5 @@
[*]
indent_style = space
indent_size = 2
Copy link
Contributor

Choose a reason for hiding this comment

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

@delgurth Could you please either update the indent_size in .editorconfig to match the existing code or remove the file altogether, and revert the whitespace related changes in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll remove all formatting changes. I've tried to align it, but if I recall correctly the formatting was different in different parts of the codebase.

echo "java_macos_integration_enable = yes" > "${ASDF_CONFIG_FILE}"
. $PWD/asdf/asdf.sh
asdf plugin add java "$GITHUB_WORKSPACE"
asdf install java adoptopenjdk-8.0.252+9.1.openj9-0.20.0
Copy link
Contributor

Choose a reason for hiding this comment

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

After the changes in #140, this (and all subsequent usages of this identifier in this file) should probably be adoptopenjdk-openj9-8.0.252+9.1.openj9-0.20.0 or adoptopenjdk-8.0.252+9.1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will see what is needed now to get things to work again properly. Been a long time since I last worked on this...

@@ -0,0 +1 @@
.idea/
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we remove this file again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added this since I'm working from IntelliJ IDEA. This way I prevent my IDEA setup to be checked in, which I think is preferable?

Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -11,46 +11,51 @@
- [unzip](http://infozip.sourceforge.net/UnZip.html)
- [jq](https://stedolan.github.io/jq/) (only for updating the release data)

_Besides bash (the shell used by the maintainer) this plugin **should** work on Fish, Zsh and Xonsh_
Copy link
Contributor

Choose a reason for hiding this comment

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

The tests in the GitHub workflows should show that it's working. 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, but I wanted to make clear what was guaranteed. Getting the Xonsh part to work properly took me quite some time, which annoyed me a bit. That's what made me add this line.

@akkadaya
Copy link

Why this PR is still open since 2021-04-05?

@halcyon
Copy link
Owner

halcyon commented Jan 19, 2023

It's still open because the issues joschi commented on were not resolved.

@delgurth
Copy link
Contributor Author

I'll try to redo the work, since it's giving quite some conflicts now.

@mrmeszaros
Copy link

@delgurth if You need help, please let me know, I would be glad to help out

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.

Plugin prevents system Java from working
5 participants