dependabot-nuget 0.279.0 → 0.280.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (21) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +7 -0
  3. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +6 -0
  4. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +8 -1
  5. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +7 -1
  6. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ErrorType.cs +1 -0
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/NativeResult.cs +1 -1
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobErrorBase.cs +1 -1
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UpdateNotPossible.cs +6 -0
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +7 -0
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/UpdateNotPossibleException.cs +11 -0
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +2 -0
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs +1 -1
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +18 -3
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +11 -0
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTestBase.cs +5 -9
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +5 -8
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +2 -7
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +79 -1
  20. data/lib/dependabot/nuget/native_helpers.rb +5 -3
  21. metadata +12 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 644fb3ec407649eb15e5e9ab7be78a85f8f03900adcc93819e3be781610cf78e
4
- data.tar.gz: 408ef4e6a5d517d159256429a2d68d61bc0e0188e3f0c13a4c0aa6b00b55e74b
3
+ metadata.gz: 2728d8749a316ac4ecbd46826beffaefc51e5101c1154d0fdef5ad756158c256
4
+ data.tar.gz: 3ec34208b76ed22dbef3ae0e49511e77f85d73aea1b980180292b5225e26367a
5
5
  SHA512:
6
- metadata.gz: 25125733df999707391798277975f970cfcf4bd87809165612d600a245d758e9bad553e046c8a0ff566446a90426c6719fedffa3a82139212c6f106de412bea7
7
- data.tar.gz: 5db427ffb67c418e0f99dcc3f83a5f320a7fc3aaff177425a5c32d9b48b3296495c9fdc5f0fbd0959c2da0cc0b35132a532b1ec83af494950df15d3fa076435e
6
+ metadata.gz: 4cf2906e79a866fb5c4d89807e893d6486f1fae08b9b951da9a049fbd546cc59d522d6b8ace80fe0ee59353eb93224b648370b404bf69ff845d89fafd70894ba
7
+ data.tar.gz: '05801823dee91eba1e490ee4fef1d44a2e83f632c7823c5ae6bd9cd3955d085c8c6c5e015023c4a6a0e34ed453e2e3d956c9399f955d608fd87381ef2ff620d7'
@@ -1,8 +1,10 @@
1
1
  using System.Text;
2
+ using System.Text.Json;
2
3
  using System.Xml.Linq;
3
4
 
4
5
  using NuGetUpdater.Core;
5
6
  using NuGetUpdater.Core.Analyze;
7
+ using NuGetUpdater.Core.Discover;
6
8
  using NuGetUpdater.Core.Test;
7
9
  using NuGetUpdater.Core.Test.Analyze;
8
10
  using NuGetUpdater.Core.Test.Update;
@@ -334,6 +336,11 @@ public partial class EntryPointTests
334
336
  Console.SetOut(originalOut);
335
337
  Console.SetError(originalErr);
336
338
  }
339
+
340
+ var resultPath = Path.Join(path, AnalyzeWorker.AnalysisDirectoryName, $"{dependencyName}.json");
341
+ var resultJson = await File.ReadAllTextAsync(resultPath);
342
+ var resultObject = JsonSerializer.Deserialize<AnalysisResult>(resultJson, DiscoveryWorker.SerializerOptions);
343
+ return resultObject!;
337
344
  });
338
345
 
339
346
  ValidateAnalysisResult(expectedResult, actualResult);
@@ -1,4 +1,5 @@
1
1
  using System.Text;
2
+ using System.Text.Json;
2
3
 
3
4
  using NuGetUpdater.Core;
4
5
  using NuGetUpdater.Core.Discover;
@@ -390,6 +391,11 @@ public partial class EntryPointTests
390
391
  Console.SetOut(originalOut);
391
392
  Console.SetError(originalErr);
392
393
  }
394
+
395
+ var resultPath = Path.Join(path, DiscoveryWorker.DiscoveryResultFileName);
396
+ var resultJson = await File.ReadAllTextAsync(resultPath);
397
+ var resultObject = JsonSerializer.Deserialize<WorkspaceDiscoveryResult>(resultJson, DiscoveryWorker.SerializerOptions);
398
+ return resultObject!;
393
399
  });
394
400
 
395
401
  ValidateWorkspaceResult(expectedResult, actualResult);
@@ -30,6 +30,13 @@ public partial class AnalyzeWorker
30
30
  }
