|
48 | 48 | //
|
49 | 49 | ///////////////////////////////////////////////////////////////////////////////
|
50 | 50 |
|
51 |
| -#addin nuget:?package=Cake.FileHelpers&version=3.0.0 |
| 51 | +#addin nuget:?package=Cake.FileHelpers&version=3.2.1 |
52 | 52 | #addin nuget:?package=NuGet.Packaging&version=4.7.0&loaddependencies=true
|
53 | 53 | #addin nuget:?package=NuGet.Protocol&version=4.7.0&loaddependencies=true
|
54 | 54 |
|
@@ -100,6 +100,8 @@ var minimumVersion = new Dictionary<string, NuGetVersion> {
|
100 | 100 |
|
101 | 101 | var blacklistIdPrefix = new List<string> {
|
102 | 102 | "xamarin.build.download",
|
| 103 | + "xamarin.android.support.constraint.layout", |
| 104 | + "xamarin.google.guava", |
103 | 105 | };
|
104 | 106 |
|
105 | 107 | var seedPackages = new [] {
|
@@ -203,16 +205,18 @@ VersionRange GetSupportVersionRange(FilePath nuspec)
|
203 | 205 | // search this nuget for a support version
|
204 | 206 | version = xmd
|
205 | 207 | .Descendants(ns + "dependency")
|
206 |
| - .FirstOrDefault(e => e.Attribute("id").Value.ToLower().StartsWith("xamarin.android.support")) |
| 208 | + .LastOrDefault(e => e.Attribute("id").Value.ToLower().StartsWith("xamarin.android.support")) |
207 | 209 | ?.Attribute("version")
|
208 | 210 | ?.Value;
|
209 | 211 |
|
210 | 212 | // if none was found, look in the dependencies
|
211 | 213 | if (string.IsNullOrEmpty(version)) {
|
212 |
| - foreach (var xdep in xmd.Descendants(ns + "dependency")) { |
| 214 | + foreach (var xdep in xmd.Descendants(ns + "dependency").Reverse()) { |
213 | 215 | var id = xdep.Attribute("id").Value.ToLower();
|
214 | 216 | var range = VersionRange.Parse(xdep.Attribute("version").Value);
|
215 | 217 | var depNuspec = $"{packagesPath}/{id}/{range.MinVersion ?? range.MaxVersion}/{id}.nuspec";
|
| 218 | + if (!FileExists(depNuspec)) |
| 219 | + continue; |
216 | 220 | // if a support version was found, use it, otherwise continue looking
|
217 | 221 | var suppRange = GetSupportVersionRange(depNuspec);
|
218 | 222 | if (suppRange != null)
|
@@ -244,7 +248,7 @@ VersionRange GetArchVersionRange(FilePath nuspec)
|
244 | 248 | if (xid.Value.ToLower().StartsWith("xamarin.android.support")) {
|
245 | 249 | version = xmd
|
246 | 250 | .Descendants(ns + "dependency")
|
247 |
| - .First(e => e.Attribute("id").Value.ToLower().StartsWith("xamarin.android.arch")) |
| 251 | + .Last(e => e.Attribute("id").Value.ToLower().StartsWith("xamarin.android.arch")) |
248 | 252 | .Attribute("version")
|
249 | 253 | .Value;
|
250 | 254 | } else {
|
@@ -509,8 +513,9 @@ Task("PrepareWorkingDirectory")
|
509 | 513 |
|
510 | 514 | // move the old dependencies into the new groups if they contain a support version
|
511 | 515 | // if not, then just use the version of the nuspec
|
512 |
| - var xgroups = xdeps.Elements(ns + "group"); |
513 |
| - foreach (var xoldGroup in xgroups) { |
| 516 | + // only select the last group as the rest will be re-created |
| 517 | + var xoldGroup = xdeps.Elements(ns + "group").LastOrDefault(); |
| 518 | + if (xoldGroup != null) { |
514 | 519 | var xgroupDeps = xoldGroup.Elements(ns + "dependency");
|
515 | 520 | var firstSupportVersion = xgroupDeps
|
516 | 521 | .Where(x => x.Attribute("id").Value.ToLower().StartsWith("xamarin.android.support"))
|
|
0 commit comments