This repository was archived by the owner on Jul 13, 2026. It is now read-only.
[Xamarin.Android.Tools.AndroidSdk] Don't check Linux paths on Windows - #250
Merged
jonpryor merged 2 commits intoMar 21, 2025
Merged
Conversation
OS-specific JDK locators should only be used on the OS that they're intended for. Remove checks for Linux JDK probe mechanisms such as `/usr/libexec/java_home` and `/usr/lib/jvm/*` from Windows & macOS.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR ensures Linux-specific JDK locator mechanisms are only executed on Linux by introducing an OS.IsLinux check.
- Added OS.IsLinux checks in GetLibexecJdkPaths, GetJavaAlternativesJdkPaths, and GetLibJvmJdkPaths in JdkInfo.cs.
- Added the OS.IsLinux property in OS.cs and updated NativeLibraryFormat initialization accordingly.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Xamarin.Android.Tools.AndroidSdk/JdkInfo.cs | Added Linux OS checks to conditionally execute Linux-specific code. |
| src/Xamarin.Android.Tools.AndroidSdk/OS.cs | Introduced OS.IsLinux and updated library format assignment based on the OS. |
grendello
approved these changes
Mar 20, 2025
dellis1972
approved these changes
Mar 20, 2025
`/usr/libexec/java_home` is a macOS-ism, not a Linux-ism. Fix the OS check. `GetMacOSMicrosoftDistJdkPaths()` is also macOS-specific.
jonpryor
deleted the
dev/jonp/jonp-do-not-use-os-specific-paths-on-other-os
branch
March 21, 2025 12:24
jonpryor
added a commit
to dotnet/android
that referenced
this pull request
Mar 21, 2025
Changes: dotnet/android-tools@ac8d0ee...0658bc6 * dotnet/android-tools@0658bc6: [Xamarin.Android.Tools.AndroidSdk] OS-specific dirs are OS-specific (dotnet/android-tools#250)
jonpryor
added a commit
that referenced
this pull request
Mar 21, 2025
…250) OS-specific JDK locators should only be attempted on the OS that they're intended for: macOS-specific JDK probe mechanisms such as `/usr/libexec/java_home -X` should only be used on macOS, and Linux-specific JDK probe mechanisms such as looking at `/usr/lib/jvm/*` should only be done on Linux.
jonpryor
added a commit
that referenced
this pull request
Mar 21, 2025
…250) OS-specific JDK locators should only be attempted on the OS that they're intended for: macOS-specific JDK probe mechanisms such as `/usr/libexec/java_home -X` should only be used on macOS, and Linux-specific JDK probe mechanisms such as looking at `/usr/lib/jvm/*` should only be done on Linux.
jonpryor
added a commit
to dotnet/android
that referenced
this pull request
Mar 21, 2025
Changes: dotnet/android-tools@f53106a...5612c1a * dotnet/android-tools@5612c1a: [Xamarin.Android.Tools.AndroidSdk] OS-specific dirs are OS-specific (dotnet/android-tools#250) * dotnet/android-tools@da87185: [Xamarin.Android.Tools.AndroidSdk] Remove hardcoded Path (dotnet/android-tools#248)
jonpryor
added a commit
to dotnet/android
that referenced
this pull request
Mar 21, 2025
Changes: dotnet/android-tools@ab657df...59cab87 * dotnet/android-tools@59cab87: [Xamarin.Android.Tools.AndroidSdk] OS-specific dirs are OS-specific (dotnet/android-tools#250) * dotnet/android-tools@ab50990: [ci] Move PR build to dnceng public (dotnet/android-tools#249)
pjcollins
pushed a commit
to dotnet/android
that referenced
this pull request
Mar 21, 2025
Changes: dotnet/android-tools@f53106a...5612c1a * dotnet/android-tools@5612c1a: [Xamarin.Android.Tools.AndroidSdk] OS-specific dirs are OS-specific (dotnet/android-tools#250) * dotnet/android-tools@da87185: [Xamarin.Android.Tools.AndroidSdk] Remove hardcoded Path (dotnet/android-tools#248)
jonpryor
added a commit
to dotnet/android
that referenced
this pull request
Mar 21, 2025
Changes: dotnet/android-tools@ac8d0ee...0658bc6 * dotnet/android-tools@0658bc6: [Xamarin.Android.Tools.AndroidSdk] OS-specific dirs are OS-specific (dotnet/android-tools#250) Changes: https://devdiv.visualstudio.com/DevDiv/_git/android-platform-support/branchCompare?baseVersion=GC77445b27f654230a2dfb1af8326a6e1e0bb1f64a&targetVersion=GC8b8d0a556383eb32afb6429f965fe5b25cc92056 * 8b8d0a556: Merged PR 621318: Bump to dotnet/android-tools@0658bc63 Co-authored-by: Peter Collins <pecolli@microsoft.com>
jonpryor
added a commit
to dotnet/android
that referenced
this pull request
Mar 22, 2025
Changes: dotnet/android-tools@ab657df...59cab87 * dotnet/android-tools@59cab87: [Xamarin.Android.Tools.AndroidSdk] OS-specific dirs are OS-specific (dotnet/android-tools#250) * dotnet/android-tools@ab50990: [ci] Move PR build to dnceng public (dotnet/android-tools#249) Changes: https://devdiv.visualstudio.com/DevDiv/_git/android-platform-support/branchCompare?baseVersion=GC2f5580c6e6121c5253098829b05a72ba36ae4da1&targetVersion=GC41f8660f009f6efe6c440100ecf13ce1e276177b * 41f8660f0: Merged PR 621317: [release/9.0.1xx] Bump to dotnet/android-tools@59cab872 Co-authored-by: Peter Collins <pecolli@microsoft.com>
jonpryor
pushed a commit
to dotnet/java-interop
that referenced
this pull request
Mar 28, 2025
Changes: dotnet/android-tools@ac8d0ee...0658bc6 * dotnet/android-tools@0658bc6: [Xamarin.Android.Tools.AndroidSdk] OS-specific dirs are OS-specific (dotnet/android-tools#250) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
pull Bot
pushed a commit
to MaxMood96/xamarin-android
that referenced
this pull request
Jul 1, 2026
Changes: dotnet/android-tools@ac8d0ee...0658bc6 * dotnet/android-tools@0658bc6: [Xamarin.Android.Tools.AndroidSdk] OS-specific dirs are OS-specific (dotnet/android-tools#250) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OS-specific JDK locators should only be used on the OS that they're intended for. Remove checks for Linux JDK probe mechanisms such as
/usr/libexec/java_homeand/usr/lib/jvm/*from Windows & macOS.