31
31
 
32
32
  public async Task RunAsync(string repoRoot, string discoveryPath, string dependencyPath, string analysisDirectory)
33
+ {
34
+ var analysisResult = await RunWithErrorHandlingAsync(repoRoot, discoveryPath, dependencyPath);
35
+ var dependencyInfo = await DeserializeJsonFileAsync<DependencyInfo>(dependencyPath, nameof(DependencyInfo));
36
+ await WriteResultsAsync(analysisDirectory, dependencyInfo.Name, analysisResult, _logger);
37
+ }
38
+
39
+ internal async Task<AnalysisResult> RunWithErrorHandlingAsync(string repoRoot, string discoveryPath, string dependencyPath)
33
40
  {
34
41
  AnalysisResult analysisResult;
35
42
  var discovery = await DeserializeJsonFileAsync<WorkspaceDiscoveryResult>(discoveryPath, nameof(WorkspaceDiscoveryResult));
@@ -54,7 +61,7 @@ public partial class AnalyzeWorker
54
61
  };
55
62
  }
56
63
 
57
- await WriteResultsAsync(analysisDirectory, dependencyInfo.Name, analysisResult, _logger);
64
+ return analysisResult;
58
65
  }
59
66
 
60
67
  public async Task<AnalysisResult> RunAsync(string repoRoot, WorkspaceDiscoveryResult discovery, DependencyInfo dependencyInfo)
@@ -31,6 +31,12 @@ public partial class DiscoveryWorker
31
31
  }
32
32
 
33
33
  public async Task RunAsync(string repoRootPath, string workspacePath, string outputPath)
34
+ {
35
+ var result = await RunWithErrorHandlingAsync(repoRootPath, workspacePath);
36
+ await WriteResultsAsync(repoRootPath, outputPath, result);
37
+ }
38
+
39
+ internal async Task<WorkspaceDiscoveryResult> RunWithErrorHandlingAsync(string repoRootPath, string workspacePath)
34
40
  {
35
41
  WorkspaceDiscoveryResult result;
36
42
  try
@@ -49,7 +55,7 @@ public partial class DiscoveryWorker
49
55
  };
50
56
  }
51
57
 
52
- await WriteResultsAsync(repoRootPath, outputPath, result);
58
+ return result;
53
59
  }
54
60
 
55
61
  internal async Task<WorkspaceDiscoveryResult> RunAsync(string repoRootPath, string workspacePath)
@@ -6,4 +6,5 @@ public enum ErrorType
6
6
  None,
7
7
  AuthenticationFailure,
8
8
  MissingFile,
9
+ UpdateNotPossible,
9
10
  }
@@ -4,5 +4,5 @@ public record NativeResult
4
4
  {
5
5
  // TODO: nullable not required, `ErrorType.None` is the default anyway
6
6
  public ErrorType? ErrorType { get; init; }
7
- public string? ErrorDetails { get; init; }
7
+ public object? ErrorDetails { get; init; }
8
8
  }
@@ -7,5 +7,5 @@ public abstract record JobErrorBase
7
7
  [JsonPropertyName("error-type")]
8
8
  public abstract string Type { get; }
9
9
  [JsonPropertyName("error-details")]
10
- public required string Details { get; init; }
10
+ public required object Details { get; init; }
11
11
  }
@@ -0,0 +1,6 @@
1
+ namespace NuGetUpdater.Core.Run.ApiModel;
2
+
3
+ public record UpdateNotPossible : JobErrorBase
4
+ {
5
+ public override string Type => "update_not_possible";
6
+ }
@@ -88,6 +88,13 @@ public class RunWorker
88
88
  Details = ex.FilePath,
89
89
  };
90
90
  }
91
+ catch (UpdateNotPossibleException ex)
92
+ {
93
+ error = new UpdateNotPossible()
94
+ {
95
+ Details = ex.Dependencies,
96
+ };
97
+ }
91
98
  catch (Exception ex)
