forked from halcyon/asdf-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
8 changed files
with
188 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{y,ya}ml] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
function asdf_update_java_home --on-event fish_prompt | ||
set --local java_path (asdf which java) | ||
if test -n "$java_path" | ||
set --local full_path (builtin realpath "$java_path") | ||
|
||
# `builtin realpath` returns $JAVA_HOME/bin/java, so we need two `dirname` calls | ||
# in order to get the correct JAVA_HOME directory | ||
set -gx JAVA_HOME (dirname (dirname "$full_path")) | ||
end | ||
set --local java_path (asdf which java) | ||
if test -n "$java_path" | ||
set --local full_path (builtin realpath "$java_path") | ||
|
||
switch (uname) | ||
case Darwin | ||
if test $java_path = "/usr/bin/java" | ||
set -gx JAVA_HOME (/usr/libexec/java_home) | ||
else | ||
# `builtin realpath` returns $JAVA_HOME/bin/java, so we need two `dirname` calls | ||
# in order to get the correct JAVA_HOME directory | ||
set -gx JAVA_HOME (dirname (dirname "$full_path")) | ||
end | ||
case '*' | ||
# `builtin realpath` returns $JAVA_HOME/bin/java, so we need two `dirname` calls | ||
# in order to get the correct JAVA_HOME directory | ||
set -gx JAVA_HOME (dirname (dirname "$full_path")) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters