-
Notifications
You must be signed in to change notification settings - Fork 31
[Xamarin.Android.Tools.AndroidSdk] Probe for Zulu JDK #114
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
Conversation
|
TODO: write a better commit message. (It's a draft!) "Primary" motivation is to add support for the Azul Zulu JDK. "Secondary" motivation -- which is most of the diff, by far -- is to bring a degree of sanity here. Previously, For me, at least, this makes understanding the lookups "weird". Unify these systems, creating 6 "JDK Location" classes which know where to look for one and only one "JDK", for both macOS & Windows, and use these unified "finders" within I find this a tad "cleaner". Keep in mind that we'll be wanting to add Yet Another JDK location next week, for Adopt OpenJDK, so I find making things "more understandable" to be a benefit. |
grendello
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I wonder if we should have a class that also looks in ~/android-toolchain/jdk without having to put that location in JAVA_HOME? I know it would work only on systems where one builds Xamarin.Android, but it should be harmless on other machines while making it easier to use XA JDK as the main one on developer's machine.
src/Xamarin.Android.Tools.AndroidSdk/Jdks/OracleJdkLocations.cs
Outdated
Show resolved
Hide resolved
src/Xamarin.Android.Tools.AndroidSdk/Jdks/OracleJdkLocations.cs
Outdated
Show resolved
Hide resolved
|
|
||
| if (!string.IsNullOrEmpty (currentVersion)) { | ||
|
|
||
| // No matter what the CurrentVersion is, look for 1.6 or 1.7 or 1.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is outdated
Context: https://www.azul.com/downloads/zulu-community/ Commit 237642c removed support for the ancient `microsoft_dist_openjdk_*` versions, replacing it with the newer [Microsoft OpenJDK][0]. One problem with this change is one of *compatibility*: `microsoft_dist_openjdk_` was a build of JDK 1.8, while Microsoft OpenJDK only provides builds for JDK 11 and later. This is a problem, as the [Visual Studio Android Designer][1] currently requires JDK 1.8, and is not yet compatible with JDK 11. Add support to probe for for [Azul Zulu OpenJDK][2] installation directories, as Zulu provides updated JDK 1.8 installers. Additionally, refactor and centralize the JDK Location logic. Previously, `JdkInfo.GetKnownSystemJdkInfos()` would return all of the Windows installation locations before the macOS/Linux/etc. locations, which made it possible for Windows and non-Windows platforms to return paths in an inconsistent order. Introduce a new `JdkLocations` helper, and add new subclasses for each specific JDK location, so that `JdkInfo.GetKnownSystemJdkInfos()` can be *unified* across macOS/Linux & Windows, increasing consistency. Add a new `tools/ls-jdks` tool, to make it easier to print all probed JDK locations. [0]: https://www.microsoft.com/openjdk [1]: https://docs.microsoft.com/en-us/xamarin/android/user-interface/android-designer/designer-walkthrough?tabs=windows [2]: https://www.azul.com/downloads/zulu-community/?package=jdk
Context: https://www.azul.com/downloads/zulu-community/
Commit 237642c removed support for the ancient
microsoft_dist_openjdk_*versions, replacing it with the newerMicrosoft OpenJDK.
One problem with this change is one of compatibility:
microsoft_dist_openjdk_was a build of JDK 1.8, whileMicrosoft OpenJDK only provides builds for JDK 11 and later.
This is a problem, as the Visual Studio Android Designer
currently requires JDK 1.8, and is not yet compatible with JDK 11.
Add support to probe for for Azul Zulu OpenJDK installation
directories, as Zulu provides updated JDK 1.8 installers.
Additionally, refactor and centralize the JDK Location logic.
Previously,
JdkInfo.GetKnownSystemJdkInfos()would return all ofthe Windows installation locations before the macOS/Linux/etc.
locations, which made it possible for Windows and non-Windows
platforms to return paths in an inconsistent order. Introduce a new
JdkLocationshelper, and add new subclasses for each specific JDKlocation, so that
JdkInfo.GetKnownSystemJdkInfos()can be unifiedacross macOS/Linux & Windows, increasing consistency.
Add a new
tools/ls-jdkstool, to make it easier to print all probedJDK locations.