You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Xamarin.Android.Tools.AndroidSdk] Add support for cmdline-tools (#83)
Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1109288
Context: https://dl.google.com/android/repository/repository2-1.xml
Google has deprecated the `tools` Android SDK package, replacing it
with the `cmdline-tools` package, which introduces a version
directory component.
Old and busted:
$(AndroidSdkDirectory)/tools/bin/sdkmanager
New hotness:
$(AndroidSdkDirectory)/cmdline-tools/latest/bin/sdkmanager
Of particular interest is that `latest` is a *literal value*. There
is also a `cmdline-tools;1.0` package which creates a
`cmdline-tools/1.0` directory.
Add a new `AndroidSdkInfo.GetCommandLineToolsPaths()` method which
returns the "command-line tools paths", ordered by version and (non-)
obsolescence. For example, given the directory structure:
* `$(AndroidSdkDirectory)/tools/bin/sdkmanager`
* `$(AndroidSdkDirectory)/cmdline-tools/1.0/bin/sdkmanager`
* `$(AndroidSdkDirectory)/cmdline-tools/latest/bin/sdkmanager`
Then `AndroidSdkInfo.GetCommandLineToolsPaths()` will return,
in this order:
* `$(AndroidSdkDirectory)/cmdline-tools/latest`
* `$(AndroidSdkDirectory)/cmdline-tools/1.0`
* `$(AndroidSdkDirectory)/tools`
The `latest` version is always preferred, if present, followed by any
actually versioned cmdline-tools directories, followed by the `tools`
directory, if it exists.
Note that "prefixes" are returned. All utilities are within a nested
`bin` directory, so if you want e.g. the latest `sdkmanager` util,
you would want to do:
var info = new AndroidSdkInfo (path);
var latestSdkManager = Path.Combine (
info.GetCommandLineToolsPaths ().First (),
"bin",
"sdkmanager");
Finally, remove some unnecessary members from `AndroidSdkBase` which
were never used -- and thus are "noise" -- and don't make sense in
the new `cmdline-tools` world, as the cmdline-tools package doesn't
contain them…
0 commit comments