Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ protected byte [] ReadAllBytesIgnoringLineEndings (Stream stream)
protected string GetPathToLatestBuildTools (string exe)
{
var path = Path.Combine (AndroidSdkPath, "build-tools");
foreach (var dir in Directory.GetDirectories (path, "*", SearchOption.TopDirectoryOnly).OrderByDescending (x => new Version (Path.GetFileName (x)))) {
foreach (var dir in Directory.GetDirectories (path, "*", SearchOption.TopDirectoryOnly).OrderByDescending (x => Path.GetFileName (x))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pity this will fails when sorting { "2", "10" }, because it sorts "stringly", not numerically.

Fortunately this is unlikely to be a problem now, because we're likely to always have two digit numbers. (But when we start hitting Build-tools 100, watch out!)

Unfortunately, this also sorts { "29.0.0-rc2", "29.0.0-rc1", "29.0.0" } in that order, such that the -rc2 will be preferred first, over the "stable" 29.0.0 version.

TestContext.Out.WriteLine ($"Found build tools version: {dir}.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var aapt2 = Path.Combine (dir, exe);
if (File.Exists (aapt2))
return dir;
Expand Down