Repository navigation
fix: detect SDK packages from Android CLI output - #309
Merged
gengjiawen merged 3 commits intoNov 11, 2026
Merged
gengjiawen merged 3 commits into
gengjiawen merged 3 commits into
Conversation
Split each row of `sdkmanager --list` into its package path and description, from the `|`-separated table of the legacy sdkmanager or the whitespace-separated rows of the Android CLI, and classify both alike. - Strip every ANSI escape sequence, not only colors. - List an API level once, so SDK extensions (android-35-ext14) no longer repeat it. - Report minor API levels and preview build tools as listed in both formats (36.1, 36.0.0-rc1). - Skip lines that are not package rows instead of throwing on them. - Fall back to the tag and ABI of a system image without a description.
gengjiawen
approved these changes
Nov 11, 2026
gengjiawen
left a comment
Collaborator
There was a problem hiding this comment.
Thanks! I pushed 6a4f79f on top of this to address a few things found in review:
- One row parser for both formats. Each row of
sdkmanager --listis split into a package path and description (|columns for the legacy sdkmanager, whitespace for the Android CLI), and;and/paths are classified the same way, so the two formats can no longer drift apart. - All ANSI escapes are stripped, not only SGR colors. Rows with a prefix such as
ESC[2KorESC(Bwere dropped before. - API levels are deduplicated. With the #308 list,
platforms/android-35-ext14and-ext15reported35three times. - Minor API levels and preview build tools are reported as listed in both formats (
36.1,36.0.0-rc1). Before, the legacy path cut them to36and36.0.0, so the same SDK gave a different report depending on the sdkmanager version. - Lines that are not package rows are skipped. The legacy path threw a TypeError on a line such as
Warning: Observed package id 'system-images;…' in inconsistent location, which rejected the whole envinfo run. - A system image without a description falls back to its tag and ABI instead of becoming
android-26 |or being dropped. - Tests cover rows from the #308 list (extension platforms, minor levels, cmake/ndk/sources rows), LF and uncolored rows, update arrows, other escapes, and the legacy edge cases above.
About the reproducer in #308: the gist's sdkmanager-cmdline-tools-23.txt stores each escape as the two printable characters ^[, not an ESC byte, so repro.sh still reports Not Found with any parser. After sed 's/\^\[/\x1b/g', envinfo reports API Levels 33, 35, 36, 37.0, 37.2, Build Tools 35.0.0, 36.0.0, 36.1.0, 37.0.0, and all 12 system images.
Collaborator
|
Merged, thanks for the fix @mayankdhingra02! |
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.
Fixes #308.
Android command-line tools 23.0 use slash-separated package paths and colored, whitespace-separated rows. Read those installed rows alongside the legacy pipe-separated table so envinfo reports the SDK API levels, build tools, and system images again.
Added a regression for colored CRLF output, minor API levels, an available update, and the available-packages boundary. The full suite passed on Node 24 and 26. Replayed both SDK manager captures through the CLI and verified the old report still matches. The SDK 23.0 run used the reporter’s Windows capture. The native Windows job remains a hosted check.