92
99
  {
93
100
  error = new UnknownError()
@@ -0,0 +1,11 @@
1
+ namespace NuGetUpdater.Core;
2
+
3
+ internal class UpdateNotPossibleException : Exception
4
+ {
5
+ public string[] Dependencies { get; }
6
+
7
+ public UpdateNotPossibleException(string[] dependencies)
8
+ {
9
+ Dependencies = dependencies;
10
+ }
11
+ }
@@ -139,6 +139,7 @@ internal static class PackagesConfigUpdater
139
139
 
140
140
  if (exitCodeAgain != 0)
141
141
  {
142
+ MSBuildHelper.ThrowOnMissingPackages(restoreOutput);
142
143
  throw new Exception($"Unable to restore.\nOutput:\n${restoreOutput}\n");
143
144
  }
144
145
 
@@ -147,6 +148,7 @@ internal static class PackagesConfigUpdater
147
148
 
148
149
  MSBuildHelper.ThrowOnUnauthenticatedFeed(fullOutput);
149
150
  MSBuildHelper.ThrowOnMissingFile(fullOutput);
151
+ MSBuildHelper.ThrowOnMissingPackages(fullOutput);
150
152
  throw new Exception(fullOutput);
151
153
  }
152
154
  }
@@ -350,7 +350,7 @@ internal static class SdkPackageUpdater
350
350
  var specificResolvedDependency = resolvedDependencies.Where(d => d.Name.Equals(dependencyName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
351
351
  if (specificResolvedDependency is null)
352
352
  {
353
- logger.Log($" Unable resolve requested dependency for {dependencyName} in {projectFile.Path}.");
353
+ logger.Log($" Unable to resolve requested dependency for {dependencyName} in {projectFile.Path}.");
354
354
  continue;
355
355
  }
356
356
 
@@ -24,6 +24,16 @@ public class UpdaterWorker
24
24
  }
25
25
 
26
26
  public async Task RunAsync(string repoRootPath, string workspacePath, string dependencyName, string previousDependencyVersion, string newDependencyVersion, bool isTransitive, string? resultOutputPath = null)
27
+ {
28
+ var result = await RunWithErrorHandlingAsync(repoRootPath, workspacePath, dependencyName, previousDependencyVersion, newDependencyVersion, isTransitive);
29
+ if (resultOutputPath is { })
30
+ {
31
+ await WriteResultFile(result, resultOutputPath, _logger);
32
+ }
33
+ }
34
+
35
+ // this is a convenient method for tests
36
+ internal async Task<UpdateOperationResult> RunWithErrorHandlingAsync(string repoRootPath, string workspacePath, string dependencyName, string previousDependencyVersion, string newDependencyVersion, bool isTransitive)
27
37
  {
28
38
  UpdateOperationResult result = new(); // assumed to be ok until proven otherwise
29
39
  try
@@ -52,11 +62,16 @@ public class UpdaterWorker
52
62
  ErrorDetails = ex.FilePath,
53
63
  };
54
64
  }
55
-
56
- if (resultOutputPath is { })
65
+ catch (UpdateNotPossibleException ex)
57
66
  {
58
- await WriteResultFile(result, resultOutputPath, _logger);
67
+ result = new()
68
+ {
69
+ ErrorType = ErrorType.UpdateNotPossible,
70
+ ErrorDetails = ex.Dependencies,
71
+ };
59
72
  }
73
+
74
+ return result;
60
75
  }
61
76
 
62
77
  public async Task<UpdateOperationResult> RunAsync(string repoRootPath, string workspacePath, string dependencyName, string previousDependencyVersion, string newDependencyVersion, bool isTransitive)
@@ -833,6 +833,17 @@ internal static partial class MSBuildHelper
833
833
  }
834
834
  }
835
835
 
836
+ internal static void ThrowOnMissingPackages(string output)
837
+ {
838
+ var missingPackagesPattern = new Regex(@"Package '(?<PackageName>[^'].*)' is not found on source");
839
+ var matchCollection = missingPackagesPattern.Matches(output);
840
+ var missingPackages = matchCollection.Select(m => m.Groups["PackageName"].Value).Distinct().ToArray();
841
+ if (missingPackages.Length > 0)
842
+ {
843
+ throw new UpdateNotPossibleException(missingPackages);
844
+ }
845
+ }
846
+
836
847
  internal static bool TryGetGlobalJsonPath(string repoRootPath, string workspacePath, [NotNullWhen(returnValue: true)] out string? globalJsonPath)
