Skip to content

Commit

Permalink
[Client SDK] Reduce dependencies (#476)
Browse files Browse the repository at this point in the history
No longer depend on `NuGet.Protocol` as that depends on the dynamic runtime, which itself has a large dependency graph.
  • Loading branch information
loic-sharma authored Feb 14, 2020
1 parent 89da76b commit 5f263e9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/BaGet.Protocol/BaGet.Protocol.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsPackageVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="NuGet.Protocol" Version="$(NuGetPackageVersion)" />
<PackageReference Include="System.Text.Encodings.Web" Version="4.5.0" />
<PackageReference Include="NuGet.Frameworks" Version="$(NuGetPackageVersion)" />
<PackageReference Include="NuGet.Versioning" Version="$(NuGetPackageVersion)" />
</ItemGroup>

</Project>
7 changes: 5 additions & 2 deletions src/BaGet.Protocol/Extensions/CatalogModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq;
using BaGet.Protocol.Models;
using NuGet.Frameworks;
using NuGet.Packaging.Core;
using NuGet.Versioning;

namespace BaGet.Protocol
Expand Down Expand Up @@ -36,7 +35,11 @@ public static List<CatalogLeafItem> GetLeavesInBounds(
if (excludeRedundantLeaves)
{
leaves = leaves
.GroupBy(x => new PackageIdentity(x.PackageId, x.ParsePackageVersion()))
.GroupBy(x => new
{
PackageId = x.PackageId.ToLowerInvariant(),
PackageVersion = x.ParsePackageVersion()
})
.Select(x => x.Last())
.OrderBy(x => x.CommitTimestamp);
}
Expand Down
5 changes: 2 additions & 3 deletions src/BaGet.Protocol/Search/RawSearchClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Text.Encodings.Web;
using System.Threading;
using System.Threading.Tasks;
using BaGet.Protocol.Models;
Expand Down Expand Up @@ -81,9 +80,9 @@ private static string AddQueryString(string uri, Dictionary<string, string> quer
foreach (var parameter in queryString)
{
builder.Append(hasQuery ? '&' : '?');
builder.Append(UrlEncoder.Default.Encode(parameter.Key));
builder.Append(Uri.EscapeDataString(parameter.Key));
builder.Append('=');
builder.Append(UrlEncoder.Default.Encode(parameter.Value));
builder.Append(Uri.EscapeDataString(parameter.Value));
hasQuery = true;
}

Expand Down

0 comments on commit 5f263e9

Please sign in to comment.