dependabot-nuget 0.297.1 → 0.298.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyNotFoundException.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/SupportedFrameworks.cs +16 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyNotFound.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobErrorBase.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +10 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/EOLHandling.cs +78 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +10 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +61 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/CompatibilityCheckerFacts.cs +2 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +100 -77
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +8 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/EOLHandlingTests.cs +23 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +18 -2
- data/lib/dependabot/nuget/native_helpers.rb +3 -0
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ddf8333c71d3c76213603301923f6005fc9a35a3a7b1f59dedf21ff2381a5ac
|
4
|
+
data.tar.gz: b2e38e24b320965f93d502eacdc0622b354e915a0366bc8478a9528c053e4410
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 317614f24858deff63cad0dddfcfb80f53c6e8330b4dfd64d9946a34c50afed27f9e63527f3563ebc2678f7c5ad6e43078ddf4feb7944c10fb7947056f31740d
|
7
|
+
data.tar.gz: 8cb7df04044fc6a1bb421508bbf1bf1fdebab675f81c30d188963e6991f2bd84b4d4f165a315fbfec3257a97e85f232ed824cef7d01f3ab658cd5f9247d44035
|
@@ -20,7 +20,8 @@ namespace NuGetGallery.Frameworks
|
|
20
20
|
/// </remarks>
|
21
21
|
public static class SupportedFrameworks
|
22
22
|
{
|
23
|
-
public static readonly Version Version8 = new Version(8, 0, 0, 0);
|
23
|
+
public static readonly Version Version8 = new Version(8, 0, 0, 0);
|
24
|
+
public static readonly Version Version9 = new Version(9, 0, 0, 0);
|
24
25
|
|
25
26
|
public static readonly NuGetFramework MonoAndroid = new NuGetFramework(FrameworkIdentifiers.MonoAndroid, EmptyVersion);
|
26
27
|
public static readonly NuGetFramework MonoTouch = new NuGetFramework(FrameworkIdentifiers.MonoTouch, EmptyVersion);
|
@@ -29,12 +30,14 @@ namespace NuGetGallery.Frameworks
|
|
29
30
|
public static readonly NuGetFramework Net48 = new NuGetFramework(FrameworkIdentifiers.Net, new Version(4, 8, 0, 0));
|
30
31
|
public static readonly NuGetFramework Net481 = new NuGetFramework(FrameworkIdentifiers.Net, new Version(4, 8, 1, 0));
|
31
32
|
public static readonly NuGetFramework Net50Windows = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version5, "windows", EmptyVersion);
|
33
|
+
|
32
34
|
public static readonly NuGetFramework Net60Android = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "android", EmptyVersion);
|
33
35
|
public static readonly NuGetFramework Net60Ios = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "ios", EmptyVersion);
|
34
36
|
public static readonly NuGetFramework Net60MacOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "macos", EmptyVersion);
|
35
37
|
public static readonly NuGetFramework Net60MacCatalyst = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "maccatalyst", EmptyVersion);
|
36
38
|
public static readonly NuGetFramework Net60TvOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "tvos", EmptyVersion);
|
37
39
|
public static readonly NuGetFramework Net60Windows = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "windows", EmptyVersion);
|
40
|
+
|
38
41
|
public static readonly NuGetFramework Net70Android = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "android", EmptyVersion);
|
39
42
|
public static readonly NuGetFramework Net70Ios = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "ios", EmptyVersion);
|
40
43
|
public static readonly NuGetFramework Net70MacOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "macos", EmptyVersion);
|
@@ -42,14 +45,22 @@ namespace NuGetGallery.Frameworks
|
|
42
45
|
public static readonly NuGetFramework Net70TvOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "tvos", EmptyVersion);
|
43
46
|
public static readonly NuGetFramework Net70Windows = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "windows", EmptyVersion);
|
44
47
|
|
45
|
-
public static readonly NuGetFramework Net80 = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8);
|
46
|
-
|
48
|
+
public static readonly NuGetFramework Net80 = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8);
|
47
49
|
public static readonly NuGetFramework Net80Android = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8, "android", EmptyVersion);
|
48
50
|
public static readonly NuGetFramework Net80Ios = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8, "ios", EmptyVersion);
|
49
51
|
public static readonly NuGetFramework Net80MacOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8, "macos", EmptyVersion);
|
50
52
|
public static readonly NuGetFramework Net80MacCatalyst = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8, "maccatalyst", EmptyVersion);
|
51
53
|
public static readonly NuGetFramework Net80TvOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8, "tvos", EmptyVersion);
|
52
54
|
public static readonly NuGetFramework Net80Windows = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8, "windows", EmptyVersion);
|
55
|
+
|
56
|
+
public static readonly NuGetFramework Net90 = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version9);
|
57
|
+
public static readonly NuGetFramework Net90Android = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version9, "android", EmptyVersion);
|
58
|
+
public static readonly NuGetFramework Net90Ios = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version9, "ios", EmptyVersion);
|
59
|
+
public static readonly NuGetFramework Net90MacOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version9, "macos", EmptyVersion);
|
60
|
+
public static readonly NuGetFramework Net90MacCatalyst = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version9, "maccatalyst", EmptyVersion);
|
61
|
+
public static readonly NuGetFramework Net90TvOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version9, "tvos", EmptyVersion);
|
62
|
+
public static readonly NuGetFramework Net90Windows = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version9, "windows", EmptyVersion);
|
63
|
+
|
53
64
|
public static readonly NuGetFramework NetCore = new NuGetFramework(FrameworkIdentifiers.NetCore, EmptyVersion);
|
54
65
|
public static readonly NuGetFramework NetMf = new NuGetFramework(FrameworkIdentifiers.NetMicro, EmptyVersion);
|
55
66
|
public static readonly NuGetFramework UAP = new NuGetFramework(FrameworkIdentifiers.UAP, EmptyVersion);
|
@@ -75,6 +86,7 @@ namespace NuGetGallery.Frameworks
|
|
75
86
|
Net60, Net60Android, Net60Ios, Net60MacCatalyst, Net60MacOs, Net60TvOs, Net60Windows,
|
76
87
|
Net70, Net70Android, Net70Ios, Net70MacCatalyst, Net70MacOs, Net70TvOs, Net70Windows,
|
77
88
|
Net80, Net80Android, Net80Ios, Net80MacCatalyst, Net80MacOs, Net80TvOs, Net80Windows,
|
89
|
+
Net90, Net90Android, Net90Ios, Net90MacCatalyst, Net90MacOs, Net90TvOs, Net90Windows,
|
78
90
|
NetCore, NetCore45, NetCore451,
|
79
91
|
NetCoreApp10, NetCoreApp11, NetCoreApp20, NetCoreApp21, NetCoreApp22, NetCoreApp30, NetCoreApp31,
|
80
92
|
NetMf,
|
@@ -94,6 +106,7 @@ namespace NuGetGallery.Frameworks
|
|
94
106
|
{
|
95
107
|
public static readonly List<NuGetFramework> NetTfms =
|
96
108
|
[
|
109
|
+
Net90,
|
97
110
|
Net80,
|
98
111
|
Net70,
|
99
112
|
Net60,
|
@@ -0,0 +1,11 @@
|
|
1
|
+
namespace NuGetUpdater.Core.Run.ApiModel;
|
2
|
+
|
3
|
+
public record DependencyNotFound : JobErrorBase
|
4
|
+
{
|
5
|
+
public DependencyNotFound(string dependency)
|
6
|
+
: base("dependency_not_found")
|
7
|
+
{
|
8
|
+
// the corresponding error type in Ruby calls this `source` but it's treated like a dependency name
|
9
|
+
Details["source"] = dependency;
|
10
|
+
}
|
11
|
+
}
|
@@ -25,6 +25,7 @@ public abstract record JobErrorBase
|
|
25
25
|
return ex switch
|
26
26
|
{
|
27
27
|
BadRequirementException badRequirement => new BadRequirement(badRequirement.Message),
|
28
|
+
DependencyNotFoundException dependencyNotFound => new DependencyNotFound(string.Join(", ", dependencyNotFound.Dependencies)),
|
28
29
|
HttpRequestException httpRequest => httpRequest.StatusCode switch
|
29
30
|
{
|
30
31
|
HttpStatusCode.Unauthorized or
|
@@ -3,6 +3,7 @@ using System.Net;
|
|
3
3
|
using System.Text;
|
4
4
|
using System.Text.Json;
|
5
5
|
using System.Text.Json.Serialization;
|
6
|
+
using System.Text.RegularExpressions;
|
6
7
|
|
7
8
|
using Microsoft.Extensions.FileSystemGlobbing;
|
8
9
|
|
@@ -13,6 +14,8 @@ using NuGetUpdater.Core.Discover;
|
|
13
14
|
using NuGetUpdater.Core.Run.ApiModel;
|
14
15
|
using NuGetUpdater.Core.Utilities;
|
15
16
|
|
17
|
+
using static NuGetUpdater.Core.Utilities.EOLHandling;
|
18
|
+
|
16
19
|
namespace NuGetUpdater.Core.Run;
|
17
20
|
|
18
21
|
public class RunWorker
|
@@ -122,6 +125,7 @@ public class RunWorker
|
|
122
125
|
|
123
126
|
// TODO: pull out relevant dependencies, then check each for updates and track the changes
|
124
127
|
var originalDependencyFileContents = new Dictionary<string, string>();
|
128
|
+
var originalDependencyFileEOFs = new Dictionary<string, EOLType>();
|
125
129
|
var actualUpdatedDependencies = new List<ReportedDependency>();
|
126
130
|
|
127
131
|
// track original contents for later handling
|
@@ -131,6 +135,7 @@ public class RunWorker
|
|
131
135
|
var localFullPath = Path.Join(repoContentsPath.FullName, repoFullPath);
|
132
136
|
var content = await File.ReadAllTextAsync(localFullPath);
|
133
137
|
originalDependencyFileContents[repoFullPath] = content;
|
138
|
+
originalDependencyFileEOFs[repoFullPath] = content.GetPredominantEOL();
|
134
139
|
}
|
135
140
|
|
136
141
|
foreach (var project in discoveryResult.Projects)
|
@@ -203,8 +208,13 @@ public class RunWorker
|
|
203
208
|
var localFullPath = Path.GetFullPath(Path.Join(repoContentsPath.FullName, repoFullPath));
|
204
209
|
var originalContent = originalDependencyFileContents[repoFullPath];
|
205
210
|
var updatedContent = await File.ReadAllTextAsync(localFullPath);
|
211
|
+
|
212
|
+
updatedContent = updatedContent.SetEOL(originalDependencyFileEOFs[repoFullPath]);
|
213
|
+
await File.WriteAllTextAsync(localFullPath, updatedContent);
|
214
|
+
|
206
215
|
if (updatedContent != originalContent)
|
207
216
|
{
|
217
|
+
|
208
218
|
updatedDependencyFiles[localFullPath] = new DependencyFile()
|
209
219
|
{
|
210
220
|
Name = Path.GetFileName(repoFullPath),
|
@@ -0,0 +1,78 @@
|
|
1
|
+
using System.Text.RegularExpressions;
|
2
|
+
|
3
|
+
namespace NuGetUpdater.Core.Utilities;
|
4
|
+
|
5
|
+
public static class EOLHandling
|
6
|
+
{
|
7
|
+
/// <summary>
|
8
|
+
/// Used to save (and then restore) which line endings are predominant in a file.
|
9
|
+
/// </summary>
|
10
|
+
public enum EOLType
|
11
|
+
{
|
12
|
+
/// <summary>
|
13
|
+
/// Line feed - \n
|
14
|
+
/// Typical on most systems.
|
15
|
+
/// </summary>
|
16
|
+
LF,
|
17
|
+
/// <summary>
|
18
|
+
/// Carriage return - \r
|
19
|
+
/// Typical on older MacOS, unlikely (but possible) to come up here
|
20
|
+
/// </summary>
|
21
|
+
CR,
|
22
|
+
/// <summary>
|
23
|
+
/// Carriage return and line feed - \r\n.
|
24
|
+
/// Typical on Windows
|
25
|
+
/// </summary>
|
26
|
+
CRLF
|
27
|
+
};
|
28
|
+
|
29
|
+
/// <summary>
|
30
|
+
/// Analyze the input string and find the most common line ending type.
|
31
|
+
/// </summary>
|
32
|
+
/// <param name="content">The string to analyze</param>
|
33
|
+
/// <returns>The most common type of line ending in the input string.</returns>
|
34
|
+
public static EOLType GetPredominantEOL(this string content)
|
35
|
+
{
|
36
|
+
// Get stats on EOL characters/character sequences, if one predominates choose that for writing later.
|
37
|
+
var lfcount = content.Count(c => c == '\n');
|
38
|
+
var crcount = content.Count(c => c == '\r');
|
39
|
+
var crlfcount = Regex.Matches(content, "\r\n").Count();
|
40
|
+
|
41
|
+
// Since CRLF contains both a CR and a LF, subtract it from those counts
|
42
|
+
lfcount -= crlfcount;
|
43
|
+
crcount -= crlfcount;
|
44
|
+
if (crcount > lfcount && crcount > crlfcount)
|
45
|
+
{
|
46
|
+
return EOLType.CR;
|
47
|
+
}
|
48
|
+
else if (crlfcount > lfcount)
|
49
|
+
{
|
50
|
+
return EOLType.CRLF;
|
51
|
+
}
|
52
|
+
else
|
53
|
+
{
|
54
|
+
return EOLType.LF;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
/// <summary>
|
59
|
+
/// Given a line ending, modify the input string to uniformly use that line ending.
|
60
|
+
/// </summary>
|
61
|
+
/// <param name="content">The input string, which may have any combination of line endings.</param>
|
62
|
+
/// <param name="desiredEOL">The line ending type to use across the result.</param>
|
63
|
+
/// <returns>The string with any line endings swapped to the desired type.</returns>
|
64
|
+
/// <exception cref="ArgumentOutOfRangeException">If EOLType is an unexpected value.</exception>
|
65
|
+
public static string SetEOL(this string content, EOLType desiredEOL)
|
66
|
+
{
|
67
|
+
switch (desiredEOL)
|
68
|
+
{
|
69
|
+
case EOLType.LF:
|
70
|
+
return Regex.Replace(content, "(\r\n|\r)", "\n");
|
71
|
+
case EOLType.CR:
|
72
|
+
return Regex.Replace(content, "(\r\n|\n)", "\r");
|
73
|
+
case EOLType.CRLF:
|
74
|
+
return Regex.Replace(content, "(\r\n|\r|\n)", "\r\n");
|
75
|
+
}
|
76
|
+
throw new ArgumentOutOfRangeException(nameof(desiredEOL));
|
77
|
+
}
|
78
|
+
}
|
@@ -970,12 +970,17 @@ internal static partial class MSBuildHelper
|
|
970
970
|
|
971
971
|
private static void ThrowOnMissingPackages(string output)
|
972
972
|
{
|
973
|
-
var
|
974
|
-
|
975
|
-
|
976
|
-
|
973
|
+
var patterns = new[]
|
974
|
+
{
|
975
|
+
new Regex(@"Package '(?<PackageName>[^']*)' is not found on source '(?<PackageSource>[^$\r\n]*)'\."),
|
976
|
+
new Regex(@"Unable to find package (?<PackageName>[^ ]+)\. No packages exist with this id in source\(s\): (?<PackageSource>.*)$", RegexOptions.Multiline),
|
977
|
+
new Regex(@"Unable to find package (?<PackageName>[^ ]+) with version \((?<PackageVersion>[^)]+)\)"),
|
978
|
+
};
|
979
|
+
var matches = patterns.Select(p => p.Match(output)).Where(m => m.Success);
|
980
|
+
if (matches.Any())
|
977
981
|
{
|
978
|
-
|
982
|
+
var packages = matches.Select(m => m.Groups["PackageName"].Value).Distinct(StringComparer.OrdinalIgnoreCase).ToArray();
|
983
|
+
throw new DependencyNotFoundException(packages);
|
979
984
|
}
|
980
985
|
}
|
981
986
|
|
@@ -1294,4 +1294,65 @@ public partial class DiscoveryWorkerTests : DiscoveryWorkerTestBase
|
|
1294
1294
|
}
|
1295
1295
|
);
|
1296
1296
|
}
|
1297
|
+
|
1298
|
+
[Fact]
|
1299
|
+
public async Task MissingPackageIsCorrectlyReported_PackageNotFound()
|
1300
|
+
{
|
1301
|
+
await TestDiscoveryAsync(
|
1302
|
+
packages: [
|
1303
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.2.3", "net8.0", [(null, [("Transitive.Dependency.Does.Not.Exist", "4.5.6")])]),
|
1304
|
+
],
|
1305
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
|
1306
|
+
workspacePath: "",
|
1307
|
+
files: [
|
1308
|
+
("project.csproj", """
|
1309
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
1310
|
+
<PropertyGroup>
|
1311
|
+
<TargetFramework>net8.0</TargetFramework>
|
1312
|
+
</PropertyGroup>
|
1313
|
+
<ItemGroup>
|
1314
|
+
<PackageReference Include="Some.Package" Version="1.2.3" />
|
1315
|
+
</ItemGroup>
|
1316
|
+
</Project>
|
1317
|
+
""")
|
1318
|
+
],
|
1319
|
+
expectedResult: new()
|
1320
|
+
{
|
1321
|
+
Path = "",
|
1322
|
+
Projects = [],
|
1323
|
+
Error = new DependencyNotFound("Transitive.Dependency.Does.Not.Exist"),
|
1324
|
+
}
|
1325
|
+
);
|
1326
|
+
}
|
1327
|
+
|
1328
|
+
[Fact]
|
1329
|
+
public async Task MissingPackageIsCorrectlyReported_VersionNotFound()
|
1330
|
+
{
|
1331
|
+
await TestDiscoveryAsync(
|
1332
|
+
packages: [
|
1333
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.2.3", "net8.0", [(null, [("Transitive.Dependency", "4.5.6")])]),
|
1334
|
+
MockNuGetPackage.CreateSimplePackage("Transitive.Dependency", "0.1.2", "net8.0"),
|
1335
|
+
],
|
1336
|
+
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
|
1337
|
+
workspacePath: "",
|
1338
|
+
files: [
|
1339
|
+
("project.csproj", """
|
1340
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
1341
|
+
<PropertyGroup>
|
1342
|
+
<TargetFramework>net8.0</TargetFramework>
|
1343
|
+
</PropertyGroup>
|
1344
|
+
<ItemGroup>
|
1345
|
+
<PackageReference Include="Some.Package" Version="1.2.3" />
|
1346
|
+
</ItemGroup>
|
1347
|
+
</Project>
|
1348
|
+
""")
|
1349
|
+
],
|
1350
|
+
expectedResult: new()
|
1351
|
+
{
|
1352
|
+
Path = "",
|
1353
|
+
Projects = [],
|
1354
|
+
Error = new DependencyNotFound("Transitive.Dependency"),
|
1355
|
+
}
|
1356
|
+
);
|
1357
|
+
}
|
1297
1358
|
}
|
data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/CompatibilityCheckerFacts.cs
CHANGED
@@ -7,6 +7,8 @@ namespace NuGetUpdater.Core.Test.FrameworkChecker;
|
|
7
7
|
public class CompatibilityCheckerFacts
|
8
8
|
{
|
9
9
|
[Theory]
|
10
|
+
[InlineData("net9.0", "net9.0")]
|
11
|
+
[InlineData("net9.0", "net8.0")]
|
10
12
|
[InlineData("net8.0", "net8.0")]
|
11
13
|
[InlineData("net8.0", "net7.0")]
|
12
14
|
[InlineData("net7.0", "net7.0")]
|
@@ -14,12 +14,17 @@ using Xunit;
|
|
14
14
|
|
15
15
|
namespace NuGetUpdater.Core.Test.Run;
|
16
16
|
|
17
|
+
using static NuGetUpdater.Core.Utilities.EOLHandling;
|
18
|
+
|
17
19
|
using TestFile = (string Path, string Content);
|
18
20
|
|
19
21
|
public class RunWorkerTests
|
20
22
|
{
|
21
|
-
[
|
22
|
-
|
23
|
+
[Theory]
|
24
|
+
[InlineData(EOLType.CR)]
|
25
|
+
[InlineData(EOLType.LF)]
|
26
|
+
[InlineData(EOLType.CRLF)]
|
27
|
+
public async Task UpdateSinglePackageProducedExpectedAPIMessages(EOLType EOL)
|
23
28
|
{
|
24
29
|
await RunAsync(
|
25
30
|
packages: [],
|
@@ -43,7 +48,7 @@ public class RunWorkerTests
|
|
43
48
|
<PackageReference Include="Some.Package" Version="1.0.0" />
|
44
49
|
</ItemGroup>
|
45
50
|
</Project>
|
46
|
-
""")
|
51
|
+
""".SetEOL(EOL))
|
47
52
|
],
|
48
53
|
discoveryWorker: new TestDiscoveryWorker(_input =>
|
49
54
|
{
|
@@ -94,7 +99,7 @@ public class RunWorkerTests
|
|
94
99
|
<PackageReference Include="Some.Package" Version="1.0.1" />
|
95
100
|
</ItemGroup>
|
96
101
|
</Project>
|
97
|
-
""");
|
102
|
+
""".SetEOL(EOL));
|
98
103
|
return new UpdateOperationResult();
|
99
104
|
}),
|
100
105
|
expectedResult: new RunResult()
|
@@ -114,7 +119,7 @@ public class RunWorkerTests
|
|
114
119
|
<PackageReference Include="Some.Package" Version="1.0.0" />
|
115
120
|
</ItemGroup>
|
116
121
|
</Project>
|
117
|
-
"""))
|
122
|
+
""".SetEOL(EOL)))
|
118
123
|
}
|
119
124
|
],
|
120
125
|
BaseCommitSha = "TEST-COMMIT-SHA",
|
@@ -199,7 +204,7 @@ public class RunWorkerTests
|
|
199
204
|
<PackageReference Include="Some.Package" Version="1.0.1" />
|
200
205
|
</ItemGroup>
|
201
206
|
</Project>
|
202
|
-
""",
|
207
|
+
""".SetEOL(EOL),
|
203
208
|
},
|
204
209
|
],
|
205
210
|
BaseCommitSha = "TEST-COMMIT-SHA",
|
@@ -212,11 +217,14 @@ public class RunWorkerTests
|
|
212
217
|
);
|
213
218
|
}
|
214
219
|
|
215
|
-
[
|
216
|
-
|
220
|
+
[Theory]
|
221
|
+
[InlineData(EOLType.CR)]
|
222
|
+
[InlineData(EOLType.LF)]
|
223
|
+
[InlineData(EOLType.CRLF)]
|
224
|
+
public async Task UpdateHandlesSemicolonsInPackageReference(EOLType EOL)
|
217
225
|
{
|
218
|
-
var repoMetadata = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some-package" />""");
|
219
|
-
var repoMetadata2 = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some-package2" />""");
|
226
|
+
var repoMetadata = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some-package" />""".SetEOL(EOL));
|
227
|
+
var repoMetadata2 = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some-package2" />""".SetEOL(EOL));
|
220
228
|
await RunAsync(
|
221
229
|
packages:
|
222
230
|
[
|
@@ -246,7 +254,7 @@ public class RunWorkerTests
|
|
246
254
|
<PackageReference Include="Some.Package;Some.Package2" Version="1.0.0" />
|
247
255
|
</ItemGroup>
|
248
256
|
</Project>
|
249
|
-
""")
|
257
|
+
""".SetEOL(EOL))
|
250
258
|
],
|
251
259
|
discoveryWorker: new TestDiscoveryWorker(_input =>
|
252
260
|
{
|
@@ -299,7 +307,7 @@ public class RunWorkerTests
|
|
299
307
|
<PackageReference Include="Some.Package;Some.Package2" Version="1.0.1" />
|
300
308
|
</ItemGroup>
|
301
309
|
</Project>
|
302
|
-
""");
|
310
|
+
""".SetEOL(EOL));
|
303
311
|
return new UpdateOperationResult();
|
304
312
|
}),
|
305
313
|
expectedResult: new RunResult()
|
@@ -319,7 +327,7 @@ public class RunWorkerTests
|
|
319
327
|
<PackageReference Include="Some.Package;Some.Package2" Version="1.0.0" />
|
320
328
|
</ItemGroup>
|
321
329
|
</Project>
|
322
|
-
"""))
|
330
|
+
""".SetEOL(EOL)))
|
323
331
|
}
|
324
332
|
],
|
325
333
|
BaseCommitSha = "TEST-COMMIT-SHA",
|
@@ -447,7 +455,7 @@ public class RunWorkerTests
|
|
447
455
|
<PackageReference Include="Some.Package;Some.Package2" Version="1.0.1" />
|
448
456
|
</ItemGroup>
|
449
457
|
</Project>
|
450
|
-
""",
|
458
|
+
""".SetEOL(EOL),
|
451
459
|
}
|
452
460
|
|
453
461
|
],
|
@@ -461,8 +469,11 @@ public class RunWorkerTests
|
|
461
469
|
);
|
462
470
|
}
|
463
471
|
|
464
|
-
[
|
465
|
-
|
472
|
+
[Theory]
|
473
|
+
[InlineData(EOLType.CR)]
|
474
|
+
[InlineData(EOLType.LF)]
|
475
|
+
[InlineData(EOLType.CRLF)]
|
476
|
+
public async Task PrivateSourceAuthenticationFailureIsForwaredToApiHandler(EOLType EOL)
|
466
477
|
{
|
467
478
|
await RunAsync(
|
468
479
|
packages:
|
@@ -486,7 +497,7 @@ public class RunWorkerTests
|
|
486
497
|
<add key="private_feed" value="http://example.com/nuget/index.json" allowInsecureConnections="true" />
|
487
498
|
</packageSources>
|
488
499
|
</configuration>
|
489
|
-
"""),
|
500
|
+
""".SetEOL(EOL)),
|
490
501
|
("project.csproj", """
|
491
502
|
<Project Sdk="Microsoft.NET.Sdk">
|
492
503
|
<PropertyGroup>
|
@@ -496,7 +507,7 @@ public class RunWorkerTests
|
|
496
507
|
<PackageReference Include="Some.Package" Version="1.0.0" />
|
497
508
|
</ItemGroup>
|
498
509
|
</Project>
|
499
|
-
""")
|
510
|
+
""".SetEOL(EOL))
|
500
511
|
],
|
501
512
|
discoveryWorker: new TestDiscoveryWorker((_input) =>
|
502
513
|
{
|
@@ -517,11 +528,14 @@ public class RunWorkerTests
|
|
517
528
|
);
|
518
529
|
}
|
519
530
|
|
520
|
-
[
|
521
|
-
|
531
|
+
[Theory]
|
532
|
+
[InlineData(EOLType.CR)]
|
533
|
+
[InlineData(EOLType.LF)]
|
534
|
+
[InlineData(EOLType.CRLF)]
|
535
|
+
public async Task UpdateHandlesPackagesConfigFiles(EOLType EOL)
|
522
536
|
{
|
523
|
-
var repoMetadata = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some-package" />""");
|
524
|
-
var repoMetadata2 = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some-package2" />""");
|
537
|
+
var repoMetadata = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some-package" />""".SetEOL(EOL));
|
538
|
+
var repoMetadata2 = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some-package2" />""".SetEOL(EOL));
|
525
539
|
await RunAsync(
|
526
540
|
packages:
|
527
541
|
[
|
@@ -551,13 +565,13 @@ public class RunWorkerTests
|
|
551
565
|
<PackageReference Include="Some.Package" Version="1.0.0" />
|
552
566
|
</ItemGroup>
|
553
567
|
</Project>
|
554
|
-
"""),
|
568
|
+
""".SetEOL(EOL)),
|
555
569
|
("some-dir/packages.config", """
|
556
570
|
<?xml version="1.0" encoding="utf-8"?>
|
557
571
|
<packages>
|
558
572
|
<package id="Some.Package2" version="2.0.0" targetFramework="net8.0" />
|
559
573
|
</packages>
|
560
|
-
"""),
|
574
|
+
""".SetEOL(EOL)),
|
561
575
|
],
|
562
576
|
discoveryWorker: new TestDiscoveryWorker(_input =>
|
563
577
|
{
|
@@ -630,7 +644,7 @@ public class RunWorkerTests
|
|
630
644
|
<PackageReference Include="Some.Package" Version="1.0.1" />
|
631
645
|
</ItemGroup>
|
632
646
|
</Project>
|
633
|
-
""");
|
647
|
+
""".SetEOL(EOL));
|
634
648
|
break;
|
635
649
|
case "Some.Package2":
|
636
650
|
await File.WriteAllTextAsync(projectPath, """
|
@@ -648,14 +662,14 @@ public class RunWorkerTests
|
|
648
662
|
</Reference>
|
649
663
|
</ItemGroup>
|
650
664
|
</Project>
|
651
|
-
""");
|
665
|
+
""".SetEOL(EOL));
|
652
666
|
var packagesConfigPath = Path.Join(Path.GetDirectoryName(projectPath)!, "packages.config");
|
653
667
|
await File.WriteAllTextAsync(packagesConfigPath, """
|
654
668
|
<?xml version="1.0" encoding="utf-8"?>
|
655
669
|
<packages>
|
656
670
|
<package id="Some.Package2" version="2.0.1" targetFramework="net8.0" />
|
657
671
|
</packages>
|
658
|
-
""");
|
672
|
+
""".SetEOL(EOL));
|
659
673
|
break;
|
660
674
|
default:
|
661
675
|
throw new NotSupportedException();
|
@@ -676,7 +690,7 @@ public class RunWorkerTests
|
|
676
690
|
<packages>
|
677
691
|
<package id="Some.Package2" version="2.0.0" targetFramework="net8.0" />
|
678
692
|
</packages>
|
679
|
-
"""))
|
693
|
+
""".SetEOL(EOL)))
|
680
694
|
},
|
681
695
|
new DependencyFile()
|
682
696
|
{
|
@@ -691,7 +705,7 @@ public class RunWorkerTests
|
|
691
705
|
<PackageReference Include="Some.Package" Version="1.0.0" />
|
692
706
|
</ItemGroup>
|
693
707
|
</Project>
|
694
|
-
"""))
|
708
|
+
""".SetEOL(EOL)))
|
695
709
|
},
|
696
710
|
],
|
697
711
|
BaseCommitSha = "TEST-COMMIT-SHA",
|
@@ -815,7 +829,7 @@ public class RunWorkerTests
|
|
815
829
|
<packages>
|
816
830
|
<package id="Some.Package2" version="2.0.1" targetFramework="net8.0" />
|
817
831
|
</packages>
|
818
|
-
""",
|
832
|
+
""".SetEOL(EOL),
|
819
833
|
},
|
820
834
|
new DependencyFile()
|
821
835
|
{
|
@@ -836,7 +850,7 @@ public class RunWorkerTests
|
|
836
850
|
</Reference>
|
837
851
|
</ItemGroup>
|
838
852
|
</Project>
|
839
|
-
""",
|
853
|
+
""".SetEOL(EOL),
|
840
854
|
},
|
841
855
|
],
|
842
856
|
BaseCommitSha = "TEST-COMMIT-SHA",
|
@@ -849,11 +863,14 @@ public class RunWorkerTests
|
|
849
863
|
);
|
850
864
|
}
|
851
865
|
|
852
|
-
[
|
853
|
-
|
866
|
+
[Theory]
|
867
|
+
[InlineData(EOLType.CR)]
|
868
|
+
[InlineData(EOLType.LF)]
|
869
|
+
[InlineData(EOLType.CRLF)]
|
870
|
+
public async Task UpdateHandlesPackagesConfigFromReferencedCsprojFiles(EOLType EOL)
|
854
871
|
{
|
855
|
-
var repoMetadata = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some-package" />""");
|
856
|
-
var repoMetadata2 = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some-package2" />""");
|
872
|
+
var repoMetadata = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some-package" />""".SetEOL(EOL));
|
873
|
+
var repoMetadata2 = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some-package2" />""".SetEOL(EOL));
|
857
874
|
await RunAsync(
|
858
875
|
packages:
|
859
876
|
[
|
@@ -886,13 +903,13 @@ public class RunWorkerTests
|
|
886
903
|
<ProjectReference Include="../ProjectB/ProjectB.csproj" />
|
887
904
|
</ItemGroup>
|
888
905
|
</Project>
|
889
|
-
"""),
|
906
|
+
""".SetEOL(EOL)),
|
890
907
|
("some-dir/ProjectA/packages.config", """
|
891
908
|
<?xml version="1.0" encoding="utf-8"?>
|
892
909
|
<packages>
|
893
910
|
<package id="Some.Package2" version="2.0.0" targetFramework="net8.0" />
|
894
911
|
</packages>
|
895
|
-
"""),
|
912
|
+
""".SetEOL(EOL)),
|
896
913
|
("some-dir/ProjectB/ProjectB.csproj", """
|
897
914
|
<Project Sdk="Microsoft.NET.Sdk">
|
898
915
|
<PropertyGroup>
|
@@ -902,13 +919,13 @@ public class RunWorkerTests
|
|
902
919
|
<PackageReference Include="Some.Package" Version="1.0.0" />
|
903
920
|
</ItemGroup>
|
904
921
|
</Project>
|
905
|
-
"""),
|
922
|
+
""".SetEOL(EOL)),
|
906
923
|
("some-dir/ProjectB/packages.config", """
|
907
924
|
<?xml version="1.0" encoding="utf-8"?>
|
908
925
|
<packages>
|
909
926
|
<package id="Some.Package2" version="2.0.0" targetFramework="net8.0" />
|
910
927
|
</packages>
|
911
|
-
"""),
|
928
|
+
""".SetEOL(EOL)),
|
912
929
|
],
|
913
930
|
discoveryWorker: new TestDiscoveryWorker(_input =>
|
914
931
|
{
|
@@ -999,7 +1016,7 @@ public class RunWorkerTests
|
|
999
1016
|
<ProjectReference Include="../ProjectB/ProjectB.csproj" />
|
1000
1017
|
</ItemGroup>
|
1001
1018
|
</Project>
|
1002
|
-
""");
|
1019
|
+
""".SetEOL(EOL));
|
1003
1020
|
break;
|
1004
1021
|
case ("ProjectA.csproj", "Some.Package2"):
|
1005
1022
|
await File.WriteAllTextAsync(projectPath, """
|
@@ -1020,13 +1037,13 @@ public class RunWorkerTests
|
|
1020
1037
|
</Reference>
|
1021
1038
|
</ItemGroup>
|
1022
1039
|
</Project>
|
1023
|
-
""");
|
1040
|
+
""".SetEOL(EOL));
|
1024
1041
|
await File.WriteAllTextAsync(packagesConfigPath, """
|
1025
1042
|
<?xml version="1.0" encoding="utf-8"?>
|
1026
1043
|
<packages>
|
1027
1044
|
<package id="Some.Package2" version="2.0.1" targetFramework="net8.0" />
|
1028
1045
|
</packages>
|
1029
|
-
""");
|
1046
|
+
""".SetEOL(EOL));
|
1030
1047
|
break;
|
1031
1048
|
case ("ProjectB.csproj", "Some.Package"):
|
1032
1049
|
await File.WriteAllTextAsync(projectPath, """
|
@@ -1038,7 +1055,7 @@ public class RunWorkerTests
|
|
1038
1055
|
<PackageReference Include="Some.Package" Version="1.0.1" />
|
1039
1056
|
</ItemGroup>
|
1040
1057
|
</Project>
|
1041
|
-
""");
|
1058
|
+
""".SetEOL(EOL));
|
1042
1059
|
break;
|
1043
1060
|
case ("ProjectB.csproj", "Some.Package2"):
|
1044
1061
|
await File.WriteAllTextAsync(projectPath, """
|
@@ -1056,13 +1073,13 @@ public class RunWorkerTests
|
|
1056
1073
|
</Reference>
|
1057
1074
|
</ItemGroup>
|
1058
1075
|
</Project>
|
1059
|
-
""");
|
1076
|
+
""".SetEOL(EOL));
|
1060
1077
|
await File.WriteAllTextAsync(packagesConfigPath, """
|
1061
1078
|
<?xml version="1.0" encoding="utf-8"?>
|
1062
1079
|
<packages>
|
1063
1080
|
<package id="Some.Package2" version="2.0.1" targetFramework="net8.0" />
|
1064
1081
|
</packages>
|
1065
|
-
""");
|
1082
|
+
""".SetEOL(EOL));
|
1066
1083
|
break;
|
1067
1084
|
default:
|
1068
1085
|
throw new NotSupportedException();
|
@@ -1083,7 +1100,7 @@ public class RunWorkerTests
|
|
1083
1100
|
<packages>
|
1084
1101
|
<package id="Some.Package2" version="2.0.0" targetFramework="net8.0" />
|
1085
1102
|
</packages>
|
1086
|
-
"""))
|
1103
|
+
""".SetEOL(EOL)))
|
1087
1104
|
},
|
1088
1105
|
new DependencyFile()
|
1089
1106
|
{
|
@@ -1101,7 +1118,7 @@ public class RunWorkerTests
|
|
1101
1118
|
<ProjectReference Include="../ProjectB/ProjectB.csproj" />
|
1102
1119
|
</ItemGroup>
|
1103
1120
|
</Project>
|
1104
|
-
"""))
|
1121
|
+
""".SetEOL(EOL)))
|
1105
1122
|
},
|
1106
1123
|
new DependencyFile()
|
1107
1124
|
{
|
@@ -1112,7 +1129,7 @@ public class RunWorkerTests
|
|
1112
1129
|
<packages>
|
1113
1130
|
<package id="Some.Package2" version="2.0.0" targetFramework="net8.0" />
|
1114
1131
|
</packages>
|
1115
|
-
"""))
|
1132
|
+
""".SetEOL(EOL)))
|
1116
1133
|
},
|
1117
1134
|
new DependencyFile()
|
1118
1135
|
{
|
@@ -1127,7 +1144,7 @@ public class RunWorkerTests
|
|
1127
1144
|
<PackageReference Include="Some.Package" Version="1.0.0" />
|
1128
1145
|
</ItemGroup>
|
1129
1146
|
</Project>
|
1130
|
-
"""))
|
1147
|
+
""".SetEOL(EOL)))
|
1131
1148
|
},
|
1132
1149
|
],
|
1133
1150
|
BaseCommitSha = "TEST-COMMIT-SHA",
|
@@ -1337,7 +1354,7 @@ public class RunWorkerTests
|
|
1337
1354
|
<packages>
|
1338
1355
|
<package id="Some.Package2" version="2.0.1" targetFramework="net8.0" />
|
1339
1356
|
</packages>
|
1340
|
-
""",
|
1357
|
+
""".SetEOL(EOL),
|
1341
1358
|
},
|
1342
1359
|
new DependencyFile()
|
1343
1360
|
{
|
@@ -1361,7 +1378,7 @@ public class RunWorkerTests
|
|
1361
1378
|
</Reference>
|
1362
1379
|
</ItemGroup>
|
1363
1380
|
</Project>
|
1364
|
-
""",
|
1381
|
+
""".SetEOL(EOL),
|
1365
1382
|
},
|
1366
1383
|
new DependencyFile()
|
1367
1384
|
{
|
@@ -1372,7 +1389,7 @@ public class RunWorkerTests
|
|
1372
1389
|
<packages>
|
1373
1390
|
<package id="Some.Package2" version="2.0.1" targetFramework="net8.0" />
|
1374
1391
|
</packages>
|
1375
|
-
""",
|
1392
|
+
""".SetEOL(EOL),
|
1376
1393
|
},
|
1377
1394
|
new DependencyFile()
|
1378
1395
|
{
|
@@ -1393,7 +1410,7 @@ public class RunWorkerTests
|
|
1393
1410
|
</Reference>
|
1394
1411
|
</ItemGroup>
|
1395
1412
|
</Project>
|
1396
|
-
""",
|
1413
|
+
""".SetEOL(EOL),
|
1397
1414
|
},
|
1398
1415
|
],
|
1399
1416
|
BaseCommitSha = "TEST-COMMIT-SHA",
|
@@ -1406,8 +1423,11 @@ public class RunWorkerTests
|
|
1406
1423
|
);
|
1407
1424
|
}
|
1408
1425
|
|
1409
|
-
[
|
1410
|
-
|
1426
|
+
[Theory]
|
1427
|
+
[InlineData(EOLType.CR)]
|
1428
|
+
[InlineData(EOLType.LF)]
|
1429
|
+
[InlineData(EOLType.CRLF)]
|
1430
|
+
public async Task UpdatedFilesAreOnlyReportedOnce(EOLType EOL)
|
1411
1431
|
{
|
1412
1432
|
await RunAsync(
|
1413
1433
|
job: new()
|
@@ -1434,14 +1454,14 @@ public class RunWorkerTests
|
|
1434
1454
|
<ProjectFile Include="project2/project2.csproj" />
|
1435
1455
|
</ItemGroup>
|
1436
1456
|
</Project>
|
1437
|
-
"""),
|
1457
|
+
""".SetEOL(EOL)),
|
1438
1458
|
("Directory.Build.props", """
|
1439
1459
|
<Project>
|
1440
1460
|
<PropertyGroup>
|
1441
1461
|
<SomePackageVersion>1.0.0</SomePackageVersion>
|
1442
1462
|
</PropertyGroup>
|
1443
1463
|
</Project>
|
1444
|
-
"""),
|
1464
|
+
""".SetEOL(EOL)),
|
1445
1465
|
("project1/project1.csproj", """
|
1446
1466
|
<Project Sdk="Microsoft.NET.Sdk">
|
1447
1467
|
<PropertyGroup>
|
@@ -1451,7 +1471,7 @@ public class RunWorkerTests
|
|
1451
1471
|
<PackageReference Include="Some.Package" Version="$(SomePackageVersion)" />
|
1452
1472
|
</ItemGroup>
|
1453
1473
|
</Project>
|
1454
|
-
"""),
|
1474
|
+
""".SetEOL(EOL)),
|
1455
1475
|
("project2/project2.csproj", """
|
1456
1476
|
<Project Sdk="Microsoft.NET.Sdk">
|
1457
1477
|
<PropertyGroup>
|
@@ -1461,7 +1481,7 @@ public class RunWorkerTests
|
|
1461
1481
|
<PackageReference Include="Some.Package" Version="$(SomePackageVersion)" />
|
1462
1482
|
</ItemGroup>
|
1463
1483
|
</Project>
|
1464
|
-
""")
|
1484
|
+
""".SetEOL(EOL))
|
1465
1485
|
],
|
1466
1486
|
discoveryWorker: new TestDiscoveryWorker(_input =>
|
1467
1487
|
{
|
@@ -1526,7 +1546,7 @@ public class RunWorkerTests
|
|
1526
1546
|
<SomePackageVersion>1.1.0</SomePackageVersion>
|
1527
1547
|
</PropertyGroup>
|
1528
1548
|
</Project>
|
1529
|
-
""");
|
1549
|
+
""".SetEOL(EOL));
|
1530
1550
|
return new UpdateOperationResult();
|
1531
1551
|
}),
|
1532
1552
|
expectedResult: new RunResult()
|
@@ -1543,7 +1563,7 @@ public class RunWorkerTests
|
|
1543
1563
|
<SomePackageVersion>1.0.0</SomePackageVersion>
|
1544
1564
|
</PropertyGroup>
|
1545
1565
|
</Project>
|
1546
|
-
"""))
|
1566
|
+
""".SetEOL(EOL)))
|
1547
1567
|
},
|
1548
1568
|
new DependencyFile()
|
1549
1569
|
{
|
@@ -1558,7 +1578,7 @@ public class RunWorkerTests
|
|
1558
1578
|
<PackageReference Include="Some.Package" Version="$(SomePackageVersion)" />
|
1559
1579
|
</ItemGroup>
|
1560
1580
|
</Project>
|
1561
|
-
"""))
|
1581
|
+
""".SetEOL(EOL)))
|
1562
1582
|
},
|
1563
1583
|
new DependencyFile()
|
1564
1584
|
{
|
@@ -1573,7 +1593,7 @@ public class RunWorkerTests
|
|
1573
1593
|
<PackageReference Include="Some.Package" Version="$(SomePackageVersion)" />
|
1574
1594
|
</ItemGroup>
|
1575
1595
|
</Project>
|
1576
|
-
"""))
|
1596
|
+
""".SetEOL(EOL)))
|
1577
1597
|
},
|
1578
1598
|
],
|
1579
1599
|
BaseCommitSha = "TEST-COMMIT-SHA",
|
@@ -1698,7 +1718,7 @@ public class RunWorkerTests
|
|
1698
1718
|
<SomePackageVersion>1.1.0</SomePackageVersion>
|
1699
1719
|
</PropertyGroup>
|
1700
1720
|
</Project>
|
1701
|
-
""",
|
1721
|
+
""".SetEOL(EOL),
|
1702
1722
|
}
|
1703
1723
|
],
|
1704
1724
|
BaseCommitSha = "TEST-COMMIT-SHA",
|
@@ -1711,8 +1731,11 @@ public class RunWorkerTests
|
|
1711
1731
|
);
|
1712
1732
|
}
|
1713
1733
|
|
1714
|
-
[
|
1715
|
-
|
1734
|
+
[Theory]
|
1735
|
+
[InlineData(EOLType.CR)]
|
1736
|
+
[InlineData(EOLType.LF)]
|
1737
|
+
[InlineData(EOLType.CRLF)]
|
1738
|
+
public async Task UpdatePackageWithDifferentVersionsInDifferentDirectories(EOLType EOL)
|
1716
1739
|
{
|
1717
1740
|
// this test passes `null` for discovery, analyze, and update workers to fully test the desired behavior
|
1718
1741
|
|
@@ -1754,7 +1777,7 @@ public class RunWorkerTests
|
|
1754
1777
|
<ProjectFile Include="library3\library3.csproj" />
|
1755
1778
|
</ItemGroup>
|
1756
1779
|
</Project>
|
1757
|
-
"""),
|
1780
|
+
""".SetEOL(EOL)),
|
1758
1781
|
("Directory.Build.props", "<Project />"),
|
1759
1782
|
("Directory.Build.targets", "<Project />"),
|
1760
1783
|
("Directory.Packages.props", """
|
@@ -1763,7 +1786,7 @@ public class RunWorkerTests
|
|
1763
1786
|
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
|
1764
1787
|
</PropertyGroup>
|
1765
1788
|
</Project>
|
1766
|
-
"""),
|
1789
|
+
""".SetEOL(EOL)),
|
1767
1790
|
("library1/library1.csproj", """
|
1768
1791
|
<Project Sdk="Microsoft.NET.Sdk">
|
1769
1792
|
<PropertyGroup>
|
@@ -1773,7 +1796,7 @@ public class RunWorkerTests
|
|
1773
1796
|
<PackageReference Include="Some.Package" Version="2.0.0" />
|
1774
1797
|
</ItemGroup>
|
1775
1798
|
</Project>
|
1776
|
-
"""),
|
1799
|
+
""".SetEOL(EOL)),
|
1777
1800
|
("library2/library2.csproj", """
|
1778
1801
|
<Project Sdk="Microsoft.NET.Sdk">
|
1779
1802
|
<PropertyGroup>
|
@@ -1783,7 +1806,7 @@ public class RunWorkerTests
|
|
1783
1806
|
<PackageReference Include="Some.Package" Version="1.0.0" />
|
1784
1807
|
</ItemGroup>
|
1785
1808
|
</Project>
|
1786
|
-
"""),
|
1809
|
+
""".SetEOL(EOL)),
|
1787
1810
|
("library3/library3.csproj", """
|
1788
1811
|
<Project Sdk="Microsoft.NET.Sdk">
|
1789
1812
|
<PropertyGroup>
|
@@ -1793,7 +1816,7 @@ public class RunWorkerTests
|
|
1793
1816
|
<PackageReference Include="Package.With.Transitive.Dependency" Version="0.1.0" />
|
1794
1817
|
</ItemGroup>
|
1795
1818
|
</Project>
|
1796
|
-
"""),
|
1819
|
+
""".SetEOL(EOL)),
|
1797
1820
|
],
|
1798
1821
|
discoveryWorker: null,
|
1799
1822
|
analyzeWorker: null,
|
@@ -1824,7 +1847,7 @@ public class RunWorkerTests
|
|
1824
1847
|
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
|
1825
1848
|
</PropertyGroup>
|
1826
1849
|
</Project>
|
1827
|
-
"""))
|
1850
|
+
""".SetEOL(EOL)))
|
1828
1851
|
},
|
1829
1852
|
new DependencyFile()
|
1830
1853
|
{
|
@@ -1839,7 +1862,7 @@ public class RunWorkerTests
|
|
1839
1862
|
<PackageReference Include="Some.Package" Version="2.0.0" />
|
1840
1863
|
</ItemGroup>
|
1841
1864
|
</Project>
|
1842
|
-
"""))
|
1865
|
+
""".SetEOL(EOL)))
|
1843
1866
|
},
|
1844
1867
|
new DependencyFile()
|
1845
1868
|
{
|
@@ -1854,7 +1877,7 @@ public class RunWorkerTests
|
|
1854
1877
|
<PackageReference Include="Some.Package" Version="1.0.0" />
|
1855
1878
|
</ItemGroup>
|
1856
1879
|
</Project>
|
1857
|
-
"""))
|
1880
|
+
""".SetEOL(EOL)))
|
1858
1881
|
},
|
1859
1882
|
new DependencyFile()
|
1860
1883
|
{
|
@@ -1869,7 +1892,7 @@ public class RunWorkerTests
|
|
1869
1892
|
<PackageReference Include="Package.With.Transitive.Dependency" Version="0.1.0" />
|
1870
1893
|
</ItemGroup>
|
1871
1894
|
</Project>
|
1872
|
-
"""))
|
1895
|
+
""".SetEOL(EOL)))
|
1873
1896
|
}
|
1874
1897
|
],
|
1875
1898
|
BaseCommitSha = "TEST-COMMIT-SHA",
|
@@ -2020,7 +2043,7 @@ public class RunWorkerTests
|
|
2020
2043
|
<PackageReference Include="Some.Package" Version="2.0.0" />
|
2021
2044
|
</ItemGroup>
|
2022
2045
|
</Project>
|
2023
|
-
"""
|
2046
|
+
""".SetEOL(EOL)
|
2024
2047
|
},
|
2025
2048
|
new()
|
2026
2049
|
{
|
@@ -2036,7 +2059,7 @@ public class RunWorkerTests
|
|
2036
2059
|
<PackageReference Include="Some.Package" Version="2.0.0" />
|
2037
2060
|
</ItemGroup>
|
2038
2061
|
</Project>
|
2039
|
-
"""
|
2062
|
+
""".SetEOL(EOL)
|
2040
2063
|
}
|
2041
2064
|
],
|
2042
2065
|
BaseCommitSha = "TEST-COMMIT-SHA",
|
@@ -620,6 +620,14 @@ public class SerializationTests
|
|
620
620
|
"""
|
621
621
|
];
|
622
622
|
|
623
|
+
yield return
|
624
|
+
[
|
625
|
+
new DependencyNotFound("some source"),
|
626
|
+
"""
|
627
|
+
{"data":{"error-type":"dependency_not_found","error-details":{"source":"some source"}}}
|
628
|
+
"""
|
629
|
+
];
|
630
|
+
|
623
631
|
yield return
|
624
632
|
[
|
625
633
|
new JobRepoNotFound("some message"),
|
@@ -0,0 +1,23 @@
|
|
1
|
+
using System.Text.RegularExpressions;
|
2
|
+
|
3
|
+
using Xunit;
|
4
|
+
|
5
|
+
using static NuGetUpdater.Core.Utilities.EOLHandling;
|
6
|
+
|
7
|
+
namespace NuGetUpdater.Core.Test.Utilities
|
8
|
+
{
|
9
|
+
public class EOLHandlingTests
|
10
|
+
{
|
11
|
+
[Theory]
|
12
|
+
[InlineData(EOLType.LF, "\n")]
|
13
|
+
[InlineData(EOLType.CR, "\r")]
|
14
|
+
[InlineData(EOLType.CRLF, "\r\n")]
|
15
|
+
public void ValidateEOLNormalizesFromLF(EOLType eolType, string literal)
|
16
|
+
{
|
17
|
+
var teststring = "this\ris\na\r\nstring\rwith\nmixed\r\nline\rendings\n.";
|
18
|
+
var changed = teststring.SetEOL(eolType);
|
19
|
+
var lineEndings = Regex.Split(changed, "\\S+");
|
20
|
+
Assert.All(lineEndings, lineEnding => lineEnding.Equals(literal));
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
@@ -1521,9 +1521,25 @@ public class MSBuildHelperTests : TestBase
|
|
1521
1521
|
yield return
|
1522
1522
|
[
|
1523
1523
|
// output
|
1524
|
-
"Package 'Some.Package' is not found on source",
|
1524
|
+
"Package 'Some.Package' is not found on source 'some-source'.",
|
1525
1525
|
// expectedError
|
1526
|
-
new
|
1526
|
+
new DependencyNotFound("Some.Package"),
|
1527
|
+
];
|
1528
|
+
|
1529
|
+
yield return
|
1530
|
+
[
|
1531
|
+
// output
|
1532
|
+
"error NU1101: Unable to find package Some.Package. No packages exist with this id in source(s): some-source",
|
1533
|
+
// expectedError
|
1534
|
+
new DependencyNotFound("Some.Package"),
|
1535
|
+
];
|
1536
|
+
|
1537
|
+
yield return
|
1538
|
+
[
|
1539
|
+
// output
|
1540
|
+
"Unable to find package Some.Package with version (= 1.2.3)",
|
1541
|
+
// expectedError
|
1542
|
+
new DependencyNotFound("Some.Package"),
|
1527
1543
|
];
|
1528
1544
|
|
1529
1545
|
yield return
|
@@ -325,6 +325,9 @@ module Dependabot
|
|
325
325
|
file_path = T.let(error_details.fetch("file-path"), String)
|
326
326
|
message = T.let(error_details.fetch("message", nil), T.nilable(String))
|
327
327
|
raise DependencyFileNotParseable.new(file_path, message)
|
328
|
+
when "dependency_not_found"
|
329
|
+
source = T.let(error_details.fetch("source"), String)
|
330
|
+
raise DependencyNotFound, source
|
328
331
|
when "illformed_requirement"
|
329
332
|
raise BadRequirementError, T.let(error_details.fetch("message"), String)
|
330
333
|
when "private_source_authentication_failure"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-nuget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.298.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dependabot-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.298.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.298.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubyzip
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -375,6 +375,7 @@ files:
|
|
375
375
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs
|
376
376
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/AssertEx.cs
|
377
377
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/DiffUtil.cs
|
378
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/EOLHandlingTests.cs
|
378
379
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/JsonHelperTests.cs
|
379
380
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/LinuxOnlyAttribute.cs
|
380
381
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs
|
@@ -402,6 +403,7 @@ files:
|
|
402
403
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Dependency.cs
|
403
404
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyDiscovery.props
|
404
405
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyDiscovery.targets
|
406
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyNotFoundException.cs
|
405
407
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyType.cs
|
406
408
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs
|
407
409
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DotNetToolsJsonDiscovery.cs
|
@@ -446,6 +448,7 @@ files:
|
|
446
448
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFileNotFound.cs
|
447
449
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFileNotParseable.cs
|
448
450
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyGroup.cs
|
451
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyNotFound.cs
|
449
452
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/GroupPullRequest.cs
|
450
453
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/IncrementMetric.cs
|
451
454
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Job.cs
|
@@ -491,6 +494,7 @@ files:
|
|
491
494
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ConsoleLogger.cs
|
492
495
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DependencyConflictResolver.cs
|
493
496
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DotNetPackageCorrelationManager.cs
|
497
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/EOLHandling.cs
|
494
498
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/HashSetExtensions.cs
|
495
499
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ILogger.cs
|
496
500
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ImmutableArrayExtensions.cs
|
@@ -533,7 +537,7 @@ licenses:
|
|
533
537
|
- MIT
|
534
538
|
metadata:
|
535
539
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
536
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
540
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.298.0
|
537
541
|
post_install_message:
|
538
542
|
rdoc_options: []
|
539
543
|
require_paths:
|