837
848
  {
838
849
  globalJsonPath = PathHelper.GetFileInDirectoryOrParent(workspacePath, repoRootPath, "global.json", caseSensitive: false);
@@ -35,10 +35,10 @@ public class AnalyzeWorkerTestBase
35
35
 
36
36
  var discoveryPath = Path.GetFullPath(DiscoveryWorker.DiscoveryResultFileName, directoryPath);
37
37
  var dependencyPath = Path.GetFullPath(relativeDependencyPath, directoryPath);
38
- var analysisPath = Path.GetFullPath(AnalyzeWorker.AnalysisDirectoryName, directoryPath);
39
38
 
40
39
  var worker = new AnalyzeWorker(new Logger(verbose: true));
41
- await worker.RunAsync(directoryPath, discoveryPath, dependencyPath, analysisPath);
40
+ var result = await worker.RunWithErrorHandlingAsync(directoryPath, discoveryPath, dependencyPath);
41
+ return result;
42
42
  });
43
43
 
44
44
  ValidateAnalysisResult(expectedResult, actualResult);
@@ -78,17 +78,13 @@ public class AnalyzeWorkerTestBase
78
78
  }
79
79
  }
80
80
 
81
- protected static async Task<AnalysisResult> RunAnalyzerAsync(string dependencyName, TestFile[] files, Func<string, Task> action)
81
+ protected static async Task<AnalysisResult> RunAnalyzerAsync(string dependencyName, TestFile[] files, Func<string, Task<AnalysisResult>> action)
82
82
  {
83
83
  // write initial files
84
84
  using var temporaryDirectory = await TemporaryDirectory.CreateWithContentsAsync(files);
85
85
 
86
86
  // run discovery
87
- await action(temporaryDirectory.DirectoryPath);
88
-
89
- // gather results
90
- var resultPath = Path.Join(temporaryDirectory.DirectoryPath, AnalyzeWorker.AnalysisDirectoryName, $"{dependencyName}.json");
91
- var resultJson = await File.ReadAllTextAsync(resultPath);
92
- return JsonSerializer.Deserialize<AnalysisResult>(resultJson, DiscoveryWorker.SerializerOptions)!;
87
+ var result = await action(temporaryDirectory.DirectoryPath);
88
+ return result;
93
89
  }
94
90
  }
@@ -25,7 +25,8 @@ public class DiscoveryWorkerTestBase
25
25
  await UpdateWorkerTestBase.MockNuGetPackagesInDirectory(packages, directoryPath);
26
26
 
27
27
  var worker = new DiscoveryWorker(new Logger(verbose: true));
28
- await worker.RunAsync(directoryPath, workspacePath, DiscoveryWorker.DiscoveryResultFileName);
28
+ var result = await worker.RunWithErrorHandlingAsync(directoryPath, workspacePath);
29
+ return result;
29
30
  });
30
31
 
31
32
  ValidateWorkspaceResult(expectedResult, actualResult);
@@ -108,18 +109,14 @@ public class DiscoveryWorkerTestBase
108
109
  }
109
110
  }
110
111
 
111
- protected static async Task<WorkspaceDiscoveryResult> RunDiscoveryAsync(TestFile[] files, Func<string, Task> action)
112
+ protected static async Task<WorkspaceDiscoveryResult> RunDiscoveryAsync(TestFile[] files, Func<string, Task<WorkspaceDiscoveryResult>> action)
112
113
  {
113
114
  // write initial files
114
115
  using var temporaryDirectory = await TemporaryDirectory.CreateWithContentsAsync(files);
115
116
 
116
117
  // run discovery
117
- await action(temporaryDirectory.DirectoryPath);
118
-
119
- // gather results
120
- var resultPath = Path.Join(temporaryDirectory.DirectoryPath, DiscoveryWorker.DiscoveryResultFileName);
121
- var resultJson = await File.ReadAllTextAsync(resultPath);
122
- return JsonSerializer.Deserialize<WorkspaceDiscoveryResult>(resultJson, DiscoveryWorker.SerializerOptions)!;
118
+ var result = await action(temporaryDirectory.DirectoryPath);
119
+ return result;
123
120
  }
124
121
 
125
122
  internal class PropertyComparer : IEqualityComparer<Property>
@@ -1,5 +1,3 @@
1
- using System.Text.Json;
2
-
3
1
  using NuGetUpdater.Core.Updater;
4
2
 
5
3
  using Xunit;
@@ -137,10 +135,7 @@ public abstract class UpdateWorkerTestBase : TestBase
137
135
  // run update
138
136
  var worker = new UpdaterWorker(new Logger(verbose: true));
