Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Xamarin.Android.Tools.AndroidSdk/AndroidSdkInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static void DetectAndSetPreferredJavaSdkPathToLatest (Action<TraceLevel,

logger = logger ?? DefaultConsoleLogger;

var latestJdk = MicrosoftOpenJdkLocations.GetMicrosoftOpenJdks (logger).FirstOrDefault ();
var latestJdk = JdkInfo.GetPreferredJdkInfos (logger).FirstOrDefault ();
if (latestJdk == null)
throw new NotSupportedException ("No Microsoft OpenJDK could be found. Please re-run the Visual Studio installer or manually specify the JDK path in settings.");

Expand Down
9 changes: 9 additions & 0 deletions src/Xamarin.Android.Tools.AndroidSdk/JdkInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ static Dictionary<string, List<string>> GetJavaProperties (string java)
return props;
}

// Keep ordering in sync w/ GetPreferredJdkInfos
public static IEnumerable<JdkInfo> GetKnownSystemJdkInfos (Action<TraceLevel, string>? logger = null)
{
logger = logger ?? AndroidSdkInfo.DefaultConsoleLogger;
Expand All @@ -300,6 +301,14 @@ public static IEnumerable<JdkInfo> GetKnownSystemJdkInfos (Action<TraceLevel, st
;
}

// Keep ordering in sync w/ GetKnownSystemJdkInfos
internal static IEnumerable<JdkInfo> GetPreferredJdkInfos (Action<TraceLevel, string> logger)
{
return MicrosoftOpenJdkLocations.GetMicrosoftOpenJdks (logger)
.Concat (MicrosoftDistJdkLocations.GetMicrosoftDistJdks (logger))
;
}

internal static JdkInfo? TryGetJdkInfo (string path, Action<TraceLevel, string> logger, string locator)
{
JdkInfo? jdk = null;
Expand Down