You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the help of BellLabs (bell-sw/Liberica#42) we now also have Liberica macOS integration support. It doesn't work for all versions we can install, so it logs a warning in case it's not possible to use their "trick".
For this to work we depend on @joschi java-metadata project. This project provides the shasum (and with that the check if the .pkg version exists).
Other things done:
- Fail if commands fail
- Fixed unzip check
- All error messages go to stderr
- Aligned indent to 4 spaces
- Removed all echo's in favor of printf in line with asdf-vm/asdf#806
- Use the bash [[ conditions
Copy file name to clipboardExpand all lines: README.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,4 +61,7 @@ Setting java_macos_integration_enable to yes on `.asdfrc` file enables this inte
61
61
java_macos_integration_enable = yes
62
62
```
63
63
64
-
_Note: Not all distributions of Java JDK packages offer this integration (eg. liberica). This option only works for packages that **do offer** that integration._
64
+
### Liberica
65
+
The Liberica distributions this plugin uses do not [contain the needed files for the macOS integration](https://github.com/bell-sw/Liberica/issues/42).
66
+
The plugin will try to download the `.pkg` distribution for the same version, but this does not always exist.
67
+
If it doesn't exist this plugin cannot provide the macOS Integration for that version. It will log a warning when that happens.
if [[ "${http_status}"="200"&&"${#new_checksum}"-gt 0 ]];then
104
+
package_filename=${new_package_filename}
105
+
package_link=${package_link/tar.gz/pkg}
106
+
package_link=${package_link/zip/pkg}
107
+
IFS=""read -r -a checksum_parts <<<"${new_checksum}"
108
+
checksum=${checksum_parts[0]}
109
+
else
110
+
>&2printf"Could not find a PKG version of %s so the macOS java_home integration will not work for this version\nSee https://github.com/halcyon/asdf-java/blob/master/README.md for more information\n""${ASDF_INSTALL_VERSION}"
if [ "$(get_asdf_config_value "java_macos_integration_enable")"="yes" ];then
126
-
echo"The ZIP packages of liberica do not contain the required files (Info.plist and the MacOS folder) to make /usr/libexec/java_home work correctly. You need the .pkg version to get those files."
153
+
if [[ "$(get_asdf_config_value "java_macos_integration_enable")"="yes"&&
if [ "$(get_asdf_config_value "java_macos_integration_enable")"="yes" ];then
149
-
java_macos_integration_remove
150
-
fi
151
-
fi
179
+
if [[ -n"${ASDF_INSTALL_VERSION}"&&"$(get_asdf_config_value "java_macos_integration_enable")"="yes" ]];then
180
+
java_macos_integration_remove
181
+
fi
152
182
esac
153
183
rm -rf "${ASDF_INSTALL_PATH}"
154
184
}
155
185
156
186
functionjava_macos_integration_remove {
157
-
printf"Removing the integration with /usr/libexec/java_home needs root permission to delete the folder at /Library/Java/JavaVirtualMachines/%s\n""${ASDF_INSTALL_VERSION}"
if [[ -d"/Library/Java/JavaVirtualMachines/${ASDF_INSTALL_VERSION}" ]];then
188
+
printf"Removing the integration with /usr/libexec/java_home needs root permission to delete the folder at /Library/Java/JavaVirtualMachines/%s\n""${ASDF_INSTALL_VERSION}"
0 commit comments