139
137
  var projectPath = placeFilesInSrc ? $"src/{projectFilePath}" : projectFilePath;
140
- var updateResultFile = Path.Combine(temporaryDirectory, "update-result.json");
141
- await worker.RunAsync(temporaryDirectory, projectPath, dependencyName, oldVersion, newVersion, isTransitive, updateResultFile);
142
- var actualResultContents = await File.ReadAllTextAsync(updateResultFile);
143
- var actualResult = JsonSerializer.Deserialize<UpdateOperationResult>(actualResultContents, UpdaterWorker.SerializerOptions);
138
+ var actualResult = await worker.RunWithErrorHandlingAsync(temporaryDirectory, projectPath, dependencyName, oldVersion, newVersion, isTransitive);
144
139
  if (expectedResult is { })
145
140
  {
146
141
  ValidateUpdateOperationResult(expectedResult, actualResult!);
@@ -159,7 +154,7 @@ public abstract class UpdateWorkerTestBase : TestBase
159
154
  protected static void ValidateUpdateOperationResult(UpdateOperationResult expectedResult, UpdateOperationResult actualResult)
160
155
  {
161
156
  Assert.Equal(expectedResult.ErrorType, actualResult.ErrorType);
162
- Assert.Equal(expectedResult.ErrorDetails, actualResult.ErrorDetails);
157
+ Assert.Equivalent(expectedResult.ErrorDetails, actualResult.ErrorDetails);
163
158
  }
164
159
 
165
160
  protected static Task TestNoChangeforSolution(
@@ -2106,7 +2106,7 @@ public partial class UpdateWorkerTests
2106
2106
  var resultContents = await File.ReadAllTextAsync(resultOutputPath);
2107
2107
  var result = JsonSerializer.Deserialize<UpdateOperationResult>(resultContents, UpdaterWorker.SerializerOptions)!;
2108
2108
  Assert.Equal(ErrorType.MissingFile, result.ErrorType);
2109
- Assert.Equal(Path.Combine(temporaryDirectory.DirectoryPath, "this.file.does.not.exist.targets"), result.ErrorDetails);
2109
+ Assert.Equal(Path.Combine(temporaryDirectory.DirectoryPath, "this.file.does.not.exist.targets"), result.ErrorDetails.ToString());
2110
2110
  }
2111
2111
 
2112
2112
  [Fact]
@@ -2190,6 +2190,84 @@ public partial class UpdateWorkerTests
2190
2190
  );
2191
2191
  }
2192
2192
 
