breautek opened a new pull request, #1877:
URL: https://github.com/apache/cordova-android/pull/1877

   <!--
   Please make sure the checklist boxes are all checked before submitting the 
PR. The checklist is intended as a quick reference, for complete details please 
see our Contributor Guidelines:
   
   http://cordova.apache.org/contribute/contribute_guidelines.html
   
   Thanks!
   -->
   
   ### Platforms affected
   
   Android/All OS
   
   ### Motivation and Context
   <!-- Why is this change required? What problem does it solve? -->
   <!-- If it fixes an open issue, please link to the issue here. -->
   
   Fixes #1841
   
   ### Description
   <!-- Describe your changes in detail -->
   
   This PR does two things:
   
   1) Introduces AndroidCommandLineTools module, whose primary purpose is to 
find the toolsets available in the workstation and to resolve the latest bin 
path.
   
   The resolving algorithm will prefer the `"latest"` (a specific Android SDK 
package that installs the cmdline tools to a `latest` directory), however if 
this package is not installed, it will choose the latest stable versioned 
cmdline-tools, e.g. `19.0`. It uses `semver` to coarce the directory names and 
sort them in descending order.
   
   Prelease packages are acceptable but prioritized lower than stable releases 
of the same version.
   
   Directories that are not parseable as a version are ignored.
   
   Directories that are valid name wise are not asserted for it's contents and 
assumes that it's structure matches what is expected based on Android SDK 
cmdline-tools installation.
   
   2) Removes references and usages of the legacy `$ANDROID_HOME/tools/bin` 
binaries. These are legacy tools that are not compatible with modern toolsets. 
The cmdline-tools is the replacement. There is existing code that would infer 
the Android SDK home directory based on the result of `which` of `avdmanager`
   
   ### Additional Notes
   
   The cmd-line tools resolution prefers the latest cmdline-tools version 
possible because that is what our 
[guide](https://cordova.apache.org/docs/en/13.x-2025.11/guide/platforms/android/index.html#installing-sdk-command-line-tools-latest)
 says to install. However cmdline-tools can introduce breaking changes. 
Typically in the java runtime required to run these tools.
   
   It would be better if we define a version or a range of versions for Cordova 
CLI to prefer, but doing so I'd consider out of scope for addressing the 
reported issue.
   
   ### Testing
   <!-- Please describe in detail how you tested your changes. -->
   
   npm test passes.
   Manually tested on windows using `cordova requirements android` / `cordova 
build android`:
    - With ANDROID_HOME / ANDROID_SDK_ROOT set
    - With ANDROID_HOME / ANDROID_SDK_ROOT unset
    - With avdmanager in my PATH
    - With avdmanager not in my PATH
    - With Android SDK in the "default" windows installation 
(C:\users\asdf\AppData\Local\Android\...)
    - With Android SDK installed in a custom location
    - Some sort of combination of all the above.
   
   ### Checklist
   
   - [x] I've run the tests to see all new and existing tests pass
   - [x] I added automated test coverage as appropriate for this change
   - [x] Commit is prefixed with `(platform)` if this change only applies to 
one platform (e.g. `(android)`)
   - [x] If this Pull Request resolves an issue, I linked to the issue in the 
text above (and used the correct [keyword to close issues using 
keywords](https://help.github.com/articles/closing-issues-using-keywords/))
   - [x] I've updated the documentation if necessary
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to