Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] Fix default $(LintToolPath) (#6293)
The [Android SDK Tools package][0] is deprecated, replaced by the [Android SDK cmdline-tools package][1]: > This SDK Tools package is deprecated and no longer receiving > updates. Instead, please use the new command-line tools package. The Android SDK Tools package hasn't seen an update since 2017-Sep. We do have support for the cmdline-tools package, e.g. 92efdcc, but the *default* `$(LintToolPath)` value was still using the Android SDK Tools package, because: 1. The [default `$(AndroidCommandLineToolsVersion)` value][2] is `2.1`, which isn't installed anywhere (current "latest" is 5.0). 2. The `<ResolveAndroidTooling/>` task would *only* check `$(AndroidSdkDirectory)\cmdline-tools\$(AndroidCommandLineToolsVersion)`; if that directory did not exist, then no other `cmdline-tools` directory would be attempted, resulting in an eventual (inevitable) fallback to the `tools` directory. The xamarin-android-tools repo should *absolutely* update the default `$(AndroidCommandLineToolsVersion)` value, but as of *now*, we ~never use the `lint` in the `cmdline-tools` package, and instead use the `lint` in the much older `tools` package. Update the `<ResolveAndroidTooling/>` task so that *all* paths returned by [`AndroidSdkInfo.GetCommandLineToolsPaths()`][3] are tried, as well as the `bin` subdirectory of all of those paths. `AndroidSdkInfo.GetCommandLineToolsPaths()` will appropriately "fall back" to the tools directory, should it need to, but *prefers* any/every `cmdline-tools` directory over the `tools` directory. [0]: https://developer.android.com/studio/releases/sdk-tools [1]: https://developer.android.com/studio#cmdline-tools [2]: https://github.com/xamarin/xamarin-android-tools/blob/9b658b29bd41157151f5515619d0d90dc062563d/src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.Versions.props [3]: https://github.com/xamarin/xamarin-android-tools/blob/9b658b29bd41157151f5515619d0d90dc062563d/src/Xamarin.Android.Tools.AndroidSdk/AndroidSdkInfo.cs#L201-L229
- Loading branch information