2193
+ [Fact]
2194
+ public async Task MissingDependencyErrorIsReported()
2195
+ {
2196
+ // trying to update Some.Package from 1.0.1 to 1.0.2, but another package isn't available; update fails
2197
+ await TestUpdateForProject("Some.Package", "1.0.1", "1.0.2",
2198
+ packages:
2199
+ [
2200
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.1", "net45"),
2201
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.2", "net45"),
2202
+
2203
+ // the package `Unrelated.Package/1.0.0` is missing and will cause the update to fail
2204
+ ],
2205
+ // existing
2206
+ projectContents: """
2207
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2208
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
2209
+ <PropertyGroup>
2210
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
2211
+ </PropertyGroup>
2212
+ <ItemGroup>
2213
+ <None Include="packages.config" />
2214
+ </ItemGroup>
2215
+ <ItemGroup>
2216
+ <Reference Include="Some.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
2217
+ <HintPath>packages\Some.Package.1.0.1\lib\net45\Some.Package.dll</HintPath>
2218
+ <Private>True</Private>
2219
+ </Reference>
2220
+ <Reference Include="Unrelated.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
2221
+ <HintPath>packages\Unrelated.Package.1.0.0\lib\net45\Unrelated.Package.dll</HintPath>
2222
+ <Private>True</Private>
2223
+ </Reference>
2224
+ </ItemGroup>
2225
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
2226
+ </Project>
2227
+ """,
2228
+ packagesConfigContents: """
2229
+ <packages>
2230
+ <package id="Some.Package" version="1.0.1" targetFramework="net45" />
2231
+ <package id="Unrelated.Package" version="1.0.0" targetFramework="net45" />
2232
+ </packages>
2233
+ """,
2234
+ // expected
2235
+ expectedProjectContents: """
2236
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2237
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
2238
+ <PropertyGroup>
2239
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
2240
+ </PropertyGroup>
2241
+ <ItemGroup>
2242
+ <None Include="packages.config" />
2243
+ </ItemGroup>
2244
+ <ItemGroup>
2245
+ <Reference Include="Some.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
2246
+ <HintPath>packages\Some.Package.1.0.1\lib\net45\Some.Package.dll</HintPath>
2247
+ <Private>True</Private>
2248
+ </Reference>
2249
+ <Reference Include="Unrelated.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
2250
+ <HintPath>packages\Unrelated.Package.1.0.0\lib\net45\Unrelated.Package.dll</HintPath>
2251
+ <Private>True</Private>
2252
+ </Reference>
2253
+ </ItemGroup>
2254
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
2255
+ </Project>
2256
+ """,
2257
+ expectedPackagesConfigContents: """
2258
+ <packages>
2259
+ <package id="Some.Package" version="1.0.1" targetFramework="net45" />
2260
+ <package id="Unrelated.Package" version="1.0.0" targetFramework="net45" />
2261
+ </packages>
2262
+ """,
2263
+ expectedResult: new()
2264
+ {
2265
+ ErrorType = ErrorType.UpdateNotPossible,
2266
+ ErrorDetails = new[] { "Unrelated.Package.1.0.0" },
2267
+ }
2268
+ );
2269
+ }
2270
+
2193
2271
  protected static Task TestUpdateForProject(
2194
2272
  string dependencyName,
2195
2273
  string oldVersion,
@@ -263,14 +263,16 @@ module Dependabot
263
263
  sig { params(json: T::Hash[String, T.untyped]).void }
264
264
  def self.ensure_no_errors(json)
265
265
  error_type = T.let(json.fetch("ErrorType", nil), T.nilable(String))
266
- error_details = T.let(json.fetch("ErrorDetails", nil), T.nilable(String))
266
+ error_details = json.fetch("ErrorDetails", nil)
267
267
  case error_type
268
268
  when "None", nil
269
269
  # no issue
270
270
  when "AuthenticationFailure"
271
- raise PrivateSourceAuthenticationFailure, error_details
271
+ raise PrivateSourceAuthenticationFailure, T.let(error_details, T.nilable(String))
272
272
  when "MissingFile"
273
- raise DependencyFileNotFound, error_details
273
+ raise DependencyFileNotFound, T.let(error_details, T.nilable(String))
274
+ when "UpdateNotPossible"
275
+ raise UpdateNotPossible, T.let(error_details, T::Array[String])
274
276
  else
275
277
  raise "Unexpected error type from native tool: #{error_type}: #{error_details}"
276
278
  end
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.279.0
4
+ version: 0.280.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-03 00:00:00.000000000 Z
11
+ date: 2024-10-10 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.279.0
19
+ version: 0.280.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.279.0
26
+ version: 0.280.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubyzip
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -176,14 +176,14 @@ dependencies:
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: 0.8.1
179
+ version: 0.8.5
180
180
  type: :development
181
181
  prerelease: false
182
182
  version_requirements: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
- version: 0.8.1
186
+ version: 0.8.5
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: simplecov
189
189
  requirement: !ruby/object:Gem::Requirement
@@ -410,11 +410,13 @@ files:
410
410
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/ReportedRequirement.cs
411
411
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/RequirementSource.cs
412
412
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UnknownError.cs
413
+ - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UpdateNotPossible.cs
413
414
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UpdatedDependencyList.cs
414
415
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/HttpApiHandler.cs
415
416
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/IApiHandler.cs
416
417
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunResult.cs
417
418
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs
419
+ - helpers/lib/NuGetUpdater/NuGetUpdater.Core/UpdateNotPossibleException.cs
418
420
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs
419
421
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectResolver.cs
420
422
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/ConfigurationFile.cs
@@ -491,8 +493,8 @@ licenses:
491
493
  - MIT
492
494
  metadata:
493
495
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
494
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.279.0
495
- post_install_message:
496
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.280.0
497
+ post_install_message:
496
498
  rdoc_options: []
497
499
  require_paths:
498
500
  - lib
@@ -508,7 +510,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
508
510
  version: 3.1.0
509
511
  requirements: []
510
512
  rubygems_version: 3.5.9
511
- signing_key:
513
+ signing_key:
512
514
  specification_version: 4
513
515
  summary: Provides Dependabot support for .NET (NuGet)
514
516
  test_files: []