[android-tools] Align command-line tool discovery order - #12319
Open
jonathanpeppers wants to merge 1 commit into
Open
[android-tools] Align command-line tool discovery order#12319jonathanpeppers wants to merge 1 commit into
jonathanpeppers wants to merge 1 commit into
Conversation
Prefer cmdline-tools/latest before versioned installations for both sdkmanager and other command-line tools, while retaining versioned fallback and excluding legacy tools/bin. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns Android SDK command-line tool discovery so FindSdkManagerPath() and FindCmdlineTool() resolve binaries consistently by preferring the SDK-recommended cmdline-tools/latest/bin layout first, with deterministic fallback to versioned installations when latest doesn’t contain the requested tool. This brings the shared resolver behavior and unit tests in line with the intended precedence rules and explicitly keeps legacy tools/bin unsupported.
Changes:
- Update command-line tools candidate ordering to always prioritize the
latestdirectory when it contains the requested binary. - Refresh/add unit tests to validate
latestprecedence (including malformed metadata), fallback whenlatestlacks the tool, and exclusion of legacytools/bin. - Update XML documentation to reflect the
latest-first behavior and lack oftools/binsupport.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/Xamarin.Android.Tools.AndroidSdk-Tests/CommandLineToolsResolverTests.cs | Updates/adds tests covering latest precedence, fallback behavior, and legacy tools/bin exclusion. |
| src/Xamarin.Android.Tools.AndroidSdk/SdkManager.CommandLineTools.cs | Updates FindSdkManager() documentation to describe latest-first selection and no legacy support. |
| src/Xamarin.Android.Tools.AndroidSdk/ProcessUtils.cs | Updates FindCmdlineTool() documentation to describe latest-first selection and no legacy support. |
| src/Xamarin.Android.Tools.AndroidSdk/CommandLineToolsResolver.cs | Adjusts candidate comparison to treat latest as the highest-precedence selection tier. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pull Request
title and
description
should follow the
commit-messages.mdworkflow documentation, and in particular should include:FindSdkManagerPath()andFindCmdlineTool()must resolve Android command-line tools consistently. Prefer the SDK-managedcmdline-tools/latest/binlayout before considering versioned installations, while retaining versioned fallback whenlatestdoes not contain the requested binary.The shared resolver now treats
latestas the first selection tier. Remaining candidates continue to usePkg.Revision, parsed directory versions, and deterministic fallback ordering. Legacytools/binremains intentionally unsupported because those tools use incompatible command-line arguments.Tests cover lower or malformed metadata on
latest, versioned fallback, and exclusion of legacytools/bin. The fullXamarin.Android.Tools.AndroidSdk-Testsproject passes with 378 passed and 16 skipped.Fixes #12072